From bca6caac95f22f9325f4fff36c6eac10e6224f50 Mon Sep 17 00:00:00 2001 From: Sagar Dhawan Date: Mon, 21 Mar 2022 21:11:18 -0700 Subject: [PATCH 01/70] Fix dispatch warnings for one-shot system timers (#16505) * Fix dispatch warnings for one-shot system timers * Restyled by clang-format Co-authored-by: Restyled.io --- src/system/SystemLayerImplSelect.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/system/SystemLayerImplSelect.cpp b/src/system/SystemLayerImplSelect.cpp index 74357f9d195b57..84d7023e1e094a 100644 --- a/src/system/SystemLayerImplSelect.cpp +++ b/src/system/SystemLayerImplSelect.cpp @@ -139,8 +139,8 @@ CHIP_ERROR LayerImplSelect::StartTimer(Clock::Timeout delay, TimerCompleteCallba timer->mTimerSource = timerSource; dispatch_source_set_timer( - timerSource, dispatch_walltime(NULL, static_cast(Clock::Milliseconds64(delay).count() * NSEC_PER_MSEC)), 0, - 2 * NSEC_PER_MSEC); + timerSource, dispatch_walltime(NULL, static_cast(Clock::Milliseconds64(delay).count() * NSEC_PER_MSEC)), + DISPATCH_TIME_FOREVER, 2 * NSEC_PER_MSEC); dispatch_source_set_event_handler(timerSource, ^{ dispatch_source_cancel(timerSource); dispatch_release(timerSource); From 6443a56149f75e967d2a2125be75aa5b433e6eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Tue, 22 Mar 2022 06:15:00 +0100 Subject: [PATCH 02/70] [window-covering] Fix compilation error on some compilers (#16491) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OperationalStatus structure contains enum class bitfields, which on some compilers (e.g. GCC prior to 9.3) generates "is too small to hold all values of ‘enum class OperationalState’" warning. It is a default warning that cannot be suppressed. Since OperationalStatus it not stored directly in the attribute table, but it is rather used to exchange decoded components of the attribute with the application, the bitfield usage is not really valuable. Switch to normal structure members for greater portability. --- .../window-covering-server/window-covering-server.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/clusters/window-covering-server/window-covering-server.h b/src/app/clusters/window-covering-server/window-covering-server.h index d02c8e8f082f94..410619c9f2da25 100644 --- a/src/app/clusters/window-covering-server/window-covering-server.h +++ b/src/app/clusters/window-covering-server/window-covering-server.h @@ -67,13 +67,13 @@ enum class OperationalState : uint8_t }; static_assert(sizeof(OperationalState) == sizeof(uint8_t), "OperationalState Size is not correct"); +// Decoded components of the OperationalStatus attribute struct OperationalStatus { - OperationalState global : 2; // bit 0-1 M - OperationalState lift : 2; // bit 2-3 LF - OperationalState tilt : 2; // bit 4-5 TL + OperationalState global; // bit 0-1 M + OperationalState lift; // bit 2-3 LF + OperationalState tilt; // bit 4-5 TL }; -static_assert(sizeof(OperationalStatus) == sizeof(uint8_t), "OperationalStatus Size is not correct"); struct SafetyStatus { From 78cfd0b6572e4d49049df3a961ed9cfa4632bfd0 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:02:15 +0530 Subject: [PATCH 03/70] [ESP32] Fixed lock-app crash (#16485) --- examples/lock-app/esp32/main/AppTask.cpp | 4 ++-- examples/lock-app/esp32/main/include/AppTask.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/lock-app/esp32/main/AppTask.cpp b/examples/lock-app/esp32/main/AppTask.cpp index 7b5a727b4dab54..efb179407c9594 100644 --- a/examples/lock-app/esp32/main/AppTask.cpp +++ b/examples/lock-app/esp32/main/AppTask.cpp @@ -103,7 +103,7 @@ CHIP_ERROR AppTask::Init() sLockLED.Set(!BoltLockMgr().IsUnlocked()); - UpdateClusterState(); + chip::DeviceLayer::SystemLayer().ScheduleWork(UpdateClusterState, nullptr); ConfigurationMgr().LogDeviceConfig(); @@ -462,7 +462,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) } /* if unlocked then it locked it first*/ -void AppTask::UpdateClusterState(void) +void AppTask::UpdateClusterState(chip::System::Layer *, void * context) { uint8_t newValue = !BoltLockMgr().IsUnlocked(); diff --git a/examples/lock-app/esp32/main/include/AppTask.h b/examples/lock-app/esp32/main/include/AppTask.h index 8d25e15981736c..ba7121b1554495 100644 --- a/examples/lock-app/esp32/main/include/AppTask.h +++ b/examples/lock-app/esp32/main/include/AppTask.h @@ -65,7 +65,7 @@ class AppTask static void LockActionEventHandler(AppEvent * aEvent); static void TimerEventHandler(TimerHandle_t xTimer); - static void UpdateClusterState(void); + static void UpdateClusterState(chip::System::Layer *, void * context); void StartTimer(uint32_t aTimeoutMs); From 2e658fbe963d218925652c667a791dedd23ce1c2 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:04:54 +0530 Subject: [PATCH 04/70] [ESP32] Added config option to disable and de-init BLE post commissioning (#16483) * [ESP32] Added config option to disable and de-init BLE post commissioning * Fixed pipline failure * Implemented config option for all-cluster and lighting app * Address review comment --- .../esp32/main/DeviceCallbacks.cpp | 25 +++++++++++++++++-- .../esp32/main/Kconfig.projbuild | 5 ++++ .../esp32/main/DeviceCallbacks.cpp | 25 +++++++++++++++++-- .../lighting-app/esp32/main/Kconfig.projbuild | 5 ++++ 4 files changed, 56 insertions(+), 4 deletions(-) diff --git a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp index 888b6e01228d8c..6de5269640521c 100644 --- a/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/all-clusters-app/esp32/main/DeviceCallbacks.cpp @@ -28,10 +28,13 @@ #include "Globals.h" #include "LEDWidget.h" #include "WiFiWidget.h" +#include "esp_bt.h" #include "esp_check.h" #include "esp_err.h" #include "esp_heap_caps.h" #include "esp_log.h" +#include "esp_nimble_hci.h" +#include "nimble/nimble_port.h" #include "route_hook/esp_route_hook.h" #include #include @@ -114,9 +117,27 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ ESP_LOGI(TAG, "CHIPoBLE disconnected"); break; - case DeviceEventType::kCommissioningComplete: + case DeviceEventType::kCommissioningComplete: { ESP_LOGI(TAG, "Commissioning complete"); - break; +#if CONFIG_BT_NIMBLE_ENABLED && CONFIG_DEINIT_BLE_ON_COMMISSIONING_COMPLETE + int ret = nimble_port_stop(); + if (ret == 0) + { + nimble_port_deinit(); + esp_err_t err = esp_nimble_hci_and_controller_deinit(); + err += esp_bt_mem_release(ESP_BT_MODE_BLE); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + } + } + else + { + ESP_LOGW(TAG, "nimble_port_stop() failed"); + } +#endif + } + break; case DeviceEventType::kInterfaceIpAddressChanged: if ((event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV4_Assigned) || diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index b305e3c8863d6a..5bd4461042836f 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -111,6 +111,11 @@ menu "Demo" help Each board has a status led, define its pin number. + config DEINIT_BLE_ON_COMMISSIONING_COMPLETE + bool "Disable and DeInit BLE on commissioning complete" + default y + help + Disable and deinit BLE and reclaim all its memory, once the commissioning is successful and Commissioning complete event is received in the application. endmenu menu "PW RPC Debug channel" diff --git a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp index f1697ec10da1e6..a9187fe053d91e 100644 --- a/examples/lighting-app/esp32/main/DeviceCallbacks.cpp +++ b/examples/lighting-app/esp32/main/DeviceCallbacks.cpp @@ -26,9 +26,12 @@ #include "DeviceCallbacks.h" #include "LEDWidget.h" +#include "esp_bt.h" #include "esp_err.h" #include "esp_heap_caps.h" #include "esp_log.h" +#include "esp_nimble_hci.h" +#include "nimble/nimble_port.h" #include "route_hook/esp_route_hook.h" #include #include @@ -66,9 +69,27 @@ void DeviceCallbacks::DeviceEventCallback(const ChipDeviceEvent * event, intptr_ ESP_LOGI(TAG, "CHIPoBLE disconnected"); break; - case DeviceEventType::kCommissioningComplete: + case DeviceEventType::kCommissioningComplete: { ESP_LOGI(TAG, "Commissioning complete"); - break; +#if CONFIG_BT_NIMBLE_ENABLED && CONFIG_DEINIT_BLE_ON_COMMISSIONING_COMPLETE + int ret = nimble_port_stop(); + if (ret == 0) + { + nimble_port_deinit(); + esp_err_t err = esp_nimble_hci_and_controller_deinit(); + err += esp_bt_mem_release(ESP_BT_MODE_BLE); + if (err == ESP_OK) + { + ESP_LOGI(TAG, "BLE deinit successful and memory reclaimed"); + } + } + else + { + ESP_LOGW(TAG, "nimble_port_stop() failed"); + } +#endif + } + break; case DeviceEventType::kInterfaceIpAddressChanged: if ((event->InterfaceIpAddressChanged.Type == InterfaceIpChangeType::kIpV4_Assigned) || diff --git a/examples/lighting-app/esp32/main/Kconfig.projbuild b/examples/lighting-app/esp32/main/Kconfig.projbuild index 839c53f3997d5c..7aa1ecd9be7ab7 100644 --- a/examples/lighting-app/esp32/main/Kconfig.projbuild +++ b/examples/lighting-app/esp32/main/Kconfig.projbuild @@ -106,4 +106,9 @@ menu "Demo" default 4 if RENDEZVOUS_MODE_THREAD default 8 if RENDEZVOUS_MODE_ETHERNET + config DEINIT_BLE_ON_COMMISSIONING_COMPLETE + bool "Disable and DeInit BLE on commissioning complete" + default y + help + Disable and deinit BLE and reclaim all its memory, once the commissioning is successful and Commissioning complete event is received in the application. endmenu From fc2fd937affde4d97cbfca8ad83ce8d579a8e6c8 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Tue, 22 Mar 2022 13:15:27 -0400 Subject: [PATCH 05/70] [EFR32] Add documentation and enable release build (#16524) * Add documentation and enable release build --- .github/.wordlist.txt | 1 + examples/light-switch-app/efr32/README.md | 24 ++++++++++++++++++++++ examples/lighting-app/efr32/README.md | 25 +++++++++++++++++++++++ examples/lock-app/efr32/README.md | 24 ++++++++++++++++++++++ examples/window-app/efr32/README.md | 24 ++++++++++++++++++++++ src/platform/EFR32/CHIPMem-Platform.cpp | 5 +---- 6 files changed, 99 insertions(+), 4 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index db98809f615b97..064a278a6c86b2 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -1113,6 +1113,7 @@ showDocumentation shubhamdp SIGINT SiLabs +Silabs's SiliconLabs SimpleFileExFlags SimpleLink diff --git a/examples/light-switch-app/efr32/README.md b/examples/light-switch-app/efr32/README.md index 641b6ddd55882b..9e8d40c8da6d84 100644 --- a/examples/light-switch-app/efr32/README.md +++ b/examples/light-switch-app/efr32/README.md @@ -382,3 +382,27 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see [EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +features can easily be toggled on or off. Here is a short list of options : + +### Disabling logging + +chip_progress_logging, chip_detail_logging, chip_automation_logging + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false" + +### Debug build / release build + +is_debug + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + +### Disabling LCD + +show_qr_code + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "show_qr_code=false" diff --git a/examples/lighting-app/efr32/README.md b/examples/lighting-app/efr32/README.md index bc802db4cd2b20..bb6b24f113337e 100644 --- a/examples/lighting-app/efr32/README.md +++ b/examples/lighting-app/efr32/README.md @@ -331,3 +331,28 @@ commands to multiples devices at once. Please refer to the [chip-tool documentation](../../chip-tool/README.md) _Configuring the server side for Group Commands_ and _Using the Client to Send Group (Multicast) Matter Commands_ + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +features can easily be toggled on or off. Here is a short list of options to be +passed to the build scripts. + +### Disabling logging + +chip_progress_logging, chip_detail_logging, chip_automation_logging + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false" + +### Debug build / release build + +is_debug + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + +### Disabling LCD + +show_qr_code + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "show_qr_code=false" diff --git a/examples/lock-app/efr32/README.md b/examples/lock-app/efr32/README.md index 4c82af13cfb24b..65442b31d84229 100644 --- a/examples/lock-app/efr32/README.md +++ b/examples/lock-app/efr32/README.md @@ -297,3 +297,27 @@ tracking code inside the `trackAlloc` and `trackFree` function For the description of Software Update process with EFR32 example applications see [EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +features can easily be toggled on or off. Here is a short list of options : + +### Disabling logging + +chip_progress_logging, chip_detail_logging, chip_automation_logging + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false" + +### Debug build / release build + +is_debug + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + +### Disabling LCD + +show_qr_code + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "show_qr_code=false" diff --git a/examples/window-app/efr32/README.md b/examples/window-app/efr32/README.md index c444d8bae3df0a..8fac6941c0a8d8 100644 --- a/examples/window-app/efr32/README.md +++ b/examples/window-app/efr32/README.md @@ -332,3 +332,27 @@ combination with JLinkRTTClient as follows: For the description of Software Update process with EFR32 example applications see [EFR32 OTA Software Update](../../../docs/guides/silabs_efr32_software_update.md) + +## Building options + +All of Silabs's examples within the Matter repo have all the features enabled by +default, as to provide the best end user experience. However some of those +features can easily be toggled on or off. Here is a short list of options : + +### Disabling logging + +chip_progress_logging, chip_detail_logging, chip_automation_logging + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "chip_detail_logging=false chip_automation_logging=false chip_progress_logging=false" + +### Debug build / release build + +is_debug + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "is_debug=false" + +### Disabling LCD + +show_qr_code + + $ ./scripts/examples/gn_efr32_example.sh ./examples/lighting-app/efr32 ./out/lighting-app BRD4164A "show_qr_code=false" diff --git a/src/platform/EFR32/CHIPMem-Platform.cpp b/src/platform/EFR32/CHIPMem-Platform.cpp index ea7f205a8956b0..4f8b938f5d26ec 100644 --- a/src/platform/EFR32/CHIPMem-Platform.cpp +++ b/src/platform/EFR32/CHIPMem-Platform.cpp @@ -82,25 +82,22 @@ static void VerifyInitialized(const char * func) CHIP_ERROR MemoryAllocatorInit(void * buf, size_t bufSize) { -#ifndef NDEBUG if (memoryInitialized++ > 0) { fprintf(stderr, "ABORT: chip::Platform::MemoryInit() called twice.\n"); abort(); } -#endif + return CHIP_NO_ERROR; } void MemoryAllocatorShutdown() { -#ifndef NDEBUG if (--memoryInitialized < 0) { fprintf(stderr, "ABORT: chip::Platform::MemoryShutdown() called twice.\n"); abort(); } -#endif } void * MemoryAlloc(size_t size) From 621b672f0888e37605df5c2d8f27d31a594e4d79 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav <69809379+jadhavrohit924@users.noreply.github.com> Date: Tue, 22 Mar 2022 23:19:40 +0530 Subject: [PATCH 06/70] [ESP32] Set-regulatory-config command is working on ESP32 (#16520) --- src/platform/DeviceControlServer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/platform/DeviceControlServer.cpp b/src/platform/DeviceControlServer.cpp index bfaf72c3c0abb0..0c1a526e10c256 100644 --- a/src/platform/DeviceControlServer.cpp +++ b/src/platform/DeviceControlServer.cpp @@ -66,9 +66,7 @@ CHIP_ERROR DeviceControlServer::SetRegulatoryConfig(uint8_t location, const Char ChipLogError(DeviceLayer, "SetRegulatoryConfig failed with error: %s", ErrorStr(err)); } - // TODO(cecille): This command fails on ESP32, but it's blocking IP cluster-based commissioning so for now just return a success - // status. - return CHIP_NO_ERROR; + return err; } CHIP_ERROR DeviceControlServer::ConnectNetworkForOperational(ByteSpan networkID) From 4498dc94363b574401ceaab2f37749146d5afcd0 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 22 Mar 2022 13:53:42 -0400 Subject: [PATCH 07/70] Move ESP jobs timeout to 90 minutes (#16501) --- .github/workflows/examples-esp32.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index 598995649776ba..70d47f833cfb1e 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -26,7 +26,7 @@ jobs: # TODO ESP32 https://github.com/project-chip/connectedhomeip/issues/1510 esp32: name: ESP32 - timeout-minutes: 80 + timeout-minutes: 90 runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' @@ -111,7 +111,7 @@ jobs: esp32_1: name: ESP32_1 - timeout-minutes: 70 + timeout-minutes: 90 runs-on: ubuntu-latest if: github.actor != 'restyled-io[bot]' From ca56d6b0722c450414bb1b242098ea32dfdf8c93 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 22 Mar 2022 14:08:42 -0400 Subject: [PATCH 08/70] Implement required check for adding an already-existing fabric. (#16404) Per spec, AddNOC should fail if the fabric id and root public key of the new NOC match an existing fabric. We were not implementing this check. --- .../templates/partials/test_cluster.zapt | 3 +- .../tests/partials/test_cluster.zapt | 3 +- .../linux/LinuxCommissionableDataProvider.h | 2 +- .../operational-credentials-server.cpp | 4 + src/app/tests/suites/TestMultiAdmin.yaml | 38 +++ .../commissioner/CommissionerCommands.cpp | 42 ++- .../commissioner/CommissionerCommands.h | 5 +- src/controller/CHIPDeviceController.cpp | 3 +- src/credentials/FabricTable.cpp | 25 ++ .../tests/partials/test_cluster.zapt | 2 +- src/lib/core/CHIPError.cpp | 25 +- src/lib/core/CHIPError.h | 69 +---- src/lib/core/tests/TestCHIPErrorStr.cpp | 9 +- src/lib/support/CodeUtils.h | 2 +- .../chip-tool/zap-generated/test/Commands.h | 241 +++++++++++++----- 15 files changed, 313 insertions(+), 160 deletions(-) diff --git a/examples/chip-tool-darwin/templates/partials/test_cluster.zapt b/examples/chip-tool-darwin/templates/partials/test_cluster.zapt index 3b49c707311442..9f2ac193e903da 100644 --- a/examples/chip-tool-darwin/templates/partials/test_cluster.zapt +++ b/examples/chip-tool-darwin/templates/partials/test_cluster.zapt @@ -107,7 +107,8 @@ class {{filename}}: public TestCommandBridge {{else}} {{#if (isString type)}}@"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}} {{~/if~}} - {{/chip_tests_item_parameters}}); + {{/chip_tests_item_parameters}} + {{additionalArguments}}); {{else}} CHIPDevice * device = GetConnectedDevice(); CHIPTest{{asUpperCamelCase cluster}} * cluster = [[CHIPTest{{asUpperCamelCase cluster}} alloc] initWithDevice:device endpoint:{{endpoint}} queue:mCallbackQueue]; diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index 27616a54ed9c2e..aa11b89cc0f81b 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -203,7 +203,8 @@ class {{filename}}Suite: public TestCommand {{~else if (isString type)}}"{{definedValue}}" {{else}}{{definedValue}} {{~/if~}} - {{/chip_tests_item_parameters}}); + {{/chip_tests_item_parameters}} + {{additionalArguments}}); } {{else if isWait}} CHIP_ERROR {{>testCommand}}() diff --git a/examples/platform/linux/LinuxCommissionableDataProvider.h b/examples/platform/linux/LinuxCommissionableDataProvider.h index 2254177c754734..81a6e6b0f39284 100644 --- a/examples/platform/linux/LinuxCommissionableDataProvider.h +++ b/examples/platform/linux/LinuxCommissionableDataProvider.h @@ -53,7 +53,7 @@ class LinuxCommissionableDataProvider : public chip::DeviceLayer::Commissionable * PASE verifier if `serializedSpake2pVerifier` argument empty. * @param discriminator - Discriminator to use for advertising. * @return CHIP_ERROR_OK on success, CHIP_ERROR_INVALID_ARGUMENT on any invalid argument combinations, - * CHIP_ERROR_INVALID_STATE if already initialized, or other CHIP_ERROR values if inner + * CHIP_ERROR_INCORRECT_STATE if already initialized, or other CHIP_ERROR values if inner * implementation dependencies fail. */ CHIP_ERROR Init(chip::Optional> serializedSpake2pVerifier, diff --git a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp index e0732e7a8bbe75..7b26f8d9e090cf 100644 --- a/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp +++ b/src/app/clusters/operational-credentials-server/operational-credentials-server.cpp @@ -564,6 +564,10 @@ OperationalCertStatus ConvertToNOCResponseStatus(CHIP_ERROR err) { return OperationalCertStatus::kTableFull; } + else if (err == CHIP_ERROR_FABRIC_EXISTS) + { + return OperationalCertStatus::kFabricConflict; + } return OperationalCertStatus::kInvalidNOC; } diff --git a/src/app/tests/suites/TestMultiAdmin.yaml b/src/app/tests/suites/TestMultiAdmin.yaml index be4c9ba14a8f84..0d60fdaaccaa60 100644 --- a/src/app/tests/suites/TestMultiAdmin.yaml +++ b/src/app/tests/suites/TestMultiAdmin.yaml @@ -16,6 +16,9 @@ name: Test Multi Admin config: nodeId: 0x12344321 + nodeIdForDuplicateCommissioning: + type: NODE_ID + defaultValue: 0x11 nodeId2: type: NODE_ID defaultValue: 0xCAFE @@ -56,6 +59,41 @@ tests: - name: "CommissioningTimeout" value: 120 + - label: "Commission from alpha again" + identity: "alpha" + cluster: "CommissionerCommands" + command: "PairWithQRCode" + additionalArguments: ", CHIP_ERROR_FABRIC_EXISTS" + arguments: + values: + - name: "nodeId" + value: nodeIdForDuplicateCommissioning + - name: "payload" + value: payload + + - label: "Check that we just have the one fabric and did not add a new one" + identity: "alpha" + cluster: "Operational Credentials" + command: "readAttribute" + attribute: "Fabrics" + fabricFiltered: false + response: + value: [{ "nodeID": nodeId }] + + - label: "Close Commissioning Window after failed commissioning" + cluster: "AdministratorCommissioning" + command: "RevokeCommissioning" + timedInteractionTimeoutMs: 10000 + + - label: "Open Commissioning Window from alpha again" + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 + - label: "Commission from beta" identity: "beta" cluster: "CommissionerCommands" diff --git a/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp b/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp index ec84e807f4ca63..49e2b0a9ca46d1 100644 --- a/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp +++ b/src/app/tests/suites/commands/commissioner/CommissionerCommands.cpp @@ -20,10 +20,12 @@ constexpr uint16_t kPayloadMaxSize = 64; -CHIP_ERROR CommissionerCommands::PairWithQRCode(chip::NodeId nodeId, const chip::CharSpan payload) +CHIP_ERROR CommissionerCommands::PairWithQRCode(chip::NodeId nodeId, const chip::CharSpan payload, CHIP_ERROR expectedStatus) { VerifyOrReturnError(payload.size() > 0 && payload.size() < kPayloadMaxSize, CHIP_ERROR_INVALID_ARGUMENT); + mExpectedStatus = expectedStatus; + GetCurrentCommissioner().RegisterPairingDelegate(this); char qrCode[kPayloadMaxSize]; @@ -35,6 +37,8 @@ CHIP_ERROR CommissionerCommands::PairWithManualCode(chip::NodeId nodeId, const c { VerifyOrReturnError(payload.size() > 0 && payload.size() < kPayloadMaxSize, CHIP_ERROR_INVALID_ARGUMENT); + mExpectedStatus = CHIP_NO_ERROR; + GetCurrentCommissioner().RegisterPairingDelegate(this); char manualCode[kPayloadMaxSize]; @@ -44,6 +48,8 @@ CHIP_ERROR CommissionerCommands::PairWithManualCode(chip::NodeId nodeId, const c CHIP_ERROR CommissionerCommands::Unpair(chip::NodeId nodeId) { + mExpectedStatus = CHIP_NO_ERROR; + return GetCurrentCommissioner().UnpairDevice(nodeId); } @@ -71,9 +77,22 @@ void CommissionerCommands::OnPairingComplete(CHIP_ERROR err) void CommissionerCommands::OnPairingDeleted(CHIP_ERROR err) { - if (CHIP_NO_ERROR != err) + if (mExpectedStatus != err) { - ChipLogError(chipTool, "Pairing Delete Failure: %s", ErrorStr(err)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(chipTool, "Pairing Delete Failure: %s", ErrorStr(err)); + } + else + { + ChipLogError(chipTool, "Got success but expected: %s", ErrorStr(mExpectedStatus)); + err = CHIP_ERROR_INCORRECT_STATE; + } + } + else + { + // Treat as success. + err = CHIP_NO_ERROR; } LogErrorOnFailure(ContinueOnChipMainThread(err)); @@ -81,9 +100,22 @@ void CommissionerCommands::OnPairingDeleted(CHIP_ERROR err) void CommissionerCommands::OnCommissioningComplete(chip::NodeId nodeId, CHIP_ERROR err) { - if (CHIP_NO_ERROR != err) + if (mExpectedStatus != err) + { + if (err != CHIP_NO_ERROR) + { + ChipLogError(chipTool, "Commissioning Complete Failure: %s", ErrorStr(err)); + } + else + { + ChipLogError(chipTool, "Got success but expected: %s", ErrorStr(mExpectedStatus)); + err = CHIP_ERROR_INCORRECT_STATE; + } + } + else { - ChipLogError(chipTool, "Commissioning Complete Failure: %s", ErrorStr(err)); + // Treat as success. + err = CHIP_NO_ERROR; } LogErrorOnFailure(ContinueOnChipMainThread(err)); diff --git a/src/app/tests/suites/commands/commissioner/CommissionerCommands.h b/src/app/tests/suites/commands/commissioner/CommissionerCommands.h index bd622c9a10ba31..370723ec498382 100644 --- a/src/app/tests/suites/commands/commissioner/CommissionerCommands.h +++ b/src/app/tests/suites/commands/commissioner/CommissionerCommands.h @@ -30,7 +30,7 @@ class CommissionerCommands : public chip::Controller::DevicePairingDelegate virtual CHIP_ERROR ContinueOnChipMainThread(CHIP_ERROR err) = 0; virtual chip::Controller::DeviceCommissioner & GetCurrentCommissioner() = 0; - CHIP_ERROR PairWithQRCode(chip::NodeId nodeId, const chip::CharSpan payload); + CHIP_ERROR PairWithQRCode(chip::NodeId nodeId, const chip::CharSpan payload, CHIP_ERROR expectedStatus = CHIP_NO_ERROR); CHIP_ERROR PairWithManualCode(chip::NodeId nodeId, const chip::CharSpan payload); CHIP_ERROR Unpair(chip::NodeId nodeId); @@ -39,4 +39,7 @@ class CommissionerCommands : public chip::Controller::DevicePairingDelegate void OnPairingComplete(CHIP_ERROR error) override; void OnPairingDeleted(CHIP_ERROR error) override; void OnCommissioningComplete(chip::NodeId deviceId, CHIP_ERROR error) override; + +private: + CHIP_ERROR mExpectedStatus = CHIP_NO_ERROR; }; diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index e4e78ef22fa051..90553946503d92 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1293,8 +1293,9 @@ CHIP_ERROR DeviceCommissioner::ConvertFromOperationalCertStatus(OperationalCrede return CHIP_ERROR_INCORRECT_STATE; case OperationalCertStatus::kTableFull: return CHIP_ERROR_NO_MEMORY; - case OperationalCertStatus::kInsufficientPrivilege: case OperationalCertStatus::kFabricConflict: + return CHIP_ERROR_FABRIC_EXISTS; + case OperationalCertStatus::kInsufficientPrivilege: case OperationalCertStatus::kLabelConflict: return CHIP_ERROR_INVALID_ARGUMENT; case OperationalCertStatus::kInvalidFabricIndex: diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index 2642e82cb2dbda..e5b1fc37f95bdc 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -677,6 +677,31 @@ CHIP_ERROR FabricTable::AddNewFabric(FabricInfo & newFabric, FabricIndex * outpu { VerifyOrReturnError(outputIndex != nullptr, CHIP_ERROR_INVALID_ARGUMENT); static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); + + // Check whether we already have a matching fabric. An incoming fabric does + // not have its fabric id set yet, so we have to extract it here to do the + // comparison. + FabricId fabricId; + { + ByteSpan noc; + ReturnErrorOnFailure(newFabric.GetNOCCert(noc)); + NodeId unused; + ReturnErrorOnFailure(ExtractNodeIdFabricIdFromOpCert(noc, &unused, &fabricId)); + } + for (auto & existingFabric : *this) + { + if (existingFabric.GetFabricId() == fabricId) + { + P256PublicKeySpan existingRootKey, newRootKey; + ReturnErrorOnFailure(existingFabric.GetRootPubkey(existingRootKey)); + ReturnErrorOnFailure(newFabric.GetRootPubkey(newRootKey)); + if (existingRootKey.data_equal(newRootKey)) + { + return CHIP_ERROR_FABRIC_EXISTS; + } + } + } + for (FabricIndex i = mNextAvailableFabricIndex; i <= kMaxValidFabricIndex; i++) { FabricInfo * fabric = FindFabricWithIndex(i); diff --git a/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt b/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt index 1ff01dfd9fae4b..bae3552ed913ac 100644 --- a/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt +++ b/src/darwin/Framework/CHIP/templates/tests/partials/test_cluster.zapt @@ -24,7 +24,7 @@ ResponseHandler {{> subscribeDataCallback}} = nil; {{#if (isTestOnlyCluster cluster)}} dispatch_queue_t queue = dispatch_get_main_queue(); - {{command}}(expectation, queue{{#chip_tests_item_parameters}}, {{#if (isString type)}}@"{{/if}}{{> defined_value}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}}); + {{command}}(expectation, queue{{#chip_tests_item_parameters}}, {{#if (isString type)}}@"{{/if}}{{> defined_value}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}}{{additionalArguments}}); {{else}} CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); diff --git a/src/lib/core/CHIPError.cpp b/src/lib/core/CHIPError.cpp index 2f999000ab4443..95476499a175a8 100644 --- a/src/lib/core/CHIPError.cpp +++ b/src/lib/core/CHIPError.cpp @@ -410,29 +410,8 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err) case CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED.AsInteger(): desc = "DRBG entropy source failed to generate entropy data"; break; - case CHIP_ERROR_NO_TAKE_AUTH_DELEGATE.AsInteger(): - desc = "No TAKE auth delegate set"; - break; - case CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED.AsInteger(): - desc = "TAKE requires a reconfigure"; - break; - case CHIP_ERROR_TAKE_REAUTH_POSSIBLE.AsInteger(): - desc = "TAKE can do a reauthentication"; - break; - case CHIP_ERROR_INVALID_TAKE_PARAMETER.AsInteger(): - desc = "TAKE received an invalid parameter"; - break; - case CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION.AsInteger(): - desc = "TAKE Unsupported configuration"; - break; - case CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED.AsInteger(): - desc = "TAKE token identification failed"; - break; - case CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE.AsInteger(): - desc = "Invalid Token Pairing Bundle"; - break; - case CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION.AsInteger(): - desc = "Unsupported Token Pairing Bundle version"; + case CHIP_ERROR_FABRIC_EXISTS.AsInteger(): + desc = "Trying to add a NOC for a fabric that already exists"; break; case CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER.AsInteger(): desc = "Key not found error code received from peer"; diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index d1f7c440c7312d..82bab653298940 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -1500,77 +1500,28 @@ using CHIP_ERROR = ::chip::ChipError; */ #define CHIP_ERROR_TLV_TAG_NOT_FOUND CHIP_CORE_ERROR(0x76) -/** - * @def CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE - * - * @brief - * A token pairing bundle is invalid. - * - */ -#define CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE CHIP_CORE_ERROR(0x77) +// unused CHIP_CORE_ERROR(0x77) -/** - * @def CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION - * - * @brief - * A token pairing bundle is invalid. - * - */ -#define CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION CHIP_CORE_ERROR(0x78) +// unused CHIP_CORE_ERROR(0x78) -/** - * @def CHIP_ERROR_NO_TAKE_AUTH_DELEGATE - * - * @brief - * No TAKE authentication delegate is set. - * - */ -#define CHIP_ERROR_NO_TAKE_AUTH_DELEGATE CHIP_CORE_ERROR(0x79) +// unused CHIP_CORE_ERROR(0x79) -/** - * @def CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED - * - * @brief - * TAKE requires a reconfigure. - * - */ -#define CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED CHIP_CORE_ERROR(0x7a) +// unused CHIP_CORE_ERROR(0x7a) -/** - * @def CHIP_ERROR_TAKE_REAUTH_POSSIBLE - * - * @brief - * TAKE can do a reauthentication. - * - */ -#define CHIP_ERROR_TAKE_REAUTH_POSSIBLE CHIP_CORE_ERROR(0x7b) +// unused CHIP_CORE_ERROR(0x7b) -/** - * @def CHIP_ERROR_INVALID_TAKE_PARAMETER - * - * @brief - * Received an invalid TAKE parameter. - * - */ -#define CHIP_ERROR_INVALID_TAKE_PARAMETER CHIP_CORE_ERROR(0x7c) +// unused CHIP_CORE_ERROR(0x7c) -/** - * @def CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION - * - * @brief - * This configuration is not supported by TAKE. - * - */ -#define CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION CHIP_CORE_ERROR(0x7d) +// unused CHIP_CORE_ERROR(0x7d) /** - * @def CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED + * @def CHIP_ERROR_FABRIC_EXISTS * * @brief - * The TAKE Token Identification failed. + * The fabric with the given fabric id and root public key already exists. * */ -#define CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED CHIP_CORE_ERROR(0x7e) +#define CHIP_ERROR_FABRIC_EXISTS CHIP_CORE_ERROR(0x7e) /** * @def CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER diff --git a/src/lib/core/tests/TestCHIPErrorStr.cpp b/src/lib/core/tests/TestCHIPErrorStr.cpp index 9e5b165763e915..3442f0f33dc2be 100644 --- a/src/lib/core/tests/TestCHIPErrorStr.cpp +++ b/src/lib/core/tests/TestCHIPErrorStr.cpp @@ -164,14 +164,7 @@ static const CHIP_ERROR kTestElements[] = CHIP_ERROR_INVALID_FABRIC_ID, CHIP_ERROR_DRBG_ENTROPY_SOURCE_FAILED, CHIP_ERROR_TLV_TAG_NOT_FOUND, - CHIP_ERROR_INVALID_TOKENPAIRINGBUNDLE, - CHIP_ERROR_UNSUPPORTED_TOKENPAIRINGBUNDLE_VERSION, - CHIP_ERROR_NO_TAKE_AUTH_DELEGATE, - CHIP_ERROR_TAKE_RECONFIGURE_REQUIRED, - CHIP_ERROR_TAKE_REAUTH_POSSIBLE, - CHIP_ERROR_INVALID_TAKE_PARAMETER, - CHIP_ERROR_UNSUPPORTED_TAKE_CONFIGURATION, - CHIP_ERROR_TAKE_TOKEN_IDENTIFICATION_FAILED, + CHIP_ERROR_FABRIC_EXISTS, CHIP_ERROR_KEY_NOT_FOUND_FROM_PEER, CHIP_ERROR_WRONG_ENCRYPTION_TYPE_FROM_PEER, CHIP_ERROR_UNKNOWN_KEY_TYPE_FROM_PEER, diff --git a/src/lib/support/CodeUtils.h b/src/lib/support/CodeUtils.h index 5b4dbbfbdd3515..f896da6c7484d1 100644 --- a/src/lib/support/CodeUtils.h +++ b/src/lib/support/CodeUtils.h @@ -341,7 +341,7 @@ constexpr inline const _T & max(const _T & a, const _T & b) * * @code * ReturnErrorCodeIf(state == kInitialized, CHIP_NO_ERROR); - * ReturnErrorCodeIf(state == kInitialized, CHIP_ERROR_INVALID_STATE); + * ReturnErrorCodeIf(state == kInitialized, CHIP_ERROR_INCORRECT_STATE); * @endcode * * @param[in] expr A Boolean expression to be evaluated. diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index bf960637442638..b864c52c471460 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -91188,6 +91188,7 @@ class TestMultiAdminSuite : public TestCommand TestCommand("TestMultiAdmin", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("nodeIdForDuplicateCommissioning", 0, UINT64_MAX, &mNodeIdForDuplicateCommissioning); AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); AddArgument("nodeId3", 0, UINT64_MAX, &mNodeId3); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); @@ -91243,40 +91244,56 @@ class TestMultiAdminSuite : public TestCommand err = TestOpenCommissioningWindowFromAlpha_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Commission from beta\n"); - err = TestCommissionFromBeta_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Commission from alpha again\n"); + err = TestCommissionFromAlphaAgain_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Wait for the commissioned device to be retrieved for beta\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrievedForBeta_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Check that we just have the one fabric and did not add a new one\n"); + err = TestCheckThatWeJustHaveTheOneFabricAndDidNotAddANewOne_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Open Commissioning Window from beta\n"); - err = TestOpenCommissioningWindowFromBeta_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Close Commissioning Window after failed commissioning\n"); + err = TestCloseCommissioningWindowAfterFailedCommissioning_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Commission from gamma\n"); - err = TestCommissionFromGamma_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Open Commissioning Window from alpha again\n"); + err = TestOpenCommissioningWindowFromAlphaAgain_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Wait for the commissioned device to be retrieved for gamma\n"); - err = TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Commission from beta\n"); + err = TestCommissionFromBeta_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : read the mandatory attribute: NodeLabel from alpha\n"); - err = TestReadTheMandatoryAttributeNodeLabelFromAlpha_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait for the commissioned device to be retrieved for beta\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrievedForBeta_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : write the mandatory attribute NodeLabel from beta\n"); - err = TestWriteTheMandatoryAttributeNodeLabelFromBeta_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Open Commissioning Window from beta\n"); + err = TestOpenCommissioningWindowFromBeta_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the mandatory attribute: NodeLabel from gamma\n"); - err = TestReadTheMandatoryAttributeNodeLabelFromGamma_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : Commission from gamma\n"); + err = TestCommissionFromGamma_10(); break; case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : write the mandatory attribute NodeLabel back to default\n"); - err = TestWriteTheMandatoryAttributeNodeLabelBackToDefault_11(); + ChipLogProgress(chipTool, " ***** Test Step 11 : Wait for the commissioned device to be retrieved for gamma\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : read the mandatory attribute: NodeLabel from alpha\n"); + err = TestReadTheMandatoryAttributeNodeLabelFromAlpha_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : write the mandatory attribute NodeLabel from beta\n"); + err = TestWriteTheMandatoryAttributeNodeLabelFromBeta_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : read the mandatory attribute: NodeLabel from gamma\n"); + err = TestReadTheMandatoryAttributeNodeLabelFromGamma_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : write the mandatory attribute NodeLabel back to default\n"); + err = TestWriteTheMandatoryAttributeNodeLabelBackToDefault_15(); break; } @@ -91294,9 +91311,10 @@ class TestMultiAdminSuite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 12; + const uint16_t mTestCount = 16; chip::Optional mNodeId; + chip::Optional mNodeIdForDuplicateCommissioning; chip::Optional mNodeId2; chip::Optional mNodeId3; chip::Optional mEndpoint; @@ -91315,39 +91333,52 @@ class TestMultiAdminSuite : public TestCommand NextTest(); } - static void OnFailureCallback_8(void * context, CHIP_ERROR error) + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); + (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_8(void * context, chip::CharSpan nodeLabel) + static void + OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) { - (static_cast(context))->OnSuccessResponse_8(nodeLabel); + (static_cast(context))->OnSuccessResponse_4(fabrics); } - static void OnFailureCallback_9(void * context, CHIP_ERROR error) + static void OnFailureCallback_12(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); + (static_cast(context))->OnFailureResponse_12(error); } - static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + static void OnSuccessCallback_12(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_12(nodeLabel); + } - static void OnFailureCallback_10(void * context, CHIP_ERROR error) + static void OnFailureCallback_13(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_10(error); + (static_cast(context))->OnFailureResponse_13(error); } - static void OnSuccessCallback_10(void * context, chip::CharSpan nodeLabel) + static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } + + static void OnFailureCallback_14(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_10(nodeLabel); + (static_cast(context))->OnFailureResponse_14(error); } - static void OnFailureCallback_11(void * context, CHIP_ERROR error) + static void OnSuccessCallback_14(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_14(nodeLabel); + } + + static void OnFailureCallback_15(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_11(error); + (static_cast(context))->OnFailureResponse_15(error); } - static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + static void OnSuccessCallback_15(void * context) { (static_cast(context))->OnSuccessResponse_15(); } // // Tests methods @@ -91394,20 +91425,114 @@ class TestMultiAdminSuite : public TestCommand void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestCommissionFromBeta_3() + CHIP_ERROR TestCommissionFromAlphaAgain_3() + { + SetIdentity(kIdentityAlpha); + return PairWithQRCode(mNodeIdForDuplicateCommissioning.HasValue() ? mNodeIdForDuplicateCommissioning.Value() : 17ULL, + mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00"), + CHIP_ERROR_FABRIC_EXISTS); + } + + CHIP_ERROR TestCheckThatWeJustHaveTheOneFabricAndDidNotAddANewOne_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, false)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + + NextTest(); + } + + CHIP_ERROR TestCloseCommissioningWindowAfterFailedCommissioning_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::RevokeCommissioning::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_5(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_5(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5() { NextTest(); } + + CHIP_ERROR TestOpenCommissioningWindowFromAlphaAgain_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; + + RequestType request; + request.commissioningTimeout = 120U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_6(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_6(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_6() { NextTest(); } + + CHIP_ERROR TestCommissionFromBeta_7() { SetIdentity(kIdentityBeta); return PairWithQRCode(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForBeta_4() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForBeta_8() { SetIdentity(kIdentityBeta); return WaitForCommissionee(mNodeId2.HasValue() ? mNodeId2.Value() : 51966ULL); } - CHIP_ERROR TestOpenCommissioningWindowFromBeta_5() + CHIP_ERROR TestOpenCommissioningWindowFromBeta_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; @@ -91416,11 +91541,11 @@ class TestMultiAdminSuite : public TestCommand request.commissioningTimeout = 120U; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_5(); + (static_cast(context))->OnSuccessResponse_9(); }; auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); + (static_cast(context))->OnFailureResponse_9(error); }; ReturnErrorOnFailure( @@ -91428,45 +91553,45 @@ class TestMultiAdminSuite : public TestCommand return CHIP_NO_ERROR; } - void OnFailureResponse_5(CHIP_ERROR error) + void OnFailureResponse_9(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_5() { NextTest(); } + void OnSuccessResponse_9() { NextTest(); } - CHIP_ERROR TestCommissionFromGamma_6() + CHIP_ERROR TestCommissionFromGamma_10() { SetIdentity(kIdentityGamma); return PairWithQRCode(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:-24J0AFN00KA0648G00")); } - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_7() + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrievedForGamma_11() { SetIdentity(kIdentityGamma); return WaitForCommissionee(mNodeId3.HasValue() ? mNodeId3.Value() : 12586990ULL); } - CHIP_ERROR TestReadTheMandatoryAttributeNodeLabelFromAlpha_8() + CHIP_ERROR TestReadTheMandatoryAttributeNodeLabelFromAlpha_12() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::BasicClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_8, OnFailureCallback_8, true)); + this, OnSuccessCallback_12, OnFailureCallback_12, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_8(CHIP_ERROR error) + void OnFailureResponse_12(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_8(chip::CharSpan nodeLabel) + void OnSuccessResponse_12(chip::CharSpan nodeLabel) { VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("", 0))); @@ -91480,7 +91605,7 @@ class TestMultiAdminSuite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTheMandatoryAttributeNodeLabelFromBeta_9() + CHIP_ERROR TestWriteTheMandatoryAttributeNodeLabelFromBeta_13() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::BasicClusterTest cluster; @@ -91490,43 +91615,43 @@ class TestMultiAdminSuite : public TestCommand nodeLabelArgument = chip::Span("written from betagarbage: not in length on purpose", 17); ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + nodeLabelArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); return CHIP_NO_ERROR; } - void OnFailureResponse_9(CHIP_ERROR error) + void OnFailureResponse_13(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_9() { NextTest(); } + void OnSuccessResponse_13() { NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeNodeLabelFromGamma_10() + CHIP_ERROR TestReadTheMandatoryAttributeNodeLabelFromGamma_14() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::BasicClusterTest cluster; cluster.Associate(mDevices[kIdentityGamma], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); + this, OnSuccessCallback_14, OnFailureCallback_14, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_10(CHIP_ERROR error) + void OnFailureResponse_14(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_10(chip::CharSpan nodeLabel) + void OnSuccessResponse_14(chip::CharSpan nodeLabel) { VerifyOrReturn(CheckConstraintNotValue("nodeLabel", nodeLabel, readFromAlpha)); NextTest(); } - CHIP_ERROR TestWriteTheMandatoryAttributeNodeLabelBackToDefault_11() + CHIP_ERROR TestWriteTheMandatoryAttributeNodeLabelBackToDefault_15() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; chip::Controller::BasicClusterTest cluster; @@ -91536,17 +91661,17 @@ class TestMultiAdminSuite : public TestCommand nodeLabelArgument = readFromAlpha; ReturnErrorOnFailure(cluster.WriteAttribute( - nodeLabelArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); + nodeLabelArgument, this, OnSuccessCallback_15, OnFailureCallback_15)); return CHIP_NO_ERROR; } - void OnFailureResponse_11(CHIP_ERROR error) + void OnFailureResponse_15(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_11() { NextTest(); } + void OnSuccessResponse_15() { NextTest(); } }; class Test_TC_SWDIAG_1_1Suite : public TestCommand From feb81b65e2f63fe91a65bd1b6c77da53835872bf Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Tue, 22 Mar 2022 14:34:32 -0400 Subject: [PATCH 09/70] Fix include checking for src/include/platform/internal/*.cpp (#15121) Since these .cpp files are included instead of being listed in sources, they are not processed by the include checker. This has allowed the introduction of a dependency cycle in 1e8ed9de5 ("Updated Device to Get PASE Verifier from Memory. (#14676)") which in turn result in the following build flake: FAILED: obj/src/platform/Darwin/Darwin.ConfigurationManagerImpl.cpp.o g++ -MMD -MF obj/src/platform/Darwin/Darwin.ConfigurationManagerImpl.cpp.o.d -target x86_64-apple-macos10.15 -O0 -g2 -fno-common -ffunction-sections -fdata-sections -fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables -fPIC -Wall -Werror -Wextra -Wshadow -Wunreachable-code -Wvla -Wformat -Wformat-nonliteral -Wformat-security -Wno-deprecated-declarations -Wno-unknown-warning-option -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-unused-parameter -Wno-psabi -Wno-cast-function-type -fno-strict-aliasing -target x86_64-apple-macos10.15 -arch arm64 -arch x86_64 -fobjc-arc -std=gnu++14 -fno-rtti -Wnon-virtual-dtor -DCHIP_HAVE_CONFIG_H=1 -I../../../../../../../../src/include -I../../../../../../../../src -Igen/include -I../../../../../../../../zzz_generated/app-common -I../../../../../../../../config/standalone -I../../../../../../../../third_party/nlassert/repo/include -I../../../../../../../../third_party/nlio/repo/include -I../../../../../../../../third_party/mbedtls/repo/include -c ../../../../../../../../src/platform/Darwin/ConfigurationManagerImpl.cpp -o obj/src/platform/Darwin/Darwin.ConfigurationManagerImpl.cpp.o In file included from ../../../../../../../../src/platform/Darwin/ConfigurationManagerImpl.cpp:31: In file included from ../../../../../../../../src/include/platform/internal/GenericConfigurationManagerImpl.cpp:38: In file included from ../../../../../../../../src/protocols/secure_channel/PASESession.h:34: In file included from ../../../../../../../../src/messaging/ExchangeContext.h:31: In file included from ../../../../../../../../src/messaging/ExchangeDelegate.h:27: In file included from ../../../../../../../../src/messaging/ApplicationExchangeDispatch.h:28: In file included from ../../../../../../../../src/messaging/ExchangeMessageDispatch.h:27: In file included from ../../../../../../../../src/transport/SessionManager.h:39: In file included from ../../../../../../../../src/transport/GroupSession.h:22: In file included from ../../../../../../../../src/transport/Session.h:19: In file included from ../../../../../../../../src/credentials/FabricTable.h:27: In file included from ../../../../../../../../src/credentials/CHIPCert.h:34: ../../../../../../../../src/lib/asn1/ASN1.h:30:10: fatal error: 'asn1/ASN1OID.h' file not found #include ^~~~~~~~~~~~~~~~ 1 error generated. The requisite dependency for this include cannot be added, because it results in a cycle: ERROR Dependency cycle: //src/platform:platform -> //src/protocols/secure_channel:secure_channel -> //src/messaging:messaging -> //src/platform:platform Fix the diagnostic so that dependency errors in these files are caught: ERROR at //src/include/platform/internal/GenericConfigurationManagerImpl.ipp:38:11: Include not allowed. #include ^------------------------------------- It is not in any dependency of //src/platform:platform The include file is in the target(s): //src/protocols/secure_channel:secure_channel which should somehow be reachable. --- ...anagerImpl.cpp => GenericConfigurationManagerImpl.ipp} | 0 ...mpl_BLE.cpp => GenericConnectivityManagerImpl_BLE.ipp} | 0 ...read.cpp => GenericConnectivityManagerImpl_Thread.ipp} | 0 ...l_WiFi.cpp => GenericConnectivityManagerImpl_WiFi.ipp} | 0 ...formManagerImpl.cpp => GenericPlatformManagerImpl.ipp} | 0 ...eeRTOS.cpp => GenericPlatformManagerImpl_FreeRTOS.ipp} | 2 +- ...mpl_POSIX.cpp => GenericPlatformManagerImpl_POSIX.ipp} | 2 +- ...l_Zephyr.cpp => GenericPlatformManagerImpl_Zephyr.ipp} | 2 +- src/platform/Ameba/ConfigurationManagerImpl.cpp | 2 +- src/platform/Ameba/ConnectivityManagerImpl.cpp | 6 +++--- src/platform/Ameba/PlatformManagerImpl.cpp | 2 +- src/platform/BUILD.gn | 8 ++++++++ src/platform/CYW30739/ConfigurationManagerImpl.cpp | 2 +- src/platform/CYW30739/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/CYW30739/PlatformManagerImpl.cpp | 2 +- src/platform/Darwin/ConfigurationManagerImpl.cpp | 2 +- src/platform/Darwin/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/Darwin/PlatformManagerImpl.cpp | 2 +- src/platform/EFR32/ConfigurationManagerImpl.cpp | 2 +- src/platform/EFR32/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/EFR32/ConnectivityManagerImpl.h | 2 +- src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp | 2 +- src/platform/EFR32/PlatformManagerImpl.cpp | 2 +- src/platform/ESP32/ConfigurationManagerImpl.cpp | 2 +- src/platform/ESP32/ConnectivityManagerImpl.cpp | 6 +++--- src/platform/ESP32/PlatformManagerImpl.cpp | 2 +- src/platform/Linux/ConfigurationManagerImpl.cpp | 2 +- src/platform/Linux/ConnectivityManagerImpl.cpp | 6 +++--- src/platform/Linux/PlatformManagerImpl.cpp | 2 +- src/platform/P6/ConfigurationManagerImpl.cpp | 2 +- src/platform/P6/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/P6/PlatformManagerImpl.cpp | 2 +- src/platform/Tizen/ConfigurationManagerImpl.cpp | 2 +- src/platform/Tizen/ConnectivityManagerImpl.cpp | 6 +++--- src/platform/Tizen/PlatformManagerImpl.cpp | 2 +- src/platform/Zephyr/ConfigurationManagerImpl.cpp | 4 ++-- src/platform/Zephyr/PlatformManagerImpl.cpp | 2 +- src/platform/android/ConfigurationManagerImpl.cpp | 2 +- src/platform/android/ConnectivityManagerImpl.cpp | 6 +++--- src/platform/android/PlatformManagerImpl.cpp | 2 +- src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp | 2 +- src/platform/cc13x2_26x2/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/cc13x2_26x2/PlatformManagerImpl.cpp | 2 +- src/platform/mbed/ConfigurationManagerImpl.cpp | 2 +- src/platform/mbed/ConnectivityManagerImpl.cpp | 6 +++--- src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp | 2 +- src/platform/mbed/PlatformManagerImpl.cpp | 2 +- src/platform/nrfconnect/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp | 2 +- src/platform/nxp/k32w/k32w0/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp | 2 +- src/platform/qpg/ConfigurationManagerImpl.cpp | 4 ++-- src/platform/qpg/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/qpg/PlatformManagerImpl.cpp | 2 +- src/platform/telink/ConnectivityManagerImpl.cpp | 4 ++-- src/platform/webos/ConnectivityManagerImpl.cpp | 6 +++--- 56 files changed, 83 insertions(+), 75 deletions(-) rename src/include/platform/internal/{GenericConfigurationManagerImpl.cpp => GenericConfigurationManagerImpl.ipp} (100%) rename src/include/platform/internal/{GenericConnectivityManagerImpl_BLE.cpp => GenericConnectivityManagerImpl_BLE.ipp} (100%) rename src/include/platform/internal/{GenericConnectivityManagerImpl_Thread.cpp => GenericConnectivityManagerImpl_Thread.ipp} (100%) rename src/include/platform/internal/{GenericConnectivityManagerImpl_WiFi.cpp => GenericConnectivityManagerImpl_WiFi.ipp} (100%) rename src/include/platform/internal/{GenericPlatformManagerImpl.cpp => GenericPlatformManagerImpl.ipp} (100%) rename src/include/platform/internal/{GenericPlatformManagerImpl_FreeRTOS.cpp => GenericPlatformManagerImpl_FreeRTOS.ipp} (99%) rename src/include/platform/internal/{GenericPlatformManagerImpl_POSIX.cpp => GenericPlatformManagerImpl_POSIX.ipp} (99%) rename src/include/platform/internal/{GenericPlatformManagerImpl_Zephyr.cpp => GenericPlatformManagerImpl_Zephyr.ipp} (99%) diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.cpp b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp similarity index 100% rename from src/include/platform/internal/GenericConfigurationManagerImpl.cpp rename to src/include/platform/internal/GenericConfigurationManagerImpl.ipp diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_BLE.cpp b/src/include/platform/internal/GenericConnectivityManagerImpl_BLE.ipp similarity index 100% rename from src/include/platform/internal/GenericConnectivityManagerImpl_BLE.cpp rename to src/include/platform/internal/GenericConnectivityManagerImpl_BLE.ipp diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.cpp b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp similarity index 100% rename from src/include/platform/internal/GenericConnectivityManagerImpl_Thread.cpp rename to src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.cpp b/src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.ipp similarity index 100% rename from src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.cpp rename to src/include/platform/internal/GenericConnectivityManagerImpl_WiFi.ipp diff --git a/src/include/platform/internal/GenericPlatformManagerImpl.cpp b/src/include/platform/internal/GenericPlatformManagerImpl.ipp similarity index 100% rename from src/include/platform/internal/GenericPlatformManagerImpl.cpp rename to src/include/platform/internal/GenericPlatformManagerImpl.ipp diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.cpp b/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp similarity index 99% rename from src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.cpp rename to src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp index 4234bad77513d5..393d921110e09c 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.cpp +++ b/src/include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp @@ -33,7 +33,7 @@ // Include the non-inline definitions for the GenericPlatformManagerImpl<> template, // from which the GenericPlatformManagerImpl_FreeRTOS<> template inherits. -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.cpp b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp similarity index 99% rename from src/include/platform/internal/GenericPlatformManagerImpl_POSIX.cpp rename to src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp index 3b5c367ab67499..0c5d3534e34b01 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.cpp +++ b/src/include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp @@ -30,7 +30,7 @@ // Include the non-inline definitions for the GenericPlatformManagerImpl<> template, // from which the GenericPlatformManagerImpl_POSIX<> template inherits. -#include +#include #include #include diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.cpp b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp similarity index 99% rename from src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.cpp rename to src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp index 606663face82f4..61814944d1fbfc 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.cpp +++ b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp @@ -30,7 +30,7 @@ // Include the non-inline definitions for the GenericPlatformManagerImpl<> template, // from which the GenericPlatformManagerImpl_Zephyr<> template inherits. -#include +#include #include #include diff --git a/src/platform/Ameba/ConfigurationManagerImpl.cpp b/src/platform/Ameba/ConfigurationManagerImpl.cpp index 62d11252157c46..44485c1d12e94f 100644 --- a/src/platform/Ameba/ConfigurationManagerImpl.cpp +++ b/src/platform/Ameba/ConfigurationManagerImpl.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/platform/Ameba/ConnectivityManagerImpl.cpp b/src/platform/Ameba/ConnectivityManagerImpl.cpp index 4b594ea32654a6..534e4cb2c6c971 100644 --- a/src/platform/Ameba/ConnectivityManagerImpl.cpp +++ b/src/platform/Ameba/ConnectivityManagerImpl.cpp @@ -21,15 +21,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI -#include +#include #endif #include diff --git a/src/platform/Ameba/PlatformManagerImpl.cpp b/src/platform/Ameba/PlatformManagerImpl.cpp index 5b787042e77f9e..8c6c93312d066e 100644 --- a/src/platform/Ameba/PlatformManagerImpl.cpp +++ b/src/platform/Ameba/PlatformManagerImpl.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index 5395d4c29a771e..f3d466068053ea 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -300,16 +300,24 @@ if (chip_device_platform != "none") { "../include/platform/internal/DeviceNetworkProvisioning.h", "../include/platform/internal/EventLogging.h", "../include/platform/internal/GenericConfigurationManagerImpl.h", + "../include/platform/internal/GenericConfigurationManagerImpl.ipp", "../include/platform/internal/GenericConnectivityManagerImpl.h", "../include/platform/internal/GenericConnectivityManagerImpl_BLE.h", + "../include/platform/internal/GenericConnectivityManagerImpl_BLE.ipp", "../include/platform/internal/GenericConnectivityManagerImpl_NoBLE.h", "../include/platform/internal/GenericConnectivityManagerImpl_NoThread.h", "../include/platform/internal/GenericConnectivityManagerImpl_NoWiFi.h", "../include/platform/internal/GenericConnectivityManagerImpl_Thread.h", + "../include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp", "../include/platform/internal/GenericConnectivityManagerImpl_WiFi.h", + "../include/platform/internal/GenericConnectivityManagerImpl_WiFi.ipp", "../include/platform/internal/GenericPlatformManagerImpl.h", + "../include/platform/internal/GenericPlatformManagerImpl.ipp", "../include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.h", + "../include/platform/internal/GenericPlatformManagerImpl_FreeRTOS.ipp", "../include/platform/internal/GenericPlatformManagerImpl_POSIX.h", + "../include/platform/internal/GenericPlatformManagerImpl_POSIX.ipp", + "../include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp", "../include/platform/internal/testing/ConfigUnitTest.h", "CommissionableDataProvider.cpp", "DeviceControlServer.cpp", diff --git a/src/platform/CYW30739/ConfigurationManagerImpl.cpp b/src/platform/CYW30739/ConfigurationManagerImpl.cpp index 891ec57385cb36..1bd7ad747301d6 100644 --- a/src/platform/CYW30739/ConfigurationManagerImpl.cpp +++ b/src/platform/CYW30739/ConfigurationManagerImpl.cpp @@ -24,7 +24,7 @@ /* this file behaves like a config.h, comes first */ #include -#include +#include #include #include diff --git a/src/platform/CYW30739/ConnectivityManagerImpl.cpp b/src/platform/CYW30739/ConnectivityManagerImpl.cpp index 7d8852c66fab44..c6f9446b10a8e2 100644 --- a/src/platform/CYW30739/ConnectivityManagerImpl.cpp +++ b/src/platform/CYW30739/ConnectivityManagerImpl.cpp @@ -21,10 +21,10 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif namespace chip { diff --git a/src/platform/CYW30739/PlatformManagerImpl.cpp b/src/platform/CYW30739/PlatformManagerImpl.cpp index 3b097fa24c886f..d2db833c176b17 100644 --- a/src/platform/CYW30739/PlatformManagerImpl.cpp +++ b/src/platform/CYW30739/PlatformManagerImpl.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/src/platform/Darwin/ConfigurationManagerImpl.cpp b/src/platform/Darwin/ConfigurationManagerImpl.cpp index de77431e6d6184..d48f7e21e77afe 100644 --- a/src/platform/Darwin/ConfigurationManagerImpl.cpp +++ b/src/platform/Darwin/ConfigurationManagerImpl.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/platform/Darwin/ConnectivityManagerImpl.cpp b/src/platform/Darwin/ConnectivityManagerImpl.cpp index 01e973eaa49767..87e38e4250d8d7 100644 --- a/src/platform/Darwin/ConnectivityManagerImpl.cpp +++ b/src/platform/Darwin/ConnectivityManagerImpl.cpp @@ -27,11 +27,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif using namespace ::chip; diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp index 631ed38f63bf86..1af5aac70507c7 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -28,7 +28,7 @@ #include // Include the non-inline definitions for the GenericPlatformManagerImpl<> template, -#include +#include #include diff --git a/src/platform/EFR32/ConfigurationManagerImpl.cpp b/src/platform/EFR32/ConfigurationManagerImpl.cpp index b65d788465a918..c99bfa734caca5 100644 --- a/src/platform/EFR32/ConfigurationManagerImpl.cpp +++ b/src/platform/EFR32/ConfigurationManagerImpl.cpp @@ -24,7 +24,7 @@ /* this file behaves like a config.h, comes first */ #include -#include +#include #include #include diff --git a/src/platform/EFR32/ConnectivityManagerImpl.cpp b/src/platform/EFR32/ConnectivityManagerImpl.cpp index 4de87db5b1637a..512788e2cdb313 100644 --- a/src/platform/EFR32/ConnectivityManagerImpl.cpp +++ b/src/platform/EFR32/ConnectivityManagerImpl.cpp @@ -29,11 +29,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif using namespace ::chip; diff --git a/src/platform/EFR32/ConnectivityManagerImpl.h b/src/platform/EFR32/ConnectivityManagerImpl.h index 7e817ad4da743c..304bf4d9e4d9db 100644 --- a/src/platform/EFR32/ConnectivityManagerImpl.h +++ b/src/platform/EFR32/ConnectivityManagerImpl.h @@ -31,7 +31,7 @@ #include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION -#include +#include #else #include #endif diff --git a/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp b/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp index 63bdb907a052eb..7c0a9bfd8d39e8 100644 --- a/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/EFR32/ConnectivityManagerImpl_WIFI.cpp @@ -30,7 +30,7 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #include "wfx_host_events.h" diff --git a/src/platform/EFR32/PlatformManagerImpl.cpp b/src/platform/EFR32/PlatformManagerImpl.cpp index 8c967e13fcc78a..5acf098528605b 100644 --- a/src/platform/EFR32/PlatformManagerImpl.cpp +++ b/src/platform/EFR32/PlatformManagerImpl.cpp @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index cbcb9afcde9303..5a3196eed0c96e 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include "esp_wifi.h" #include "nvs.h" diff --git a/src/platform/ESP32/ConnectivityManagerImpl.cpp b/src/platform/ESP32/ConnectivityManagerImpl.cpp index db167c9ec7e7ca..dab26056596f6f 100644 --- a/src/platform/ESP32/ConnectivityManagerImpl.cpp +++ b/src/platform/ESP32/ConnectivityManagerImpl.cpp @@ -22,15 +22,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI -#include +#include #endif #include diff --git a/src/platform/ESP32/PlatformManagerImpl.cpp b/src/platform/ESP32/PlatformManagerImpl.cpp index bd47cdfaf8976c..f6bdaece639314 100644 --- a/src/platform/ESP32/PlatformManagerImpl.cpp +++ b/src/platform/ESP32/PlatformManagerImpl.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include "esp_event.h" #include "esp_heap_caps_init.h" diff --git a/src/platform/Linux/ConfigurationManagerImpl.cpp b/src/platform/Linux/ConfigurationManagerImpl.cpp index fed2f6d723a56f..64b14d3067ec97 100644 --- a/src/platform/Linux/ConfigurationManagerImpl.cpp +++ b/src/platform/Linux/ConfigurationManagerImpl.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index 0d6d4de61f427b..a801e310a07efc 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -43,15 +43,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WPA -#include +#include #endif #ifndef CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index e6ad974847a081..fd3d5b3203e6ba 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include diff --git a/src/platform/P6/ConfigurationManagerImpl.cpp b/src/platform/P6/ConfigurationManagerImpl.cpp index f078d0bc71b1bf..65ec8e6fd5db1f 100644 --- a/src/platform/P6/ConfigurationManagerImpl.cpp +++ b/src/platform/P6/ConfigurationManagerImpl.cpp @@ -25,7 +25,7 @@ /* this file behaves like a config.h, comes first */ #include -#include +#include #include #include diff --git a/src/platform/P6/ConnectivityManagerImpl.cpp b/src/platform/P6/ConnectivityManagerImpl.cpp index 5e284d54659e3e..986054789b42f3 100644 --- a/src/platform/P6/ConnectivityManagerImpl.cpp +++ b/src/platform/P6/ConnectivityManagerImpl.cpp @@ -21,9 +21,9 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif -#include +#include #include #include diff --git a/src/platform/P6/PlatformManagerImpl.cpp b/src/platform/P6/PlatformManagerImpl.cpp index 0ff0ce3a29f6c1..95bc6bdae7f15b 100644 --- a/src/platform/P6/PlatformManagerImpl.cpp +++ b/src/platform/P6/PlatformManagerImpl.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Tizen/ConfigurationManagerImpl.cpp b/src/platform/Tizen/ConfigurationManagerImpl.cpp index 1091beb7aa34e5..08c76952e52f32 100644 --- a/src/platform/Tizen/ConfigurationManagerImpl.cpp +++ b/src/platform/Tizen/ConfigurationManagerImpl.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Tizen/ConnectivityManagerImpl.cpp b/src/platform/Tizen/ConnectivityManagerImpl.cpp index b992985c32d613..1b56b8bebc2e1a 100644 --- a/src/platform/Tizen/ConnectivityManagerImpl.cpp +++ b/src/platform/Tizen/ConnectivityManagerImpl.cpp @@ -28,15 +28,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI -#include +#include #endif using namespace ::chip; diff --git a/src/platform/Tizen/PlatformManagerImpl.cpp b/src/platform/Tizen/PlatformManagerImpl.cpp index d678f81fbc61ba..87b9a36201bad4 100644 --- a/src/platform/Tizen/PlatformManagerImpl.cpp +++ b/src/platform/Tizen/PlatformManagerImpl.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.cpp b/src/platform/Zephyr/ConfigurationManagerImpl.cpp index 33add147262079..481f1c5ac0f22f 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.cpp +++ b/src/platform/Zephyr/ConfigurationManagerImpl.cpp @@ -24,13 +24,13 @@ #include #include -#include +#include #include #include #if CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING -#include +#include #endif // CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING #include diff --git a/src/platform/Zephyr/PlatformManagerImpl.cpp b/src/platform/Zephyr/PlatformManagerImpl.cpp index abee0c70ec23f3..cea8a956b4806a 100644 --- a/src/platform/Zephyr/PlatformManagerImpl.cpp +++ b/src/platform/Zephyr/PlatformManagerImpl.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/platform/android/ConfigurationManagerImpl.cpp b/src/platform/android/ConfigurationManagerImpl.cpp index fbcca64417888c..e7d860ce02a2d4 100644 --- a/src/platform/android/ConfigurationManagerImpl.cpp +++ b/src/platform/android/ConfigurationManagerImpl.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include namespace chip { namespace DeviceLayer { diff --git a/src/platform/android/ConnectivityManagerImpl.cpp b/src/platform/android/ConnectivityManagerImpl.cpp index b43c35cdf2a013..4cbabc39b354cc 100644 --- a/src/platform/android/ConnectivityManagerImpl.cpp +++ b/src/platform/android/ConnectivityManagerImpl.cpp @@ -28,15 +28,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WPA -#include +#include #endif using namespace ::chip; diff --git a/src/platform/android/PlatformManagerImpl.cpp b/src/platform/android/PlatformManagerImpl.cpp index 2bc2597cfcc7e0..44ebf7af8594ee 100644 --- a/src/platform/android/PlatformManagerImpl.cpp +++ b/src/platform/android/PlatformManagerImpl.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include diff --git a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp index 0981df0169d9d5..bb402fef21e2ec 100644 --- a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/src/platform/cc13x2_26x2/ConnectivityManagerImpl.cpp b/src/platform/cc13x2_26x2/ConnectivityManagerImpl.cpp index 7f1d7610cf9eab..04889a1c9733f1 100644 --- a/src/platform/cc13x2_26x2/ConnectivityManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/ConnectivityManagerImpl.cpp @@ -25,11 +25,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #include diff --git a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp index fbc1d3fe3282af..9174b2a8418d3a 100644 --- a/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/PlatformManagerImpl.cpp @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include diff --git a/src/platform/mbed/ConfigurationManagerImpl.cpp b/src/platform/mbed/ConfigurationManagerImpl.cpp index 94f79c80ef8a4e..a43f914e8f786b 100644 --- a/src/platform/mbed/ConfigurationManagerImpl.cpp +++ b/src/platform/mbed/ConfigurationManagerImpl.cpp @@ -30,7 +30,7 @@ #include #undef sleep -#include +#include #include diff --git a/src/platform/mbed/ConnectivityManagerImpl.cpp b/src/platform/mbed/ConnectivityManagerImpl.cpp index 646b56f309caf8..7e91ba1a1eb976 100644 --- a/src/platform/mbed/ConnectivityManagerImpl.cpp +++ b/src/platform/mbed/ConnectivityManagerImpl.cpp @@ -23,15 +23,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WIFI -#include +#include #endif namespace chip { diff --git a/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp b/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp index d5e0200e84c76b..38799727266686 100644 --- a/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp +++ b/src/platform/mbed/ConnectivityManagerImpl_WiFi.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include diff --git a/src/platform/mbed/PlatformManagerImpl.cpp b/src/platform/mbed/PlatformManagerImpl.cpp index 1bc89117d3d2cd..eb34cf271c5554 100644 --- a/src/platform/mbed/PlatformManagerImpl.cpp +++ b/src/platform/mbed/PlatformManagerImpl.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/platform/nrfconnect/ConnectivityManagerImpl.cpp b/src/platform/nrfconnect/ConnectivityManagerImpl.cpp index 5803265cd47a67..c09181db994e8d 100644 --- a/src/platform/nrfconnect/ConnectivityManagerImpl.cpp +++ b/src/platform/nrfconnect/ConnectivityManagerImpl.cpp @@ -24,11 +24,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif using namespace ::chip; diff --git a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp index 0cfc4ae6708ad6..947e0194df35a2 100644 --- a/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/ConfigurationManagerImpl.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include "fsl_power.h" diff --git a/src/platform/nxp/k32w/k32w0/ConnectivityManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/ConnectivityManagerImpl.cpp index a457e62761bb6d..9fc2bacaf5d8a2 100644 --- a/src/platform/nxp/k32w/k32w0/ConnectivityManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/ConnectivityManagerImpl.cpp @@ -30,11 +30,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif using namespace ::chip; diff --git a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp index 53fd82e6b3cdfd..9b928dea89aa86 100644 --- a/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/PlatformManagerImpl.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include #include diff --git a/src/platform/qpg/ConfigurationManagerImpl.cpp b/src/platform/qpg/ConfigurationManagerImpl.cpp index 130f1a9876c68e..59e686fa9c50a0 100644 --- a/src/platform/qpg/ConfigurationManagerImpl.cpp +++ b/src/platform/qpg/ConfigurationManagerImpl.cpp @@ -24,13 +24,13 @@ #include #include -#include +#include #include #include #if CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING -#include +#include #endif // CHIP_DEVICE_CONFIG_ENABLE_FACTORY_PROVISIONING #include diff --git a/src/platform/qpg/ConnectivityManagerImpl.cpp b/src/platform/qpg/ConnectivityManagerImpl.cpp index 9a339f9c6354fe..84b0760d74a51c 100644 --- a/src/platform/qpg/ConnectivityManagerImpl.cpp +++ b/src/platform/qpg/ConnectivityManagerImpl.cpp @@ -18,11 +18,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #include diff --git a/src/platform/qpg/PlatformManagerImpl.cpp b/src/platform/qpg/PlatformManagerImpl.cpp index f882539344ea0c..4719ab8ff5bf0b 100644 --- a/src/platform/qpg/PlatformManagerImpl.cpp +++ b/src/platform/qpg/PlatformManagerImpl.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include diff --git a/src/platform/telink/ConnectivityManagerImpl.cpp b/src/platform/telink/ConnectivityManagerImpl.cpp index f57a8002c38616..a5b8853414ac8d 100644 --- a/src/platform/telink/ConnectivityManagerImpl.cpp +++ b/src/platform/telink/ConnectivityManagerImpl.cpp @@ -24,11 +24,11 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif using namespace ::chip; diff --git a/src/platform/webos/ConnectivityManagerImpl.cpp b/src/platform/webos/ConnectivityManagerImpl.cpp index f4e3d3001984ed..6e2d297c7d1051 100644 --- a/src/platform/webos/ConnectivityManagerImpl.cpp +++ b/src/platform/webos/ConnectivityManagerImpl.cpp @@ -36,15 +36,15 @@ #include #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#include +#include #endif #if CHIP_DEVICE_CONFIG_ENABLE_WPA -#include +#include #endif #ifndef CHIP_DEVICE_CONFIG_LINUX_DHCPC_CMD From d71e8e56d107c126bac736bd814f95889fa4bc4b Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 22 Mar 2022 15:03:56 -0400 Subject: [PATCH 10/70] Don't lose enableServerInteractions state when controller restarts. (#16504) When we shut down and restart the last controller, we shut down and reinitialize the system state. Since we were not storing the enableServerInteractions state in either the SystemState or the CHIPDeviceControllerFactory, it was getting lost during this process. The fix is to store the state in CHIPDeviceControllerFactory. --- src/controller/CHIPDeviceControllerFactory.cpp | 12 ++++++++---- src/controller/CHIPDeviceControllerFactory.h | 1 + 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index 213ffddafb46e7..d04f56e83123a4 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -55,8 +55,11 @@ CHIP_ERROR DeviceControllerFactory::Init(FactoryInitParams params) return CHIP_NO_ERROR; } + // Save our initialization state that we can't recover later from a + // created-but-shut-down system state. mListenPort = params.listenPort; mFabricIndependentStorage = params.fabricIndependentStorage; + mEnableServerInteractions = params.enableServerInteractions; CHIP_ERROR err = InitSystemState(params); @@ -74,10 +77,11 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState() #if CONFIG_NETWORK_LAYER_BLE params.bleLayer = mSystemState->BleLayer(); #endif + params.listenPort = mListenPort; + params.fabricIndependentStorage = mFabricIndependentStorage; + params.enableServerInteractions = mEnableServerInteractions; } - params.fabricIndependentStorage = mFabricIndependentStorage; - return InitSystemState(params); } @@ -128,12 +132,12 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) // ReturnErrorOnFailure(stateParams.transportMgr->Init(Transport::UdpListenParameters(stateParams.udpEndPointManager) .SetAddressType(Inet::IPAddressType::kIPv6) - .SetListenPort(mListenPort) + .SetListenPort(params.listenPort) #if INET_CONFIG_ENABLE_IPV4 , Transport::UdpListenParameters(stateParams.udpEndPointManager) .SetAddressType(Inet::IPAddressType::kIPv4) - .SetListenPort(mListenPort) + .SetListenPort(params.listenPort) #endif #if CONFIG_NETWORK_LAYER_BLE , diff --git a/src/controller/CHIPDeviceControllerFactory.h b/src/controller/CHIPDeviceControllerFactory.h index 0477aa3d4a69cd..be6ae934b3cd52 100644 --- a/src/controller/CHIPDeviceControllerFactory.h +++ b/src/controller/CHIPDeviceControllerFactory.h @@ -182,6 +182,7 @@ class DeviceControllerFactory uint16_t mListenPort; DeviceControllerSystemState * mSystemState = nullptr; PersistentStorageDelegate * mFabricIndependentStorage = nullptr; + bool mEnableServerInteractions = false; }; } // namespace Controller From d57c3b34e19d2e57598d14e1511fea5001125661 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Tue, 22 Mar 2022 12:29:53 -0700 Subject: [PATCH 11/70] Initialize the generic implementation ConfigurationManager base class. (#16532) --- src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp index bb402fef21e2ec..1db7197b6fdac1 100644 --- a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp @@ -65,6 +65,10 @@ CHIP_ERROR ConfigurationManagerImpl::Init() CHIP_ERROR err; bool failSafeArmed; + // Initialize the generic implementation base class. + err = Internal::GenericConfigurationManagerImpl::Init(); + ReturnErrorOnFailure(err); + // If the fail-safe was armed when the device last shutdown, initiate a factory reset. if (GetFailSafeArmed(failSafeArmed) == CHIP_NO_ERROR && failSafeArmed) { From 32f23fa1cf1d1e42a3eedc99822fede7134e66a2 Mon Sep 17 00:00:00 2001 From: Carol Yang Date: Tue, 22 Mar 2022 13:16:49 -0700 Subject: [PATCH 12/70] [OTA] Add a CLI option to support automatic image apply (#16533) --- .github/.wordlist.txt | 1 + examples/ota-requestor-app/linux/README.md | 1 + examples/ota-requestor-app/linux/main.cpp | 26 ++++++++++++++++++- .../clusters/ota-requestor/BDXDownloader.cpp | 4 +-- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 064a278a6c86b2..8a6d2116e2cbb7 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -95,6 +95,7 @@ ATWC AudioOutput auth AuthMode +autoApplyImage autocompletion autoconnect autocrlf diff --git a/examples/ota-requestor-app/linux/README.md b/examples/ota-requestor-app/linux/README.md index f192d94c54b74f..ad610c9a56e870 100644 --- a/examples/ota-requestor-app/linux/README.md +++ b/examples/ota-requestor-app/linux/README.md @@ -23,6 +23,7 @@ following command line options are available for the OTA Requestor application. | -c/--requestorCanConsent | If supplied, the RequestorCanConsent field of the QueryImage command is set to true. Otherwise, the value is determined by the driver. | | -f/--otaDownloadPath | If supplied, the OTA image is downloaded to the given fully-qualified file-path. Otherwise, the value defaults to /tmp/test.bin. | | -u/--userConsentState | The user consent state for the first QueryImage command. For all subsequent commands, the value of granted will be used.
  • granted: Authorize OTA requestor to download an OTA image
  • denied: Forbid OTA requestor to download an OTA image
  • deferred: Defer obtaining user consent | +| -a/--autoApplyImage | If supplied, apply the image immediately after download. Otherwise, the OTA update is complete after image download. | ## Software Image Header diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index b02cae2c49ac3f..add907124b41c5 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -51,6 +51,7 @@ class CustomOTARequestorDriver : public DeviceLayer::ExtendedOTARequestorDriver { public: bool CanConsent() override; + void UpdateDownloaded() override; }; OTARequestor gRequestorCore; @@ -67,17 +68,20 @@ constexpr uint16_t kOptionUserConsentState = 'u'; constexpr uint16_t kOptionPeriodicQueryTimeout = 'p'; constexpr uint16_t kOptionRequestorCanConsent = 'c'; constexpr uint16_t kOptionOtaDownloadPath = 'f'; +constexpr uint16_t kOptionAutoApplyImage = 'a'; constexpr size_t kMaxFilePathSize = 256; uint32_t gPeriodicQueryTimeoutSec = (24 * 60 * 60); chip::Optional gRequestorCanConsent; static char gOtaDownloadPath[kMaxFilePathSize] = "/tmp/test.bin"; +bool gAutoApplyImage = false; OptionDef cmdLineOptionsDef[] = { { "periodicQueryTimeout", chip::ArgParser::kArgumentRequired, kOptionPeriodicQueryTimeout }, { "requestorCanConsent", chip::ArgParser::kNoArgument, kOptionRequestorCanConsent }, { "otaDownloadPath", chip::ArgParser::kArgumentRequired, kOptionOtaDownloadPath }, { "userConsentState", chip::ArgParser::kArgumentRequired, kOptionUserConsentState }, + { "autoApplyImage", chip::ArgParser::kNoArgument, kOptionAutoApplyImage }, {}, }; @@ -97,7 +101,10 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " subsequent commands, the value of granted will be used.\n" " granted: Authorize OTA requestor to download an OTA image\n" " denied: Forbid OTA requestor to download an OTA image\n" - " deferred: Defer obtaining user consent \n" }; + " deferred: Defer obtaining user consent \n" + " -a/--autoApplyImage\n" + " If supplied, apply the image immediately after download.\n" + " Otherwise, the OTA update is complete after image download.\n" }; OptionSet * allOptions[] = { &cmdLineOptions, nullptr }; @@ -106,6 +113,20 @@ bool CustomOTARequestorDriver::CanConsent() return gRequestorCanConsent.ValueOr(DeviceLayer::ExtendedOTARequestorDriver::CanConsent()); } +void CustomOTARequestorDriver::UpdateDownloaded() +{ + if (gAutoApplyImage) + { + // Let the default driver take further action to apply the image + GenericOTARequestorDriver::UpdateDownloaded(); + } + else + { + // Cancelling will put the state back to idle + gRequestorCore.CancelImageUpdate(); + } +} + static void InitOTARequestor(void) { // Set the global instance of the OTA requestor core component @@ -170,6 +191,9 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, retval = false; } break; + case kOptionAutoApplyImage: + gAutoApplyImage = true; + break; default: PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); retval = false; diff --git a/src/app/clusters/ota-requestor/BDXDownloader.cpp b/src/app/clusters/ota-requestor/BDXDownloader.cpp index 4bf42b151c460d..184fceb2738183 100644 --- a/src/app/clusters/ota-requestor/BDXDownloader.cpp +++ b/src/app/clusters/ota-requestor/BDXDownloader.cpp @@ -174,7 +174,7 @@ void BDXDownloader::OnDownloadTimeout() } else { - ChipLogError(BDX, "no download in progress"); + ChipLogError(BDX, "No download in progress"); } } @@ -207,7 +207,7 @@ void BDXDownloader::EndDownload(CHIP_ERROR reason) } else { - ChipLogError(BDX, "no download in progress"); + ChipLogError(BDX, "No download in progress"); } } From f97e2c53e3701cb405cca1847fc89a88471a7e08 Mon Sep 17 00:00:00 2001 From: krypton36 Date: Tue, 22 Mar 2022 15:41:54 -0700 Subject: [PATCH 13/70] Add missing clusters and attributes to simulated app (#16461) * Add missing clusters and attributes to simulated device app. * Generated code. --- examples/placeholder/linux/BUILD.gn | 5 +- .../placeholder/linux/apps/app1/config.matter | 184 +++ .../placeholder/linux/apps/app1/config.zap | 904 ++++++++++++-- .../placeholder/linux/apps/app2/config.matter | 249 ++++ .../placeholder/linux/apps/app2/config.zap | 1048 ++++++++++++++--- .../include/static-supported-modes-manager.h | 73 ++ .../linux/static-supported-modes-manager.cpp | 71 ++ .../app1/zap-generated/CHIPClientCallbacks.h | 61 + .../app1/zap-generated/CHIPClusters.h | 28 + .../zap-generated/IMClusterCommandHandler.cpp | 40 + .../PluginApplicationCallbacks.h | 8 + .../app1/zap-generated/callback-stub.cpp | 32 + .../app1/zap-generated/endpoint_config.h | 313 +++-- .../app1/zap-generated/gen_config.h | 44 + .../app2/zap-generated/CHIPClientCallbacks.h | 61 + .../app2/zap-generated/CHIPClusters.h | 35 + .../zap-generated/IMClusterCommandHandler.cpp | 40 + .../PluginApplicationCallbacks.h | 9 + .../app2/zap-generated/callback-stub.cpp | 32 + .../app2/zap-generated/endpoint_config.h | 346 ++++-- .../app2/zap-generated/gen_config.h | 49 + 21 files changed, 3259 insertions(+), 373 deletions(-) create mode 100644 examples/placeholder/linux/include/static-supported-modes-manager.h create mode 100644 examples/placeholder/linux/static-supported-modes-manager.cpp diff --git a/examples/placeholder/linux/BUILD.gn b/examples/placeholder/linux/BUILD.gn index eb556088aded57..d4caa0b0d1897e 100644 --- a/examples/placeholder/linux/BUILD.gn +++ b/examples/placeholder/linux/BUILD.gn @@ -36,7 +36,10 @@ config("includes") { } executable("chip-${chip_tests_zap_config}") { - sources = [ "main.cpp" ] + sources = [ + "main.cpp", + "static-supported-modes-manager.cpp", + ] deps = [ ":configuration", diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 538e36db9c0e5f..52cc0ea6df0025 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1009,6 +1009,56 @@ server cluster LevelControl = 8 { command StopWithOnOff(): DefaultSuccess = 7; } +client cluster ModeSelect = 80 { + struct ModeOptionStruct { + CHAR_STRING<32> label = 0; + INT8U mode = 1; + INT32U semanticTag = 2; + } + + readonly attribute int8u currentMode = 0; + readonly attribute ModeOptionStruct supportedModes[] = 1; + attribute int8u onMode = 2; + readonly attribute int8u startUpMode = 3; + readonly attribute char_string<32> description = 4; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; + + request struct ChangeToModeRequest { + INT8U newMode = 0; + } + + command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0; +} + +server cluster ModeSelect = 80 { + struct ModeOptionStruct { + CHAR_STRING<32> label = 0; + INT8U mode = 1; + INT32U semanticTag = 2; + } + + readonly attribute int8u currentMode = 0; + readonly attribute ModeOptionStruct supportedModes[] = 1; + attribute int8u onMode = 2; + readonly attribute int8u startUpMode = 3; + readonly attribute char_string<32> description = 4; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; + + request struct ChangeToModeRequest { + INT8U newMode = 0; + } + + command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0; +} + server cluster NetworkCommissioning = 49 { enum NetworkCommissioningStatus : ENUM8 { kSuccess = 0; @@ -1528,6 +1578,28 @@ server cluster PumpConfigurationAndControl = 512 { readonly global attribute int16u clusterRevision = 65533; } +client cluster RelativeHumidityMeasurement = 1029 { + readonly attribute int16u measuredValue = 0; + readonly attribute int16u minMeasuredValue = 1; + readonly attribute int16u maxMeasuredValue = 2; + readonly attribute int16u tolerance = 3; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; +} + +server cluster RelativeHumidityMeasurement = 1029 { + readonly attribute int16u measuredValue = 0; + readonly attribute int16u minMeasuredValue = 1; + readonly attribute int16u maxMeasuredValue = 2; + readonly attribute int16u tolerance = 3; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; +} + server cluster Scenes = 5 { bitmap ScenesCopyMode : BITMAP8 { kCopyAllScenes = 0x1; @@ -1632,6 +1704,88 @@ server cluster Scenes = 5 { command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; } +client cluster Switch = 59 { + info event SwitchLatched = 0 { + INT8U newPosition = 0; + } + + info event InitialPress = 1 { + INT8U newPosition = 0; + } + + info event LongPress = 2 { + INT8U newPosition = 0; + } + + info event ShortRelease = 3 { + INT8U previousPosition = 0; + } + + info event LongRelease = 4 { + INT8U previousPosition = 0; + } + + info event MultiPressOngoing = 5 { + INT8U newPosition = 0; + INT8U currentNumberOfPressesCounted = 1; + } + + info event MultiPressComplete = 6 { + INT8U newPosition = 0; + INT8U totalNumberOfPressesCounted = 1; + } + + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute int8u multiPressMax = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + +server cluster Switch = 59 { + info event SwitchLatched = 0 { + INT8U newPosition = 0; + } + + info event InitialPress = 1 { + INT8U newPosition = 0; + } + + info event LongPress = 2 { + INT8U newPosition = 0; + } + + info event ShortRelease = 3 { + INT8U previousPosition = 0; + } + + info event LongRelease = 4 { + INT8U previousPosition = 0; + } + + info event MultiPressOngoing = 5 { + INT8U newPosition = 0; + INT8U currentNumberOfPressesCounted = 1; + } + + info event MultiPressComplete = 6 { + INT8U newPosition = 0; + INT8U totalNumberOfPressesCounted = 1; + } + + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute int8u multiPressMax = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + client cluster TargetNavigator = 1285 { enum StatusEnum : ENUM8 { kSuccess = 0; @@ -1787,6 +1941,28 @@ server cluster Thermostat = 513 { readonly global attribute int16u clusterRevision = 65533; } +client cluster ThermostatUserInterfaceConfiguration = 516 { + attribute enum8 temperatureDisplayMode = 0; + attribute enum8 keypadLockout = 1; + attribute enum8 scheduleProgrammingVisibility = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + +server cluster ThermostatUserInterfaceConfiguration = 516 { + attribute enum8 temperatureDisplayMode = 0; + attribute enum8 keypadLockout = 1; + attribute enum8 scheduleProgrammingVisibility = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + server cluster WindowCovering = 258 { bitmap WcConfigStatus : BITMAP8 { kOperational = 0x1; @@ -1895,17 +2071,25 @@ endpoint 0 { server cluster GeneralDiagnostics; binding cluster KeypadInput; server cluster KeypadInput; + binding cluster ModeSelect; + server cluster ModeSelect; server cluster NetworkCommissioning; binding cluster OnOff; server cluster OnOff; binding cluster OperationalCredentials; server cluster OperationalCredentials; server cluster PumpConfigurationAndControl; + binding cluster RelativeHumidityMeasurement; + server cluster RelativeHumidityMeasurement; + binding cluster Switch; + server cluster Switch; binding cluster TargetNavigator; server cluster TargetNavigator; binding cluster TemperatureMeasurement; server cluster TemperatureMeasurement; server cluster Thermostat; + binding cluster ThermostatUserInterfaceConfiguration; + server cluster ThermostatUserInterfaceConfiguration; server cluster WindowCovering; } diff --git a/examples/placeholder/linux/apps/app1/config.zap b/examples/placeholder/linux/apps/app1/config.zap index e04442dc27aee6..a8653107ab654e 100644 --- a/examples/placeholder/linux/apps/app1/config.zap +++ b/examples/placeholder/linux/apps/app1/config.zap @@ -1346,6 +1346,178 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Operational Credentials", "code": 62, @@ -1580,71 +1752,38 @@ ] }, { - "name": "Window Covering", - "code": 258, + "name": "Mode Select", + "code": 80, "mfgCode": null, - "define": "WINDOW_COVERING_CLUSTER", + "define": "MODE_SELECT_CLUSTER", "side": "client", - "enabled": 0, + "enabled": 1, "commands": [ { - "name": "UpOrOpen", + "name": "ChangeToMode", "code": 0, "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 0 - }, - { - "name": "DownOrClose", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "StopMotion", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToLiftValue", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToLiftPercentage", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToTiltValue", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToTiltPercentage", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 + "outgoing": 1 } ], "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1654,25 +1793,25 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "1", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 } ] }, { - "name": "Window Covering", - "code": 258, + "name": "Mode Select", + "code": 80, "mfgCode": null, - "define": "WINDOW_COVERING_CLUSTER", + "define": "MODE_SELECT_CLUSTER", "side": "server", "enabled": 1, "commands": [], "attributes": [ { - "name": "Type", + "name": "CurrentMode", "code": 0, "mfgCode": null, "side": "server", @@ -1680,24 +1819,268 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "CurrentPositionLift", - "code": 3, + "name": "SupportedModes", + "code": 1, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "NVM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x7FFF", + "defaultValue": "", "reportable": 1, - "minInterval": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OnMode", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "255", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "StartUpMode", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Window Covering", + "code": 258, + "mfgCode": null, + "define": "WINDOW_COVERING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "UpOrOpen", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "DownOrClose", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StopMotion", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToLiftValue", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToLiftPercentage", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToTiltValue", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToTiltPercentage", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "5", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Window Covering", + "code": 258, + "mfgCode": null, + "define": "WINDOW_COVERING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "Type", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "CurrentPositionLift", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x7FFF", + "reportable": 1, + "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, @@ -2811,32 +3194,204 @@ ] }, { - "name": "Temperature Measurement", - "code": 1026, + "name": "Thermostat User Interface Configuration", + "code": 516, "mfgCode": null, - "define": "TEMP_MEASUREMENT_CLUSTER", + "define": "THERMOSTAT_UI_CONFIG_CLUSTER", "side": "client", "enabled": 1, "commands": [], "attributes": [ { - "name": "ClusterRevision", - "code": 65533, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "0", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 - } - ] - }, - { + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Thermostat User Interface Configuration", + "code": 516, + "mfgCode": null, + "define": "THERMOSTAT_UI_CONFIG_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "temperature display mode", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "keypad lockout", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "schedule programming visibility", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { "name": "Temperature Measurement", "code": 1026, "mfgCode": null, @@ -2922,6 +3477,193 @@ } ] }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Relative Humidity Measurement", + "code": 1029, + "mfgCode": null, + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "measured value", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "min measured value", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "max measured value", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0xFFFF", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "tolerance", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Target Navigator", "code": 1285, diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index ebe41f9d02ffd9..52cc0ea6df0025 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -9,10 +9,16 @@ client cluster ApplicationBasic = 1293 { kActiveVisibleNotFocus = 3; } + struct ApplicationBasicApplication { + INT16U catalogVendorId = 0; + CHAR_STRING applicationId = 1; + } + readonly attribute char_string<32> vendorName = 0; readonly attribute int16u vendorID = 1; readonly attribute char_string<32> applicationName = 2; readonly attribute int16u productID = 3; + readonly attribute ApplicationBasicApplication application = 4; readonly attribute ApplicationStatusEnum status = 5; readonly attribute char_string<32> applicationVersion = 6; readonly attribute vendor_id allowedVendorList[] = 7; @@ -30,10 +36,16 @@ server cluster ApplicationBasic = 1293 { kActiveVisibleNotFocus = 3; } + struct ApplicationBasicApplication { + INT16U catalogVendorId = 0; + CHAR_STRING applicationId = 1; + } + readonly attribute char_string<32> vendorName = 0; readonly attribute int16u vendorID = 1; readonly attribute char_string<32> applicationName = 2; readonly attribute int16u productID = 3; + readonly attribute ApplicationBasicApplication application = 4; readonly attribute ApplicationStatusEnum status = 5; readonly attribute char_string<32> applicationVersion = 6; readonly attribute vendor_id allowedVendorList[] = 7; @@ -997,6 +1009,56 @@ server cluster LevelControl = 8 { command StopWithOnOff(): DefaultSuccess = 7; } +client cluster ModeSelect = 80 { + struct ModeOptionStruct { + CHAR_STRING<32> label = 0; + INT8U mode = 1; + INT32U semanticTag = 2; + } + + readonly attribute int8u currentMode = 0; + readonly attribute ModeOptionStruct supportedModes[] = 1; + attribute int8u onMode = 2; + readonly attribute int8u startUpMode = 3; + readonly attribute char_string<32> description = 4; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; + + request struct ChangeToModeRequest { + INT8U newMode = 0; + } + + command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0; +} + +server cluster ModeSelect = 80 { + struct ModeOptionStruct { + CHAR_STRING<32> label = 0; + INT8U mode = 1; + INT32U semanticTag = 2; + } + + readonly attribute int8u currentMode = 0; + readonly attribute ModeOptionStruct supportedModes[] = 1; + attribute int8u onMode = 2; + readonly attribute int8u startUpMode = 3; + readonly attribute char_string<32> description = 4; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; + + request struct ChangeToModeRequest { + INT8U newMode = 0; + } + + command ChangeToMode(ChangeToModeRequest): DefaultSuccess = 0; +} + server cluster NetworkCommissioning = 49 { enum NetworkCommissioningStatus : ENUM8 { kSuccess = 0; @@ -1122,6 +1184,57 @@ server cluster NetworkCommissioning = 49 { command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; } +client cluster OnOff = 6 { + enum OnOffDelayedAllOffEffectVariant : enum8 { + kFadeToOffIn0p8Seconds = 0; + kNoFade = 1; + k50PercentDimDownIn0p8SecondsThenFadeToOffIn12Seconds = 2; + } + + enum OnOffDyingLightEffectVariant : enum8 { + k20PercenterDimUpIn0p5SecondsThenFadeToOffIn1Second = 0; + } + + enum OnOffEffectIdentifier : enum8 { + kDelayedAllOff = 0; + kDyingLight = 1; + } + + bitmap OnOffControl : BITMAP8 { + kAcceptOnlyWhenOn = 0x1; + } + + bitmap OnOffFeature : BITMAP32 { + kLighting = 0x1; + } + + readonly attribute boolean onOff = 0; + readonly attribute boolean globalSceneControl = 16384; + attribute int16u onTime = 16385; + attribute int16u offWaitTime = 16386; + attribute nullable enum8 startUpOnOff = 16387; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; + + request struct OffWithEffectRequest { + OnOffEffectIdentifier effectId = 0; + OnOffDelayedAllOffEffectVariant effectVariant = 1; + } + + request struct OnWithTimedOffRequest { + OnOffControl onOffControl = 0; + int16u onTime = 1; + int16u offWaitTime = 2; + } + + command Off(): DefaultSuccess = 0; + command OffWithEffect(OffWithEffectRequest): DefaultSuccess = 64; + command On(): DefaultSuccess = 1; + command OnWithRecallGlobalScene(): DefaultSuccess = 65; + command OnWithTimedOff(OnWithTimedOffRequest): DefaultSuccess = 66; + command Toggle(): DefaultSuccess = 2; +} + server cluster OnOff = 6 { enum OnOffDelayedAllOffEffectVariant : enum8 { kFadeToOffIn0p8Seconds = 0; @@ -1465,6 +1578,28 @@ server cluster PumpConfigurationAndControl = 512 { readonly global attribute int16u clusterRevision = 65533; } +client cluster RelativeHumidityMeasurement = 1029 { + readonly attribute int16u measuredValue = 0; + readonly attribute int16u minMeasuredValue = 1; + readonly attribute int16u maxMeasuredValue = 2; + readonly attribute int16u tolerance = 3; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; +} + +server cluster RelativeHumidityMeasurement = 1029 { + readonly attribute int16u measuredValue = 0; + readonly attribute int16u minMeasuredValue = 1; + readonly attribute int16u maxMeasuredValue = 2; + readonly attribute int16u tolerance = 3; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; +} + server cluster Scenes = 5 { bitmap ScenesCopyMode : BITMAP8 { kCopyAllScenes = 0x1; @@ -1569,6 +1704,88 @@ server cluster Scenes = 5 { command ViewScene(ViewSceneRequest): ViewSceneResponse = 1; } +client cluster Switch = 59 { + info event SwitchLatched = 0 { + INT8U newPosition = 0; + } + + info event InitialPress = 1 { + INT8U newPosition = 0; + } + + info event LongPress = 2 { + INT8U newPosition = 0; + } + + info event ShortRelease = 3 { + INT8U previousPosition = 0; + } + + info event LongRelease = 4 { + INT8U previousPosition = 0; + } + + info event MultiPressOngoing = 5 { + INT8U newPosition = 0; + INT8U currentNumberOfPressesCounted = 1; + } + + info event MultiPressComplete = 6 { + INT8U newPosition = 0; + INT8U totalNumberOfPressesCounted = 1; + } + + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute int8u multiPressMax = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + +server cluster Switch = 59 { + info event SwitchLatched = 0 { + INT8U newPosition = 0; + } + + info event InitialPress = 1 { + INT8U newPosition = 0; + } + + info event LongPress = 2 { + INT8U newPosition = 0; + } + + info event ShortRelease = 3 { + INT8U previousPosition = 0; + } + + info event LongRelease = 4 { + INT8U previousPosition = 0; + } + + info event MultiPressOngoing = 5 { + INT8U newPosition = 0; + INT8U currentNumberOfPressesCounted = 1; + } + + info event MultiPressComplete = 6 { + INT8U newPosition = 0; + INT8U totalNumberOfPressesCounted = 1; + } + + readonly attribute int8u numberOfPositions = 0; + readonly attribute int8u currentPosition = 1; + readonly attribute int8u multiPressMax = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + client cluster TargetNavigator = 1285 { enum StatusEnum : ENUM8 { kSuccess = 0; @@ -1724,6 +1941,28 @@ server cluster Thermostat = 513 { readonly global attribute int16u clusterRevision = 65533; } +client cluster ThermostatUserInterfaceConfiguration = 516 { + attribute enum8 temperatureDisplayMode = 0; + attribute enum8 keypadLockout = 1; + attribute enum8 scheduleProgrammingVisibility = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + +server cluster ThermostatUserInterfaceConfiguration = 516 { + attribute enum8 temperatureDisplayMode = 0; + attribute enum8 keypadLockout = 1; + attribute enum8 scheduleProgrammingVisibility = 2; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; + readonly global attribute int16u clusterRevision = 65533; +} + server cluster WindowCovering = 258 { bitmap WcConfigStatus : BITMAP8 { kOperational = 0x1; @@ -1832,16 +2071,25 @@ endpoint 0 { server cluster GeneralDiagnostics; binding cluster KeypadInput; server cluster KeypadInput; + binding cluster ModeSelect; + server cluster ModeSelect; server cluster NetworkCommissioning; + binding cluster OnOff; server cluster OnOff; binding cluster OperationalCredentials; server cluster OperationalCredentials; server cluster PumpConfigurationAndControl; + binding cluster RelativeHumidityMeasurement; + server cluster RelativeHumidityMeasurement; + binding cluster Switch; + server cluster Switch; binding cluster TargetNavigator; server cluster TargetNavigator; binding cluster TemperatureMeasurement; server cluster TemperatureMeasurement; server cluster Thermostat; + binding cluster ThermostatUserInterfaceConfiguration; + server cluster ThermostatUserInterfaceConfiguration; server cluster WindowCovering; } @@ -1851,6 +2099,7 @@ endpoint 1 { server cluster Groups; server cluster Identify; server cluster LevelControl; + binding cluster OnOff; server cluster OnOff; server cluster Scenes; } diff --git a/examples/placeholder/linux/apps/app2/config.zap b/examples/placeholder/linux/apps/app2/config.zap index d0db307af7cb51..a8653107ab654e 100644 --- a/examples/placeholder/linux/apps/app2/config.zap +++ b/examples/placeholder/linux/apps/app2/config.zap @@ -42,7 +42,7 @@ "mfgCode": null, "define": "ON_OFF_CLUSTER", "side": "client", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "Off", @@ -827,7 +827,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -842,7 +842,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -857,7 +857,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1346,6 +1346,178 @@ } ] }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Switch", + "code": 59, + "mfgCode": null, + "define": "SWITCH_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "number of positions", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "current position", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "multi press max", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "2", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, { "name": "Operational Credentials", "code": 62, @@ -1580,71 +1752,38 @@ ] }, { - "name": "Window Covering", - "code": 258, + "name": "Mode Select", + "code": 80, "mfgCode": null, - "define": "WINDOW_COVERING_CLUSTER", + "define": "MODE_SELECT_CLUSTER", "side": "client", - "enabled": 0, + "enabled": 1, "commands": [ { - "name": "UpOrOpen", + "name": "ChangeToMode", "code": 0, "mfgCode": null, "source": "client", "incoming": 1, - "outgoing": 0 - }, - { - "name": "DownOrClose", - "code": 1, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "StopMotion", - "code": 2, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToLiftValue", - "code": 4, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToLiftPercentage", - "code": 5, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToTiltValue", - "code": 7, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 - }, - { - "name": "GoToTiltPercentage", - "code": 8, - "mfgCode": null, - "source": "client", - "incoming": 1, - "outgoing": 0 + "outgoing": 1 } ], "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -1654,25 +1793,25 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "5", + "defaultValue": "1", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 } ] }, { - "name": "Window Covering", - "code": 258, + "name": "Mode Select", + "code": 80, "mfgCode": null, - "define": "WINDOW_COVERING_CLUSTER", + "define": "MODE_SELECT_CLUSTER", "side": "server", "enabled": 1, "commands": [], "attributes": [ { - "name": "Type", + "name": "CurrentMode", "code": 0, "mfgCode": null, "side": "server", @@ -1680,10 +1819,254 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "SupportedModes", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OnMode", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "255", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "StartUpMode", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "Description", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Window Covering", + "code": 258, + "mfgCode": null, + "define": "WINDOW_COVERING_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "UpOrOpen", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "DownOrClose", + "code": 1, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "StopMotion", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToLiftValue", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToLiftPercentage", + "code": 5, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToTiltValue", + "code": 7, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "GoToTiltPercentage", + "code": 8, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "5", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Window Covering", + "code": 258, + "mfgCode": null, + "define": "WINDOW_COVERING_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "Type", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, "reportableChange": 0 }, { @@ -2679,115 +3062,399 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x19", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "control sequence of operation", + "code": 27, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x04", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "system mode", + "code": 28, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x01", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "start of week", + "code": 32, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "number of weekly transitions", + "code": 33, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "7", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "number of daily transitions", + "code": 34, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "4", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "temperature setpoint hold", + "code": 35, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x000b", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "3", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "Thermostat User Interface Configuration", + "code": 516, + "mfgCode": null, + "define": "THERMOSTAT_UI_CONFIG_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + } + ] + }, + { + "name": "Thermostat User Interface Configuration", + "code": 516, + "mfgCode": null, + "define": "THERMOSTAT_UI_CONFIG_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "temperature display mode", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "keypad lockout", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x00", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "schedule programming visibility", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "0x19", + "defaultValue": "", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "control sequence of operation", - "code": 27, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x04", + "defaultValue": "0", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "system mode", - "code": 28, + "name": "ClusterRevision", + "code": 65533, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x01", + "defaultValue": "1", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [], + "attributes": [ { - "name": "start of week", - "code": 32, + "name": "ClusterRevision", + "code": 65533, "mfgCode": null, - "side": "server", + "side": "client", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "3", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 - }, + } + ] + }, + { + "name": "Temperature Measurement", + "code": 1026, + "mfgCode": null, + "define": "TEMP_MEASUREMENT_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ { - "name": "number of weekly transitions", - "code": 33, + "name": "MeasuredValue", + "code": 0, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "7", + "defaultValue": "0x8000", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "number of daily transitions", - "code": 34, + "name": "MinMeasuredValue", + "code": 1, "mfgCode": null, "side": "server", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "4", + "defaultValue": "0x8000", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "temperature setpoint hold", - "code": 35, + "name": "MaxMeasuredValue", + "code": 2, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x00", + "defaultValue": "0x8000", "reportable": 1, "minInterval": 0, "maxInterval": 65344, "reportableChange": 0 }, { - "name": "FeatureMap", - "code": 65532, + "name": "Tolerance", + "code": 3, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x000b", + "defaultValue": "", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -2811,14 +3478,29 @@ ] }, { - "name": "Temperature Measurement", - "code": 1026, + "name": "Relative Humidity Measurement", + "code": 1029, "mfgCode": null, - "define": "TEMP_MEASUREMENT_CLUSTER", + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", "side": "client", "enabled": 1, "commands": [], "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -2828,25 +3510,25 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "1", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 } ] }, { - "name": "Temperature Measurement", - "code": 1026, + "name": "Relative Humidity Measurement", + "code": 1029, "mfgCode": null, - "define": "TEMP_MEASUREMENT_CLUSTER", + "define": "RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER", "side": "server", "enabled": 1, "commands": [], "attributes": [ { - "name": "MeasuredValue", + "name": "measured value", "code": 0, "mfgCode": null, "side": "server", @@ -2854,14 +3536,14 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "MinMeasuredValue", + "name": "min measured value", "code": 1, "mfgCode": null, "side": "server", @@ -2869,14 +3551,14 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "0xFFFF", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "MaxMeasuredValue", + "name": "max measured value", "code": 2, "mfgCode": null, "side": "server", @@ -2884,25 +3566,85 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0x8000", + "defaultValue": "0xFFFF", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { - "name": "Tolerance", + "name": "tolerance", "code": 3, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 }, { @@ -2910,14 +3652,14 @@ "code": 65533, "mfgCode": null, "side": "server", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "3", + "defaultValue": "1", "reportable": 1, - "minInterval": 0, - "maxInterval": 65344, + "minInterval": 1, + "maxInterval": 65534, "reportableChange": 0 } ] @@ -2981,7 +3723,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3011,7 +3753,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3026,7 +3768,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3041,7 +3783,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3126,7 +3868,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3141,7 +3883,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3156,7 +3898,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3249,7 +3991,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3279,7 +4021,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3294,7 +4036,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3309,7 +4051,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3430,7 +4172,21 @@ "maxInterval": 65534, "reportableChange": 0 }, - + { + "name": "Application", + "code": 4, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "Status", "code": 5, @@ -3467,7 +4223,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3482,7 +4238,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3497,7 +4253,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -3512,7 +4268,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -4042,7 +4798,7 @@ "mfgCode": null, "define": "ON_OFF_CLUSTER", "side": "client", - "enabled": 0, + "enabled": 1, "commands": [ { "name": "Off", diff --git a/examples/placeholder/linux/include/static-supported-modes-manager.h b/examples/placeholder/linux/include/static-supported-modes-manager.h new file mode 100644 index 00000000000000..2d4f674a65920d --- /dev/null +++ b/examples/placeholder/linux/include/static-supported-modes-manager.h @@ -0,0 +1,73 @@ +/* + * + * Copyright (c) 2021 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 ModeSelect { + +/** + * This implementation statically defines the options. + */ + +class StaticSupportedModesManager : public chip::app::Clusters::ModeSelect::SupportedModesManager +{ + using ModeOptionStructType = Structs::ModeOptionStruct::Type; + using storage_value_type = const ModeOptionStructType; + + struct EndpointSpanPair + { + const EndpointId mEndpointId; + const Span mSpan; + + EndpointSpanPair(const EndpointId aEndpointId, const Span && aSpan) : + mEndpointId(aEndpointId), mSpan(aSpan) + {} + + EndpointSpanPair() : mEndpointId(0), mSpan(Span()) {} + }; + + static storage_value_type coffeeOptions[]; + static const EndpointSpanPair supportedOptionsByEndpoints[EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT]; + +public: + static const StaticSupportedModesManager instance; + + const SupportedModesManager::ModeOptionsProvider getModeOptionsProvider(EndpointId endpointId) const override; + + EmberAfStatus getModeOptionByMode(EndpointId endpointId, uint8_t mode, const ModeOptionStructType ** dataPtr) const override; + + ~StaticSupportedModesManager(){}; + + StaticSupportedModesManager() {} + + static inline const StaticSupportedModesManager & getStaticSupportedModesManagerInstance() { return instance; } +}; + +const SupportedModesManager * getSupportedModesManager(); + +} // namespace ModeSelect +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/placeholder/linux/static-supported-modes-manager.cpp b/examples/placeholder/linux/static-supported-modes-manager.cpp new file mode 100644 index 00000000000000..c4ad314f236961 --- /dev/null +++ b/examples/placeholder/linux/static-supported-modes-manager.cpp @@ -0,0 +1,71 @@ +#include + +using namespace std; +using namespace chip; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ModeSelect; + +using ModeOptionStructType = Structs::ModeOptionStruct::Type; +using storage_value_type = const ModeOptionStructType; +namespace { +Structs::ModeOptionStruct::Type buildModeOptionStruct(const char * label, uint8_t mode, uint32_t semanticTag) +{ + Structs::ModeOptionStruct::Type option; + option.label = CharSpan::fromCharString(label); + option.mode = mode; + option.semanticTag = semanticTag; + return option; +} +} // namespace + +// TODO: Configure your options for each endpoint +storage_value_type StaticSupportedModesManager::coffeeOptions[] = { buildModeOptionStruct("Black", 0, 0), + buildModeOptionStruct("Cappuccino", 4, 0), + buildModeOptionStruct("Espresso", 7, 0) }; +const StaticSupportedModesManager::EndpointSpanPair + StaticSupportedModesManager::supportedOptionsByEndpoints[EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT] = { + EndpointSpanPair(1, Span(StaticSupportedModesManager::coffeeOptions)) // Options for Endpoint 1 + }; + +const StaticSupportedModesManager StaticSupportedModesManager::instance = StaticSupportedModesManager(); + +const SupportedModesManager::ModeOptionsProvider StaticSupportedModesManager::getModeOptionsProvider(EndpointId endpointId) const +{ + for (auto & endpointSpanPair : supportedOptionsByEndpoints) + { + if (endpointSpanPair.mEndpointId == endpointId) + { + return ModeOptionsProvider(endpointSpanPair.mSpan.data(), endpointSpanPair.mSpan.end()); + } + } + return ModeOptionsProvider(nullptr, nullptr); +} + +EmberAfStatus StaticSupportedModesManager::getModeOptionByMode(unsigned short endpointId, unsigned char mode, + const ModeOptionStructType ** dataPtr) const +{ + auto modeOptionsProvider = this->getModeOptionsProvider(endpointId); + if (modeOptionsProvider.begin() == nullptr) + { + return EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER; + } + auto * begin = this->getModeOptionsProvider(endpointId).begin(); + auto * end = this->getModeOptionsProvider(endpointId).end(); + + for (auto * it = begin; it != end; ++it) + { + auto & modeOption = *it; + if (modeOption.mode == mode) + { + *dataPtr = &modeOption; + return EMBER_ZCL_STATUS_SUCCESS; + } + } + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "Cannot find the mode %u", mode); + return EMBER_ZCL_STATUS_INVALID_VALUE; +} + +const ModeSelect::SupportedModesManager * ModeSelect::getSupportedModesManager() +{ + return &StaticSupportedModesManager::instance; +} diff --git a/zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.h b/zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.h index a956f21dd94a03..a3e9f16908f69a 100644 --- a/zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/placeholder/app1/zap-generated/CHIPClientCallbacks.h @@ -100,6 +100,25 @@ void KeypadInputClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * d chip::Callback::Cancelable * onFailureCallback); typedef void (*KeypadInputAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterSupportedModesListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectSupportedModesListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterGeneratedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterAcceptedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectAttributeListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); void OperationalCredentialsClusterFabricsListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); @@ -112,6 +131,35 @@ void OperationalCredentialsClusterTrustedRootCertificatesListAttributeFilter(chi chip::Callback::Cancelable * onFailureCallback); typedef void (*OperationalCredentialsTrustedRootCertificatesListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +void RelativeHumidityMeasurementClusterGeneratedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*RelativeHumidityMeasurementGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void RelativeHumidityMeasurementClusterAcceptedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*RelativeHumidityMeasurementAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void RelativeHumidityMeasurementClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*RelativeHumidityMeasurementAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void SwitchClusterGeneratedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*SwitchGeneratedCommandListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); +void SwitchClusterAcceptedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*SwitchAcceptedCommandListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); +void SwitchClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*SwitchAttributeListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); void TargetNavigatorClusterTargetListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); @@ -133,3 +181,16 @@ void TargetNavigatorClusterAttributeListListAttributeFilter(chip::TLV::TLVReader chip::Callback::Cancelable * onFailureCallback); typedef void (*TargetNavigatorAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +void ThermostatUserInterfaceConfigurationClusterGeneratedCommandListListAttributeFilter( + chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); +typedef void (*ThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ThermostatUserInterfaceConfigurationClusterAcceptedCommandListListAttributeFilter( + chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); +typedef void (*ThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ThermostatUserInterfaceConfigurationClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ThermostatUserInterfaceConfigurationAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); diff --git a/zzz_generated/placeholder/app1/zap-generated/CHIPClusters.h b/zzz_generated/placeholder/app1/zap-generated/CHIPClusters.h index 4399f8c0cf0432..df3cdd4ae885f0 100644 --- a/zzz_generated/placeholder/app1/zap-generated/CHIPClusters.h +++ b/zzz_generated/placeholder/app1/zap-generated/CHIPClusters.h @@ -58,6 +58,13 @@ class DLL_EXPORT KeypadInputCluster : public ClusterBase ~KeypadInputCluster() {} }; +class DLL_EXPORT ModeSelectCluster : public ClusterBase +{ +public: + ModeSelectCluster() : ClusterBase(app::Clusters::ModeSelect::Id) {} + ~ModeSelectCluster() {} +}; + class DLL_EXPORT OnOffCluster : public ClusterBase { public: @@ -72,6 +79,20 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase ~OperationalCredentialsCluster() {} }; +class DLL_EXPORT RelativeHumidityMeasurementCluster : public ClusterBase +{ +public: + RelativeHumidityMeasurementCluster() : ClusterBase(app::Clusters::RelativeHumidityMeasurement::Id) {} + ~RelativeHumidityMeasurementCluster() {} +}; + +class DLL_EXPORT SwitchCluster : public ClusterBase +{ +public: + SwitchCluster() : ClusterBase(app::Clusters::Switch::Id) {} + ~SwitchCluster() {} +}; + class DLL_EXPORT TargetNavigatorCluster : public ClusterBase { public: @@ -86,5 +107,12 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase ~TemperatureMeasurementCluster() {} }; +class DLL_EXPORT ThermostatUserInterfaceConfigurationCluster : public ClusterBase +{ +public: + ThermostatUserInterfaceConfigurationCluster() : ClusterBase(app::Clusters::ThermostatUserInterfaceConfiguration::Id) {} + ~ThermostatUserInterfaceConfigurationCluster() {} +}; + } // namespace Controller } // namespace chip diff --git a/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp index 64aea788706522..ed53683dba764c 100644 --- a/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/placeholder/app1/zap-generated/IMClusterCommandHandler.cpp @@ -463,6 +463,43 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace LevelControl +namespace ModeSelect { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ChangeToMode::Id: { + Commands::ChangeToMode::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfModeSelectClusterChangeToModeCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace ModeSelect + namespace NetworkCommissioning { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -990,6 +1027,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::LevelControl::Id: Clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::ModeSelect::Id: + Clusters::ModeSelect::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::NetworkCommissioning::Id: Clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/placeholder/app1/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/placeholder/app1/zap-generated/PluginApplicationCallbacks.h index 950bcbaf3a4f8c..87c7fc3176b636 100644 --- a/zzz_generated/placeholder/app1/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/placeholder/app1/zap-generated/PluginApplicationCallbacks.h @@ -37,16 +37,24 @@ MatterKeypadInputPluginClientInitCallback(); \ MatterKeypadInputPluginServerInitCallback(); \ MatterLevelControlPluginServerInitCallback(); \ + MatterModeSelectPluginClientInitCallback(); \ + MatterModeSelectPluginServerInitCallback(); \ MatterNetworkCommissioningPluginServerInitCallback(); \ MatterOnOffPluginClientInitCallback(); \ MatterOnOffPluginServerInitCallback(); \ MatterOperationalCredentialsPluginClientInitCallback(); \ MatterOperationalCredentialsPluginServerInitCallback(); \ MatterPumpConfigurationAndControlPluginServerInitCallback(); \ + MatterRelativeHumidityMeasurementPluginClientInitCallback(); \ + MatterRelativeHumidityMeasurementPluginServerInitCallback(); \ MatterScenesPluginServerInitCallback(); \ + MatterSwitchPluginClientInitCallback(); \ + MatterSwitchPluginServerInitCallback(); \ MatterTargetNavigatorPluginClientInitCallback(); \ MatterTargetNavigatorPluginServerInitCallback(); \ MatterTemperatureMeasurementPluginClientInitCallback(); \ MatterTemperatureMeasurementPluginServerInitCallback(); \ MatterThermostatPluginServerInitCallback(); \ + MatterThermostatUserInterfaceConfigurationPluginClientInitCallback(); \ + MatterThermostatUserInterfaceConfigurationPluginServerInitCallback(); \ MatterWindowCoveringPluginServerInitCallback(); diff --git a/zzz_generated/placeholder/app1/zap-generated/callback-stub.cpp b/zzz_generated/placeholder/app1/zap-generated/callback-stub.cpp index f57c304662c26c..8742292e7f53d6 100644 --- a/zzz_generated/placeholder/app1/zap-generated/callback-stub.cpp +++ b/zzz_generated/placeholder/app1/zap-generated/callback-stub.cpp @@ -62,6 +62,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_LEVEL_CONTROL_CLUSTER_ID: emberAfLevelControlClusterInitCallback(endpoint); break; + case ZCL_MODE_SELECT_CLUSTER_ID: + emberAfModeSelectClusterInitCallback(endpoint); + break; case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: emberAfNetworkCommissioningClusterInitCallback(endpoint); break; @@ -74,9 +77,15 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); break; + case ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID: + emberAfRelativeHumidityMeasurementClusterInitCallback(endpoint); + break; case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; case ZCL_TARGET_NAVIGATOR_CLUSTER_ID: emberAfTargetNavigatorClusterInitCallback(endpoint); break; @@ -86,6 +95,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_THERMOSTAT_CLUSTER_ID: emberAfThermostatClusterInitCallback(endpoint); break; + case ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID: + emberAfThermostatUserInterfaceConfigurationClusterInitCallback(endpoint); + break; case ZCL_WINDOW_COVERING_CLUSTER_ID: emberAfWindowCoveringClusterInitCallback(endpoint); break; @@ -150,6 +162,11 @@ void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfModeSelectClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -170,11 +187,21 @@ void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfRelativeHumidityMeasurementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) { // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTargetNavigatorClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -190,6 +217,11 @@ void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpo // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfThermostatUserInterfaceConfigurationClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfWindowCoveringClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h index dc13b3f4922822..a732031ae25e2b 100644 --- a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h @@ -58,33 +58,53 @@ /* 32 - TotalOperationalHours, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 0, Cluster: Window Covering (server), big-endian */ \ + /* Endpoint: 0, Cluster: Switch (server), big-endian */ \ \ /* 36 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Mode Select (server), big-endian */ \ + \ + /* 40 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Window Covering (server), big-endian */ \ + \ + /* 44 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), big-endian */ \ \ - /* 40 - LifetimeRunningHours, */ \ + /* 48 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 43 - Power, */ \ + /* 51 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 46 - LifetimeEnergyConsumed, */ \ + /* 54 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 50 - FeatureMap, */ \ + /* 58 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), big-endian */ \ \ - /* 54 - FeatureMap, */ \ + /* 62 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), big-endian */ \ + \ + /* 66 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), big-endian */ \ + \ + /* 70 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 0, Cluster: Content Launcher (server), big-endian */ \ \ - /* 58 - SupportedStreamingProtocols, */ \ + /* 74 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -121,39 +141,59 @@ /* 32 - TotalOperationalHours, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 0, Cluster: Window Covering (server), little-endian */ \ + /* Endpoint: 0, Cluster: Switch (server), little-endian */ \ \ /* 36 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Mode Select (server), little-endian */ \ + \ + /* 40 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Window Covering (server), little-endian */ \ + \ + /* 44 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), little-endian */ \ \ - /* 40 - LifetimeRunningHours, */ \ + /* 48 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 43 - Power, */ \ + /* 51 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 46 - LifetimeEnergyConsumed, */ \ + /* 54 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 50 - FeatureMap, */ \ + /* 58 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), little-endian */ \ \ - /* 54 - FeatureMap, */ \ + /* 62 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), little-endian */ \ + \ + /* 66 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), little-endian */ \ + \ + /* 70 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 0, Cluster: Content Launcher (server), little-endian */ \ \ - /* 58 - SupportedStreamingProtocols, */ \ + /* 74 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (14) +#define GENERATED_DEFAULTS_COUNT (18) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -174,7 +214,7 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 12 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 15 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -194,6 +234,11 @@ { (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* control sequence of operation */ \ { (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x7 }, /* system mode */ \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* temperature display mode */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x5 }, /* keypad lockout */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* schedule programming visibility */ \ + \ /* Endpoint: 1, Cluster: Identify (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* identify time */ \ \ @@ -205,7 +250,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 188 +#define GENERATED_ATTRIBUTE_COUNT 210 #define GENERATED_ATTRIBUTES \ { \ \ @@ -303,6 +348,13 @@ ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Switch (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* current position */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(36) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* Fabrics */ \ { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* SupportedFabrics */ \ @@ -313,6 +365,15 @@ ZAP_EMPTY_DEFAULT() }, /* CurrentFabricIndex */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Mode Select (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ + { 0x00000004, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Type */ \ { 0x00000003, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -346,7 +407,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(36) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(44) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ @@ -369,16 +430,16 @@ { 0x00000013, ZAP_TYPE(INT16S), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Capacity */ \ { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Speed */ \ { 0x00000015, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(40) }, /* LifetimeRunningHours */ \ - { 0x00000016, ZAP_TYPE(INT24U), 3, 0, ZAP_LONG_DEFAULTS_INDEX(43) }, /* Power */ \ + ZAP_LONG_DEFAULTS_INDEX(48) }, /* LifetimeRunningHours */ \ + { 0x00000016, ZAP_TYPE(INT24U), 3, 0, ZAP_LONG_DEFAULTS_INDEX(51) }, /* Power */ \ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(46) }, /* LifetimeEnergyConsumed */ \ + ZAP_LONG_DEFAULTS_INDEX(54) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(50) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(58) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thermostat (server) */ \ @@ -407,15 +468,32 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(54) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(62) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* temperature display mode */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* keypad lockout */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* schedule programming visibility */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(66) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Temperature Measurement (server) */ \ { 0x00000000, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) }, /* MeasuredValue */ \ { 0x00000001, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) }, /* MinMeasuredValue */ \ { 0x00000002, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) }, /* MaxMeasuredValue */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* measured value */ \ + { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* min measured value */ \ + { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* max measured value */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* tolerance */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(70) }, /* FeatureMap */ \ + \ /* Endpoint: 0, Cluster: Target Navigator (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TargetList */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentTarget */ \ @@ -427,7 +505,7 @@ /* Endpoint: 0, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(58) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(74) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Application Basic (server) */ \ @@ -443,7 +521,7 @@ \ /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* identify time */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* identify time */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -516,7 +594,7 @@ ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* start up color temperature mireds */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* start up color temperature mireds */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ } @@ -543,6 +621,9 @@ const EmberAfGenericClusterFunction chipFuncArrayThermostatServer[] = { \ (EmberAfGenericClusterFunction) emberAfThermostatClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayThermostatUserInterfaceConfigurationServer[] = { \ + (EmberAfGenericClusterFunction) MatterThermostatUserInterfaceConfigurationClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayIdentifyServer[] = { \ (EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback, \ (EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback, \ @@ -613,6 +694,10 @@ 0x00000005 /* CSRResponse */, \ 0x00000008 /* NOCResponse */, \ chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Mode Select (server) */\ + /* client_generated */ \ + 0x00000000 /* ChangeToMode */, \ + chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Window Covering (server) */\ /* client_generated */ \ 0x00000000 /* UpOrOpen */, \ @@ -720,7 +805,7 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 31 +#define GENERATED_CLUSTER_COUNT 39 // clang-format off #define GENERATED_CLUSTERS { \ @@ -812,10 +897,32 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Switch (client) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Switch (server) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributeCount = 5, \ + .clusterSize = 9, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Operational Credentials (client) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributes = ZAP_ATTRIBUTE_INDEX(62), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -826,7 +933,7 @@ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributes = ZAP_ATTRIBUTE_INDEX(62), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -834,21 +941,43 @@ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 25 ) ,\ .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 35 ) ,\ },\ + { \ + /* Endpoint: 0, Cluster: Mode Select (client) */ \ + .clusterId = 0x00000050, \ + .attributes = ZAP_ATTRIBUTE_INDEX(68), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Mode Select (server) */ \ + .clusterId = 0x00000050, \ + .attributes = ZAP_ATTRIBUTE_INDEX(68), \ + .attributeCount = 7, \ + .clusterSize = 42, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ .clusterId = 0x00000102, \ - .attributes = ZAP_ATTRIBUTE_INDEX(63), \ + .attributes = ZAP_ATTRIBUTE_INDEX(75), \ .attributeCount = 20, \ .clusterSize = 35, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayWindowCoveringServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 42 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ .clusterId = 0x00000200, \ - .attributes = ZAP_ATTRIBUTE_INDEX(83), \ + .attributes = ZAP_ATTRIBUTE_INDEX(95), \ .attributeCount = 26, \ .clusterSize = 54, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -859,18 +988,40 @@ { \ /* Endpoint: 0, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ - .attributes = ZAP_ATTRIBUTE_INDEX(109), \ + .attributes = ZAP_ATTRIBUTE_INDEX(121), \ .attributeCount = 18, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 48 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 50 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (client) */ \ + .clusterId = 0x00000204, \ + .attributes = ZAP_ATTRIBUTE_INDEX(139), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ + .clusterId = 0x00000204, \ + .attributes = ZAP_ATTRIBUTE_INDEX(139), \ + .attributeCount = 5, \ + .clusterSize = 9, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayThermostatUserInterfaceConfigurationServer, \ + .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Temperature Measurement (client) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(127), \ + .attributes = ZAP_ATTRIBUTE_INDEX(144), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -881,7 +1032,7 @@ { \ /* Endpoint: 0, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(127), \ + .attributes = ZAP_ATTRIBUTE_INDEX(144), \ .attributeCount = 4, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -889,10 +1040,32 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (client) */ \ + .clusterId = 0x00000405, \ + .attributes = ZAP_ATTRIBUTE_INDEX(148), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ + .clusterId = 0x00000405, \ + .attributes = ZAP_ATTRIBUTE_INDEX(148), \ + .attributeCount = 5, \ + .clusterSize = 12, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Target Navigator (client) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(131), \ + .attributes = ZAP_ATTRIBUTE_INDEX(153), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -903,18 +1076,18 @@ { \ /* Endpoint: 0, Cluster: Target Navigator (server) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(131), \ + .attributes = ZAP_ATTRIBUTE_INDEX(153), \ .attributeCount = 3, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 52 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 54 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 54 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 56 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Keypad Input (client) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(134), \ + .attributes = ZAP_ATTRIBUTE_INDEX(156), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -925,18 +1098,18 @@ { \ /* Endpoint: 0, Cluster: Keypad Input (server) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(134), \ + .attributes = ZAP_ATTRIBUTE_INDEX(156), \ .attributeCount = 1, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 56 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 58 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 58 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Content Launcher (client) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(135), \ + .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -947,18 +1120,18 @@ { \ /* Endpoint: 0, Cluster: Content Launcher (server) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(135), \ + .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 63 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 62 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 65 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Application Basic (client) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(138), \ + .attributes = ZAP_ATTRIBUTE_INDEX(160), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -969,7 +1142,7 @@ { \ /* Endpoint: 0, Cluster: Application Basic (server) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(138), \ + .attributes = ZAP_ATTRIBUTE_INDEX(160), \ .attributeCount = 9, \ .clusterSize = 106, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -980,40 +1153,40 @@ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(147), \ + .attributes = ZAP_ATTRIBUTE_INDEX(169), \ .attributeCount = 3, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 65 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 68 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 67 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 70 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(150), \ + .attributes = ZAP_ATTRIBUTE_INDEX(172), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 70 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 77 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 72 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 79 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Scenes (server) */ \ .clusterId = 0x00000005, \ - .attributes = ZAP_ATTRIBUTE_INDEX(152), \ + .attributes = ZAP_ATTRIBUTE_INDEX(174), \ .attributeCount = 6, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayScenesServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 90 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 84 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 92 ) ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (client) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(158), \ + .attributes = ZAP_ATTRIBUTE_INDEX(180), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -1024,29 +1197,29 @@ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(158), \ + .attributes = ZAP_ATTRIBUTE_INDEX(180), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 97 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 99 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(160), \ + .attributes = ZAP_ATTRIBUTE_INDEX(182), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 101 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 103 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Basic (server) */ \ .clusterId = 0x00000028, \ - .attributes = ZAP_ATTRIBUTE_INDEX(162), \ + .attributes = ZAP_ATTRIBUTE_INDEX(184), \ .attributeCount = 20, \ .clusterSize = 39, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -1057,12 +1230,12 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(182), \ + .attributes = ZAP_ATTRIBUTE_INDEX(204), \ .attributeCount = 6, \ .clusterSize = 11, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 110 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 112 ) ,\ .generatedCommandList = nullptr ,\ },\ } @@ -1071,12 +1244,12 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 22 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 26 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 23, 383 }, { ZAP_CLUSTER_INDEX(23), 8, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 31, 455 }, { ZAP_CLUSTER_INDEX(31), 8, 72 }, \ } // Largest attribute size is needed for various buffers @@ -1088,7 +1261,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (78) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (455) +#define ATTRIBUTE_MAX_SIZE (527) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/placeholder/app1/zap-generated/gen_config.h b/zzz_generated/placeholder/app1/zap-generated/gen_config.h index 9c02dfd43083ce..7e0b2c2460f365 100644 --- a/zzz_generated/placeholder/app1/zap-generated/gen_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/gen_config.h @@ -44,18 +44,26 @@ #define EMBER_AF_KEYPAD_INPUT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_MODE_SELECT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (2) #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_PUMP_CONFIG_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_THERMOSTAT_UI_CONFIG_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_THERMOSTAT_UI_CONFIG_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -139,6 +147,15 @@ #define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0 #define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0 +// Use this macro to check if the client side of the Mode Select cluster is included +#define ZCL_USING_MODE_SELECT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_MODE_SELECT_CLIENT + +// Use this macro to check if the server side of the Mode Select cluster is included +#define ZCL_USING_MODE_SELECT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_MODE_SELECT_SERVER +#define EMBER_AF_PLUGIN_MODE_SELECT + // Use this macro to check if the server side of the Network Commissioning cluster is included #define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER @@ -167,6 +184,15 @@ #define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL_SERVER #define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL +// Use this macro to check if the client side of the Relative Humidity Measurement cluster is included +#define ZCL_USING_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT_CLIENT + +// Use this macro to check if the server side of the Relative Humidity Measurement cluster is included +#define ZCL_USING_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT_SERVER +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT + // Use this macro to check if the server side of the Scenes cluster is included #define ZCL_USING_SCENES_CLUSTER_SERVER #define EMBER_AF_PLUGIN_SCENES_SERVER @@ -174,6 +200,15 @@ // User options for server plugin Scenes #define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Use this macro to check if the client side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_SWITCH_CLIENT + +// Use this macro to check if the server side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_SWITCH_SERVER +#define EMBER_AF_PLUGIN_SWITCH + // Use this macro to check if the client side of the Target Navigator cluster is included #define ZCL_USING_TARGET_NAVIGATOR_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TARGET_NAVIGATOR_CLIENT @@ -197,6 +232,15 @@ #define EMBER_AF_PLUGIN_THERMOSTAT_SERVER #define EMBER_AF_PLUGIN_THERMOSTAT +// Use this macro to check if the client side of the Thermostat User Interface Configuration cluster is included +#define ZCL_USING_THERMOSTAT_UI_CONFIG_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLIENT + +// Use this macro to check if the server side of the Thermostat User Interface Configuration cluster is included +#define ZCL_USING_THERMOSTAT_UI_CONFIG_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_THERMOSTAT_USER_INTERFACE_CONFIGURATION_SERVER +#define EMBER_AF_PLUGIN_THERMOSTAT_USER_INTERFACE_CONFIGURATION + // Use this macro to check if the server side of the Window Covering cluster is included #define ZCL_USING_WINDOW_COVERING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_WINDOW_COVERING_SERVER diff --git a/zzz_generated/placeholder/app2/zap-generated/CHIPClientCallbacks.h b/zzz_generated/placeholder/app2/zap-generated/CHIPClientCallbacks.h index a956f21dd94a03..a3e9f16908f69a 100644 --- a/zzz_generated/placeholder/app2/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/placeholder/app2/zap-generated/CHIPClientCallbacks.h @@ -100,6 +100,25 @@ void KeypadInputClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * d chip::Callback::Cancelable * onFailureCallback); typedef void (*KeypadInputAttributeListListAttributeCallback)(void * context, const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterSupportedModesListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectSupportedModesListAttributeCallback)( + void * context, + const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterGeneratedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterAcceptedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ModeSelectClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ModeSelectAttributeListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); void OperationalCredentialsClusterFabricsListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); @@ -112,6 +131,35 @@ void OperationalCredentialsClusterTrustedRootCertificatesListAttributeFilter(chi chip::Callback::Cancelable * onFailureCallback); typedef void (*OperationalCredentialsTrustedRootCertificatesListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +void RelativeHumidityMeasurementClusterGeneratedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*RelativeHumidityMeasurementGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void RelativeHumidityMeasurementClusterAcceptedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*RelativeHumidityMeasurementAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void RelativeHumidityMeasurementClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*RelativeHumidityMeasurementAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void SwitchClusterGeneratedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*SwitchGeneratedCommandListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); +void SwitchClusterAcceptedCommandListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*SwitchAcceptedCommandListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); +void SwitchClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*SwitchAttributeListListAttributeCallback)(void * context, + const chip::app::DataModel::DecodableList & data); void TargetNavigatorClusterTargetListListAttributeFilter(chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); @@ -133,3 +181,16 @@ void TargetNavigatorClusterAttributeListListAttributeFilter(chip::TLV::TLVReader chip::Callback::Cancelable * onFailureCallback); typedef void (*TargetNavigatorAttributeListListAttributeCallback)( void * context, const chip::app::DataModel::DecodableList & data); +void ThermostatUserInterfaceConfigurationClusterGeneratedCommandListListAttributeFilter( + chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); +typedef void (*ThermostatUserInterfaceConfigurationGeneratedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ThermostatUserInterfaceConfigurationClusterAcceptedCommandListListAttributeFilter( + chip::TLV::TLVReader * data, chip::Callback::Cancelable * onSuccessCallback, chip::Callback::Cancelable * onFailureCallback); +typedef void (*ThermostatUserInterfaceConfigurationAcceptedCommandListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); +void ThermostatUserInterfaceConfigurationClusterAttributeListListAttributeFilter(chip::TLV::TLVReader * data, + chip::Callback::Cancelable * onSuccessCallback, + chip::Callback::Cancelable * onFailureCallback); +typedef void (*ThermostatUserInterfaceConfigurationAttributeListListAttributeCallback)( + void * context, const chip::app::DataModel::DecodableList & data); diff --git a/zzz_generated/placeholder/app2/zap-generated/CHIPClusters.h b/zzz_generated/placeholder/app2/zap-generated/CHIPClusters.h index c59f0704744494..df3cdd4ae885f0 100644 --- a/zzz_generated/placeholder/app2/zap-generated/CHIPClusters.h +++ b/zzz_generated/placeholder/app2/zap-generated/CHIPClusters.h @@ -58,6 +58,20 @@ class DLL_EXPORT KeypadInputCluster : public ClusterBase ~KeypadInputCluster() {} }; +class DLL_EXPORT ModeSelectCluster : public ClusterBase +{ +public: + ModeSelectCluster() : ClusterBase(app::Clusters::ModeSelect::Id) {} + ~ModeSelectCluster() {} +}; + +class DLL_EXPORT OnOffCluster : public ClusterBase +{ +public: + OnOffCluster() : ClusterBase(app::Clusters::OnOff::Id) {} + ~OnOffCluster() {} +}; + class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase { public: @@ -65,6 +79,20 @@ class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase ~OperationalCredentialsCluster() {} }; +class DLL_EXPORT RelativeHumidityMeasurementCluster : public ClusterBase +{ +public: + RelativeHumidityMeasurementCluster() : ClusterBase(app::Clusters::RelativeHumidityMeasurement::Id) {} + ~RelativeHumidityMeasurementCluster() {} +}; + +class DLL_EXPORT SwitchCluster : public ClusterBase +{ +public: + SwitchCluster() : ClusterBase(app::Clusters::Switch::Id) {} + ~SwitchCluster() {} +}; + class DLL_EXPORT TargetNavigatorCluster : public ClusterBase { public: @@ -79,5 +107,12 @@ class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase ~TemperatureMeasurementCluster() {} }; +class DLL_EXPORT ThermostatUserInterfaceConfigurationCluster : public ClusterBase +{ +public: + ThermostatUserInterfaceConfigurationCluster() : ClusterBase(app::Clusters::ThermostatUserInterfaceConfiguration::Id) {} + ~ThermostatUserInterfaceConfigurationCluster() {} +}; + } // namespace Controller } // namespace chip diff --git a/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp index 64aea788706522..ed53683dba764c 100644 --- a/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/placeholder/app2/zap-generated/IMClusterCommandHandler.cpp @@ -463,6 +463,43 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace LevelControl +namespace ModeSelect { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ChangeToMode::Id: { + Commands::ChangeToMode::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfModeSelectClusterChangeToModeCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace ModeSelect + namespace NetworkCommissioning { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -990,6 +1027,9 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::LevelControl::Id: Clusters::LevelControl::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::ModeSelect::Id: + Clusters::ModeSelect::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::NetworkCommissioning::Id: Clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; diff --git a/zzz_generated/placeholder/app2/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/placeholder/app2/zap-generated/PluginApplicationCallbacks.h index c73db0e906ef14..87c7fc3176b636 100644 --- a/zzz_generated/placeholder/app2/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/placeholder/app2/zap-generated/PluginApplicationCallbacks.h @@ -37,15 +37,24 @@ MatterKeypadInputPluginClientInitCallback(); \ MatterKeypadInputPluginServerInitCallback(); \ MatterLevelControlPluginServerInitCallback(); \ + MatterModeSelectPluginClientInitCallback(); \ + MatterModeSelectPluginServerInitCallback(); \ MatterNetworkCommissioningPluginServerInitCallback(); \ + MatterOnOffPluginClientInitCallback(); \ MatterOnOffPluginServerInitCallback(); \ MatterOperationalCredentialsPluginClientInitCallback(); \ MatterOperationalCredentialsPluginServerInitCallback(); \ MatterPumpConfigurationAndControlPluginServerInitCallback(); \ + MatterRelativeHumidityMeasurementPluginClientInitCallback(); \ + MatterRelativeHumidityMeasurementPluginServerInitCallback(); \ MatterScenesPluginServerInitCallback(); \ + MatterSwitchPluginClientInitCallback(); \ + MatterSwitchPluginServerInitCallback(); \ MatterTargetNavigatorPluginClientInitCallback(); \ MatterTargetNavigatorPluginServerInitCallback(); \ MatterTemperatureMeasurementPluginClientInitCallback(); \ MatterTemperatureMeasurementPluginServerInitCallback(); \ MatterThermostatPluginServerInitCallback(); \ + MatterThermostatUserInterfaceConfigurationPluginClientInitCallback(); \ + MatterThermostatUserInterfaceConfigurationPluginServerInitCallback(); \ MatterWindowCoveringPluginServerInitCallback(); diff --git a/zzz_generated/placeholder/app2/zap-generated/callback-stub.cpp b/zzz_generated/placeholder/app2/zap-generated/callback-stub.cpp index f57c304662c26c..8742292e7f53d6 100644 --- a/zzz_generated/placeholder/app2/zap-generated/callback-stub.cpp +++ b/zzz_generated/placeholder/app2/zap-generated/callback-stub.cpp @@ -62,6 +62,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_LEVEL_CONTROL_CLUSTER_ID: emberAfLevelControlClusterInitCallback(endpoint); break; + case ZCL_MODE_SELECT_CLUSTER_ID: + emberAfModeSelectClusterInitCallback(endpoint); + break; case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: emberAfNetworkCommissioningClusterInitCallback(endpoint); break; @@ -74,9 +77,15 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_PUMP_CONFIG_CONTROL_CLUSTER_ID: emberAfPumpConfigurationAndControlClusterInitCallback(endpoint); break; + case ZCL_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_ID: + emberAfRelativeHumidityMeasurementClusterInitCallback(endpoint); + break; case ZCL_SCENES_CLUSTER_ID: emberAfScenesClusterInitCallback(endpoint); break; + case ZCL_SWITCH_CLUSTER_ID: + emberAfSwitchClusterInitCallback(endpoint); + break; case ZCL_TARGET_NAVIGATOR_CLUSTER_ID: emberAfTargetNavigatorClusterInitCallback(endpoint); break; @@ -86,6 +95,9 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_THERMOSTAT_CLUSTER_ID: emberAfThermostatClusterInitCallback(endpoint); break; + case ZCL_THERMOSTAT_UI_CONFIG_CLUSTER_ID: + emberAfThermostatUserInterfaceConfigurationClusterInitCallback(endpoint); + break; case ZCL_WINDOW_COVERING_CLUSTER_ID: emberAfWindowCoveringClusterInitCallback(endpoint); break; @@ -150,6 +162,11 @@ void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId end // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfModeSelectClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -170,11 +187,21 @@ void __attribute__((weak)) emberAfPumpConfigurationAndControlClusterInitCallback // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfRelativeHumidityMeasurementClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfScenesClusterInitCallback(EndpointId endpoint) { // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfSwitchClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfTargetNavigatorClusterInitCallback(EndpointId endpoint) { // To prevent warning @@ -190,6 +217,11 @@ void __attribute__((weak)) emberAfThermostatClusterInitCallback(EndpointId endpo // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfThermostatUserInterfaceConfigurationClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfWindowCoveringClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h index c6d9490d313ccc..a732031ae25e2b 100644 --- a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h @@ -58,33 +58,53 @@ /* 32 - TotalOperationalHours, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 0, Cluster: Window Covering (server), big-endian */ \ + /* Endpoint: 0, Cluster: Switch (server), big-endian */ \ \ /* 36 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Mode Select (server), big-endian */ \ + \ + /* 40 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Window Covering (server), big-endian */ \ + \ + /* 44 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), big-endian */ \ \ - /* 40 - LifetimeRunningHours, */ \ + /* 48 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 43 - Power, */ \ + /* 51 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 46 - LifetimeEnergyConsumed, */ \ + /* 54 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 50 - FeatureMap, */ \ + /* 58 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), big-endian */ \ \ - /* 54 - FeatureMap, */ \ + /* 62 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), big-endian */ \ + \ + /* 66 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), big-endian */ \ + \ + /* 70 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 0, Cluster: Content Launcher (server), big-endian */ \ \ - /* 58 - SupportedStreamingProtocols, */ \ + /* 74 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -121,39 +141,59 @@ /* 32 - TotalOperationalHours, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* Endpoint: 0, Cluster: Window Covering (server), little-endian */ \ + /* Endpoint: 0, Cluster: Switch (server), little-endian */ \ \ /* 36 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Mode Select (server), little-endian */ \ + \ + /* 40 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Window Covering (server), little-endian */ \ + \ + /* 44 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server), little-endian */ \ \ - /* 40 - LifetimeRunningHours, */ \ + /* 48 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 43 - Power, */ \ + /* 51 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 46 - LifetimeEnergyConsumed, */ \ + /* 54 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 50 - FeatureMap, */ \ + /* 58 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 0, Cluster: Thermostat (server), little-endian */ \ \ - /* 54 - FeatureMap, */ \ + /* 62 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server), little-endian */ \ + \ + /* 66 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server), little-endian */ \ + \ + /* 70 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 0, Cluster: Content Launcher (server), little-endian */ \ \ - /* 58 - SupportedStreamingProtocols, */ \ + /* 74 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (14) +#define GENERATED_DEFAULTS_COUNT (18) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -174,7 +214,7 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 12 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 15 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -194,6 +234,11 @@ { (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* control sequence of operation */ \ { (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x7 }, /* system mode */ \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* temperature display mode */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x5 }, /* keypad lockout */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* schedule programming visibility */ \ + \ /* Endpoint: 1, Cluster: Identify (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* identify time */ \ \ @@ -205,7 +250,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 187 +#define GENERATED_ATTRIBUTE_COUNT 210 #define GENERATED_ATTRIBUTES \ { \ \ @@ -303,6 +348,13 @@ ZAP_EMPTY_DEFAULT() }, /* ActiveNetworkFaults */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Switch (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* number of positions */ \ + { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* current position */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* multi press max */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(36) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* Fabrics */ \ { 0x00000002, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* SupportedFabrics */ \ @@ -313,6 +365,15 @@ ZAP_EMPTY_DEFAULT() }, /* CurrentFabricIndex */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Mode Select (server) */ \ + { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ + { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ + { 0x00000002, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ + { 0x00000004, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Type */ \ { 0x00000003, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -346,7 +407,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(36) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(44) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ @@ -369,16 +430,16 @@ { 0x00000013, ZAP_TYPE(INT16S), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Capacity */ \ { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Speed */ \ { 0x00000015, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(40) }, /* LifetimeRunningHours */ \ - { 0x00000016, ZAP_TYPE(INT24U), 3, 0, ZAP_LONG_DEFAULTS_INDEX(43) }, /* Power */ \ + ZAP_LONG_DEFAULTS_INDEX(48) }, /* LifetimeRunningHours */ \ + { 0x00000016, ZAP_TYPE(INT24U), 3, 0, ZAP_LONG_DEFAULTS_INDEX(51) }, /* Power */ \ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(46) }, /* LifetimeEnergyConsumed */ \ + ZAP_LONG_DEFAULTS_INDEX(54) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(50) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(58) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Thermostat (server) */ \ @@ -407,15 +468,32 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(54) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(62) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ + { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* temperature display mode */ \ + { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* keypad lockout */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* schedule programming visibility */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(66) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Temperature Measurement (server) */ \ { 0x00000000, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) }, /* MeasuredValue */ \ { 0x00000001, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) }, /* MinMeasuredValue */ \ { 0x00000002, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0x8000) }, /* MaxMeasuredValue */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ + { 0x00000000, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* measured value */ \ + { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* min measured value */ \ + { 0x00000002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* max measured value */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* tolerance */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(70) }, /* FeatureMap */ \ + \ /* Endpoint: 0, Cluster: Target Navigator (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* TargetList */ \ { 0x00000001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentTarget */ \ @@ -427,22 +505,23 @@ /* Endpoint: 0, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(58) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(74) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Application Basic (server) */ \ - { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ - { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* VendorID */ \ - { 0x00000002, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* ApplicationName */ \ - { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* ProductID */ \ - { 0x00000005, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Status */ \ + { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* VendorName */ \ + { 0x00000001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* VendorID */ \ + { 0x00000002, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* ApplicationName */ \ + { 0x00000003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* ProductID */ \ + { 0x00000004, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* Application */ \ + { 0x00000005, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Status */ \ { 0x00000006, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* ApplicationVersion */ \ { 0x00000007, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AllowedVendorList */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* identify time */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* identify time */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -515,7 +594,7 @@ ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* start up color temperature mireds */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* start up color temperature mireds */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ } @@ -542,6 +621,9 @@ const EmberAfGenericClusterFunction chipFuncArrayThermostatServer[] = { \ (EmberAfGenericClusterFunction) emberAfThermostatClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayThermostatUserInterfaceConfigurationServer[] = { \ + (EmberAfGenericClusterFunction) MatterThermostatUserInterfaceConfigurationClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayIdentifyServer[] = { \ (EmberAfGenericClusterFunction) emberAfIdentifyClusterServerInitCallback, \ (EmberAfGenericClusterFunction) MatterIdentifyClusterServerAttributeChangedCallback, \ @@ -612,6 +694,10 @@ 0x00000005 /* CSRResponse */, \ 0x00000008 /* NOCResponse */, \ chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Mode Select (server) */\ + /* client_generated */ \ + 0x00000000 /* ChangeToMode */, \ + chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Window Covering (server) */\ /* client_generated */ \ 0x00000000 /* UpOrOpen */, \ @@ -719,10 +805,21 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 29 +#define GENERATED_CLUSTER_COUNT 39 // clang-format off #define GENERATED_CLUSTERS { \ + { \ + /* Endpoint: 0, Cluster: On/Off (client) */ \ + .clusterId = 0x00000006, \ + .attributes = ZAP_ATTRIBUTE_INDEX(0), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ @@ -800,10 +897,32 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Switch (client) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Switch (server) */ \ + .clusterId = 0x0000003B, \ + .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributeCount = 5, \ + .clusterSize = 9, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Operational Credentials (client) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributes = ZAP_ATTRIBUTE_INDEX(62), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -814,7 +933,7 @@ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(57), \ + .attributes = ZAP_ATTRIBUTE_INDEX(62), \ .attributeCount = 6, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -822,21 +941,43 @@ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 25 ) ,\ .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 35 ) ,\ },\ + { \ + /* Endpoint: 0, Cluster: Mode Select (client) */ \ + .clusterId = 0x00000050, \ + .attributes = ZAP_ATTRIBUTE_INDEX(68), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Mode Select (server) */ \ + .clusterId = 0x00000050, \ + .attributes = ZAP_ATTRIBUTE_INDEX(68), \ + .attributeCount = 7, \ + .clusterSize = 42, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ .clusterId = 0x00000102, \ - .attributes = ZAP_ATTRIBUTE_INDEX(63), \ + .attributes = ZAP_ATTRIBUTE_INDEX(75), \ .attributeCount = 20, \ .clusterSize = 35, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayWindowCoveringServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 42 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ .clusterId = 0x00000200, \ - .attributes = ZAP_ATTRIBUTE_INDEX(83), \ + .attributes = ZAP_ATTRIBUTE_INDEX(95), \ .attributeCount = 26, \ .clusterSize = 54, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -847,18 +988,40 @@ { \ /* Endpoint: 0, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ - .attributes = ZAP_ATTRIBUTE_INDEX(109), \ + .attributes = ZAP_ATTRIBUTE_INDEX(121), \ .attributeCount = 18, \ .clusterSize = 32, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayThermostatServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 48 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 50 ) ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (client) */ \ + .clusterId = 0x00000204, \ + .attributes = ZAP_ATTRIBUTE_INDEX(139), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ + .clusterId = 0x00000204, \ + .attributes = ZAP_ATTRIBUTE_INDEX(139), \ + .attributeCount = 5, \ + .clusterSize = 9, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayThermostatUserInterfaceConfigurationServer, \ + .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Temperature Measurement (client) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(127), \ + .attributes = ZAP_ATTRIBUTE_INDEX(144), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -869,7 +1032,7 @@ { \ /* Endpoint: 0, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(127), \ + .attributes = ZAP_ATTRIBUTE_INDEX(144), \ .attributeCount = 4, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -877,10 +1040,32 @@ .acceptedCommandList = nullptr ,\ .generatedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (client) */ \ + .clusterId = 0x00000405, \ + .attributes = ZAP_ATTRIBUTE_INDEX(148), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: Relative Humidity Measurement (server) */ \ + .clusterId = 0x00000405, \ + .attributes = ZAP_ATTRIBUTE_INDEX(148), \ + .attributeCount = 5, \ + .clusterSize = 12, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Target Navigator (client) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(131), \ + .attributes = ZAP_ATTRIBUTE_INDEX(153), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -891,18 +1076,18 @@ { \ /* Endpoint: 0, Cluster: Target Navigator (server) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(131), \ + .attributes = ZAP_ATTRIBUTE_INDEX(153), \ .attributeCount = 3, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 52 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 54 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 54 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 56 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Keypad Input (client) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(134), \ + .attributes = ZAP_ATTRIBUTE_INDEX(156), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -913,18 +1098,18 @@ { \ /* Endpoint: 0, Cluster: Keypad Input (server) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(134), \ + .attributes = ZAP_ATTRIBUTE_INDEX(156), \ .attributeCount = 1, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 56 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 58 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 58 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Content Launcher (client) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(135), \ + .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -935,18 +1120,18 @@ { \ /* Endpoint: 0, Cluster: Content Launcher (server) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(135), \ + .attributes = ZAP_ATTRIBUTE_INDEX(157), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 60 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 63 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 62 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 65 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Application Basic (client) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(138), \ + .attributes = ZAP_ATTRIBUTE_INDEX(160), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(CLIENT), \ @@ -957,8 +1142,8 @@ { \ /* Endpoint: 0, Cluster: Application Basic (server) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(138), \ - .attributeCount = 8, \ + .attributes = ZAP_ATTRIBUTE_INDEX(160), \ + .attributeCount = 9, \ .clusterSize = 106, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ @@ -968,62 +1153,73 @@ { \ /* Endpoint: 1, Cluster: Identify (server) */ \ .clusterId = 0x00000003, \ - .attributes = ZAP_ATTRIBUTE_INDEX(146), \ + .attributes = ZAP_ATTRIBUTE_INDEX(169), \ .attributeCount = 3, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ .functions = chipFuncArrayIdentifyServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 65 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 68 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 67 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 70 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(149), \ + .attributes = ZAP_ATTRIBUTE_INDEX(172), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayGroupsServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 70 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 77 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 72 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 79 ) ,\ },\ { \ /* Endpoint: 1, Cluster: Scenes (server) */ \ .clusterId = 0x00000005, \ - .attributes = ZAP_ATTRIBUTE_INDEX(151), \ + .attributes = ZAP_ATTRIBUTE_INDEX(174), \ .attributeCount = 6, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayScenesServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 82 ) ,\ - .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 90 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 84 ) ,\ + .generatedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 92 ) ,\ + },\ + { \ + /* Endpoint: 1, Cluster: On/Off (client) */ \ + .clusterId = 0x00000006, \ + .attributes = ZAP_ATTRIBUTE_INDEX(180), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .acceptedCommandList = nullptr ,\ + .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(157), \ + .attributes = ZAP_ATTRIBUTE_INDEX(180), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 97 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 99 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Level Control (server) */ \ .clusterId = 0x00000008, \ - .attributes = ZAP_ATTRIBUTE_INDEX(159), \ + .attributes = ZAP_ATTRIBUTE_INDEX(182), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayLevelControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 101 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 103 ) ,\ .generatedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Basic (server) */ \ .clusterId = 0x00000028, \ - .attributes = ZAP_ATTRIBUTE_INDEX(161), \ + .attributes = ZAP_ATTRIBUTE_INDEX(184), \ .attributeCount = 20, \ .clusterSize = 39, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -1034,12 +1230,12 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(181), \ + .attributes = ZAP_ATTRIBUTE_INDEX(204), \ .attributeCount = 6, \ .clusterSize = 11, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayColorControlServer, \ - .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 110 ) ,\ + .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 112 ) ,\ .generatedCommandList = nullptr ,\ },\ } @@ -1048,12 +1244,12 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 22 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 26 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 22, 383 }, { ZAP_CLUSTER_INDEX(22), 7, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 31, 455 }, { ZAP_CLUSTER_INDEX(31), 8, 72 }, \ } // Largest attribute size is needed for various buffers @@ -1065,7 +1261,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (78) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (455) +#define ATTRIBUTE_MAX_SIZE (527) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/placeholder/app2/zap-generated/gen_config.h b/zzz_generated/placeholder/app2/zap-generated/gen_config.h index 6ae5cf0539b8e0..7e0b2c2460f365 100644 --- a/zzz_generated/placeholder/app2/zap-generated/gen_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/gen_config.h @@ -44,17 +44,26 @@ #define EMBER_AF_KEYPAD_INPUT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_KEYPAD_INPUT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_MODE_SELECT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_MODE_SELECT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_ON_OFF_CLUSTER_CLIENT_ENDPOINT_COUNT (2) #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (2) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_PUMP_CONFIG_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_SCENES_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_SWITCH_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TARGET_NAVIGATOR_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_CLIENT_ENDPOINT_COUNT (1) #define EMBER_AF_TEMP_MEASUREMENT_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_THERMOSTAT_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_THERMOSTAT_UI_CONFIG_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_THERMOSTAT_UI_CONFIG_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_WINDOW_COVERING_CLUSTER_SERVER_ENDPOINT_COUNT (1) /**** Cluster Plugins ****/ @@ -138,11 +147,24 @@ #define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0 #define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0 +// Use this macro to check if the client side of the Mode Select cluster is included +#define ZCL_USING_MODE_SELECT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_MODE_SELECT_CLIENT + +// Use this macro to check if the server side of the Mode Select cluster is included +#define ZCL_USING_MODE_SELECT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_MODE_SELECT_SERVER +#define EMBER_AF_PLUGIN_MODE_SELECT + // Use this macro to check if the server side of the Network Commissioning cluster is included #define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING +// Use this macro to check if the client side of the On/Off cluster is included +#define ZCL_USING_ON_OFF_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_ON_OFF_CLIENT + // Use this macro to check if the server side of the On/Off cluster is included #define ZCL_USING_ON_OFF_CLUSTER_SERVER #define EMBER_AF_PLUGIN_ON_OFF_SERVER @@ -162,6 +184,15 @@ #define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL_SERVER #define EMBER_AF_PLUGIN_PUMP_CONFIGURATION_AND_CONTROL +// Use this macro to check if the client side of the Relative Humidity Measurement cluster is included +#define ZCL_USING_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT_CLIENT + +// Use this macro to check if the server side of the Relative Humidity Measurement cluster is included +#define ZCL_USING_RELATIVE_HUMIDITY_MEASUREMENT_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT_SERVER +#define EMBER_AF_PLUGIN_RELATIVE_HUMIDITY_MEASUREMENT + // Use this macro to check if the server side of the Scenes cluster is included #define ZCL_USING_SCENES_CLUSTER_SERVER #define EMBER_AF_PLUGIN_SCENES_SERVER @@ -169,6 +200,15 @@ // User options for server plugin Scenes #define EMBER_AF_PLUGIN_SCENES_TABLE_SIZE 3 +// Use this macro to check if the client side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_SWITCH_CLIENT + +// Use this macro to check if the server side of the Switch cluster is included +#define ZCL_USING_SWITCH_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_SWITCH_SERVER +#define EMBER_AF_PLUGIN_SWITCH + // Use this macro to check if the client side of the Target Navigator cluster is included #define ZCL_USING_TARGET_NAVIGATOR_CLUSTER_CLIENT #define EMBER_AF_PLUGIN_TARGET_NAVIGATOR_CLIENT @@ -192,6 +232,15 @@ #define EMBER_AF_PLUGIN_THERMOSTAT_SERVER #define EMBER_AF_PLUGIN_THERMOSTAT +// Use this macro to check if the client side of the Thermostat User Interface Configuration cluster is included +#define ZCL_USING_THERMOSTAT_UI_CONFIG_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_THERMOSTAT_USER_INTERFACE_CONFIGURATION_CLIENT + +// Use this macro to check if the server side of the Thermostat User Interface Configuration cluster is included +#define ZCL_USING_THERMOSTAT_UI_CONFIG_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_THERMOSTAT_USER_INTERFACE_CONFIGURATION_SERVER +#define EMBER_AF_PLUGIN_THERMOSTAT_USER_INTERFACE_CONFIGURATION + // Use this macro to check if the server side of the Window Covering cluster is included #define ZCL_USING_WINDOW_COVERING_CLUSTER_SERVER #define EMBER_AF_PLUGIN_WINDOW_COVERING_SERVER From a9bca9bed56752c2172337fbbad033eaf643d220 Mon Sep 17 00:00:00 2001 From: Carol Yang Date: Tue, 22 Mar 2022 15:42:33 -0700 Subject: [PATCH 14/70] [OTA] Use the version from OTA image header to send QueryImageResponse (#16515) * [OTA] Use the version from OTA image header to send QueryImageResponse - Remove command line options for software version and software version string - Source of truth should be from the image header - Validate the JSON file when the candidates are set --- examples/ota-provider-app/linux/README.md | 6 +- examples/ota-provider-app/linux/main.cpp | 43 +------ .../OTAProviderExample.cpp | 119 +++++++++++++----- .../ota-provider-common/OTAProviderExample.h | 32 ++--- 4 files changed, 110 insertions(+), 90 deletions(-) diff --git a/examples/ota-provider-app/linux/README.md b/examples/ota-provider-app/linux/README.md index b9693154bc1305..7293b068867e0e 100644 --- a/examples/ota-provider-app/linux/README.md +++ b/examples/ota-provider-app/linux/README.md @@ -24,8 +24,6 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug c | -t/--delayedQueryActionTimeSec
  • granted: Status field in QueryImageResponse is set to updateAvailable
  • denied: Status field in QueryImageResponse is set to updateNotAvailable
  • deferred: Status field in QueryImageResponse is set to busy | -| -s/--softwareVersion | Value for the SoftwareVersion field in the QueryImageResponse
    Note that -o/--otaImageList overrides this option | -| -S/--softwareVersionStr | Value for the SoftwareVersionString field in the QueryImageResponse
    Note that -o/--otaImageList overrides this option | | -c/--UserConsentNeeded | If provided, and value of RequestorCanConsent field in QueryImage Command is true,
    then value of UserConsentNeeded field in the QueryImageResponse is set to true.
    Else, value of UserConsentNeeded is false. | **Using `--filepath` and `--otaImageList`** @@ -39,6 +37,10 @@ scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/debug c - If `--otaImageList` is supplied, the application will parse the JSON file and extract all required data. The most recent/valid software version will be selected and the corresponding OTA file will be sent to the OTA Requestor +- The SoftwareVersion and SoftwareVersionString sent in the QueryImageResponse + is derived from the OTA image header. Please note that if the version in the + `--otaImageList` JSON file does not match that in the header, the + application will terminate. An example of the `--otaImageList` file contents: diff --git a/examples/ota-provider-app/linux/main.cpp b/examples/ota-provider-app/linux/main.cpp index cf2de8a415cc03..bc7076da265a1a 100644 --- a/examples/ota-provider-app/linux/main.cpp +++ b/examples/ota-provider-app/linux/main.cpp @@ -52,8 +52,6 @@ constexpr uint16_t kOptionUserConsentState = 'u'; constexpr uint16_t kOptionUpdateAction = 'a'; constexpr uint16_t kOptionDelayedQueryActionTimeSec = 't'; constexpr uint16_t kOptionDelayedApplyActionTimeSec = 'p'; -constexpr uint16_t kOptionSoftwareVersion = 's'; -constexpr uint16_t kOptionSoftwareVersionStr = 'S'; constexpr uint16_t kOptionUserConsentNeeded = 'c'; OTAProviderExample gOtaProvider; @@ -68,10 +66,8 @@ static const char * gOtaFilepath = nullptr; static const char * gOtaImageListFilepath = nullptr; static chip::ota::UserConsentState gUserConsentState = chip::ota::UserConsentState::kUnknown; static bool gUserConsentNeeded = false; -static chip::Optional gSoftwareVersion; -static const char * gSoftwareVersionString = nullptr; -static uint32_t gIgnoreQueryImageCount = 0; -static uint32_t gIgnoreApplyUpdateCount = 0; +static uint32_t gIgnoreQueryImageCount = 0; +static uint32_t gIgnoreApplyUpdateCount = 0; // Parses the JSON filepath and extracts DeviceSoftwareVersionModel parameters static bool ParseJsonFileAndPopulateCandidates(const char * filepath, @@ -252,28 +248,9 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, retval = false; } break; - case kOptionSoftwareVersion: - gSoftwareVersion.SetValue(static_cast(strtoul(aValue, NULL, 0))); - break; case kOptionUserConsentNeeded: gUserConsentNeeded = true; break; - case kOptionSoftwareVersionStr: - if (aValue == NULL) - { - PrintArgError("%s: ERROR: NULL SoftwareVersionStr parameter\n", aProgram); - retval = false; - } - else if ((strlen(aValue) < 1 || strlen(aValue) > 64)) - { - PrintArgError("%s: ERROR: SoftwareVersionStr parameter length is out of range \n", aProgram); - retval = false; - } - else - { - gSoftwareVersionString = aValue; - } - break; default: PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", aProgram, aName); retval = false; @@ -293,8 +270,6 @@ OptionDef cmdLineOptionsDef[] = { { "delayedQueryActionTimeSec", chip::ArgParser::kArgumentRequired, kOptionDelayedQueryActionTimeSec }, { "delayedApplyActionTimeSec", chip::ArgParser::kArgumentRequired, kOptionDelayedApplyActionTimeSec }, { "userConsentState", chip::ArgParser::kArgumentRequired, kOptionUserConsentState }, - { "softwareVersion", chip::ArgParser::kArgumentRequired, kOptionSoftwareVersion }, - { "softwareVersionStr", chip::ArgParser::kArgumentRequired, kOptionSoftwareVersionStr }, { "UserConsentNeeded", chip::ArgParser::kNoArgument, kOptionUserConsentNeeded }, {}, }; @@ -327,12 +302,6 @@ OptionSet cmdLineOptions = { HandleOptions, cmdLineOptionsDef, "PROGRAM OPTIONS" " denied: Status field in QueryImageResponse is set to updateNotAvailable\n" " deferred: Status field in QueryImageResponse is set to busy\n" " -q/--queryImageStatus overrides this option\n" - " -s/--softwareVersion \n" - " Value for the SoftwareVersion field in the QueryImageResponse\n" - " -o/--otaImageList overrides this option\n" - " -S/--softwareVersionStr \n" - " Value for the SoftwareVersionString field in the QueryImageResponse\n" - " -o/--otaImageList overrides this option\n" " -c/--UserConsentNeeded\n" " If provided, and value of RequestorCanConsent field in QueryImage Command is true,\n" " then value of UserConsentNeeded field in the QueryImageResponse is set to true.\n" @@ -367,14 +336,6 @@ void ApplicationInit() gOtaProvider.SetApplyUpdateAction(gOptionUpdateAction); gOtaProvider.SetDelayedQueryActionTimeSec(gDelayedQueryActionTimeSec); gOtaProvider.SetDelayedApplyActionTimeSec(gDelayedApplyActionTimeSec); - if (gSoftwareVersion.HasValue()) - { - gOtaProvider.SetSoftwareVersion(gSoftwareVersion.Value()); - } - if (gSoftwareVersionString) - { - gOtaProvider.SetSoftwareVersionString(gSoftwareVersionString); - } if (gUserConsentState != chip::ota::UserConsentState::kUnknown) { diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index 2b85058257ff4d..e583fe0ad4de84 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -29,6 +29,7 @@ #include #include +#include #include using chip::BitFlags; @@ -51,6 +52,7 @@ using namespace chip::app::Clusters::OtaSoftwareUpdateProvider::Commands; constexpr uint8_t kUpdateTokenLen = 32; // must be between 8 and 32 constexpr uint8_t kUpdateTokenStrLen = kUpdateTokenLen * 2 + 1; // Hex string needs 2 hex chars for every byte constexpr size_t kUriMaxLen = 256; +constexpr size_t kOtaHeaderMaxSize = 1024; // Arbitrary BDX Transfer Params constexpr uint32_t kMaxBdxBlockSize = 1024; @@ -99,6 +101,29 @@ void OTAProviderExample::SetOTAFilePath(const char * path) void OTAProviderExample::SetOTACandidates(std::vector candidates) { mCandidates = std::move(candidates); + + // Validate that each candidate matches the info in the image header + for (auto candidate : mCandidates) + { + OTAImageHeader header; + ParseOTAHeader(candidate.otaURL, header); + + ChipLogDetail(SoftwareUpdate, "Validating image list candidate %s: ", candidate.otaURL); + VerifyOrDie(candidate.vendorId == header.mVendorId); + VerifyOrDie(candidate.productId == header.mProductId); + VerifyOrDie(candidate.softwareVersion == header.mSoftwareVersion); + VerifyOrDie(strlen(candidate.softwareVersionString) == header.mSoftwareVersionString.size()); + VerifyOrDie(memcmp(candidate.softwareVersionString, header.mSoftwareVersionString.data(), + header.mSoftwareVersionString.size()) == 0); + if (header.mMinApplicableVersion.HasValue()) + { + VerifyOrDie(candidate.minApplicableSoftwareVersion == header.mMinApplicableVersion.Value()); + } + if (header.mMaxApplicableVersion.HasValue()) + { + VerifyOrDie(candidate.maxApplicableSoftwareVersion == header.mMaxApplicableVersion.Value()); + } + } } static bool CompareSoftwareVersions(const OTAProviderExample::DeviceSoftwareVersionModel & a, @@ -147,20 +172,58 @@ UserConsentSubject OTAProviderExample::GetUserConsentSubject(const app::CommandH return subject; } +bool OTAProviderExample::ParseOTAHeader(const char * otaFilePath, OTAImageHeader & header) +{ + OTAImageHeaderParser parser; + uint8_t otaFileContent[kOtaHeaderMaxSize]; + ByteSpan buffer(otaFileContent); + + std::ifstream otaFile(otaFilePath, std::ifstream::in); + if (!otaFile.is_open() || !otaFile.good()) + { + ChipLogError(SoftwareUpdate, "Error opening OTA image file: %s", otaFilePath); + return false; + } + + otaFile.read(reinterpret_cast(otaFileContent), kOtaHeaderMaxSize); + if (!otaFile.good()) + { + ChipLogError(SoftwareUpdate, "Error reading OTA image file: %s", otaFilePath); + return false; + } + + parser.Init(); + if (!parser.IsInitialized()) + { + return false; + } + + CHIP_ERROR error = parser.AccumulateAndDecode(buffer, header); + if (error != CHIP_NO_ERROR) + { + ChipLogError(SoftwareUpdate, "Error parsing OTA image header: %" CHIP_ERROR_FORMAT, error.Format()); + return false; + } + + parser.Clear(); + + return true; +} + EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const QueryImage::DecodableType & commandData) { OTAQueryStatus queryStatus = OTAQueryStatus::kNotAvailable; OTAProviderExample::DeviceSoftwareVersionModel candidate; - uint32_t newSoftwareVersion = commandData.softwareVersion + 1; - const char * newSoftwareVersionString = "Example-Image-V0.1"; - const char * otaFilePath = mOTAFilePath; - uint8_t updateToken[kUpdateTokenLen] = { 0 }; - char strBuf[kUpdateTokenStrLen] = { 0 }; - char uriBuf[kUriMaxLen] = { 0 }; - uint32_t delayedQueryActionTimeSec = mDelayedQueryActionTimeSec; - bool requestorCanConsent = commandData.requestorCanConsent.ValueOr(false); + uint32_t newSoftwareVersion = 0; + char newSoftwareVersionString[SW_VER_STR_MAX_LEN] = { 0 }; + const char * otaFilePath = mOTAFilePath; + uint8_t updateToken[kUpdateTokenLen] = { 0 }; + char strBuf[kUpdateTokenStrLen] = { 0 }; + char uriBuf[kUriMaxLen] = { 0 }; + uint32_t delayedQueryActionTimeSec = mDelayedQueryActionTimeSec; + bool requestorCanConsent = commandData.requestorCanConsent.ValueOr(false); QueryImageResponse::Type response; if (mIgnoreQueryImageCount > 0) @@ -177,19 +240,12 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c // Can be removed once all other platforms start using the ota-candidates-file method. if (strlen(mOTAFilePath) > 0) // If OTA file is directly provided { - // TODO: Following details shall be read from the OTA file - - // If software version is provided using command line then use it - if (mSoftwareVersion.HasValue()) - { - newSoftwareVersion = mSoftwareVersion.Value(); - } - - // If software version string is provided using command line then use it - if (mSoftwareVersionString) - { - newSoftwareVersionString = mSoftwareVersionString; - } + // Parse the header and set version info based on the header + OTAImageHeader header; + VerifyOrDie(ParseOTAHeader(mOTAFilePath, header) == true); + VerifyOrDie(sizeof(newSoftwareVersionString) > header.mSoftwareVersionString.size()); + newSoftwareVersion = header.mSoftwareVersion; + memcpy(newSoftwareVersionString, header.mSoftwareVersionString.data(), header.mSoftwareVersionString.size()); queryStatus = OTAQueryStatus::kUpdateAvailable; } @@ -197,10 +253,13 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c { if (SelectOTACandidate(commandData.vendorId, commandData.productId, commandData.softwareVersion, candidate)) { - newSoftwareVersion = candidate.softwareVersion; - newSoftwareVersionString = candidate.softwareVersionString; - otaFilePath = candidate.otaURL; - queryStatus = OTAQueryStatus::kUpdateAvailable; + VerifyOrDie(sizeof(newSoftwareVersionString) > strlen(candidate.softwareVersionString)); + + // This assumes all candidates have passed verification so the values are safe to use + newSoftwareVersion = candidate.softwareVersion; + memcpy(newSoftwareVersionString, candidate.softwareVersionString, strlen(candidate.softwareVersionString)); + otaFilePath = candidate.otaURL; + queryStatus = OTAQueryStatus::kUpdateAvailable; } } @@ -247,9 +306,6 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c break; } - // Reset with default success behavior - mQueryImageBehavior = OTAProviderExample::kRespondWithUpdateAvailable; - if (queryStatus == OTAQueryStatus::kUpdateAvailable) { GenerateUpdateToken(updateToken, kUpdateTokenLen); @@ -309,11 +365,12 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c response.metadataForRequestor.Emplace(chip::ByteSpan()); } - // Reset delay back to 0 for subsequent uses - mDelayedQueryActionTimeSec = 0; - VerifyOrReturnError(commandObj->AddResponseData(commandPath, response) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); + // After the first response is sent back, default to these values + mQueryImageBehavior = OTAProviderExample::kRespondWithUpdateAvailable; + mDelayedQueryActionTimeSec = 0; + return EMBER_ZCL_STATUS_SUCCESS; } diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h index 9e1200cd81d239..19be8e613d49c1 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -54,7 +55,7 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate kRespondWithBusy, kRespondWithNotAvailable }; - static constexpr uint16_t SW_VER_STR_MAX_LEN = 32; + static constexpr uint16_t SW_VER_STR_MAX_LEN = 64; static constexpr uint16_t OTA_URL_MAX_LEN = 512; typedef struct DeviceSoftwareVersionModel { @@ -79,11 +80,20 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate void SetDelayedQueryActionTimeSec(uint32_t time) { mDelayedQueryActionTimeSec = time; } void SetDelayedApplyActionTimeSec(uint32_t time) { mDelayedApplyActionTimeSec = time; } void SetUserConsentDelegate(chip::ota::UserConsentDelegate * delegate) { mUserConsentDelegate = delegate; } - void SetSoftwareVersion(uint32_t softwareVersion) { mSoftwareVersion.SetValue(softwareVersion); } - void SetSoftwareVersionString(const char * versionString) { mSoftwareVersionString = versionString; } void SetUserConsentNeeded(bool needed) { mUserConsentNeeded = needed; } private: + bool SelectOTACandidate(const uint16_t requestorVendorID, const uint16_t requestorProductID, + const uint32_t requestorSoftwareVersion, + OTAProviderExample::DeviceSoftwareVersionModel & finalCandidate); + + chip::ota::UserConsentSubject + GetUserConsentSubject(const chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::DecodableType & commandData, + uint32_t targetVersion); + + bool ParseOTAHeader(const char * otaFilePath, chip::OTAImageHeader & header); + BdxOtaSender mBdxOtaSender; std::vector mCandidates; static constexpr size_t kFilepathBufLen = 256; @@ -92,18 +102,8 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate uint32_t mIgnoreQueryImageCount = 0; uint32_t mIgnoreApplyUpdateCount = 0; chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction mUpdateAction; - uint32_t mDelayedApplyActionTimeSec = 0; - uint32_t mDelayedQueryActionTimeSec = 0; - bool SelectOTACandidate(const uint16_t requestorVendorID, const uint16_t requestorProductID, - const uint32_t requestorSoftwareVersion, - OTAProviderExample::DeviceSoftwareVersionModel & finalCandidate); + uint32_t mDelayedApplyActionTimeSec = 0; + uint32_t mDelayedQueryActionTimeSec = 0; chip::ota::UserConsentDelegate * mUserConsentDelegate = nullptr; - - chip::ota::UserConsentSubject - GetUserConsentSubject(const chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::DecodableType & commandData, - uint32_t targetVersion); - chip::Optional mSoftwareVersion; - const char * mSoftwareVersionString = nullptr; - bool mUserConsentNeeded = false; + bool mUserConsentNeeded = false; }; From ab00e9c231f0763d2b0b82787d44949715244adb Mon Sep 17 00:00:00 2001 From: Marc Lepage <67919234+mlepage-google@users.noreply.github.com> Date: Tue, 22 Mar 2022 23:56:13 -0400 Subject: [PATCH 15/70] Remove access control temporary override (#16536) The "empty" default delegate now denies access. The delegate can now override the check, or proceed with the standard check. The "permissive" example delegate still permits access, by overriding the check. The "normal" example delegate still performs a standard check, by not overriding the check. Fixes #13867 --- src/access/AccessControl.cpp | 12 ++++++++---- src/access/AccessControl.h | 13 ++++++++++--- .../examples/ExampleAccessControlDelegate.cpp | 8 ++++++++ .../examples/PermissiveAccessControlDelegate.cpp | 8 ++++++-- 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/src/access/AccessControl.cpp b/src/access/AccessControl.cpp index 44a880965b74ee..2a2f37beb40fa7 100644 --- a/src/access/AccessControl.cpp +++ b/src/access/AccessControl.cpp @@ -206,11 +206,14 @@ CHIP_ERROR AccessControl::Check(const SubjectDescriptor & subjectDescriptor, con } #endif - // TODO(#13867): this will go away - if (mDelegate->TemporaryCheckOverride()) { - ChipLogProgress(DataManagement, "AccessControl: temporary check override (this will go away)"); - return CHIP_NO_ERROR; + CHIP_ERROR result = mDelegate->Check(subjectDescriptor, requestPath, requestPrivilege); + if (result != CHIP_ERROR_NOT_IMPLEMENTED) + { + ChipLogProgress(DataManagement, "AccessControl: %s (delegate)", + (result == CHIP_NO_ERROR) ? "allowed" : (result == CHIP_ERROR_ACCESS_DENIED) ? "denied" : "error"); + return result; + } } // Operational PASE not supported for v1.0, so PASE implies commissioning, which has highest privilege. @@ -318,6 +321,7 @@ CHIP_ERROR AccessControl::Check(const SubjectDescriptor & subjectDescriptor, con } // Entry passed all checks: access is allowed. + ChipLogProgress(DataManagement, "AccessControl: allowed"); return CHIP_NO_ERROR; } diff --git a/src/access/AccessControl.h b/src/access/AccessControl.h index ce31345bb0256c..dd74167f0891d5 100644 --- a/src/access/AccessControl.h +++ b/src/access/AccessControl.h @@ -341,13 +341,20 @@ class AccessControl // Iteration virtual CHIP_ERROR Entries(EntryIterator & iterator, const FabricIndex * fabricIndex) const { return CHIP_NO_ERROR; } + // Check + // Return CHIP_NO_ERROR if allowed, CHIP_ERROR_ACCESS_DENIED if denied, + // CHIP_ERROR_NOT_IMPLEMENTED to use the default check algorithm (against entries), + // or any other CHIP_ERROR if another error occurred. + virtual CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, + Privilege requestPrivilege) + { + return CHIP_ERROR_ACCESS_DENIED; + } + // Listening virtual void SetListener(Listener & listener) { mListener = &listener; } virtual void ClearListener() { mListener = nullptr; } - // TODO(#13867): this will go away - virtual bool TemporaryCheckOverride() const { return false; } - private: Listener * mListener = nullptr; }; diff --git a/src/access/examples/ExampleAccessControlDelegate.cpp b/src/access/examples/ExampleAccessControlDelegate.cpp index 9ccceeb16db876..d7b234343ade48 100644 --- a/src/access/examples/ExampleAccessControlDelegate.cpp +++ b/src/access/examples/ExampleAccessControlDelegate.cpp @@ -40,6 +40,8 @@ using chip::kUndefinedNodeId; using chip::Access::AccessControl; using chip::Access::AuthMode; using chip::Access::Privilege; +using chip::Access::RequestPath; +using chip::Access::SubjectDescriptor; using Entry = chip::Access::AccessControl::Entry; using EntryIterator = chip::Access::AccessControl::EntryIterator; @@ -1237,6 +1239,12 @@ class AccessControlDelegate : public AccessControl::Delegate return CHIP_ERROR_BUFFER_TOO_SMALL; } + CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, + Privilege requestPrivilege) override + { + return CHIP_ERROR_NOT_IMPLEMENTED; + } + public: void SetStorageDelegate(chip::PersistentStorageDelegate * storageDelegate) { mStorageDelegate = storageDelegate; } diff --git a/src/access/examples/PermissiveAccessControlDelegate.cpp b/src/access/examples/PermissiveAccessControlDelegate.cpp index ddee48a9f48e48..55adb13bffc67e 100644 --- a/src/access/examples/PermissiveAccessControlDelegate.cpp +++ b/src/access/examples/PermissiveAccessControlDelegate.cpp @@ -59,8 +59,12 @@ class AccessControlDelegate : public AccessControl::Delegate // Iteration CHIP_ERROR Entries(EntryIterator & iterator, const FabricIndex * fabricIndex) const override { return CHIP_NO_ERROR; } - // TODO(#13867): this will go away - bool TemporaryCheckOverride() const override { return true; } + // Check + CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, + Privilege requestPrivilege) override + { + return CHIP_NO_ERROR; + } }; } // namespace From 5d510f1523c06e2485fd2ca52c0fb4ca9d520e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Wed, 23 Mar 2022 06:39:38 +0100 Subject: [PATCH 16/70] [dns-sd] Extended discovery improvements (#16290) * [dns-sd] Change extended discovery condition According to the spec, each time a commissionable node service is advertised and the device is not in the commissioning mode, the advertising should be treated as Extended Discovery. The current code, however, makes a distinction whether the device is on any fabric or not. * [dns-sd] Set default extended discovery timeout to 15 minutes The spec recommends that the extended discovery by default time out after a period recommended in the "Announcement duration" section. Change the default from "no timeout" to 15 minutes. Use DefaultStorageKeyAllocator when persisting the timeout. Make extended discovery logs more meaningful for a non-implementer and remove some irrelevant messages. * Fix Cirque tests Discriminator must be now explicitly specified in Linux apps. Previously the Cirque tests were passing only by chance. * Remove CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY Most platforms have it enabled, by default, and those that don't, have extended discovery disabled, too, which covers the case when the commissioning window is closed. On the other hand, when the commissioning window is open, the device should always try to advertise over DNS-SD. * Fix build * Follow KVS key convention --- src/app/server/Dnssd.cpp | 74 ++++++++----------- src/include/platform/CHIPDeviceConfig.h | 23 +----- src/lib/support/DefaultStorageKeyAllocator.h | 3 + .../Darwin/CHIPDevicePlatformConfig.h | 2 - src/platform/EFR32/CHIPDevicePlatformConfig.h | 1 - src/platform/Linux/CHIPDevicePlatformConfig.h | 2 - .../cc13x2_26x2/CHIPDevicePlatformConfig.h | 1 - .../nrfconnect/CHIPDevicePlatformConfig.h | 1 - .../nxp/k32w/k32w0/CHIPDevicePlatformConfig.h | 1 - src/platform/qpg/CHIPDevicePlatformConfig.h | 1 - src/platform/webos/CHIPDevicePlatformConfig.h | 2 - .../linux-cirque/CommissioningTest.py | 5 +- .../linux-cirque/MobileDeviceTest.py | 5 +- 13 files changed, 43 insertions(+), 78 deletions(-) diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index f2804f0908d637..e544b43e99ba7e 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -78,34 +79,34 @@ bool DnssdServer::HaveOperationalCredentials() } } - ChipLogProgress(Discovery, "Failed to find a valid admin pairing. Node ID unknown"); return false; } #if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY -constexpr const char kExtendedDiscoveryTimeoutKeypairStorage[] = "ExtDiscKey"; - void DnssdServer::SetExtendedDiscoveryTimeoutSecs(int16_t secs) { - ChipLogDetail(Discovery, "SetExtendedDiscoveryTimeoutSecs %d", secs); - chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Put(kExtendedDiscoveryTimeoutKeypairStorage, &secs, sizeof(secs)); + ChipLogDetail(Discovery, "Setting extended discovery timeout to %" PRId16 "s", secs); + chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Put(DefaultStorageKeyAllocator::DNSExtendedDiscoveryTimeout(), secs); } int16_t DnssdServer::GetExtendedDiscoveryTimeoutSecs() { - CHIP_ERROR err = CHIP_NO_ERROR; int16_t secs; + CHIP_ERROR err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Get( + DefaultStorageKeyAllocator::DNSExtendedDiscoveryTimeout(), &secs); - err = chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr().Get(kExtendedDiscoveryTimeoutKeypairStorage, &secs, sizeof(secs)); - if (err != CHIP_NO_ERROR) + if (err == CHIP_NO_ERROR) + { + return secs; + } + + if (err != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) { - ChipLogError(Discovery, "Failed to get extended timeout configuration err: %s", chip::ErrorStr(err)); - secs = CHIP_DEVICE_CONFIG_EXTENDED_DISCOVERY_TIMEOUT_SECS; + ChipLogError(Discovery, "Failed to load extended discovery timeout: %" CHIP_ERROR_FORMAT, err.Format()); } - ChipLogDetail(Discovery, "GetExtendedDiscoveryTimeoutSecs %d", secs); - return secs; + return CHIP_DEVICE_CONFIG_EXTENDED_DISCOVERY_TIMEOUT_SECS; } /// Callback from Extended Discovery Expiration timer @@ -118,11 +119,11 @@ void DnssdServer::OnExtendedDiscoveryExpiration(System::Layer * aSystemLayer, vo { if (!DnssdServer::OnExpiration(mExtendedDiscoveryExpiration)) { - ChipLogDetail(Discovery, "OnExtendedDiscoveryExpiration callback for cleared session"); + ChipLogDetail(Discovery, "Extended discovery timeout cancelled"); return; } - ChipLogDetail(Discovery, "OnExtendedDiscoveryExpiration callback for valid session"); + ChipLogDetail(Discovery, "Extended discovery timed out"); mExtendedDiscoveryExpiration = kTimeoutCleared; } @@ -220,7 +221,7 @@ CHIP_ERROR DnssdServer::ScheduleDiscoveryExpiration() { return CHIP_NO_ERROR; } - ChipLogDetail(Discovery, "Scheduling Discovery timeout in secs=%d", mDiscoveryTimeoutSecs); + ChipLogDetail(Discovery, "Scheduling discovery timeout in %" PRId16 "s", mDiscoveryTimeoutSecs); mDiscoveryExpiration = mTimeSource.GetMonotonicTimestamp() + System::Clock::Seconds16(mDiscoveryTimeoutSecs); @@ -236,7 +237,7 @@ CHIP_ERROR DnssdServer::ScheduleExtendedDiscoveryExpiration() { return CHIP_NO_ERROR; } - ChipLogDetail(Discovery, "Scheduling Extended Discovery timeout in secs=%d", extendedDiscoveryTimeoutSecs); + ChipLogDetail(Discovery, "Scheduling extended discovery timeout in %" PRId16 "s", extendedDiscoveryTimeoutSecs); mExtendedDiscoveryExpiration = mTimeSource.GetMonotonicTimestamp() + System::Clock::Seconds16(extendedDiscoveryTimeoutSecs); @@ -448,7 +449,7 @@ void DnssdServer::StartServer() void DnssdServer::StartServer(Dnssd::CommissioningMode mode) { - ChipLogDetail(Discovery, "DNS-SD StartServer mode=%d", static_cast(mode)); + ChipLogProgress(Discovery, "Updating services using commissioning mode %d", static_cast(mode)); ClearTimeouts(); @@ -472,44 +473,33 @@ void DnssdServer::StartServer(Dnssd::CommissioningMode mode) ChipLogError(Discovery, "Failed to advertise operational node: %s", chip::ErrorStr(err)); } - if (HaveOperationalCredentials()) + if (mode != chip::Dnssd::CommissioningMode::kDisabled) { - ChipLogProgress(Discovery, "Have operational credentials"); - if (mode != chip::Dnssd::CommissioningMode::kDisabled) + err = AdvertiseCommissionableNode(mode); + if (err != CHIP_NO_ERROR) { - err = AdvertiseCommissionableNode(mode); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Discovery, "Failed to advertise commissionable node: %s", chip::ErrorStr(err)); - } - // no need to set timeout because callers are currently doing that and their timeout might be longer than the default + ChipLogError(Discovery, "Failed to advertise commissionable node: %s", chip::ErrorStr(err)); } -#if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY - else if (GetExtendedDiscoveryTimeoutSecs() != CHIP_DEVICE_CONFIG_DISCOVERY_DISABLED) + + // If any fabrics exist, the commissioning window must have been opened by the administrator + // commissioning cluster commands which take care of the timeout. + if (!HaveOperationalCredentials()) { - err = AdvertiseCommissionableNode(mode); - if (err != CHIP_NO_ERROR) - { - ChipLogError(Discovery, "Failed to advertise extended commissionable node: %s", chip::ErrorStr(err)); - } - // set timeout - ScheduleExtendedDiscoveryExpiration(); + ScheduleDiscoveryExpiration(); } -#endif // CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY } - else +#if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY + else if (GetExtendedDiscoveryTimeoutSecs() != CHIP_DEVICE_CONFIG_DISCOVERY_DISABLED) { -#if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY - ChipLogProgress(Discovery, "Start dns-sd server - no current nodeId"); err = AdvertiseCommissionableNode(mode); if (err != CHIP_NO_ERROR) { - ChipLogError(Discovery, "Failed to advertise unprovisioned commissionable node: %s", chip::ErrorStr(err)); + ChipLogError(Discovery, "Failed to advertise extended commissionable node: %s", chip::ErrorStr(err)); } // set timeout - ScheduleDiscoveryExpiration(); -#endif + ScheduleExtendedDiscoveryExpiration(); } +#endif // CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY err = AdvertiseCommissioner(); diff --git a/src/include/platform/CHIPDeviceConfig.h b/src/include/platform/CHIPDeviceConfig.h index 921c042e74203b..7dd950f32a825a 100644 --- a/src/include/platform/CHIPDeviceConfig.h +++ b/src/include/platform/CHIPDeviceConfig.h @@ -1162,32 +1162,13 @@ // -------------------- Device DNS-SD Configuration -------------------- -/** - * CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY - * - * Enable MDNS commissionable node advertising when not yet provisioned. - * - * This should be 1 for WiFi SoftAP devices, ethernet devices, and (probably) bridge devices - * - * This should be 0 for Thread/BLE devices and WiFi/BLE devices - */ -#ifndef CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY -#if CHIP_DEVICE_CONFIG_ENABLE_THREAD -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 0 -#else -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 -#endif -#endif - /** * CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS * * Time in seconds that a factory new device will advertise commissionable node discovery. - * - * Only valid when CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY==1 */ #ifndef CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS -#define CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS 15 * 60 +#define CHIP_DEVICE_CONFIG_DISCOVERY_TIMEOUT_SECS (15 * 60) #endif /** @@ -1256,7 +1237,7 @@ */ #define CHIP_DEVICE_CONFIG_DISCOVERY_DISABLED 0 #define CHIP_DEVICE_CONFIG_DISCOVERY_NO_TIMEOUT -1 -#define CHIP_DEVICE_CONFIG_EXTENDED_DISCOVERY_TIMEOUT_SECS CHIP_DEVICE_CONFIG_DISCOVERY_NO_TIMEOUT +#define CHIP_DEVICE_CONFIG_EXTENDED_DISCOVERY_TIMEOUT_SECS (15 * 60) /** * CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DEVICE_TYPE diff --git a/src/lib/support/DefaultStorageKeyAllocator.h b/src/lib/support/DefaultStorageKeyAllocator.h index d9df01301ef9b2..bd46209f3c8f6c 100644 --- a/src/lib/support/DefaultStorageKeyAllocator.h +++ b/src/lib/support/DefaultStorageKeyAllocator.h @@ -80,6 +80,9 @@ class DefaultStorageKeyAllocator static const char * OTACurrentProvider() { return "o/cp"; } static const char * OTAUpdateToken() { return "o/ut"; } + // [G]lobal [D]NS-related keys + static const char * DNSExtendedDiscoveryTimeout() { return "g/d/edt"; } + private: // The ENFORCE_FORMAT args are "off by one" because this is a class method, // with an implicit "this" as first arg. diff --git a/src/platform/Darwin/CHIPDevicePlatformConfig.h b/src/platform/Darwin/CHIPDevicePlatformConfig.h index 2912fd016b4ec8..690a5eaf97b36d 100644 --- a/src/platform/Darwin/CHIPDevicePlatformConfig.h +++ b/src/platform/Darwin/CHIPDevicePlatformConfig.h @@ -36,8 +36,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to Darwin platforms. diff --git a/src/platform/EFR32/CHIPDevicePlatformConfig.h b/src/platform/EFR32/CHIPDevicePlatformConfig.h index acdbf0c7bff8ac..ba22beda6ab6d9 100644 --- a/src/platform/EFR32/CHIPDevicePlatformConfig.h +++ b/src/platform/EFR32/CHIPDevicePlatformConfig.h @@ -45,7 +45,6 @@ #endif /* defined(SL_WIFI) */ #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 1 diff --git a/src/platform/Linux/CHIPDevicePlatformConfig.h b/src/platform/Linux/CHIPDevicePlatformConfig.h index 7c9a5d6beb417c..23aaff4ace2ab2 100644 --- a/src/platform/Linux/CHIPDevicePlatformConfig.h +++ b/src/platform/Linux/CHIPDevicePlatformConfig.h @@ -43,8 +43,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to Linux platforms. diff --git a/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h b/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h index cae88c46eb1559..5927b58b3c2c60 100644 --- a/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h @@ -55,4 +55,3 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index 8ddf607d5d8239..3748d3bd724a1f 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -102,7 +102,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 #define CHIP_DEVICE_CONFIG_THREAD_SRP_MAX_SERVICES (CHIP_CONFIG_MAX_FABRICS + 1) #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 #ifdef CONFIG_CHIP_ENABLE_DNS_CLIENT #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_COMMISSIONABLE_DISCOVERY 1 diff --git a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h index 600b065f7f3e03..13232a2819b4d2 100644 --- a/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h +++ b/src/platform/nxp/k32w/k32w0/CHIPDevicePlatformConfig.h @@ -99,5 +99,4 @@ #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 #endif diff --git a/src/platform/qpg/CHIPDevicePlatformConfig.h b/src/platform/qpg/CHIPDevicePlatformConfig.h index a4342e49f33d77..0f5367c7c69252 100644 --- a/src/platform/qpg/CHIPDevicePlatformConfig.h +++ b/src/platform/qpg/CHIPDevicePlatformConfig.h @@ -39,7 +39,6 @@ #endif #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 diff --git a/src/platform/webos/CHIPDevicePlatformConfig.h b/src/platform/webos/CHIPDevicePlatformConfig.h index 9a8fe4f699ebaa..2abb98fe27cb56 100644 --- a/src/platform/webos/CHIPDevicePlatformConfig.h +++ b/src/platform/webos/CHIPDevicePlatformConfig.h @@ -43,8 +43,6 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIP_TIME_SERVICE_TIME_SYNC 0 -#define CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONABLE_DISCOVERY 1 - // ========== Platform-specific Configuration ========= // These are configuration options that are unique to webOs platforms. diff --git a/src/test_driver/linux-cirque/CommissioningTest.py b/src/test_driver/linux-cirque/CommissioningTest.py index e9e311d17daf4b..9ef3a838ea9859 100755 --- a/src/test_driver/linux-cirque/CommissioningTest.py +++ b/src/test_driver/linux-cirque/CommissioningTest.py @@ -38,6 +38,7 @@ CHIP_REPO = os.path.join(os.path.abspath( os.path.dirname(__file__)), "..", "..", "..") TEST_EXTPANID = "fedcba9876543210" +TEST_DISCRIMINATOR = 3840 DEVICE_CONFIG = { 'device0': { @@ -81,8 +82,8 @@ def run_controller_test(self): if device['type'] == 'MobileDevice'] for server in server_ids: - self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread".format( - os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"))) + self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format( + os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR)) self.reset_thread_devices(server_ids) diff --git a/src/test_driver/linux-cirque/MobileDeviceTest.py b/src/test_driver/linux-cirque/MobileDeviceTest.py index 9af296978b760d..90af77227bb533 100755 --- a/src/test_driver/linux-cirque/MobileDeviceTest.py +++ b/src/test_driver/linux-cirque/MobileDeviceTest.py @@ -38,6 +38,7 @@ CHIP_REPO = os.path.join(os.path.abspath( os.path.dirname(__file__)), "..", "..", "..") TEST_EXTPANID = "fedcba9876543210" +TEST_DISCRIMINATOR = 3840 DEVICE_CONFIG = { 'device0': { @@ -81,8 +82,8 @@ def run_controller_test(self): if device['type'] == 'MobileDevice'] for server in server_ids: - self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread".format( - os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"))) + self.execute_device_cmd(server, "CHIPCirqueDaemon.py -- run gdb -return-child-result -q -ex \"set pagination off\" -ex run -ex \"bt 25\" --args {} --thread --discriminator {}".format( + os.path.join(CHIP_REPO, "out/debug/standalone/chip-all-clusters-app"), TEST_DISCRIMINATOR)) self.reset_thread_devices(server_ids) From dd2f7e03d93a2fff98cb9523fd105d50be0e9ec7 Mon Sep 17 00:00:00 2001 From: Song GUO Date: Wed, 23 Mar 2022 14:35:06 +0800 Subject: [PATCH 17/70] Remove over-killed output processing (#16519) Co-authored-by: Jerry Johns --- .github/.wordlist.txt | 1 + .github/workflows/tests.yaml | 4 +-- docs/guides/matter-repl.md | 19 +++++----- scripts/tests/run_python_test.py | 62 +++++++------------------------- 4 files changed, 23 insertions(+), 63 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 8a6d2116e2cbb7..7d416e04f4b17f 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -1437,3 +1437,4 @@ UTF localedef nameserver nmcli +tsan diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6dab37ab7a264e..018d102b583cfc 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -274,7 +274,7 @@ jobs: - name: Run Tests timeout-minutes: 30 run: | - scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset -- -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v2 if: ${{ failure() }} && ${{ !env.ACT }} @@ -356,7 +356,7 @@ jobs: - name: Run Tests timeout-minutes: 30 run: | - scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset --app-params "--discriminator 3840 --interface-id -1" -- -t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/darwin-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --app-args "--discriminator 3840 --interface-id -1" --script-args "-t 3600 --disable-test ClusterObjectTests.TestTimedRequestTimeout"' - name: Uploading core files uses: actions/upload-artifact@v2 if: ${{ failure() }} && ${{ !env.ACT }} diff --git a/docs/guides/matter-repl.md b/docs/guides/matter-repl.md index 52e0c31ba271c2..89655045887095 100644 --- a/docs/guides/matter-repl.md +++ b/docs/guides/matter-repl.md @@ -224,23 +224,20 @@ example, you can run: It provides some extra options, for example: ``` - --app TEXT Local application to use, omit to use external apps, use - a path for a specific binary or use a filename to search - under the current matter checkout. - - --factoryreset Remove app config and repl configs (/tmp/chip* and - /tmp/repl*) before running the tests. - - --app-params TEXT The extra parameters passed to the device. - --script PATH Test script to use. - --help Show this message and exit. +optional arguments: + -h, --help show this help message and exit + --app APP Path to local application to use, omit to use external apps. + --factoryreset Remove app config and repl configs (/tmp/chip* and /tmp/repl*) before running the tests. + --app-args APP_ARGS The extra parameters passed to the device side app. + --script SCRIPT Path to the test script to use, omit to use the default test script (mobile-device-test.py). + --script-args SCRIPT_ARGS Arguments for the REPL test script ``` You can pass your own flags for mobile-device-test.py by appending them to the command line with two dashes, for example: ``` -./scripts/tests/run_python_test.py --app chip-all-clusters-app --factoryreset -- -t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout +./scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-no-ble-no-wifi-tsan-clang/chip-all-clusters-app --factoryreset --script-args "-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout" ``` will pass `-t 90 --disable-test ClusterObjectTests.TestTimedRequestTimeout` to diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index 229e26594a4694..10d9e864f89aee 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -32,17 +32,6 @@ os.path.join(os.path.dirname(__file__), '..', '..')) -def FindBinaryPath(name: str): - for path in pathlib.Path(DEFAULT_CHIP_ROOT).rglob(name): - if not path.is_file(): - continue - if path.name != name: - continue - return str(path) - - return None - - def EnqueueLogOutput(fp, tag, q): for line in iter(fp.readline, b''): timestamp = time.time() @@ -52,8 +41,9 @@ def EnqueueLogOutput(fp, tag, q): line = line[19:] except Exception as ex: pass - q.put((tag, line, datetime.datetime.fromtimestamp( - timestamp).isoformat(sep=" "))) + sys.stdout.buffer.write( + (f"[{datetime.datetime.fromtimestamp(timestamp).isoformat(sep=' ')}]").encode() + tag + line) + sys.stdout.flush() fp.close() @@ -64,15 +54,6 @@ def RedirectQueueThread(fp, tag, queue) -> threading.Thread: return log_queue_thread -def DumpLogOutput(q: queue.Queue): - # TODO: Due to the nature of os pipes, the order of the timestamp is not guaranteed, need to figure out a better output format. - while True: - line = q.get_nowait() - sys.stdout.buffer.write( - (f"[{line[2]}]").encode() + line[0] + line[1]) - sys.stdout.flush() - - def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: str, process: subprocess.Popen, queue: queue.Queue): thread_list.append(RedirectQueueThread(process.stdout, (f"[{tag}][\33[33mSTDOUT\33[0m]").encode(), queue)) @@ -81,12 +62,12 @@ def DumpProgramOutputToQueue(thread_list: typing.List[threading.Thread], tag: st @click.command() -@click.option("--app", type=str, default=None, help='Local application to use, omit to use external apps, use a path for a specific binary or use a filename to search under the current matter checkout.') +@click.option("--app", type=click.Path(exists=True), default=None, help='Path to local application to use, omit to use external apps.') @click.option("--factoryreset", is_flag=True, help='Remove app config and repl configs (/tmp/chip* and /tmp/repl*) before running the tests.') -@click.option("--app-params", type=str, default='', help='The extra parameters passed to the device.') -@click.option("--script", type=click.Path(exists=True), default=FindBinaryPath("mobile-device-test.py"), help='Test script to use.') -@click.argument("script-args", nargs=-1, type=str) -def main(app: str, factoryreset: bool, app_params: str, script: str, script_args: typing.List[str]): +@click.option("--app-args", type=str, default='', help='The extra arguments passed to the device.') +@click.option("--script", type=click.Path(exists=True), default=os.path.join(DEFAULT_CHIP_ROOT, 'src', 'controller', 'python', 'test', 'test_scripts', 'mobile-device-test.py'), help='Test script to use.') +@click.option("--script-args", type=str, default='', help='Path to the test script to use, omit to use the default test script (mobile-device-test.py).') +def main(app: str, factoryreset: bool, app_args: str, script: str, script_args: str): if factoryreset: retcode = subprocess.call("rm -rf /tmp/chip* /tmp/repl*", shell=True) if retcode != 0: @@ -98,10 +79,9 @@ def main(app: str, factoryreset: bool, app_params: str, script: str, script_args app_process = None if app: if not os.path.exists(app): - app = FindBinaryPath(app) if app is None: raise FileNotFoundError(f"{app} not found") - app_args = [app] + shlex.split(app_params) + app_args = [app] + shlex.split(app_args) logging.info(f"Execute: {app_args}") app_process = subprocess.Popen( app_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=0) @@ -109,43 +89,25 @@ def main(app: str, factoryreset: bool, app_params: str, script: str, script_args log_cooking_threads, "\33[34mAPP \33[0m", app_process, log_queue) script_command = ["/usr/bin/env", "python3", script, - '--log-format', '%(message)s'] + [v for v in script_args] + '--log-format', '%(message)s'] + shlex.split(script_args) logging.info(f"Execute: {script_command}") test_script_process = subprocess.Popen( script_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) DumpProgramOutputToQueue(log_cooking_threads, "\33[32mTEST\33[0m", test_script_process, log_queue) - test_script_exit_code = test_script_process.poll() - while test_script_exit_code is None: - try: - DumpLogOutput(log_queue) - except queue.Empty: - pass - test_script_exit_code = test_script_process.poll() + test_script_exit_code = test_script_process.wait() test_app_exit_code = 0 if app_process: app_process.send_signal(2) - - test_app_exit_code = app_process.poll() - while test_app_exit_code is None: - try: - DumpLogOutput(log_queue) - except queue.Empty: - pass - test_app_exit_code = app_process.poll() + test_app_exit_code = app_process.wait() # There are some logs not cooked, so we wait until we have processed all logs. # This procedure should be very fast since the related processes are finished. for thread in log_cooking_threads: thread.join() - try: - DumpLogOutput(log_queue) - except queue.Empty: - pass - if test_script_exit_code != 0: sys.exit(test_script_exit_code) else: From fc6595a117c18c1af8f82df13a3ec4a5ec9a2c78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Wed, 23 Mar 2022 08:46:41 +0100 Subject: [PATCH 18/70] [zephyr] BootReasons and NetworkInterfaces fixes (#16530) 1. Fix BootReasons attribute of GeneralDiagnostics cluster: - Make sure hwinfo_get_reset_cause() is called once per boot and is immediately followed by hwinfo_clear_reset_cause() since the reset cause is accumulated between subsequent resets. - Add support for SoftwareUpdateCompleted boot reason. - Reduce the scope of reasons classified as SoftwareReset. 2. Add a missing bound check to the NetworkInterfaces attribute provider and always assume that Zephyr's net_if API is available. --- .../Zephyr/DiagnosticDataProviderImpl.cpp | 103 +++++++++++------- .../Zephyr/DiagnosticDataProviderImpl.h | 5 + 2 files changed, 69 insertions(+), 39 deletions(-) diff --git a/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp b/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp index 8d32fe8ae06253..b6958451aa0001 100644 --- a/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp +++ b/src/platform/Zephyr/DiagnosticDataProviderImpl.cpp @@ -29,17 +29,76 @@ #include +#ifdef CONFIG_MCUBOOT_IMG_MANAGER +#include +#endif + #include namespace chip { namespace DeviceLayer { +namespace { + +uint8_t DetermineBootReason() +{ +#ifdef CONFIG_HWINFO + uint32_t reason; + + if (hwinfo_get_reset_cause(&reason) != 0) + { + return BootReasonType::Unspecified; + } + + // Bits returned by hwinfo_get_reset_cause() are accumulated between subsequent resets, so + // the reset cause must be cleared after reading in order to make sure it always contains + // information about the most recent boot only. + (void) hwinfo_clear_reset_cause(); + + // If no reset cause is provided, it indicates a power-on-reset. + if (reason == 0 || reason & (RESET_POR | RESET_PIN)) + { + return BootReasonType::PowerOnReboot; + } + + if (reason & RESET_WATCHDOG) + { + return BootReasonType::HardwareWatchdogReset; + } + + if (reason & RESET_BROWNOUT) + { + return BootReasonType::BrownOutReset; + } + + if (reason & RESET_SOFTWARE) + { +#ifdef CONFIG_MCUBOOT_IMG_MANAGER + if (mcuboot_swap_type() == BOOT_SWAP_TYPE_REVERT) + { + return BootReasonType::SoftwareUpdateCompleted; + } +#endif + return BootReasonType::SoftwareReset; + } +#endif + + return BootReasonType::Unspecified; +} + +} // namespace + DiagnosticDataProviderImpl & DiagnosticDataProviderImpl::GetDefaultInstance() { static DiagnosticDataProviderImpl sInstance; return sInstance; } +inline DiagnosticDataProviderImpl::DiagnosticDataProviderImpl() : mBootReason(DetermineBootReason()) +{ + ChipLogDetail(DeviceLayer, "Boot reason: %" PRIu16, static_cast(mBootReason)); +} + CHIP_ERROR DiagnosticDataProviderImpl::GetCurrentHeapFree(uint64_t & currentHeapFree) { #ifdef CONFIG_NEWLIB_LIBC @@ -124,45 +183,15 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetTotalOperationalHours(uint32_t & total CHIP_ERROR DiagnosticDataProviderImpl::GetBootReason(uint8_t & bootReason) { #if CONFIG_HWINFO - uint32_t reason = 0; - - CHIP_ERROR err = CHIP_NO_ERROR; - - if (hwinfo_get_reset_cause(&reason) != 0) - { - return CHIP_ERROR_INCORRECT_STATE; - } - - if (reason & (RESET_POR | RESET_PIN)) - { - bootReason = BootReasonType::PowerOnReboot; - } - else if (reason & RESET_WATCHDOG) - { - bootReason = BootReasonType::SoftwareWatchdogReset; - } - else if (reason & RESET_BROWNOUT) - { - bootReason = BootReasonType::BrownOutReset; - } - else if (reason & (RESET_SOFTWARE | RESET_CPU_LOCKUP | RESET_DEBUG)) - { - bootReason = BootReasonType::SoftwareReset; - } - else - { - bootReason = BootReasonType::Unspecified; - } - - return err; + bootReason = mBootReason; + return CHIP_NO_ERROR; #else - return CHIP_ERROR_NOT_IMPLEMENTED; + return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; #endif } CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** netifpp) { -#if CHIP_SYSTEM_CONFIG_USE_ZEPHYR_NET_IF NetworkInterface * head = NULL; for (Inet::InterfaceIterator interfaceIterator; interfaceIterator.HasCurrent(); interfaceIterator.Next()) @@ -215,7 +244,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** // Assuming IPv6-only support Inet::InterfaceAddressIterator interfaceAddressIterator; uint8_t ipv6AddressesCount = 0; - while (interfaceAddressIterator.HasCurrent()) + while (interfaceAddressIterator.HasCurrent() && ipv6AddressesCount < kMaxIPv6AddrCount) { if (interfaceAddressIterator.GetInterfaceId() == interfaceIterator.GetInterfaceId()) { @@ -223,8 +252,7 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** if (interfaceAddressIterator.GetAddress(ipv6Address) == CHIP_NO_ERROR) { memcpy(ifp->Ipv6AddressesBuffer[ipv6AddressesCount], ipv6Address.Addr, kMaxIPv6AddrSize); - ifp->Ipv6AddressSpans[ipv6AddressesCount] = - ByteSpan(ifp->Ipv6AddressesBuffer[ipv6AddressesCount], kMaxIPv6AddrSize); + ifp->Ipv6AddressSpans[ipv6AddressesCount] = ByteSpan(ifp->Ipv6AddressesBuffer[ipv6AddressesCount]); ipv6AddressesCount++; } } @@ -237,9 +265,6 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** *netifpp = head; return CHIP_NO_ERROR; -#else - return CHIP_ERROR_NOT_IMPLEMENTED; -#endif } void DiagnosticDataProviderImpl::ReleaseNetworkInterfaces(NetworkInterface * netifp) diff --git a/src/platform/Zephyr/DiagnosticDataProviderImpl.h b/src/platform/Zephyr/DiagnosticDataProviderImpl.h index 05687dcb9832fc..b8b05591332b2f 100644 --- a/src/platform/Zephyr/DiagnosticDataProviderImpl.h +++ b/src/platform/Zephyr/DiagnosticDataProviderImpl.h @@ -49,6 +49,11 @@ class DiagnosticDataProviderImpl : public DiagnosticDataProvider CHIP_ERROR GetBootReason(uint8_t & bootReason) override; CHIP_ERROR GetNetworkInterfaces(NetworkInterface ** netifpp) override; void ReleaseNetworkInterfaces(NetworkInterface * netifp) override; + +private: + DiagnosticDataProviderImpl(); + + const uint8_t mBootReason; }; } // namespace DeviceLayer From a041a2c3a110d33013d28da06b9eb6f0b058c5c8 Mon Sep 17 00:00:00 2001 From: du48s03 Date: Wed, 23 Mar 2022 01:39:53 -0700 Subject: [PATCH 19/70] =?UTF-8?q?Add=20implementation=20for=20ModeSelectCl?= =?UTF-8?q?uster's=20OnMode=20attribute=20and=20DEPON=E2=80=A6=20(#15888)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Implement OnMode functionalities * Generated Changes. --- .../all-clusters-app.matter | 19 +- .../all-clusters-common/all-clusters-app.zap | 272 +++++++++- .../clusters/on-off-server/on-off-server.cpp | 18 +- .../tests/suites/TestModeSelectCluster.yaml | 83 ++- src/app/tests/suites/include/ValueChecker.h | 14 + .../data-model/chip/mode-select-cluster.xml | 16 +- .../data_model/controller-clusters.matter | 16 +- .../data_model/controller-clusters.zap | 54 +- .../CHIPAttributeTLVValueDecoder.cpp | 81 ++- .../java/zap-generated/CHIPCallbackTypes.h | 16 +- .../zap-generated/CHIPClustersWrite-JNI.cpp | 12 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 195 +++++++ .../java/zap-generated/CHIPReadCallbacks.h | 89 ++++ .../chip/devicecontroller/ChipClusters.java | 150 ++++-- .../chip/devicecontroller/ChipIdLookup.java | 16 +- .../devicecontroller/ClusterReadMapping.java | 61 ++- .../python/chip/clusters/CHIPClusters.py | 32 +- .../python/chip/clusters/Objects.py | 62 ++- .../CHIPAttributeTLVValueDecoder.mm | 58 ++- .../CHIP/zap-generated/CHIPClustersObjc.h | 97 ++-- .../CHIP/zap-generated/CHIPClustersObjc.mm | 296 ++++++++--- .../CHIP/zap-generated/CHIPTestClustersObjc.h | 8 +- .../zap-generated/CHIPTestClustersObjc.mm | 62 ++- .../Framework/CHIPTests/CHIPClustersTests.m | 271 ++++++++-- .../zap-generated/endpoint_config.h | 434 +++++++-------- .../app-common/zap-generated/attribute-id.h | 11 +- .../zap-generated/attributes/Accessors.cpp | 169 ++++-- .../zap-generated/attributes/Accessors.h | 31 +- .../app-common/zap-generated/cluster-enums.h | 6 + .../zap-generated/cluster-objects.cpp | 15 +- .../zap-generated/cluster-objects.h | 59 ++- .../app-common/zap-generated/enums.h | 2 + .../app-common/zap-generated/ids/Attributes.h | 24 +- .../cluster/CHIPTestClustersObjc.h | 8 +- .../cluster/CHIPTestClustersObjc.mm | 62 ++- .../zap-generated/cluster/Commands.h | 371 +++++++++---- .../zap-generated/test/Commands.h | 333 ++++++++++-- .../zap-generated/cluster/Commands.h | 31 +- .../cluster/logging/DataModelLogger.cpp | 23 +- .../chip-tool/zap-generated/test/Commands.h | 493 +++++++++++++++--- 40 files changed, 3134 insertions(+), 936 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index a7b2a1a7b228da..4e8dd35960d890 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -1971,17 +1971,26 @@ server cluster MediaPlayback = 1286 { } server cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u onMode = 5; + readonly global attribute command_id generatedCommandList[] = 65528; + readonly global attribute command_id acceptedCommandList[] = 65529; + readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; request struct ChangeToModeRequest { diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 513cf3c479e308..c74772c8bc26f7 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -7963,7 +7963,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "NVM", "singleton": 0, "bounded": 0, "defaultValue": "0x00", @@ -8032,6 +8032,51 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "FeatureMap", "code": 65532, @@ -8462,11 +8507,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -8477,11 +8522,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -8492,11 +8537,11 @@ "mfgCode": null, "side": "server", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", - "reportable": 0, + "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 @@ -8889,6 +8934,66 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -10376,7 +10481,7 @@ "commands": [], "attributes": [ { - "name": "CurrentMode", + "name": "Description", "code": 0, "mfgCode": null, "side": "server", @@ -10384,19 +10489,19 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "Coffee", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "SupportedModes", + "name": "StandardNamespace", "code": 1, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10406,12 +10511,12 @@ "reportableChange": 0 }, { - "name": "OnMode", + "name": "SupportedModes", "code": 2, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10421,7 +10526,7 @@ "reportableChange": 0 }, { - "name": "StartUpMode", + "name": "CurrentMode", "code": 3, "mfgCode": null, "side": "server", @@ -10436,15 +10541,90 @@ "reportableChange": 0 }, { - "name": "Description", + "name": "StartUpMode", "code": 4, "mfgCode": null, "side": "server", "included": 1, + "storageOption": "NVM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "OnMode", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "Coffee", + "defaultValue": "255", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -14661,6 +14841,66 @@ "maxInterval": 65344, "reportableChange": 0 }, + { + "name": "ServerGeneratedCommandList", + "code": 65528, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClientGeneratedCommandList", + "code": 65529, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index 4dde061e4c38b4..cf7780e63ed749 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -41,6 +41,7 @@ #include "on-off-server.h" #include +#include #include #include #include @@ -165,6 +166,21 @@ EmberAfStatus OnOffServer::setOnOffValue(chip::EndpointId endpoint, uint8_t comm { emberAfOnOffClusterLevelControlEffectCallback(endpoint, newValue); } +#endif +#ifdef EMBER_AF_PLUGIN_MODE_SELECT + // If OnMode is not a null value, then change the current mode to it. + ModeSelect::Attributes::OnMode::TypeInfo::Type onMode; + status = ModeSelect::Attributes::OnMode::Get(endpoint, onMode); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + emberAfOnOffClusterPrintln("ERR: reading onMode %x", status); + return status; + } + if (!onMode.IsNull()) + { + emberAfOnOffClusterPrintln("Changing Current Mode to %x", onMode.Value()); + status = ModeSelect::Attributes::CurrentMode::Set(endpoint, onMode.Value()); + } #endif } else // Set Off @@ -260,7 +276,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) break; } } - status = Attributes::OnOff::Set(endpoint, updatedOnOff); + status = setOnOffValue(endpoint, updatedOnOff, false); } } } diff --git a/src/app/tests/suites/TestModeSelectCluster.yaml b/src/app/tests/suites/TestModeSelectCluster.yaml index 000d0be8f02914..a27f110eb5aaf6 100644 --- a/src/app/tests/suites/TestModeSelectCluster.yaml +++ b/src/app/tests/suites/TestModeSelectCluster.yaml @@ -27,31 +27,18 @@ tests: values: - name: "nodeId" value: nodeId - - - label: "Read CurrentMode" - command: "readAttribute" - attribute: "CurrentMode" - response: - value: 0 - - - label: "Read OnMode" + - label: "Read Description" command: "readAttribute" - attribute: "OnMode" + attribute: "Description" response: - value: 0 + value: "Coffee" - - label: "Read StartUpMode" + - label: "Read StandardNamespace" command: "readAttribute" - attribute: "StartUpMode" + attribute: "StandardNamespace" response: value: 0 - - label: "Read Description" - command: "readAttribute" - attribute: "Description" - response: - value: "Coffee" - - label: "Read SupportedModes" command: "readAttribute" attribute: "SupportedModes" @@ -67,6 +54,24 @@ tests: - minLength: 3 - maxLength: 3 + - label: "Read CurrentMode" + command: "readAttribute" + attribute: "CurrentMode" + response: + value: 0 + + - label: "Read StartUpMode" + command: "readAttribute" + attribute: "StartUpMode" + response: + value: 0 + + - label: "Read OnMode" + command: "readAttribute" + attribute: "OnMode" + response: + value: null + - label: "Change to Supported Mode" command: "changeToMode" arguments: @@ -79,6 +84,7 @@ tests: attribute: "CurrentMode" response: value: 4 + saveAs: currentModeBeforeToggle - label: "Change to Unsupported Mode" command: "changeToMode" @@ -88,3 +94,44 @@ tests: value: 2 response: error: CONSTRAINT_ERROR + + - label: "Toggle OnOff" + cluster: "On/Off" + command: "off" + + - label: "Toggle OnOff" + cluster: "On/Off" + command: "on" + + - label: "Verify Current Mode does not change when OnMode is null" + command: "readAttribute" + attribute: "CurrentMode" + response: + value: currentModeBeforeToggle + + - label: "Change OnMode" + command: "writeAttribute" + attribute: "OnMode" + arguments: + value: 7 + + - label: "Verify OnMode" + command: "readAttribute" + attribute: "OnMode" + response: + saveAs: OnModeValue + value: 7 + + - label: "Toggle OnOff" + cluster: "On/Off" + command: "off" + + - label: "Toggle OnOff" + cluster: "On/Off" + command: "on" + + - label: "Verify Current Mode Changes if OnMode is not null" + command: "readAttribute" + attribute: "CurrentMode" + response: + value: OnModeValue diff --git a/src/app/tests/suites/include/ValueChecker.h b/src/app/tests/suites/include/ValueChecker.h index 540546667a70d2..d952d0d7557de3 100644 --- a/src/app/tests/suites/include/ValueChecker.h +++ b/src/app/tests/suites/include/ValueChecker.h @@ -83,6 +83,20 @@ class ValueChecker return CheckValue(itemName, current.Raw(), expected); } + // Allow an expected value that is a nullable wrapped around the actual + // value (e.g. a SaveAs from reading a different attribute that has a value + // space that includes null). In that case we check that: + // 1) The nullable is not in fact null. + // + // 2) The value in the nullable matches our test value. + template + bool CheckValue(const char * itemName, T current, const chip::app::DataModel::Nullable & expected) + { + auto nullableName = std::string(itemName); + nullableName += " expected value"; + return CheckValueNonNull(nullableName.c_str(), expected) && CheckValue(itemName, current, expected.Value()); + } + template bool CheckValue(const char * itemName, chip::BitFlags current, chip::BitFlags expected) { diff --git a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml index a5b26f35bf3200..6b41513b2990ad 100644 --- a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml @@ -41,11 +41,12 @@ limitations under the License. true Attributes and commands for selecting a mode from a list of supported options. - CurrentMode - SupportedModes - OnMode - StartUpMode - Description + Description + StandardNamespace + SupportedModes + CurrentMode + StartUpMode + OnMode @@ -56,4 +57,9 @@ limitations under the License. + + + + + diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index b3ff0e5efaa6d2..b7cebe1026fa11 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2366,20 +2366,26 @@ client cluster MediaPlayback = 1286 { } client cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u onMode = 5; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; + readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; request struct ChangeToModeRequest { diff --git a/src/controller/data_model/controller-clusters.zap b/src/controller/data_model/controller-clusters.zap index 0bb7b5c8ddb9fc..5d4c79a993d5bc 100644 --- a/src/controller/data_model/controller-clusters.zap +++ b/src/controller/data_model/controller-clusters.zap @@ -8517,6 +8517,21 @@ } ], "attributes": [ + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "client", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "ClusterRevision", "code": 65533, @@ -8544,7 +8559,7 @@ "commands": [], "attributes": [ { - "name": "CurrentMode", + "name": "Description", "code": 0, "mfgCode": null, "side": "server", @@ -8559,7 +8574,7 @@ "reportableChange": 0 }, { - "name": "SupportedModes", + "name": "StandardNamespace", "code": 1, "mfgCode": null, "side": "server", @@ -8574,22 +8589,22 @@ "reportableChange": 0 }, { - "name": "OnMode", + "name": "SupportedModes", "code": 2, "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "255", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, "reportableChange": 0 }, { - "name": "StartUpMode", + "name": "CurrentMode", "code": 3, "mfgCode": null, "side": "server", @@ -8604,7 +8619,7 @@ "reportableChange": 0 }, { - "name": "Description", + "name": "StartUpMode", "code": 4, "mfgCode": null, "side": "server", @@ -8618,6 +8633,21 @@ "maxInterval": 65534, "reportableChange": 0 }, + { + "name": "OnMode", + "code": 5, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, { "name": "GeneratedCommandList", "code": 65528, @@ -8668,7 +8698,7 @@ "code": 65532, "mfgCode": null, "side": "server", - "included": 0, + "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, @@ -11460,7 +11490,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -11475,7 +11505,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -11490,7 +11520,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -18057,4 +18087,4 @@ } ], "log": [] -} +} \ No newline at end of file diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index 638540db118491..f68a1c8cff23e5 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -8095,8 +8095,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR using namespace app::Clusters::ModeSelect; switch (aPath.mAttributeId) { - case Attributes::CurrentMode::Id: { - using TypeInfo = Attributes::CurrentMode::TypeInfo; + case Attributes::Description::Id: { + using TypeInfo = Attributes::Description::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -8104,10 +8104,29 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - std::string valueClassName = "java/lang/Integer"; - std::string valueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + value = env->NewStringUTF(std::string(cppValue.data(), cppValue.size()).c_str()); + return value; + } + case Attributes::StandardNamespace::Id: { + using TypeInfo = Attributes::StandardNamespace::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue.Value(), value); + } return value; } case Attributes::SupportedModes::Id: { @@ -8162,8 +8181,8 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } - case Attributes::OnMode::Id: { - using TypeInfo = Attributes::OnMode::TypeInfo; + case Attributes::CurrentMode::Id: { + using TypeInfo = Attributes::CurrentMode::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -8186,14 +8205,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - std::string valueClassName = "java/lang/Integer"; - std::string valueCtorSignature = "(I)V"; - chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue, value); + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue.Value(), value); + } return value; } - case Attributes::Description::Id: { - using TypeInfo = Attributes::Description::TypeInfo; + case Attributes::OnMode::Id: { + using TypeInfo = Attributes::OnMode::TypeInfo; TypeInfo::DecodableType cppValue; *aError = app::DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) @@ -8201,7 +8227,17 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR return nullptr; } jobject value; - value = env->NewStringUTF(std::string(cppValue.data(), cppValue.size()).c_str()); + if (cppValue.IsNull()) + { + value = nullptr; + } + else + { + std::string valueClassName = "java/lang/Integer"; + std::string valueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue.Value(), value); + } return value; } case Attributes::GeneratedCommandList::Id: { @@ -8276,6 +8312,21 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR } return value; } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = app::DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) + { + return nullptr; + } + jobject value; + std::string valueClassName = "java/lang/Long"; + std::string valueCtorSignature = "(J)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), + cppValue, value); + return value; + } case Attributes::ClusterRevision::Id: { using TypeInfo = Attributes::ClusterRevision::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/controller/java/zap-generated/CHIPCallbackTypes.h b/src/controller/java/zap-generated/CHIPCallbackTypes.h index 0950abbcf460ed..cb52ddf1a4f5cd 100644 --- a/src/controller/java/zap-generated/CHIPCallbackTypes.h +++ b/src/controller/java/zap-generated/CHIPCallbackTypes.h @@ -835,22 +835,26 @@ typedef void (*CHIPMediaPlaybackClusterAttributeListAttributeCallbackType)( typedef void (*CHIPMediaPlaybackClusterClusterRevisionAttributeCallbackType)( void *, chip::app::Clusters::MediaPlayback::Attributes::ClusterRevision::TypeInfo::DecodableArgType); -typedef void (*CHIPModeSelectClusterCurrentModeAttributeCallbackType)( - void *, chip::app::Clusters::ModeSelect::Attributes::CurrentMode::TypeInfo::DecodableArgType); +typedef void (*CHIPModeSelectClusterDescriptionAttributeCallbackType)( + void *, chip::app::Clusters::ModeSelect::Attributes::Description::TypeInfo::DecodableArgType); +typedef void (*CHIPModeSelectClusterStandardNamespaceAttributeCallbackType)( + void *, chip::app::Clusters::ModeSelect::Attributes::StandardNamespace::TypeInfo::DecodableArgType); typedef void (*CHIPModeSelectClusterSupportedModesAttributeCallbackType)( void *, const chip::app::Clusters::ModeSelect::Attributes::SupportedModes::TypeInfo::DecodableType &); -typedef void (*CHIPModeSelectClusterOnModeAttributeCallbackType)( - void *, chip::app::Clusters::ModeSelect::Attributes::OnMode::TypeInfo::DecodableArgType); +typedef void (*CHIPModeSelectClusterCurrentModeAttributeCallbackType)( + void *, chip::app::Clusters::ModeSelect::Attributes::CurrentMode::TypeInfo::DecodableArgType); typedef void (*CHIPModeSelectClusterStartUpModeAttributeCallbackType)( void *, chip::app::Clusters::ModeSelect::Attributes::StartUpMode::TypeInfo::DecodableArgType); -typedef void (*CHIPModeSelectClusterDescriptionAttributeCallbackType)( - void *, chip::app::Clusters::ModeSelect::Attributes::Description::TypeInfo::DecodableArgType); +typedef void (*CHIPModeSelectClusterOnModeAttributeCallbackType)( + void *, chip::app::Clusters::ModeSelect::Attributes::OnMode::TypeInfo::DecodableArgType); typedef void (*CHIPModeSelectClusterGeneratedCommandListAttributeCallbackType)( void *, const chip::app::Clusters::ModeSelect::Attributes::GeneratedCommandList::TypeInfo::DecodableType &); typedef void (*CHIPModeSelectClusterAcceptedCommandListAttributeCallbackType)( void *, const chip::app::Clusters::ModeSelect::Attributes::AcceptedCommandList::TypeInfo::DecodableType &); typedef void (*CHIPModeSelectClusterAttributeListAttributeCallbackType)( void *, const chip::app::Clusters::ModeSelect::Attributes::AttributeList::TypeInfo::DecodableType &); +typedef void (*CHIPModeSelectClusterFeatureMapAttributeCallbackType)( + void *, chip::app::Clusters::ModeSelect::Attributes::FeatureMap::TypeInfo::DecodableArgType); typedef void (*CHIPModeSelectClusterClusterRevisionAttributeCallbackType)( void *, chip::app::Clusters::ModeSelect::Attributes::ClusterRevision::TypeInfo::DecodableArgType); typedef void (*CHIPNetworkCommissioningClusterConnectNetworkResponseCallbackType)( diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index fb6bbb96483f6e..7a1a6d0395f110 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -2620,8 +2620,16 @@ JNI_METHOD(void, ModeSelectCluster, writeOnModeAttribute) std::vector> cleanupByteArrays; std::vector> cleanupStrings; - cppValue = - static_cast>(chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + if (value == nullptr) + { + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + } std::unique_ptr onSuccess( Platform::New(callback), Platform::Delete); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index da5d045ebf991f..a605129092dbef 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -12116,6 +12116,73 @@ void CHIPMediaPlaybackAttributeListAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPModeSelectStandardNamespaceAttributeCallback::CHIPModeSelectStandardNamespaceAttributeCallback(jobject javaCallback, + bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), + keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPModeSelectStandardNamespaceAttributeCallback::~CHIPModeSelectStandardNamespaceAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPModeSelectStandardNamespaceAttributeCallback::CallbackFn(void * context, + const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPModeSelectSupportedModesAttributeCallback::CHIPModeSelectSupportedModesAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) { @@ -12214,6 +12281,134 @@ void CHIPModeSelectSupportedModesAttributeCallback::CallbackFn( env->CallVoidMethod(javaCallbackRef, javaMethod, arrayListObj); } +CHIPModeSelectStartUpModeAttributeCallback::CHIPModeSelectStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPModeSelectStartUpModeAttributeCallback::~CHIPModeSelectStartUpModeAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPModeSelectStartUpModeAttributeCallback::CallbackFn(void * context, const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + +CHIPModeSelectOnModeAttributeCallback::CHIPModeSelectOnModeAttributeCallback(jobject javaCallback, bool keepAlive) : + chip::Callback::Callback(CallbackFn, this), keepAlive(keepAlive) +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + return; + } + + javaCallbackRef = env->NewGlobalRef(javaCallback); + if (javaCallbackRef == nullptr) + { + ChipLogError(Zcl, "Could not create global reference for Java callback"); + } +} + +CHIPModeSelectOnModeAttributeCallback::~CHIPModeSelectOnModeAttributeCallback() +{ + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + if (env == nullptr) + { + ChipLogError(Zcl, "Could not delete global reference for Java callback"); + return; + } + env->DeleteGlobalRef(javaCallbackRef); +} + +void CHIPModeSelectOnModeAttributeCallback::CallbackFn(void * context, const chip::app::DataModel::Nullable & value) +{ + chip::DeviceLayer::StackUnlock unlock; + CHIP_ERROR err = CHIP_NO_ERROR; + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject javaCallbackRef; + + VerifyOrReturn(env != nullptr, ChipLogError(Zcl, "Could not get JNI env")); + std::unique_ptr cppCallback( + reinterpret_cast(context), maybeDestroy); + + // It's valid for javaCallbackRef to be nullptr if the Java code passed in a null callback. + javaCallbackRef = cppCallback.get()->javaCallbackRef; + VerifyOrReturn(javaCallbackRef != nullptr, + ChipLogProgress(Zcl, "Early return from attribute callback since Java callback is null")); + + jmethodID javaMethod; + err = chip::JniReferences::GetInstance().FindMethod(env, javaCallbackRef, "onSuccess", "(Ljava/lang/Integer;)V", &javaMethod); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Could not find onSuccess() method")); + + jobject javaValue; + if (value.IsNull()) + { + javaValue = nullptr; + } + else + { + std::string javaValueClassName = "java/lang/Integer"; + std::string javaValueCtorSignature = "(I)V"; + chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), + value.Value(), javaValue); + } + + env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); +} + CHIPModeSelectGeneratedCommandListAttributeCallback::CHIPModeSelectGeneratedCommandListAttributeCallback(jobject javaCallback, bool keepAlive) : chip::Callback::Callback(CallbackFn, this), diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index 86e2f26577f120..0ee1f7d24d7d2c 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -5036,6 +5036,36 @@ class CHIPMediaPlaybackAttributeListAttributeCallback bool keepAlive; }; +class CHIPModeSelectStandardNamespaceAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPModeSelectStandardNamespaceAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPModeSelectStandardNamespaceAttributeCallback(); + + static void maybeDestroy(CHIPModeSelectStandardNamespaceAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPModeSelectSupportedModesAttributeCallback : public chip::Callback::Callback { @@ -5069,6 +5099,65 @@ class CHIPModeSelectSupportedModesAttributeCallback bool keepAlive; }; +class CHIPModeSelectStartUpModeAttributeCallback + : public chip::Callback::Callback +{ +public: + CHIPModeSelectStartUpModeAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPModeSelectStartUpModeAttributeCallback(); + + static void maybeDestroy(CHIPModeSelectStartUpModeAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + +class CHIPModeSelectOnModeAttributeCallback : public chip::Callback::Callback +{ +public: + CHIPModeSelectOnModeAttributeCallback(jobject javaCallback, bool keepAlive = false); + + ~CHIPModeSelectOnModeAttributeCallback(); + + static void maybeDestroy(CHIPModeSelectOnModeAttributeCallback * callback) + { + if (!callback->keepAlive) + { + callback->Cancel(); + chip::Platform::Delete(callback); + } + } + + static void CallbackFn(void * context, const chip::app::DataModel::Nullable & value); + static void OnSubscriptionEstablished(void * context) + { + CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( + reinterpret_cast(context)->javaCallbackRef); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(Zcl, "Error calling onSubscriptionEstablished: %s", ErrorStr(err))); + }; + +private: + jobject javaCallbackRef; + bool keepAlive; +}; + class CHIPModeSelectGeneratedCommandListAttributeCallback : public chip::Callback::Callback { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index 9d630477075b9b..b591c9b7f39264 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -11053,6 +11053,14 @@ private native void changeToMode( Integer newMode, @Nullable Integer timedInvokeTimeoutMs); + public interface StandardNamespaceAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + public interface SupportedModesAttributeCallback { void onSuccess(List valueList); @@ -11061,6 +11069,22 @@ public interface SupportedModesAttributeCallback { default void onSubscriptionEstablished() {} } + public interface StartUpModeAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + + public interface OnModeAttributeCallback { + void onSuccess(@Nullable Integer value); + + void onError(Exception ex); + + default void onSubscriptionEstablished() {} + } + public interface GeneratedCommandListAttributeCallback { void onSuccess(List valueList); @@ -11085,13 +11109,22 @@ public interface AttributeListAttributeCallback { default void onSubscriptionEstablished() {} } - public void readCurrentModeAttribute(IntegerAttributeCallback callback) { - readCurrentModeAttribute(chipClusterPtr, callback); + public void readDescriptionAttribute(CharStringAttributeCallback callback) { + readDescriptionAttribute(chipClusterPtr, callback); } - public void subscribeCurrentModeAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { - subscribeCurrentModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); + public void subscribeDescriptionAttribute( + CharStringAttributeCallback callback, int minInterval, int maxInterval) { + subscribeDescriptionAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + + public void readStandardNamespaceAttribute(StandardNamespaceAttributeCallback callback) { + readStandardNamespaceAttribute(chipClusterPtr, callback); + } + + public void subscribeStandardNamespaceAttribute( + StandardNamespaceAttributeCallback callback, int minInterval, int maxInterval) { + subscribeStandardNamespaceAttribute(chipClusterPtr, callback, minInterval, maxInterval); } public void readSupportedModesAttribute(SupportedModesAttributeCallback callback) { @@ -11103,40 +11136,40 @@ public void subscribeSupportedModesAttribute( subscribeSupportedModesAttribute(chipClusterPtr, callback, minInterval, maxInterval); } - public void readOnModeAttribute(IntegerAttributeCallback callback) { - readOnModeAttribute(chipClusterPtr, callback); - } - - public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value) { - writeOnModeAttribute(chipClusterPtr, callback, value, null); - } - - public void writeOnModeAttribute( - DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { - writeOnModeAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + public void readCurrentModeAttribute(IntegerAttributeCallback callback) { + readCurrentModeAttribute(chipClusterPtr, callback); } - public void subscribeOnModeAttribute( + public void subscribeCurrentModeAttribute( IntegerAttributeCallback callback, int minInterval, int maxInterval) { - subscribeOnModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); + subscribeCurrentModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); } - public void readStartUpModeAttribute(IntegerAttributeCallback callback) { + public void readStartUpModeAttribute(StartUpModeAttributeCallback callback) { readStartUpModeAttribute(chipClusterPtr, callback); } public void subscribeStartUpModeAttribute( - IntegerAttributeCallback callback, int minInterval, int maxInterval) { + StartUpModeAttributeCallback callback, int minInterval, int maxInterval) { subscribeStartUpModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); } - public void readDescriptionAttribute(CharStringAttributeCallback callback) { - readDescriptionAttribute(chipClusterPtr, callback); + public void readOnModeAttribute(OnModeAttributeCallback callback) { + readOnModeAttribute(chipClusterPtr, callback); } - public void subscribeDescriptionAttribute( - CharStringAttributeCallback callback, int minInterval, int maxInterval) { - subscribeDescriptionAttribute(chipClusterPtr, callback, minInterval, maxInterval); + public void writeOnModeAttribute(DefaultClusterCallback callback, Integer value) { + writeOnModeAttribute(chipClusterPtr, callback, value, null); + } + + public void writeOnModeAttribute( + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + writeOnModeAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + + public void subscribeOnModeAttribute( + OnModeAttributeCallback callback, int minInterval, int maxInterval) { + subscribeOnModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); } public void readGeneratedCommandListAttribute(GeneratedCommandListAttributeCallback callback) { @@ -11166,6 +11199,15 @@ public void subscribeAttributeListAttribute( subscribeAttributeListAttribute(chipClusterPtr, callback, minInterval, maxInterval); } + public void readFeatureMapAttribute(LongAttributeCallback callback) { + readFeatureMapAttribute(chipClusterPtr, callback); + } + + public void subscribeFeatureMapAttribute( + LongAttributeCallback callback, int minInterval, int maxInterval) { + subscribeFeatureMapAttribute(chipClusterPtr, callback, minInterval, maxInterval); + } + public void readClusterRevisionAttribute(IntegerAttributeCallback callback) { readClusterRevisionAttribute(chipClusterPtr, callback); } @@ -11175,11 +11217,23 @@ public void subscribeClusterRevisionAttribute( subscribeClusterRevisionAttribute(chipClusterPtr, callback, minInterval, maxInterval); } - private native void readCurrentModeAttribute( - long chipClusterPtr, IntegerAttributeCallback callback); + private native void readDescriptionAttribute( + long chipClusterPtr, CharStringAttributeCallback callback); - private native void subscribeCurrentModeAttribute( - long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); + private native void subscribeDescriptionAttribute( + long chipClusterPtr, + CharStringAttributeCallback callback, + int minInterval, + int maxInterval); + + private native void readStandardNamespaceAttribute( + long chipClusterPtr, StandardNamespaceAttributeCallback callback); + + private native void subscribeStandardNamespaceAttribute( + long chipClusterPtr, + StandardNamespaceAttributeCallback callback, + int minInterval, + int maxInterval); private native void readSupportedModesAttribute( long chipClusterPtr, SupportedModesAttributeCallback callback); @@ -11190,32 +11244,32 @@ private native void subscribeSupportedModesAttribute( int minInterval, int maxInterval); - private native void readOnModeAttribute(long chipClusterPtr, IntegerAttributeCallback callback); - - private native void writeOnModeAttribute( - long chipClusterPtr, - DefaultClusterCallback callback, - Integer value, - @Nullable Integer timedWriteTimeoutMs); + private native void readCurrentModeAttribute( + long chipClusterPtr, IntegerAttributeCallback callback); - private native void subscribeOnModeAttribute( + private native void subscribeCurrentModeAttribute( long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); private native void readStartUpModeAttribute( - long chipClusterPtr, IntegerAttributeCallback callback); + long chipClusterPtr, StartUpModeAttributeCallback callback); private native void subscribeStartUpModeAttribute( - long chipClusterPtr, IntegerAttributeCallback callback, int minInterval, int maxInterval); - - private native void readDescriptionAttribute( - long chipClusterPtr, CharStringAttributeCallback callback); - - private native void subscribeDescriptionAttribute( long chipClusterPtr, - CharStringAttributeCallback callback, + StartUpModeAttributeCallback callback, int minInterval, int maxInterval); + private native void readOnModeAttribute(long chipClusterPtr, OnModeAttributeCallback callback); + + private native void writeOnModeAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + Integer value, + @Nullable Integer timedWriteTimeoutMs); + + private native void subscribeOnModeAttribute( + long chipClusterPtr, OnModeAttributeCallback callback, int minInterval, int maxInterval); + private native void readGeneratedCommandListAttribute( long chipClusterPtr, GeneratedCommandListAttributeCallback callback); @@ -11243,6 +11297,12 @@ private native void subscribeAttributeListAttribute( int minInterval, int maxInterval); + private native void readFeatureMapAttribute( + long chipClusterPtr, LongAttributeCallback callback); + + private native void subscribeFeatureMapAttribute( + long chipClusterPtr, LongAttributeCallback callback, int minInterval, int maxInterval); + private native void readClusterRevisionAttribute( long chipClusterPtr, IntegerAttributeCallback callback); diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java index b3185a5503cc04..b7fb7d3aec606f 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipIdLookup.java @@ -1433,19 +1433,22 @@ public static String attributeIdToName(long clusterId, long attributeId) { } if (clusterId == 80L) { if (attributeId == 0L) { - return "CurrentMode"; + return "Description"; } if (attributeId == 1L) { - return "SupportedModes"; + return "StandardNamespace"; } if (attributeId == 2L) { - return "OnMode"; + return "SupportedModes"; } if (attributeId == 3L) { - return "StartUpMode"; + return "CurrentMode"; } if (attributeId == 4L) { - return "Description"; + return "StartUpMode"; + } + if (attributeId == 5L) { + return "OnMode"; } if (attributeId == 65528L) { return "GeneratedCommandList"; @@ -1456,6 +1459,9 @@ public static String attributeIdToName(long clusterId, long attributeId) { if (attributeId == 65531L) { return "AttributeList"; } + if (attributeId == 65532L) { + return "FeatureMap"; + } if (attributeId == 65533L) { return "ClusterRevision"; } diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java index d912c0484aa130..cf907dfea85668 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterReadMapping.java @@ -5120,18 +5120,31 @@ public Map> getReadAttributeMap() { "readClusterRevisionAttribute", readMediaPlaybackClusterRevisionAttributeInteractionInfo); readAttributeMap.put("mediaPlayback", readMediaPlaybackInteractionInfo); Map readModeSelectInteractionInfo = new LinkedHashMap<>(); - Map readModeSelectCurrentModeCommandParams = + Map readModeSelectDescriptionCommandParams = new LinkedHashMap(); - InteractionInfo readModeSelectCurrentModeAttributeInteractionInfo = + InteractionInfo readModeSelectDescriptionAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ModeSelectCluster) cluster) - .readCurrentModeAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readDescriptionAttribute((ChipClusters.CharStringAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedCharStringAttributeCallback(), + readModeSelectDescriptionCommandParams); + readModeSelectInteractionInfo.put( + "readDescriptionAttribute", readModeSelectDescriptionAttributeInteractionInfo); + Map readModeSelectStandardNamespaceCommandParams = + new LinkedHashMap(); + InteractionInfo readModeSelectStandardNamespaceAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ModeSelectCluster) cluster) + .readStandardNamespaceAttribute( + (ChipClusters.ModeSelectCluster.StandardNamespaceAttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readModeSelectCurrentModeCommandParams); + readModeSelectStandardNamespaceCommandParams); readModeSelectInteractionInfo.put( - "readCurrentModeAttribute", readModeSelectCurrentModeAttributeInteractionInfo); + "readStandardNamespaceAttribute", readModeSelectStandardNamespaceAttributeInteractionInfo); Map readModeSelectSupportedModesCommandParams = new LinkedHashMap(); InteractionInfo readModeSelectSupportedModesAttributeInteractionInfo = @@ -5146,42 +5159,44 @@ public Map> getReadAttributeMap() { readModeSelectSupportedModesCommandParams); readModeSelectInteractionInfo.put( "readSupportedModesAttribute", readModeSelectSupportedModesAttributeInteractionInfo); - Map readModeSelectOnModeCommandParams = + Map readModeSelectCurrentModeCommandParams = new LinkedHashMap(); - InteractionInfo readModeSelectOnModeAttributeInteractionInfo = + InteractionInfo readModeSelectCurrentModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ModeSelectCluster) cluster) - .readOnModeAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readCurrentModeAttribute((ChipClusters.IntegerAttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), - readModeSelectOnModeCommandParams); + readModeSelectCurrentModeCommandParams); readModeSelectInteractionInfo.put( - "readOnModeAttribute", readModeSelectOnModeAttributeInteractionInfo); + "readCurrentModeAttribute", readModeSelectCurrentModeAttributeInteractionInfo); Map readModeSelectStartUpModeCommandParams = new LinkedHashMap(); InteractionInfo readModeSelectStartUpModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ModeSelectCluster) cluster) - .readStartUpModeAttribute((ChipClusters.IntegerAttributeCallback) callback); + .readStartUpModeAttribute( + (ChipClusters.ModeSelectCluster.StartUpModeAttributeCallback) callback); }, () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), readModeSelectStartUpModeCommandParams); readModeSelectInteractionInfo.put( "readStartUpModeAttribute", readModeSelectStartUpModeAttributeInteractionInfo); - Map readModeSelectDescriptionCommandParams = + Map readModeSelectOnModeCommandParams = new LinkedHashMap(); - InteractionInfo readModeSelectDescriptionAttributeInteractionInfo = + InteractionInfo readModeSelectOnModeAttributeInteractionInfo = new InteractionInfo( (cluster, callback, commandArguments) -> { ((ChipClusters.ModeSelectCluster) cluster) - .readDescriptionAttribute((ChipClusters.CharStringAttributeCallback) callback); + .readOnModeAttribute( + (ChipClusters.ModeSelectCluster.OnModeAttributeCallback) callback); }, - () -> new ClusterInfoMapping.DelegatedCharStringAttributeCallback(), - readModeSelectDescriptionCommandParams); + () -> new ClusterInfoMapping.DelegatedIntegerAttributeCallback(), + readModeSelectOnModeCommandParams); readModeSelectInteractionInfo.put( - "readDescriptionAttribute", readModeSelectDescriptionAttributeInteractionInfo); + "readOnModeAttribute", readModeSelectOnModeAttributeInteractionInfo); Map readModeSelectGeneratedCommandListCommandParams = new LinkedHashMap(); InteractionInfo readModeSelectGeneratedCommandListAttributeInteractionInfo = @@ -5229,6 +5244,18 @@ public Map> getReadAttributeMap() { readModeSelectAttributeListCommandParams); readModeSelectInteractionInfo.put( "readAttributeListAttribute", readModeSelectAttributeListAttributeInteractionInfo); + Map readModeSelectFeatureMapCommandParams = + new LinkedHashMap(); + InteractionInfo readModeSelectFeatureMapAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ModeSelectCluster) cluster) + .readFeatureMapAttribute((ChipClusters.LongAttributeCallback) callback); + }, + () -> new ClusterInfoMapping.DelegatedLongAttributeCallback(), + readModeSelectFeatureMapCommandParams); + readModeSelectInteractionInfo.put( + "readFeatureMapAttribute", readModeSelectFeatureMapAttributeInteractionInfo); Map readModeSelectClusterRevisionCommandParams = new LinkedHashMap(); InteractionInfo readModeSelectClusterRevisionAttributeInteractionInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index de3c329f8ea2ac..532da158fd2628 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -3471,36 +3471,42 @@ class ChipClusters: }, "attributes": { 0x00000000: { - "attributeName": "CurrentMode", + "attributeName": "Description", "attributeId": 0x00000000, - "type": "int", + "type": "str", "reportable": True, }, 0x00000001: { - "attributeName": "SupportedModes", + "attributeName": "StandardNamespace", "attributeId": 0x00000001, - "type": "", + "type": "int", "reportable": True, }, 0x00000002: { - "attributeName": "OnMode", + "attributeName": "SupportedModes", "attributeId": 0x00000002, - "type": "int", + "type": "", "reportable": True, - "writable": True, }, 0x00000003: { - "attributeName": "StartUpMode", + "attributeName": "CurrentMode", "attributeId": 0x00000003, "type": "int", "reportable": True, }, 0x00000004: { - "attributeName": "Description", + "attributeName": "StartUpMode", "attributeId": 0x00000004, - "type": "str", + "type": "int", "reportable": True, }, + 0x00000005: { + "attributeName": "OnMode", + "attributeId": 0x00000005, + "type": "int", + "reportable": True, + "writable": True, + }, 0x0000FFF8: { "attributeName": "GeneratedCommandList", "attributeId": 0x0000FFF8, @@ -3519,6 +3525,12 @@ class ChipClusters: "type": "int", "reportable": True, }, + 0x0000FFFC: { + "attributeName": "FeatureMap", + "attributeId": 0x0000FFFC, + "type": "int", + "reportable": True, + }, 0x0000FFFD: { "attributeName": "ClusterRevision", "attributeId": 0x0000FFFD, diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index cd64d8bd92bbda..d76c0c80695f4b 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -15601,11 +15601,12 @@ class ModeSelect(Cluster): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields = [ - ClusterObjectFieldDescriptor(Label="currentMode", Tag=0x00000000, Type=uint), - ClusterObjectFieldDescriptor(Label="supportedModes", Tag=0x00000001, Type=typing.List[ModeSelect.Structs.ModeOptionStruct]), - ClusterObjectFieldDescriptor(Label="onMode", Tag=0x00000002, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="startUpMode", Tag=0x00000003, Type=uint), - ClusterObjectFieldDescriptor(Label="description", Tag=0x00000004, Type=str), + ClusterObjectFieldDescriptor(Label="description", Tag=0x00000000, Type=str), + ClusterObjectFieldDescriptor(Label="standardNamespace", Tag=0x00000001, Type=typing.Union[Nullable, uint]), + ClusterObjectFieldDescriptor(Label="supportedModes", Tag=0x00000002, Type=typing.List[ModeSelect.Structs.ModeOptionStruct]), + ClusterObjectFieldDescriptor(Label="currentMode", Tag=0x00000003, Type=uint), + ClusterObjectFieldDescriptor(Label="startUpMode", Tag=0x00000004, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="onMode", Tag=0x00000005, Type=typing.Union[None, Nullable, uint]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), @@ -15613,11 +15614,12 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="clusterRevision", Tag=0x0000FFFD, Type=uint), ]) - currentMode: 'uint' = None - supportedModes: 'typing.List[ModeSelect.Structs.ModeOptionStruct]' = None - onMode: 'typing.Optional[uint]' = None - startUpMode: 'uint' = None description: 'str' = None + standardNamespace: 'typing.Union[Nullable, uint]' = None + supportedModes: 'typing.List[ModeSelect.Structs.ModeOptionStruct]' = None + currentMode: 'uint' = None + startUpMode: 'typing.Union[None, Nullable, uint]' = None + onMode: 'typing.Union[None, Nullable, uint]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None attributeList: 'typing.List[uint]' = None @@ -15675,7 +15677,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: class Attributes: @dataclass - class CurrentMode(ClusterAttributeDescriptor): + class Description(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0050 @@ -15686,12 +15688,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=uint) + return ClusterObjectFieldDescriptor(Type=str) - value: 'uint' = 0 + value: 'str' = "" @dataclass - class SupportedModes(ClusterAttributeDescriptor): + class StandardNamespace(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0050 @@ -15702,12 +15704,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.List[ModeSelect.Structs.ModeOptionStruct]) + return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) - value: 'typing.List[ModeSelect.Structs.ModeOptionStruct]' = field(default_factory=lambda: []) + value: 'typing.Union[Nullable, uint]' = NullValue @dataclass - class OnMode(ClusterAttributeDescriptor): + class SupportedModes(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0050 @@ -15718,12 +15720,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + return ClusterObjectFieldDescriptor(Type=typing.List[ModeSelect.Structs.ModeOptionStruct]) - value: 'typing.Optional[uint]' = None + value: 'typing.List[ModeSelect.Structs.ModeOptionStruct]' = field(default_factory=lambda: []) @dataclass - class StartUpMode(ClusterAttributeDescriptor): + class CurrentMode(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0050 @@ -15739,7 +15741,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 @dataclass - class Description(ClusterAttributeDescriptor): + class StartUpMode(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0050 @@ -15750,9 +15752,25 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=str) + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) - value: 'str' = "" + value: 'typing.Union[None, Nullable, uint]' = None + + @dataclass + class OnMode(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0050 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000005 + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + + value: 'typing.Union[None, Nullable, uint]' = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index d79b4446a3e749..37e7f6048f4c69 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -6736,15 +6736,30 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader case Clusters::ModeSelect::Id: { using namespace Clusters::ModeSelect; switch (aPath.mAttributeId) { - case Attributes::CurrentMode::Id: { - using TypeInfo = Attributes::CurrentMode::TypeInfo; + case Attributes::Description::Id: { + using TypeInfo = Attributes::Description::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::StandardNamespace::Id: { + using TypeInfo = Attributes::StandardNamespace::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } return value; } case Attributes::SupportedModes::Id: { @@ -6778,8 +6793,8 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader } return value; } - case Attributes::OnMode::Id: { - using TypeInfo = Attributes::OnMode::TypeInfo; + case Attributes::CurrentMode::Id: { + using TypeInfo = Attributes::CurrentMode::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { @@ -6796,19 +6811,27 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader if (*aError != CHIP_NO_ERROR) { return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } return value; } - case Attributes::Description::Id: { - using TypeInfo = Attributes::Description::TypeInfo; + case Attributes::OnMode::Id: { + using TypeInfo = Attributes::OnMode::TypeInfo; TypeInfo::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); if (*aError != CHIP_NO_ERROR) { return nil; } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } return value; } case Attributes::GeneratedCommandList::Id: { @@ -6889,6 +6912,17 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader } return value; } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } case Attributes::ClusterRevision::Id: { using TypeInfo = Attributes::ClusterRevision::TypeInfo; TypeInfo::DecodableType cppValue; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index c1b010af58cd53..ed6c0e230bc548 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -7177,22 +7177,40 @@ NS_ASSUME_NONNULL_BEGIN - (void)changeToModeWithParams:(CHIPModeSelectClusterChangeToModeParams *)params completionHandler:(StatusCompletion)completionHandler; -- (void)readAttributeCurrentModeWithCompletionHandler:(void (^)( - NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)readAttributeDescriptionWithCompletionHandler:(void (^)( + NSString * _Nullable value, NSError * _Nullable error))completionHandler; /** * This API does not support setting autoResubscribe to NO in the * CHIPSubscribeParams. */ -- (void)subscribeAttributeCurrentModeWithMinInterval:(NSNumber * _Nonnull)minInterval +- (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(CHIPSubscribeParams * _Nullable)params subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; -+ (void)readAttributeCurrentModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeDescriptionWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler: - (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + (void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler; + +- (void)readAttributeStandardNamespaceWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeStandardNamespaceWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeStandardNamespaceWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)readAttributeSupportedModesWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; @@ -7212,21 +7230,22 @@ NS_ASSUME_NONNULL_BEGIN completionHandler: (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; -- (void)readAttributeOnModeWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; -- (void)writeAttributeOnModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)readAttributeCurrentModeWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; /** * This API does not support setting autoResubscribe to NO in the * CHIPSubscribeParams. */ -- (void)subscribeAttributeOnModeWithMinInterval:(NSNumber * _Nonnull)minInterval - maxInterval:(NSNumber * _Nonnull)maxInterval - params:(CHIPSubscribeParams * _Nullable)params - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; -+ (void)readAttributeOnModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer - endpoint:(NSNumber *)endpoint - queue:(dispatch_queue_t)queue - completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeCurrentModeWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeCurrentModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)readAttributeStartUpModeWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; @@ -7245,22 +7264,21 @@ NS_ASSUME_NONNULL_BEGIN completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; -- (void)readAttributeDescriptionWithCompletionHandler:(void (^)( - NSString * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)readAttributeOnModeWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; /** * This API does not support setting autoResubscribe to NO in the * CHIPSubscribeParams. */ -- (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInterval - maxInterval:(NSNumber * _Nonnull)maxInterval - params:(CHIPSubscribeParams * _Nullable)params - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler; -+ (void)readAttributeDescriptionWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer - endpoint:(NSNumber *)endpoint - queue:(dispatch_queue_t)queue - completionHandler: - (void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)subscribeAttributeOnModeWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeOnModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; @@ -7318,6 +7336,23 @@ NS_ASSUME_NONNULL_BEGIN completionHandler: (void (^)(NSArray * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)readAttributeFeatureMapWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +/** + * This API does not support setting autoResubscribe to NO in the + * CHIPSubscribeParams. + */ +- (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler; ++ (void)readAttributeFeatureMapWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; + - (void)readAttributeClusterRevisionWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; /** @@ -15377,6 +15412,10 @@ typedef NS_ENUM(uint8_t, CHIPGroupKeyManagementGroupKeySecurityPolicy) { CHIPGroupKeyManagementGroupKeySecurityPolicyCacheAndSync = 0x01, }; +typedef NS_OPTIONS(uint32_t, CHIPModeSelectFeature) { + CHIPModeSelectFeatureDEPONOFF = 0x1, +}; + typedef NS_ENUM(uint8_t, CHIPDoorLockDlAlarmCode) { CHIPDoorLockDlAlarmCodeLockJammed = 0x00, CHIPDoorLockDlAlarmCodeLockFactoryReset = 0x01, diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 280d1b663da5c9..59abda05bde02f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -26666,58 +26666,121 @@ new CHIPCommandSuccessCallbackBridge( }); } -- (void)readAttributeCurrentModeWithCompletionHandler:(void (^)( - NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeDescriptionWithCompletionHandler:(void (^)( + NSString * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); + new CHIPCharStringAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); } -- (void)subscribeAttributeCurrentModeWithMinInterval:(NSNumber * _Nonnull)minInterval +- (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(CHIPSubscribeParams * _Nullable)params subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler + reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt8uAttributeCallbackSubscriptionBridge( + new CHIPCharStringAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { // We don't support disabling auto-resubscribe. return CHIP_ERROR_INVALID_ARGUMENT; } - using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, subscriptionEstablishedHandler); } -+ (void)readAttributeCurrentModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer ++ (void)readAttributeDescriptionWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer endpoint:(NSNumber *)endpoint queue:(dispatch_queue_t)queue completionHandler: - (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler + (void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + new CHIPCharStringAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { if (attributeCacheContainer.cppAttributeCache) { chip::app::ConcreteAttributePath path; - using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; path.mEndpointId = static_cast([endpoint unsignedShortValue]); path.mClusterId = TypeInfo::GetClusterId(); path.mAttributeId = TypeInfo::GetAttributeId(); TypeInfo::DecodableType value; CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + +- (void)readAttributeStandardNamespaceWithCompletionHandler:(void (^)(NSNumber * _Nullable value, + NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16uAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeStandardNamespaceWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPNullableInt16uAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPNullableInt16uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeStandardNamespaceWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPNullableInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); if (err == CHIP_NO_ERROR) { successFn->mCall(successFn->mContext, value); } @@ -26791,39 +26854,22 @@ new CHIPModeSelectSupportedModesListAttributeCallbackBridge( }); } -- (void)readAttributeOnModeWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeCurrentModeWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); } -- (void)writeAttributeOnModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; - TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - -- (void)subscribeAttributeOnModeWithMinInterval:(NSNumber * _Nonnull)minInterval - maxInterval:(NSNumber * _Nonnull)maxInterval - params:(CHIPSubscribeParams * _Nullable)params - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +- (void)subscribeAttributeCurrentModeWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { new CHIPInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, @@ -26832,7 +26878,7 @@ new CHIPInt8uAttributeCallbackSubscriptionBridge( // We don't support disabling auto-resubscribe. return CHIP_ERROR_INVALID_ARGUMENT; } - using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, @@ -26844,15 +26890,16 @@ new CHIPInt8uAttributeCallbackSubscriptionBridge( subscriptionEstablishedHandler); } -+ (void)readAttributeOnModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer - endpoint:(NSNumber *)endpoint - queue:(dispatch_queue_t)queue - completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeCurrentModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler: + (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { if (attributeCacheContainer.cppAttributeCache) { chip::app::ConcreteAttributePath path; - using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; path.mEndpointId = static_cast([endpoint unsignedShortValue]); path.mClusterId = TypeInfo::GetClusterId(); path.mAttributeId = TypeInfo::GetAttributeId(); @@ -26871,12 +26918,13 @@ new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * su - (void)readAttributeStartUpModeWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPNullableInt8uAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } - (void)subscribeAttributeStartUpModeWithMinInterval:(NSNumber * _Nonnull)minInterval @@ -26885,7 +26933,7 @@ - (void)subscribeAttributeStartUpModeWithMinInterval:(NSNumber * _Nonnull)minInt subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPInt8uAttributeCallbackSubscriptionBridge( + new CHIPNullableInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -26893,11 +26941,11 @@ new CHIPInt8uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -26910,7 +26958,7 @@ + (void)readAttributeStartUpModeWithAttributeCache:(CHIPAttributeCacheContainer completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + new CHIPNullableInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { if (attributeCacheContainer.cppAttributeCache) { chip::app::ConcreteAttributePath path; using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; @@ -26919,7 +26967,7 @@ new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * su path.mAttributeId = TypeInfo::GetAttributeId(); TypeInfo::DecodableType value; CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); if (err == CHIP_NO_ERROR) { successFn->mCall(successFn->mContext, value); } @@ -26929,58 +26977,80 @@ new CHIPInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * su }); } -- (void)readAttributeDescriptionWithCompletionHandler:(void (^)( - NSString * _Nullable value, NSError * _Nullable error))completionHandler +- (void)readAttributeOnModeWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPCharStringAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); - }); + new CHIPNullableInt8uAttributeCallbackBridge( + self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); } -- (void)subscribeAttributeDescriptionWithMinInterval:(NSNumber * _Nonnull)minInterval - maxInterval:(NSNumber * _Nonnull)maxInterval - params:(CHIPSubscribeParams * _Nullable)params - subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler - reportHandler:(void (^)(NSString * _Nullable value, NSError * _Nullable error))reportHandler +- (void)writeAttributeOnModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler { - new CHIPCharStringAttributeCallbackSubscriptionBridge( + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeOnModeWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPNullableInt8uAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { // We don't support disabling auto-resubscribe. return CHIP_ERROR_INVALID_ARGUMENT; } - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; - auto successFn = Callback::FromCancelable(success); + using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPCharStringAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, subscriptionEstablishedHandler); } -+ (void)readAttributeDescriptionWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer - endpoint:(NSNumber *)endpoint - queue:(dispatch_queue_t)queue - completionHandler: - (void (^)(NSString * _Nullable value, NSError * _Nullable error))completionHandler ++ (void)readAttributeOnModeWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPCharStringAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + new CHIPNullableInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { if (attributeCacheContainer.cppAttributeCache) { chip::app::ConcreteAttributePath path; - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; + using TypeInfo = ModeSelect::Attributes::OnMode::TypeInfo; path.mEndpointId = static_cast([endpoint unsignedShortValue]); path.mClusterId = TypeInfo::GetClusterId(); path.mAttributeId = TypeInfo::GetAttributeId(); TypeInfo::DecodableType value; CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); if (err == CHIP_NO_ERROR) { successFn->mCall(successFn->mContext, value); } @@ -27183,6 +27253,66 @@ new CHIPModeSelectAttributeListListAttributeCallbackBridge( }); } +- (void)readAttributeFeatureMapWithCompletionHandler:(void (^)( + NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt32uAttributeCallbackBridge(self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + using TypeInfo = ModeSelect::Attributes::FeatureMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)subscribeAttributeFeatureMapWithMinInterval:(NSNumber * _Nonnull)minInterval + maxInterval:(NSNumber * _Nonnull)maxInterval + params:(CHIPSubscribeParams * _Nullable)params + subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler + reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler +{ + new CHIPInt32uAttributeCallbackSubscriptionBridge( + self.callbackQueue, reportHandler, + ^(Cancelable * success, Cancelable * failure) { + if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { + // We don't support disabling auto-resubscribe. + return CHIP_ERROR_INVALID_ARGUMENT; + } + using TypeInfo = ModeSelect::Attributes::FeatureMap::TypeInfo; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, + [minInterval unsignedShortValue], [maxInterval unsignedShortValue], + CHIPInt32uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], + params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); + }, + subscriptionEstablishedHandler); +} + ++ (void)readAttributeFeatureMapWithAttributeCache:(CHIPAttributeCacheContainer *)attributeCacheContainer + endpoint:(NSNumber *)endpoint + queue:(dispatch_queue_t)queue + completionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler +{ + new CHIPInt32uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = ModeSelect::Attributes::FeatureMap::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; + } + return CHIP_ERROR_NOT_FOUND; + }); +} + - (void)readAttributeClusterRevisionWithCompletionHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h index 85fdde05e6b7fb..c6753ae1bb6de0 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h @@ -697,13 +697,15 @@ NS_ASSUME_NONNULL_BEGIN */ @interface CHIPTestModeSelect : CHIPModeSelect -- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; @end diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 3eea99930f40c3..87bfd9a92e852f 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -9250,7 +9250,7 @@ @implementation CHIPTestModeSelect return &_cppCluster; } -- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -9259,9 +9259,32 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = [self asCharSpan:value]; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedShortValue; + } auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -9309,7 +9332,7 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -9318,7 +9341,7 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; TypeInfo::Type cppValue; cppValue = value.unsignedCharValue; auto successFn = Callback::FromCancelable(success); @@ -9327,7 +9350,7 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -9336,9 +9359,14 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; + using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -9462,6 +9490,24 @@ new CHIPDefaultSuccessCallbackBridge( }); } +- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::FeatureMap::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedIntValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 172fdd10c9f847..180ffae02bacba 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -48739,21 +48739,21 @@ - (void)testSendClusterTestModeSelectCluster_000000_WaitForCommissionee } - (void)testSendClusterTestModeSelectCluster_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentMode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read Description"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentMode Error: %@", err); + [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Description Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + XCTAssertTrue([actualValue isEqualToString:@"Coffee"]); } [expectation fulfill]; @@ -48763,21 +48763,22 @@ - (void)testSendClusterTestModeSelectCluster_000001_ReadAttribute } - (void)testSendClusterTestModeSelectCluster_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read OnMode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read StandardNamespace"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OnMode Error: %@", err); + [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read StandardNamespace Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedShortValue], 0U); } [expectation fulfill]; @@ -48787,21 +48788,30 @@ - (void)testSendClusterTestModeSelectCluster_000002_ReadAttribute } - (void)testSendClusterTestModeSelectCluster_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read StartUpMode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read SupportedModes"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StartUpMode Error: %@", err); + [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read SupportedModes Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + XCTAssertEqual([actualValue count], 3); + XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label isEqualToString:@"Black"]); + XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode unsignedCharValue], 0); + XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag unsignedIntValue], 0UL); + XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label isEqualToString:@"Cappuccino"]); + XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode unsignedCharValue], 4); + XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag unsignedIntValue], 0UL); + XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label isEqualToString:@"Espresso"]); + XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode unsignedCharValue], 7); + XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag unsignedIntValue], 0UL); } [expectation fulfill]; @@ -48811,21 +48821,21 @@ - (void)testSendClusterTestModeSelectCluster_000003_ReadAttribute } - (void)testSendClusterTestModeSelectCluster_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read Description"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentMode"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Description Error: %@", err); + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentMode Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"Coffee"]); + XCTAssertEqual([actualValue unsignedCharValue], 0); } [expectation fulfill]; @@ -48835,30 +48845,22 @@ - (void)testSendClusterTestModeSelectCluster_000004_ReadAttribute } - (void)testSendClusterTestModeSelectCluster_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read SupportedModes"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read StartUpMode"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read SupportedModes Error: %@", err); + [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read StartUpMode Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue count], 3); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label isEqualToString:@"Black"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode unsignedCharValue], 0); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag unsignedIntValue], 0UL); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label isEqualToString:@"Cappuccino"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode unsignedCharValue], 4); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag unsignedIntValue], 0UL); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label isEqualToString:@"Espresso"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode unsignedCharValue], 7); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag unsignedIntValue], 0UL); + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 0); } [expectation fulfill]; @@ -48866,7 +48868,31 @@ - (void)testSendClusterTestModeSelectCluster_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestModeSelectCluster_000006_ChangeToMode +- (void)testSendClusterTestModeSelectCluster_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read OnMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read OnMode Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertTrue(actualValue == nil); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000007_ChangeToMode { XCTestExpectation * expectation = [self expectationWithDescription:@"Change to Supported Mode"]; @@ -48888,7 +48914,8 @@ - (void)testSendClusterTestModeSelectCluster_000006_ChangeToMode [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestModeSelectCluster_000007_ReadAttribute +NSNumber * _Nonnull currentModeBeforeToggle; +- (void)testSendClusterTestModeSelectCluster_000008_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode Change"]; @@ -48906,13 +48933,17 @@ - (void)testSendClusterTestModeSelectCluster_000007_ReadAttribute id actualValue = value; XCTAssertEqual([actualValue unsignedCharValue], 4); } + { + id actualValue = value; + currentModeBeforeToggle = actualValue; + } [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestModeSelectCluster_000008_ChangeToMode +- (void)testSendClusterTestModeSelectCluster_000009_ChangeToMode { XCTestExpectation * expectation = [self expectationWithDescription:@"Change to Unsupported Mode"]; @@ -48933,6 +48964,182 @@ - (void)testSendClusterTestModeSelectCluster_000008_ChangeToMode [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTestModeSelectCluster_000010_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000011_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000012_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode does not change when OnMode is null"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Current Mode does not change when OnMode is null Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqualObjects(actualValue, currentModeBeforeToggle); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000013_WriteAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Change OnMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id onModeArgument; + onModeArgument = [NSNumber numberWithUnsignedChar:7]; + [cluster writeAttributeOnModeWithValue:onModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Change OnMode Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +NSNumber * _Nullable OnModeValue; +- (void)testSendClusterTestModeSelectCluster_000014_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify OnMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify OnMode Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertFalse(actualValue == nil); + XCTAssertEqual([actualValue unsignedCharValue], 7); + } + { + id actualValue = value; + OnModeValue = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000015_Off +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000016_On +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTestModeSelectCluster_000017_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode Changes if OnMode is not null"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Current Mode Changes if OnMode is not null Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqualObjects(actualValue, OnModeValue); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTestBinding_000000_WaitForCommissionee { diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index bbed336be01103..079fa1e2f326d6 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -291,189 +291,192 @@ /* 379 - Description, */ \ 6, 'C', 'o', 'f', 'f', 'e', 'e', \ \ + /* 386 - FeatureMap, */ \ + 0x00, 0x00, 0x00, 0x01, \ + \ /* Endpoint: 1, Cluster: Door Lock (server), big-endian */ \ \ - /* 386 - DoorOpenEvents, */ \ + /* 390 - DoorOpenEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 390 - DoorClosedEvents, */ \ + /* 394 - DoorClosedEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 394 - Language, */ \ + /* 398 - Language, */ \ 2, 'e', 'n', \ \ - /* 397 - AutoRelockTime, */ \ + /* 401 - AutoRelockTime, */ \ 0x00, 0x00, 0x00, 0x60, \ \ - /* 401 - FeatureMap, */ \ + /* 405 - FeatureMap, */ \ 0x00, 0x00, 0x01, 0x03, \ \ /* Endpoint: 1, Cluster: Window Covering (server), big-endian */ \ \ - /* 405 - FeatureMap, */ \ + /* 409 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x17, \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server), big-endian */ \ \ - /* 409 - LifetimeRunningHours, */ \ + /* 413 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 412 - Power, */ \ + /* 416 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 415 - LifetimeEnergyConsumed, */ \ + /* 419 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 419 - FeatureMap, */ \ + /* 423 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Thermostat (server), big-endian */ \ \ - /* 423 - FeatureMap, */ \ + /* 427 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x0B, \ \ /* Endpoint: 1, Cluster: IAS Zone (server), big-endian */ \ \ - /* 427 - IAS CIE address, */ \ + /* 431 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Media Playback (server), big-endian */ \ \ - /* 435 - StartTime, */ \ + /* 439 - StartTime, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, \ \ - /* 443 - Duration, */ \ + /* 447 - Duration, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 451 - PlaybackSpeed, */ \ + /* 455 - PlaybackSpeed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 455 - SeekRangeEnd, */ \ + /* 459 - SeekRangeEnd, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 463 - SeekRangeStart, */ \ + /* 467 - SeekRangeStart, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Content Launcher (server), big-endian */ \ \ - /* 471 - SupportedStreamingProtocols, */ \ + /* 475 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Test Cluster (server), big-endian */ \ \ - /* 475 - bitmap32, */ \ + /* 479 - bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 479 - bitmap64, */ \ + /* 483 - bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 487 - int24u, */ \ + /* 491 - int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 490 - int32u, */ \ + /* 494 - int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 494 - int40u, */ \ + /* 498 - int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 499 - int48u, */ \ + /* 503 - int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 505 - int56u, */ \ + /* 509 - int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 512 - int64u, */ \ + /* 516 - int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 520 - int24s, */ \ + /* 524 - int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 523 - int32s, */ \ + /* 527 - int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 527 - int40s, */ \ + /* 531 - int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 532 - int48s, */ \ + /* 536 - int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 538 - int56s, */ \ + /* 542 - int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 545 - int64s, */ \ + /* 549 - int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 553 - float_single, */ \ + /* 557 - float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 557 - float_double, */ \ + /* 561 - float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 565 - epoch_us, */ \ + /* 569 - epoch_us, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 573 - epoch_s, */ \ + /* 577 - epoch_s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 577 - nullable_bitmap32, */ \ + /* 581 - nullable_bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 581 - nullable_bitmap64, */ \ + /* 585 - nullable_bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 589 - nullable_int24u, */ \ + /* 593 - nullable_int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 592 - nullable_int32u, */ \ + /* 596 - nullable_int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 596 - nullable_int40u, */ \ + /* 600 - nullable_int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 601 - nullable_int48u, */ \ + /* 605 - nullable_int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 607 - nullable_int56u, */ \ + /* 611 - nullable_int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 614 - nullable_int64u, */ \ + /* 618 - nullable_int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 622 - nullable_int24s, */ \ + /* 626 - nullable_int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 625 - nullable_int32s, */ \ + /* 629 - nullable_int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 629 - nullable_int40s, */ \ + /* 633 - nullable_int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 634 - nullable_int48s, */ \ + /* 638 - nullable_int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 640 - nullable_int56s, */ \ + /* 644 - nullable_int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 647 - nullable_int64s, */ \ + /* 651 - nullable_int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 655 - nullable_float_single, */ \ + /* 659 - nullable_float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 659 - nullable_float_double, */ \ + /* 663 - nullable_float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server), big-endian */ \ \ - /* 667 - measurement type, */ \ + /* 671 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 671 - total active power, */ \ + /* 675 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), big-endian */ \ \ - /* 675 - FeatureMap, */ \ + /* 679 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } @@ -743,195 +746,198 @@ /* 379 - Description, */ \ 6, 'C', 'o', 'f', 'f', 'e', 'e', \ \ + /* 386 - FeatureMap, */ \ + 0x01, 0x00, 0x00, 0x00, \ + \ /* Endpoint: 1, Cluster: Door Lock (server), little-endian */ \ \ - /* 386 - DoorOpenEvents, */ \ + /* 390 - DoorOpenEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 390 - DoorClosedEvents, */ \ + /* 394 - DoorClosedEvents, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 394 - Language, */ \ + /* 398 - Language, */ \ 2, 'e', 'n', \ \ - /* 397 - AutoRelockTime, */ \ + /* 401 - AutoRelockTime, */ \ 0x60, 0x00, 0x00, 0x00, \ \ - /* 401 - FeatureMap, */ \ + /* 405 - FeatureMap, */ \ 0x03, 0x01, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Window Covering (server), little-endian */ \ \ - /* 405 - FeatureMap, */ \ + /* 409 - FeatureMap, */ \ 0x17, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server), little-endian */ \ \ - /* 409 - LifetimeRunningHours, */ \ + /* 413 - LifetimeRunningHours, */ \ 0x00, 0x00, 0x00, \ \ - /* 412 - Power, */ \ + /* 416 - Power, */ \ 0x00, 0x00, 0x00, \ \ - /* 415 - LifetimeEnergyConsumed, */ \ + /* 419 - LifetimeEnergyConsumed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 419 - FeatureMap, */ \ + /* 423 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Thermostat (server), little-endian */ \ \ - /* 423 - FeatureMap, */ \ + /* 427 - FeatureMap, */ \ 0x0B, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: IAS Zone (server), little-endian */ \ \ - /* 427 - IAS CIE address, */ \ + /* 431 - IAS CIE address, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Media Playback (server), little-endian */ \ \ - /* 435 - StartTime, */ \ + /* 439 - StartTime, */ \ 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 443 - Duration, */ \ + /* 447 - Duration, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 451 - PlaybackSpeed, */ \ + /* 455 - PlaybackSpeed, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 455 - SeekRangeEnd, */ \ + /* 459 - SeekRangeEnd, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 463 - SeekRangeStart, */ \ + /* 467 - SeekRangeStart, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Content Launcher (server), little-endian */ \ \ - /* 471 - SupportedStreamingProtocols, */ \ + /* 475 - SupportedStreamingProtocols, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Test Cluster (server), little-endian */ \ \ - /* 475 - bitmap32, */ \ + /* 479 - bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 479 - bitmap64, */ \ + /* 483 - bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 487 - int24u, */ \ + /* 491 - int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 490 - int32u, */ \ + /* 494 - int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 494 - int40u, */ \ + /* 498 - int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 499 - int48u, */ \ + /* 503 - int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 505 - int56u, */ \ + /* 509 - int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 512 - int64u, */ \ + /* 516 - int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 520 - int24s, */ \ + /* 524 - int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 523 - int32s, */ \ + /* 527 - int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 527 - int40s, */ \ + /* 531 - int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 532 - int48s, */ \ + /* 536 - int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 538 - int56s, */ \ + /* 542 - int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 545 - int64s, */ \ + /* 549 - int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 553 - float_single, */ \ + /* 557 - float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 557 - float_double, */ \ + /* 561 - float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 565 - epoch_us, */ \ + /* 569 - epoch_us, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 573 - epoch_s, */ \ + /* 577 - epoch_s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 577 - nullable_bitmap32, */ \ + /* 581 - nullable_bitmap32, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 581 - nullable_bitmap64, */ \ + /* 585 - nullable_bitmap64, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 589 - nullable_int24u, */ \ + /* 593 - nullable_int24u, */ \ 0x00, 0x00, 0x00, \ \ - /* 592 - nullable_int32u, */ \ + /* 596 - nullable_int32u, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 596 - nullable_int40u, */ \ + /* 600 - nullable_int40u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 601 - nullable_int48u, */ \ + /* 605 - nullable_int48u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 607 - nullable_int56u, */ \ + /* 611 - nullable_int56u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 614 - nullable_int64u, */ \ + /* 618 - nullable_int64u, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 622 - nullable_int24s, */ \ + /* 626 - nullable_int24s, */ \ 0x00, 0x00, 0x00, \ \ - /* 625 - nullable_int32s, */ \ + /* 629 - nullable_int32s, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 629 - nullable_int40s, */ \ + /* 633 - nullable_int40s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 634 - nullable_int48s, */ \ + /* 638 - nullable_int48s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 640 - nullable_int56s, */ \ + /* 644 - nullable_int56s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 647 - nullable_int64s, */ \ + /* 651 - nullable_int64s, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ - /* 655 - nullable_float_single, */ \ + /* 659 - nullable_float_single, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 659 - nullable_float_double, */ \ + /* 663 - nullable_float_double, */ \ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server), little-endian */ \ \ - /* 667 - measurement type, */ \ + /* 671 - measurement type, */ \ 0x00, 0x00, 0x00, 0x00, \ \ - /* 671 - total active power, */ \ + /* 675 - total active power, */ \ 0x00, 0x00, 0x00, 0x00, \ \ /* Endpoint: 2, Cluster: On/Off (server), little-endian */ \ \ - /* 675 - FeatureMap, */ \ + /* 679 - FeatureMap, */ \ 0x00, 0x00, 0x00, 0x00, \ } #endif // BIGENDIAN_CPU -#define GENERATED_DEFAULTS_COUNT (133) +#define GENERATED_DEFAULTS_COUNT (134) #define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE #define ZAP_LONG_DEFAULTS_INDEX(index) \ @@ -1027,7 +1033,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 629 +#define GENERATED_ATTRIBUTE_COUNT 631 #define GENERATED_ATTRIBUTES \ { \ \ @@ -1340,8 +1346,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: On/Off (server) */ \ - { 0x00000000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \ - { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ + { 0x00000000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0x00) }, /* OnOff */ \ + { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -1442,21 +1448,25 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Mode Select (server) */ \ - { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ - { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ - { 0x00000002, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OnMode */ \ - { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* StartUpMode */ \ - { 0x00000004, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* Description */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* Description */ \ + { 0x00000001, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* StandardNamespace */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(0) }, /* StartUpMode */ \ + { 0x00000005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(386) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(2) }, /* LockState */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* LockType */ \ { 0x00000002, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_EMPTY_DEFAULT() }, /* ActuatorEnabled */ \ { 0x00000003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* DoorState */ \ - { 0x00000004, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(386) }, /* DoorOpenEvents */ \ + { 0x00000004, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(390) }, /* DoorOpenEvents */ \ { 0x00000005, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(390) }, /* DoorClosedEvents */ \ + ZAP_LONG_DEFAULTS_INDEX(394) }, /* DoorClosedEvents */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* OpenPeriod */ \ { 0x00000011, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfTotalUsersSupported */ \ { 0x00000012, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(10) }, /* NumberOfPINUsersSupported */ \ @@ -1469,8 +1479,8 @@ { 0x00000019, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(20) }, /* MaxRFIDCodeLength */ \ { 0x0000001A, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(10) }, /* MinRFIDCodeLength */ \ { 0x0000001B, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* CredentialRulesSupport */ \ - { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(394) }, /* Language */ \ - { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(397) }, /* AutoRelockTime */ \ + { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(398) }, /* Language */ \ + { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(401) }, /* AutoRelockTime */ \ { 0x00000024, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* SoundVolume */ \ { 0x00000025, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -1488,7 +1498,7 @@ ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* UserCodeTemporaryDisableTime */ \ { 0x00000033, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* RequirePINforRemoteOperation */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(401) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(405) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ @@ -1524,7 +1534,7 @@ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(405) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(409) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Barrier Control (server) */ \ @@ -1554,16 +1564,16 @@ { 0x00000013, ZAP_TYPE(INT16S), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Capacity */ \ { 0x00000014, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Speed */ \ { 0x00000015, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(409) }, /* LifetimeRunningHours */ \ - { 0x00000016, ZAP_TYPE(INT24U), 3, 0, ZAP_LONG_DEFAULTS_INDEX(412) }, /* Power */ \ + ZAP_LONG_DEFAULTS_INDEX(413) }, /* LifetimeRunningHours */ \ + { 0x00000016, ZAP_TYPE(INT24U), 3, 0, ZAP_LONG_DEFAULTS_INDEX(416) }, /* Power */ \ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(415) }, /* LifetimeEnergyConsumed */ \ + ZAP_LONG_DEFAULTS_INDEX(419) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(419) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(423) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Thermostat (server) */ \ @@ -1593,7 +1603,7 @@ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(423) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(427) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ @@ -1716,7 +1726,7 @@ { 0x00000001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* zone type */ \ { 0x00000002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* zone status */ \ { 0x00000010, ZAP_TYPE(NODE_ID), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(427) }, /* IAS CIE address */ \ + ZAP_LONG_DEFAULTS_INDEX(431) }, /* IAS CIE address */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* Zone ID */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -1735,11 +1745,11 @@ \ /* Endpoint: 1, Cluster: Media Playback (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* CurrentState */ \ - { 0x00000001, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(435) }, /* StartTime */ \ - { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(443) }, /* Duration */ \ - { 0x00000004, ZAP_TYPE(SINGLE), 4, 0, ZAP_LONG_DEFAULTS_INDEX(451) }, /* PlaybackSpeed */ \ - { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(455) }, /* SeekRangeEnd */ \ - { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(463) }, /* SeekRangeStart */ \ + { 0x00000001, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(439) }, /* StartTime */ \ + { 0x00000002, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(447) }, /* Duration */ \ + { 0x00000004, ZAP_TYPE(SINGLE), 4, 0, ZAP_LONG_DEFAULTS_INDEX(455) }, /* PlaybackSpeed */ \ + { 0x00000005, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(459) }, /* SeekRangeEnd */ \ + { 0x00000006, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_LONG_DEFAULTS_INDEX(467) }, /* SeekRangeStart */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Media Input (server) */ \ @@ -1756,7 +1766,7 @@ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* AcceptHeader */ \ { 0x00000001, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_LONG_DEFAULTS_INDEX(471) }, /* SupportedStreamingProtocols */ \ + ZAP_LONG_DEFAULTS_INDEX(475) }, /* SupportedStreamingProtocols */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Audio Output (server) */ \ @@ -1785,28 +1795,28 @@ { 0x00000000, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(false) }, /* boolean */ \ { 0x00000001, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap8 */ \ { 0x00000002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* bitmap16 */ \ - { 0x00000003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(475) }, /* bitmap32 */ \ - { 0x00000004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(479) }, /* bitmap64 */ \ + { 0x00000003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(479) }, /* bitmap32 */ \ + { 0x00000004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(483) }, /* bitmap64 */ \ { 0x00000005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8u */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16u */ \ - { 0x00000007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(487) }, /* int24u */ \ - { 0x00000008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(490) }, /* int32u */ \ - { 0x00000009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(494) }, /* int40u */ \ - { 0x0000000A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(499) }, /* int48u */ \ - { 0x0000000B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(505) }, /* int56u */ \ - { 0x0000000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(512) }, /* int64u */ \ + { 0x00000007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(491) }, /* int24u */ \ + { 0x00000008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(494) }, /* int32u */ \ + { 0x00000009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(498) }, /* int40u */ \ + { 0x0000000A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(503) }, /* int48u */ \ + { 0x0000000B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(509) }, /* int56u */ \ + { 0x0000000C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(516) }, /* int64u */ \ { 0x0000000D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int8s */ \ { 0x0000000E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* int16s */ \ - { 0x0000000F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(520) }, /* int24s */ \ - { 0x00000010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(523) }, /* int32s */ \ - { 0x00000011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(527) }, /* int40s */ \ - { 0x00000012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(532) }, /* int48s */ \ - { 0x00000013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(538) }, /* int56s */ \ - { 0x00000014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(545) }, /* int64s */ \ + { 0x0000000F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(524) }, /* int24s */ \ + { 0x00000010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(527) }, /* int32s */ \ + { 0x00000011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(531) }, /* int40s */ \ + { 0x00000012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(536) }, /* int48s */ \ + { 0x00000013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(542) }, /* int56s */ \ + { 0x00000014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(549) }, /* int64s */ \ { 0x00000015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum8 */ \ { 0x00000016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* enum16 */ \ - { 0x00000017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(553) }, /* float_single */ \ - { 0x00000018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(557) }, /* float_double */ \ + { 0x00000017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(557) }, /* float_single */ \ + { 0x00000018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(561) }, /* float_double */ \ { 0x00000019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* octet_string */ \ { 0x0000001A, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* list_int8u */ \ @@ -1819,8 +1829,8 @@ { 0x0000001E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* char_string */ \ { 0x0000001F, ZAP_TYPE(LONG_CHAR_STRING), 1002, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* long_char_string */ \ - { 0x00000020, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(565) }, /* epoch_us */ \ - { 0x00000021, ZAP_TYPE(EPOCH_S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(573) }, /* epoch_s */ \ + { 0x00000020, ZAP_TYPE(EPOCH_US), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(569) }, /* epoch_us */ \ + { 0x00000021, ZAP_TYPE(EPOCH_S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(577) }, /* epoch_s */ \ { 0x00000022, ZAP_TYPE(VENDOR_ID), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* vendor_id */ \ { 0x00000023, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* list_nullables_and_optionals_struct */ \ @@ -1852,49 +1862,49 @@ { 0x00008002, ZAP_TYPE(BITMAP16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_bitmap16 */ \ { 0x00008003, ZAP_TYPE(BITMAP32), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(577) }, /* nullable_bitmap32 */ \ + ZAP_LONG_DEFAULTS_INDEX(581) }, /* nullable_bitmap32 */ \ { 0x00008004, ZAP_TYPE(BITMAP64), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(581) }, /* nullable_bitmap64 */ \ + ZAP_LONG_DEFAULTS_INDEX(585) }, /* nullable_bitmap64 */ \ { 0x00008005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8u */ \ { 0x00008006, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16u */ \ { 0x00008007, ZAP_TYPE(INT24U), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(589) }, /* nullable_int24u */ \ + ZAP_LONG_DEFAULTS_INDEX(593) }, /* nullable_int24u */ \ { 0x00008008, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(592) }, /* nullable_int32u */ \ + ZAP_LONG_DEFAULTS_INDEX(596) }, /* nullable_int32u */ \ { 0x00008009, ZAP_TYPE(INT40U), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(596) }, /* nullable_int40u */ \ + ZAP_LONG_DEFAULTS_INDEX(600) }, /* nullable_int40u */ \ { 0x0000800A, ZAP_TYPE(INT48U), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(601) }, /* nullable_int48u */ \ + ZAP_LONG_DEFAULTS_INDEX(605) }, /* nullable_int48u */ \ { 0x0000800B, ZAP_TYPE(INT56U), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(607) }, /* nullable_int56u */ \ + ZAP_LONG_DEFAULTS_INDEX(611) }, /* nullable_int56u */ \ { 0x0000800C, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(614) }, /* nullable_int64u */ \ + ZAP_LONG_DEFAULTS_INDEX(618) }, /* nullable_int64u */ \ { 0x0000800D, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int8s */ \ { 0x0000800E, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_int16s */ \ { 0x0000800F, ZAP_TYPE(INT24S), 3, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(622) }, /* nullable_int24s */ \ + ZAP_LONG_DEFAULTS_INDEX(626) }, /* nullable_int24s */ \ { 0x00008010, ZAP_TYPE(INT32S), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(625) }, /* nullable_int32s */ \ + ZAP_LONG_DEFAULTS_INDEX(629) }, /* nullable_int32s */ \ { 0x00008011, ZAP_TYPE(INT40S), 5, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(629) }, /* nullable_int40s */ \ + ZAP_LONG_DEFAULTS_INDEX(633) }, /* nullable_int40s */ \ { 0x00008012, ZAP_TYPE(INT48S), 6, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(634) }, /* nullable_int48s */ \ + ZAP_LONG_DEFAULTS_INDEX(638) }, /* nullable_int48s */ \ { 0x00008013, ZAP_TYPE(INT56S), 7, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(640) }, /* nullable_int56s */ \ + ZAP_LONG_DEFAULTS_INDEX(644) }, /* nullable_int56s */ \ { 0x00008014, ZAP_TYPE(INT64S), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(647) }, /* nullable_int64s */ \ + ZAP_LONG_DEFAULTS_INDEX(651) }, /* nullable_int64s */ \ { 0x00008015, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum8 */ \ { 0x00008016, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* nullable_enum16 */ \ { 0x00008017, ZAP_TYPE(SINGLE), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(655) }, /* nullable_float_single */ \ + ZAP_LONG_DEFAULTS_INDEX(659) }, /* nullable_float_single */ \ { 0x00008018, ZAP_TYPE(DOUBLE), 8, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_LONG_DEFAULTS_INDEX(659) }, /* nullable_float_double */ \ + ZAP_LONG_DEFAULTS_INDEX(663) }, /* nullable_float_double */ \ { 0x00008019, ZAP_TYPE(OCTET_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* nullable_octet_string */ \ { 0x0000801E, ZAP_TYPE(CHAR_STRING), 11, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -1919,8 +1929,8 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ - { 0x00000000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(667) }, /* measurement type */ \ - { 0x00000304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(671) }, /* total active power */ \ + { 0x00000000, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(671) }, /* measurement type */ \ + { 0x00000304, ZAP_TYPE(INT32S), 4, 0, ZAP_LONG_DEFAULTS_INDEX(675) }, /* total active power */ \ { 0x00000505, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xffff) }, /* rms voltage */ \ { 0x00000506, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* rms voltage min */ \ { 0x00000507, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x8000) }, /* rms voltage max */ \ @@ -1943,7 +1953,7 @@ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OffWaitTime */ \ { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(675) }, /* FeatureMap */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(679) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ @@ -2856,8 +2866,8 @@ /* Endpoint: 1, Cluster: Mode Select (server) */ \ .clusterId = 0x00000050, \ .attributes = ZAP_ATTRIBUTE_INDEX(272), \ - .attributeCount = 6, \ - .clusterSize = 38, \ + .attributeCount = 8, \ + .clusterSize = 44, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 125 ) ,\ @@ -2866,7 +2876,7 @@ { \ /* Endpoint: 1, Cluster: Door Lock (server) */ \ .clusterId = 0x00000101, \ - .attributes = ZAP_ATTRIBUTE_INDEX(278), \ + .attributes = ZAP_ATTRIBUTE_INDEX(280), \ .attributeCount = 32, \ .clusterSize = 54, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2877,7 +2887,7 @@ { \ /* Endpoint: 1, Cluster: Window Covering (server) */ \ .clusterId = 0x00000102, \ - .attributes = ZAP_ATTRIBUTE_INDEX(310), \ + .attributes = ZAP_ATTRIBUTE_INDEX(312), \ .attributeCount = 20, \ .clusterSize = 35, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2888,7 +2898,7 @@ { \ /* Endpoint: 1, Cluster: Barrier Control (server) */ \ .clusterId = 0x00000103, \ - .attributes = ZAP_ATTRIBUTE_INDEX(330), \ + .attributes = ZAP_ATTRIBUTE_INDEX(332), \ .attributeCount = 5, \ .clusterSize = 7, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2899,7 +2909,7 @@ { \ /* Endpoint: 1, Cluster: Pump Configuration and Control (server) */ \ .clusterId = 0x00000200, \ - .attributes = ZAP_ATTRIBUTE_INDEX(335), \ + .attributes = ZAP_ATTRIBUTE_INDEX(337), \ .attributeCount = 26, \ .clusterSize = 54, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2910,7 +2920,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat (server) */ \ .clusterId = 0x00000201, \ - .attributes = ZAP_ATTRIBUTE_INDEX(361), \ + .attributes = ZAP_ATTRIBUTE_INDEX(363), \ .attributeCount = 19, \ .clusterSize = 34, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2921,7 +2931,7 @@ { \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ .clusterId = 0x00000204, \ - .attributes = ZAP_ATTRIBUTE_INDEX(380), \ + .attributes = ZAP_ATTRIBUTE_INDEX(382), \ .attributeCount = 4, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -2932,7 +2942,7 @@ { \ /* Endpoint: 1, Cluster: Color Control (server) */ \ .clusterId = 0x00000300, \ - .attributes = ZAP_ATTRIBUTE_INDEX(384), \ + .attributes = ZAP_ATTRIBUTE_INDEX(386), \ .attributeCount = 53, \ .clusterSize = 341, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -2943,7 +2953,7 @@ { \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ .clusterId = 0x00000400, \ - .attributes = ZAP_ATTRIBUTE_INDEX(437), \ + .attributes = ZAP_ATTRIBUTE_INDEX(439), \ .attributeCount = 6, \ .clusterSize = 11, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2954,7 +2964,7 @@ { \ /* Endpoint: 1, Cluster: Temperature Measurement (server) */ \ .clusterId = 0x00000402, \ - .attributes = ZAP_ATTRIBUTE_INDEX(443), \ + .attributes = ZAP_ATTRIBUTE_INDEX(445), \ .attributeCount = 5, \ .clusterSize = 10, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2965,7 +2975,7 @@ { \ /* Endpoint: 1, Cluster: Pressure Measurement (server) */ \ .clusterId = 0x00000403, \ - .attributes = ZAP_ATTRIBUTE_INDEX(448), \ + .attributes = ZAP_ATTRIBUTE_INDEX(450), \ .attributeCount = 4, \ .clusterSize = 8, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2976,7 +2986,7 @@ { \ /* Endpoint: 1, Cluster: Flow Measurement (server) */ \ .clusterId = 0x00000404, \ - .attributes = ZAP_ATTRIBUTE_INDEX(452), \ + .attributes = ZAP_ATTRIBUTE_INDEX(454), \ .attributeCount = 5, \ .clusterSize = 10, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2987,7 +2997,7 @@ { \ /* Endpoint: 1, Cluster: Relative Humidity Measurement (server) */ \ .clusterId = 0x00000405, \ - .attributes = ZAP_ATTRIBUTE_INDEX(457), \ + .attributes = ZAP_ATTRIBUTE_INDEX(459), \ .attributeCount = 5, \ .clusterSize = 10, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -2998,7 +3008,7 @@ { \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(462), \ + .attributes = ZAP_ATTRIBUTE_INDEX(464), \ .attributeCount = 4, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3009,7 +3019,7 @@ { \ /* Endpoint: 1, Cluster: IAS Zone (server) */ \ .clusterId = 0x00000500, \ - .attributes = ZAP_ATTRIBUTE_INDEX(466), \ + .attributes = ZAP_ATTRIBUTE_INDEX(468), \ .attributeCount = 6, \ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION) | ZAP_CLUSTER_MASK(MESSAGE_SENT_FUNCTION), \ @@ -3020,7 +3030,7 @@ { \ /* Endpoint: 1, Cluster: Wake on LAN (server) */ \ .clusterId = 0x00000503, \ - .attributes = ZAP_ATTRIBUTE_INDEX(472), \ + .attributes = ZAP_ATTRIBUTE_INDEX(474), \ .attributeCount = 2, \ .clusterSize = 35, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3031,7 +3041,7 @@ { \ /* Endpoint: 1, Cluster: Channel (server) */ \ .clusterId = 0x00000504, \ - .attributes = ZAP_ATTRIBUTE_INDEX(474), \ + .attributes = ZAP_ATTRIBUTE_INDEX(476), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3042,7 +3052,7 @@ { \ /* Endpoint: 1, Cluster: Target Navigator (server) */ \ .clusterId = 0x00000505, \ - .attributes = ZAP_ATTRIBUTE_INDEX(476), \ + .attributes = ZAP_ATTRIBUTE_INDEX(478), \ .attributeCount = 3, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3053,7 +3063,7 @@ { \ /* Endpoint: 1, Cluster: Media Playback (server) */ \ .clusterId = 0x00000506, \ - .attributes = ZAP_ATTRIBUTE_INDEX(479), \ + .attributes = ZAP_ATTRIBUTE_INDEX(481), \ .attributeCount = 7, \ .clusterSize = 39, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3064,7 +3074,7 @@ { \ /* Endpoint: 1, Cluster: Media Input (server) */ \ .clusterId = 0x00000507, \ - .attributes = ZAP_ATTRIBUTE_INDEX(486), \ + .attributes = ZAP_ATTRIBUTE_INDEX(488), \ .attributeCount = 3, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3075,7 +3085,7 @@ { \ /* Endpoint: 1, Cluster: Low Power (server) */ \ .clusterId = 0x00000508, \ - .attributes = ZAP_ATTRIBUTE_INDEX(489), \ + .attributes = ZAP_ATTRIBUTE_INDEX(491), \ .attributeCount = 1, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3086,7 +3096,7 @@ { \ /* Endpoint: 1, Cluster: Keypad Input (server) */ \ .clusterId = 0x00000509, \ - .attributes = ZAP_ATTRIBUTE_INDEX(490), \ + .attributes = ZAP_ATTRIBUTE_INDEX(492), \ .attributeCount = 1, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3097,7 +3107,7 @@ { \ /* Endpoint: 1, Cluster: Content Launcher (server) */ \ .clusterId = 0x0000050A, \ - .attributes = ZAP_ATTRIBUTE_INDEX(491), \ + .attributes = ZAP_ATTRIBUTE_INDEX(493), \ .attributeCount = 3, \ .clusterSize = 6, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3108,7 +3118,7 @@ { \ /* Endpoint: 1, Cluster: Audio Output (server) */ \ .clusterId = 0x0000050B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(494), \ + .attributes = ZAP_ATTRIBUTE_INDEX(496), \ .attributeCount = 3, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3119,7 +3129,7 @@ { \ /* Endpoint: 1, Cluster: Application Launcher (server) */ \ .clusterId = 0x0000050C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(497), \ + .attributes = ZAP_ATTRIBUTE_INDEX(499), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3130,7 +3140,7 @@ { \ /* Endpoint: 1, Cluster: Application Basic (server) */ \ .clusterId = 0x0000050D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(499), \ + .attributes = ZAP_ATTRIBUTE_INDEX(501), \ .attributeCount = 8, \ .clusterSize = 106, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3141,7 +3151,7 @@ { \ /* Endpoint: 1, Cluster: Account Login (server) */ \ .clusterId = 0x0000050E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(507), \ + .attributes = ZAP_ATTRIBUTE_INDEX(509), \ .attributeCount = 1, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3152,7 +3162,7 @@ { \ /* Endpoint: 1, Cluster: Test Cluster (server) */ \ .clusterId = 0x0000050F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(508), \ + .attributes = ZAP_ATTRIBUTE_INDEX(510), \ .attributeCount = 81, \ .clusterSize = 2285, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3163,7 +3173,7 @@ { \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ .clusterId = 0x00000B04, \ - .attributes = ZAP_ATTRIBUTE_INDEX(589), \ + .attributes = ZAP_ATTRIBUTE_INDEX(591), \ .attributeCount = 12, \ .clusterSize = 28, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3174,7 +3184,7 @@ { \ /* Endpoint: 2, Cluster: Groups (server) */ \ .clusterId = 0x00000004, \ - .attributes = ZAP_ATTRIBUTE_INDEX(601), \ + .attributes = ZAP_ATTRIBUTE_INDEX(603), \ .attributeCount = 2, \ .clusterSize = 3, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3185,7 +3195,7 @@ { \ /* Endpoint: 2, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(603), \ + .attributes = ZAP_ATTRIBUTE_INDEX(605), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3196,7 +3206,7 @@ { \ /* Endpoint: 2, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(610), \ + .attributes = ZAP_ATTRIBUTE_INDEX(612), \ .attributeCount = 5, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3207,7 +3217,7 @@ { \ /* Endpoint: 2, Cluster: Occupancy Sensing (server) */ \ .clusterId = 0x00000406, \ - .attributes = ZAP_ATTRIBUTE_INDEX(615), \ + .attributes = ZAP_ATTRIBUTE_INDEX(617), \ .attributeCount = 4, \ .clusterSize = 5, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ @@ -3218,7 +3228,7 @@ { \ /* Endpoint: 65534, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(619), \ + .attributes = ZAP_ATTRIBUTE_INDEX(621), \ .attributeCount = 10, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -3237,7 +3247,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 26, 598 }, { ZAP_CLUSTER_INDEX(26), 44, 3319 }, { ZAP_CLUSTER_INDEX(70), 4, 21 }, \ + { ZAP_CLUSTER_INDEX(0), 26, 598 }, { ZAP_CLUSTER_INDEX(26), 44, 3325 }, { ZAP_CLUSTER_INDEX(70), 4, 21 }, \ { ZAP_CLUSTER_INDEX(74), 1, 0 }, \ } @@ -3250,7 +3260,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (39) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (3938) +#define ATTRIBUTE_MAX_SIZE (3944) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (4) diff --git a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h index 0d1ed3f8fd3dde..be05e5d61d1b55 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attribute-id.h +++ b/zzz_generated/app-common/app-common/zap-generated/attribute-id.h @@ -661,11 +661,12 @@ // Client attributes // Server attributes -#define ZCL_CURRENT_MODE_ATTRIBUTE_ID (0x0000) -#define ZCL_SUPPORTED_MODES_ATTRIBUTE_ID (0x0001) -#define ZCL_ON_MODE_ATTRIBUTE_ID (0x0002) -#define ZCL_START_UP_MODE_ATTRIBUTE_ID (0x0003) -#define ZCL_MODE_DESCRIPTION_ATTRIBUTE_ID (0x0004) +#define ZCL_MODE_DESCRIPTION_ATTRIBUTE_ID (0x0000) +#define ZCL_STANDARD_NAMESPACE_ATTRIBUTE_ID (0x0001) +#define ZCL_SUPPORTED_MODES_ATTRIBUTE_ID (0x0002) +#define ZCL_CURRENT_MODE_ATTRIBUTE_ID (0x0003) +#define ZCL_START_UP_MODE_ATTRIBUTE_ID (0x0004) +#define ZCL_ON_MODE_ATTRIBUTE_ID (0x0005) // Attribute ids for cluster: Shade Configuration diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 7bf0f6c52799e8..196bd9a7ffb77e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -13273,38 +13273,90 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace ModeSelect { namespace Attributes { -namespace CurrentMode { +namespace Description { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) { - using Traits = NumericAttributeTraits; + uint8_t zclString[32 + 1]; + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, zclString, sizeof(zclString)); + VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); + size_t length = emberAfStringLength(zclString); + if (length == NumericAttributeTraits::kNullValue) + { + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + } + + VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_DATA_TYPE); + memcpy(value.data(), &zclString[1], 32); + value.reduce_size(length); + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) +{ + static_assert(32 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); + VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + uint8_t zclString[32 + 1]; + emberAfCopyInt8u(zclString, 0, static_cast(value.size())); + memcpy(&zclString[1], value.data(), value.size()); + return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); +} + +} // namespace Description + +namespace StandardNamespace { + +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +{ + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); + return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_ENUM16_ATTRIBUTE_TYPE); } -} // namespace CurrentMode +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_ENUM16_ATTRIBUTE_TYPE); +} -namespace OnMode { +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + +} // namespace StandardNamespace + +namespace CurrentMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { @@ -13333,28 +13385,31 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } -} // namespace OnMode +} // namespace CurrentMode namespace StartUpMode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) + if (Traits::IsNullValue(temp)) { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); } - *value = Traits::StorageToWorking(temp); return status; } EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } @@ -13364,37 +13419,79 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +{ + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); +} + } // namespace StartUpMode -namespace Description { +namespace OnMode { -EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - uint8_t zclString[32 + 1]; - EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, zclString, sizeof(zclString)); + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) + if (Traits::IsNullValue(temp)) + { + value.SetNull(); + } + else + { + value.SetNonNull() = Traits::StorageToWorking(temp); + } + return status; +} +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +{ + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); +} - VerifyOrReturnError(value.size() == 32, EMBER_ZCL_STATUS_INVALID_DATA_TYPE); - memcpy(value.data(), &zclString[1], 32); - value.reduce_size(length); - return status; +EmberAfStatus SetNull(chip::EndpointId endpoint) +{ + using Traits = NumericAttributeTraits; + Traits::StorageType value; + Traits::SetNull(value); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); + return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) + +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) { - static_assert(32 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 32, EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - uint8_t zclString[32 + 1]; - emberAfCopyInt8u(zclString, 0, static_cast(value.size())); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteServerAttribute(endpoint, Clusters::ModeSelect::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); + if (value.IsNull()) + { + return SetNull(endpoint); + } + + return Set(endpoint, value.Value()); } -} // namespace Description +} // namespace OnMode namespace FeatureMap { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index db6e51b8e891ab..59370c671dd012 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -2387,25 +2387,36 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace ModeSelect { namespace Attributes { +namespace Description { +EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value); // char_string +EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value); +} // namespace Description + +namespace StandardNamespace { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // enum16 +EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace StandardNamespace + namespace CurrentMode { EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); } // namespace CurrentMode -namespace OnMode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); -} // namespace OnMode - namespace StartUpMode { -EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int8u EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); } // namespace StartUpMode -namespace Description { -EmberAfStatus Get(chip::EndpointId endpoint, chip::MutableCharSpan value); // char_string -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value); -} // namespace Description +namespace OnMode { +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus SetNull(chip::EndpointId endpoint); +EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +} // namespace OnMode namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index d3207eef9140c3..d37115f911985b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -941,6 +941,12 @@ namespace BooleanState { } // namespace BooleanState namespace ModeSelect { + +// Bitmap for ModeSelectFeature +enum class ModeSelectFeature : uint32_t +{ + kDeponoff = 0x1, +}; } // namespace ModeSelect namespace ShadeConfiguration { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 6402c10a79f0a8..9bb9e4aa96ba8f 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -11696,20 +11696,23 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre { switch (path.mAttributeId) { - case Attributes::CurrentMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); + case Attributes::Description::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, description)); + break; + case Attributes::StandardNamespace::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, standardNamespace)); break; case Attributes::SupportedModes::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, supportedModes)); break; - case Attributes::OnMode::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); + case Attributes::CurrentMode::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, currentMode)); break; case Attributes::StartUpMode::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, startUpMode)); break; - case Attributes::Description::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, description)); + case Attributes::OnMode::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, onMode)); break; case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index 1fb260967210aa..b7aa0cee8eb298 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -16958,18 +16958,31 @@ struct DecodableType namespace Attributes { -namespace CurrentMode { +namespace Description { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::CharSpan; + using DecodableType = chip::CharSpan; + using DecodableArgType = chip::CharSpan; static constexpr ClusterId GetClusterId() { return Clusters::ModeSelect::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::CurrentMode::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::Description::Id; } static constexpr bool MustUseTimedWrite() { return false; } + static constexpr size_t MaxLength() { return 32; } }; -} // namespace CurrentMode +} // namespace Description +namespace StandardNamespace { +struct TypeInfo +{ + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; + + static constexpr ClusterId GetClusterId() { return Clusters::ModeSelect::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::StandardNamespace::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace StandardNamespace namespace SupportedModes { struct TypeInfo { @@ -16984,7 +16997,7 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace SupportedModes -namespace OnMode { +namespace CurrentMode { struct TypeInfo { using Type = uint8_t; @@ -16992,35 +17005,34 @@ struct TypeInfo using DecodableArgType = uint8_t; static constexpr ClusterId GetClusterId() { return Clusters::ModeSelect::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::OnMode::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::CurrentMode::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace OnMode +} // namespace CurrentMode namespace StartUpMode { struct TypeInfo { - using Type = uint8_t; - using DecodableType = uint8_t; - using DecodableArgType = uint8_t; + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; static constexpr ClusterId GetClusterId() { return Clusters::ModeSelect::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::StartUpMode::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace StartUpMode -namespace Description { +namespace OnMode { struct TypeInfo { - using Type = chip::CharSpan; - using DecodableType = chip::CharSpan; - using DecodableArgType = chip::CharSpan; + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; static constexpr ClusterId GetClusterId() { return Clusters::ModeSelect::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::Description::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::OnMode::Id; } static constexpr bool MustUseTimedWrite() { return false; } - static constexpr size_t MaxLength() { return 32; } }; -} // namespace Description +} // namespace OnMode namespace GeneratedCommandList { struct TypeInfo { @@ -17090,11 +17102,12 @@ struct TypeInfo CHIP_ERROR Decode(TLV::TLVReader & reader, const ConcreteAttributePath & path); - Attributes::CurrentMode::TypeInfo::DecodableType currentMode = static_cast(0); - Attributes::SupportedModes::TypeInfo::DecodableType supportedModes; - Attributes::OnMode::TypeInfo::DecodableType onMode = static_cast(0); - Attributes::StartUpMode::TypeInfo::DecodableType startUpMode = static_cast(0); Attributes::Description::TypeInfo::DecodableType description; + Attributes::StandardNamespace::TypeInfo::DecodableType standardNamespace; + Attributes::SupportedModes::TypeInfo::DecodableType supportedModes; + Attributes::CurrentMode::TypeInfo::DecodableType currentMode = static_cast(0); + Attributes::StartUpMode::TypeInfo::DecodableType startUpMode; + Attributes::OnMode::TypeInfo::DecodableType onMode; Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::AttributeList::TypeInfo::DecodableType attributeList; diff --git a/zzz_generated/app-common/app-common/zap-generated/enums.h b/zzz_generated/app-common/app-common/zap-generated/enums.h index 041edefe735bab..e2fd7404f342ba 100644 --- a/zzz_generated/app-common/app-common/zap-generated/enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/enums.h @@ -846,6 +846,8 @@ enum EmberAfWiFiVersionType : uint8_t #define EMBER_AF_MODE_FOR_SEQUENCE_HEAT_SETPOINT_FIELD_PRESENT_OFFSET (0) #define EMBER_AF_MODE_FOR_SEQUENCE_COOL_SETPOINT_FIELD_PRESENT (2) #define EMBER_AF_MODE_FOR_SEQUENCE_COOL_SETPOINT_FIELD_PRESENT_OFFSET (1) +#define EMBER_AF_MODE_SELECT_FEATURE_DEPONOFF (1) +#define EMBER_AF_MODE_SELECT_FEATURE_DEPONOFF_OFFSET (0) #define EMBER_AF_NETWORK_COMMISSIONING_FEATURE_WI_FI_NETWORK_INTERFACE (1) #define EMBER_AF_NETWORK_COMMISSIONING_FEATURE_WI_FI_NETWORK_INTERFACE_OFFSET (0) #define EMBER_AF_NETWORK_COMMISSIONING_FEATURE_THREAD_NETWORK_INTERFACE (2) diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index 5b0a2deac5d8fd..35fc05d30b1f2c 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -2656,25 +2656,29 @@ static constexpr AttributeId Id = Globals::Attributes::ClusterRevision::Id; namespace ModeSelect { namespace Attributes { -namespace CurrentMode { +namespace Description { static constexpr AttributeId Id = 0x00000000; -} // namespace CurrentMode +} // namespace Description -namespace SupportedModes { +namespace StandardNamespace { static constexpr AttributeId Id = 0x00000001; -} // namespace SupportedModes +} // namespace StandardNamespace -namespace OnMode { +namespace SupportedModes { static constexpr AttributeId Id = 0x00000002; -} // namespace OnMode +} // namespace SupportedModes -namespace StartUpMode { +namespace CurrentMode { static constexpr AttributeId Id = 0x00000003; -} // namespace StartUpMode +} // namespace CurrentMode -namespace Description { +namespace StartUpMode { static constexpr AttributeId Id = 0x00000004; -} // namespace Description +} // namespace StartUpMode + +namespace OnMode { +static constexpr AttributeId Id = 0x00000005; +} // namespace OnMode namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h index 85fdde05e6b7fb..c6753ae1bb6de0 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h @@ -697,13 +697,15 @@ NS_ASSUME_NONNULL_BEGIN */ @interface CHIPTestModeSelect : CHIPModeSelect -- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; +- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; @end diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index 3eea99930f40c3..87bfd9a92e852f 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -9250,7 +9250,7 @@ @implementation CHIPTestModeSelect return &_cppCluster; } -- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -9259,9 +9259,32 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; TypeInfo::Type cppValue; - cppValue = value.unsignedCharValue; + cppValue = [self asCharSpan:value]; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + +- (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::StandardNamespace::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedShortValue; + } auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -9309,7 +9332,7 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -9318,7 +9341,7 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; + using TypeInfo = ModeSelect::Attributes::CurrentMode::TypeInfo; TypeInfo::Type cppValue; cppValue = value.unsignedCharValue; auto successFn = Callback::FromCancelable(success); @@ -9327,7 +9350,7 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeDescriptionWithValue:(NSString * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( self.callbackQueue, @@ -9336,9 +9359,14 @@ new CHIPDefaultSuccessCallbackBridge( }, ^(Cancelable * success, Cancelable * failure) { ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::Description::TypeInfo; + using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; TypeInfo::Type cppValue; - cppValue = [self asCharSpan:value]; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); @@ -9462,6 +9490,24 @@ new CHIPDefaultSuccessCallbackBridge( }); } +- (void)writeAttributeFeatureMapWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::FeatureMap::TypeInfo; + TypeInfo::Type cppValue; + cppValue = value.unsignedIntValue; + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)writeAttributeClusterRevisionWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index e31f0207eab1c7..e5b2fae755e46c 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -34568,11 +34568,12 @@ class SubscribeAttributeMediaPlaybackClusterRevision : public ModelCommand { | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * CurrentMode | 0x0000 | -| * SupportedModes | 0x0001 | -| * OnMode | 0x0002 | -| * StartUpMode | 0x0003 | -| * Description | 0x0004 | +| * Description | 0x0000 | +| * StandardNamespace | 0x0001 | +| * SupportedModes | 0x0002 | +| * CurrentMode | 0x0003 | +| * StartUpMode | 0x0004 | +| * OnMode | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -34617,18 +34618,18 @@ class ModeSelectChangeToMode : public ModelCommand { }; /* - * Attribute CurrentMode + * Attribute Description */ -class ReadModeSelectCurrentMode : public ModelCommand { +class ReadModeSelectDescription : public ModelCommand { public: - ReadModeSelectCurrentMode() + ReadModeSelectDescription() : ModelCommand("read") { - AddArgument("attr-name", "current-mode"); + AddArgument("attr-name", "description"); ModelCommand::AddArguments(); } - ~ReadModeSelectCurrentMode() {} + ~ReadModeSelectDescription() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { @@ -34637,30 +34638,30 @@ class ReadModeSelectCurrentMode : public ModelCommand { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block err = CHIP_NO_ERROR; - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.CurrentMode response %@", [value description]); + [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.Description response %@", [value description]); err = [CHIPError errorToCHIPErrorCode:error]; - ChipLogError(chipTool, "ModeSelect CurrentMode Error: %s", chip::ErrorStr(err)); + ChipLogError(chipTool, "ModeSelect Description Error: %s", chip::ErrorStr(err)); SetCommandExitStatus(err); }]; return err; } }; -class SubscribeAttributeModeSelectCurrentMode : public ModelCommand { +class SubscribeAttributeModeSelectDescription : public ModelCommand { public: - SubscribeAttributeModeSelectCurrentMode() + SubscribeAttributeModeSelectDescription() : ModelCommand("subscribe") { - AddArgument("attr-name", "current-mode"); + AddArgument("attr-name", "description"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~SubscribeAttributeModeSelectCurrentMode() {} + ~SubscribeAttributeModeSelectDescription() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { @@ -34668,12 +34669,12 @@ class SubscribeAttributeModeSelectCurrentMode : public ModelCommand { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster subscribeAttributeCurrentModeWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + [cluster subscribeAttributeDescriptionWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] params:params subscriptionEstablished:NULL - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.CurrentMode response %@", [value description]); + reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.Description response %@", [value description]); SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); }]; @@ -34692,18 +34693,18 @@ class SubscribeAttributeModeSelectCurrentMode : public ModelCommand { }; /* - * Attribute SupportedModes + * Attribute StandardNamespace */ -class ReadModeSelectSupportedModes : public ModelCommand { +class ReadModeSelectStandardNamespace : public ModelCommand { public: - ReadModeSelectSupportedModes() + ReadModeSelectStandardNamespace() : ModelCommand("read") { - AddArgument("attr-name", "supported-modes"); + AddArgument("attr-name", "standard-namespace"); ModelCommand::AddArguments(); } - ~ReadModeSelectSupportedModes() {} + ~ReadModeSelectStandardNamespace() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { @@ -34712,30 +34713,30 @@ class ReadModeSelectSupportedModes : public ModelCommand { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block err = CHIP_NO_ERROR; - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.SupportedModes response %@", [value description]); + [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); err = [CHIPError errorToCHIPErrorCode:error]; - ChipLogError(chipTool, "ModeSelect SupportedModes Error: %s", chip::ErrorStr(err)); + ChipLogError(chipTool, "ModeSelect StandardNamespace Error: %s", chip::ErrorStr(err)); SetCommandExitStatus(err); }]; return err; } }; -class SubscribeAttributeModeSelectSupportedModes : public ModelCommand { +class SubscribeAttributeModeSelectStandardNamespace : public ModelCommand { public: - SubscribeAttributeModeSelectSupportedModes() + SubscribeAttributeModeSelectStandardNamespace() : ModelCommand("subscribe") { - AddArgument("attr-name", "supported-modes"); + AddArgument("attr-name", "standard-namespace"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~SubscribeAttributeModeSelectSupportedModes() {} + ~SubscribeAttributeModeSelectStandardNamespace() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { @@ -34743,14 +34744,14 @@ class SubscribeAttributeModeSelectSupportedModes : public ModelCommand { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster subscribeAttributeSupportedModesWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.SupportedModes response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster subscribeAttributeStandardNamespaceWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; return CHIP_NO_ERROR; } @@ -34767,18 +34768,18 @@ class SubscribeAttributeModeSelectSupportedModes : public ModelCommand { }; /* - * Attribute OnMode + * Attribute SupportedModes */ -class ReadModeSelectOnMode : public ModelCommand { +class ReadModeSelectSupportedModes : public ModelCommand { public: - ReadModeSelectOnMode() + ReadModeSelectSupportedModes() : ModelCommand("read") { - AddArgument("attr-name", "on-mode"); + AddArgument("attr-name", "supported-modes"); ModelCommand::AddArguments(); } - ~ReadModeSelectOnMode() {} + ~ReadModeSelectSupportedModes() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { @@ -34787,79 +34788,120 @@ class ReadModeSelectOnMode : public ModelCommand { dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block err = CHIP_NO_ERROR; - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.OnMode response %@", [value description]); + [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.SupportedModes response %@", [value description]); err = [CHIPError errorToCHIPErrorCode:error]; - ChipLogError(chipTool, "ModeSelect OnMode Error: %s", chip::ErrorStr(err)); + ChipLogError(chipTool, "ModeSelect SupportedModes Error: %s", chip::ErrorStr(err)); SetCommandExitStatus(err); }]; return err; } }; -class WriteModeSelectOnMode : public ModelCommand { +class SubscribeAttributeModeSelectSupportedModes : public ModelCommand { public: - WriteModeSelectOnMode() - : ModelCommand("write") + SubscribeAttributeModeSelectSupportedModes() + : ModelCommand("subscribe") { - AddArgument("attr-name", "on-mode"); - AddArgument("attr-value", 0, UINT8_MAX, &mValue); + AddArgument("attr-name", "supported-modes"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~WriteModeSelectOnMode() {} + ~SubscribeAttributeModeSelectSupportedModes() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) WriteAttribute (0x00000002) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000002) on endpoint %" PRIu16, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; - CHIP_ERROR __block err = CHIP_NO_ERROR; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeSupportedModesWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.SupportedModes response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; - NSNumber * _Nonnull value = [NSNumber numberWithUnsignedChar:mValue]; + return CHIP_NO_ERROR; + } - [cluster writeAttributeOnModeWithValue:value - completionHandler:^(NSError * _Nullable error) { - err = [CHIPError errorToCHIPErrorCode:error]; - ChipLogError(chipTool, "ModeSelect OnMode Error: %s", chip::ErrorStr(err)); - SetCommandExitStatus(err); - }]; - return err; + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); } private: - uint8_t mValue; + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; }; -class SubscribeAttributeModeSelectOnMode : public ModelCommand { +/* + * Attribute CurrentMode + */ +class ReadModeSelectCurrentMode : public ModelCommand { public: - SubscribeAttributeModeSelectOnMode() + ReadModeSelectCurrentMode() + : ModelCommand("read") + { + AddArgument("attr-name", "current-mode"); + ModelCommand::AddArguments(); + } + + ~ReadModeSelectCurrentMode() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000003) on endpoint %" PRIu16, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.CurrentMode response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + ChipLogError(chipTool, "ModeSelect CurrentMode Error: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributeModeSelectCurrentMode : public ModelCommand { +public: + SubscribeAttributeModeSelectCurrentMode() : ModelCommand("subscribe") { - AddArgument("attr-name", "on-mode"); + AddArgument("attr-name", "current-mode"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~SubscribeAttributeModeSelectOnMode() {} + ~SubscribeAttributeModeSelectCurrentMode() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000002) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000003) on endpoint %" PRIu16, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster subscribeAttributeOnModeWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.OnMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster subscribeAttributeCurrentModeWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.CurrentMode response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; return CHIP_NO_ERROR; } @@ -34891,7 +34933,7 @@ class ReadModeSelectStartUpMode : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000003) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000004) on endpoint %" PRIu16, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; @@ -34923,7 +34965,7 @@ class SubscribeAttributeModeSelectStartUpMode : public ModelCommand { CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000003) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000004) on endpoint %" PRIu16, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; @@ -34951,65 +34993,99 @@ class SubscribeAttributeModeSelectStartUpMode : public ModelCommand { }; /* - * Attribute Description + * Attribute OnMode */ -class ReadModeSelectDescription : public ModelCommand { +class ReadModeSelectOnMode : public ModelCommand { public: - ReadModeSelectDescription() + ReadModeSelectOnMode() : ModelCommand("read") { - AddArgument("attr-name", "description"); + AddArgument("attr-name", "on-mode"); ModelCommand::AddArguments(); } - ~ReadModeSelectDescription() {} + ~ReadModeSelectOnMode() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000004) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x00000005) on endpoint %" PRIu16, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIP_ERROR __block err = CHIP_NO_ERROR; - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.Description response %@", [value description]); + [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.OnMode response %@", [value description]); err = [CHIPError errorToCHIPErrorCode:error]; - ChipLogError(chipTool, "ModeSelect Description Error: %s", chip::ErrorStr(err)); + ChipLogError(chipTool, "ModeSelect OnMode Error: %s", chip::ErrorStr(err)); SetCommandExitStatus(err); }]; return err; } }; -class SubscribeAttributeModeSelectDescription : public ModelCommand { +class WriteModeSelectOnMode : public ModelCommand { public: - SubscribeAttributeModeSelectDescription() + WriteModeSelectOnMode() + : ModelCommand("write") + { + AddArgument("attr-name", "on-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteModeSelectOnMode() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000050) WriteAttribute (0x00000005) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + + NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeOnModeWithValue:value + completionHandler:^(NSError * _Nullable error) { + err = [CHIPError errorToCHIPErrorCode:error]; + ChipLogError(chipTool, "ModeSelect OnMode Error: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + }]; + return err; + } + +private: + uint8_t mValue; +}; + +class SubscribeAttributeModeSelectOnMode : public ModelCommand { +public: + SubscribeAttributeModeSelectOnMode() : ModelCommand("subscribe") { - AddArgument("attr-name", "description"); + AddArgument("attr-name", "on-mode"); AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); AddArgument("wait", 0, 1, &mWait); ModelCommand::AddArguments(); } - ~SubscribeAttributeModeSelectDescription() {} + ~SubscribeAttributeModeSelectOnMode() {} CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override { - ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000004) on endpoint %" PRIu16, endpointId); + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x00000005) on endpoint %" PRIu16, endpointId); dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster subscribeAttributeDescriptionWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { - NSLog(@"ModeSelect.Description response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster subscribeAttributeOnModeWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.OnMode response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; return CHIP_NO_ERROR; } @@ -35252,6 +35328,81 @@ class SubscribeAttributeModeSelectAttributeList : public ModelCommand { bool mWait; }; +/* + * Attribute FeatureMap + */ +class ReadModeSelectFeatureMap : public ModelCommand { +public: + ReadModeSelectFeatureMap() + : ModelCommand("read") + { + AddArgument("attr-name", "feature-map"); + ModelCommand::AddArguments(); + } + + ~ReadModeSelectFeatureMap() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReadAttribute (0x0000FFFC) on endpoint %" PRIu16, endpointId); + + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.FeatureMap response %@", [value description]); + err = [CHIPError errorToCHIPErrorCode:error]; + + ChipLogError(chipTool, "ModeSelect FeatureMap Error: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + }]; + return err; + } +}; + +class SubscribeAttributeModeSelectFeatureMap : public ModelCommand { +public: + SubscribeAttributeModeSelectFeatureMap() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "feature-map"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeModeSelectFeatureMap() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000050) ReportAttribute (0x0000FFFC) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeFeatureMapWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ModeSelect.FeatureMap response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute ClusterRevision */ @@ -73715,23 +73866,27 @@ void registerClusterModeSelect(Commands & commands) commands_list clusterCommands = { make_unique(), // - make_unique(), // - make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // - make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // }; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 27786ab0031dc5..3e7d79e5cf6b95 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -55829,36 +55829,72 @@ class TestModeSelectCluster : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read CurrentMode\n"); - err = TestReadCurrentMode_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read Description\n"); + err = TestReadDescription_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read OnMode\n"); - err = TestReadOnMode_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read StandardNamespace\n"); + err = TestReadStandardNamespace_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read StartUpMode\n"); - err = TestReadStartUpMode_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read SupportedModes\n"); + err = TestReadSupportedModes_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read Description\n"); - err = TestReadDescription_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentMode\n"); + err = TestReadCurrentMode_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read SupportedModes\n"); - err = TestReadSupportedModes_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read StartUpMode\n"); + err = TestReadStartUpMode_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Change to Supported Mode\n"); - err = TestChangeToSupportedMode_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read OnMode\n"); + err = TestReadOnMode_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Verify Current Mode Change\n"); - err = TestVerifyCurrentModeChange_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Change to Supported Mode\n"); + err = TestChangeToSupportedMode_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Change to Unsupported Mode\n"); - err = TestChangeToUnsupportedMode_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Verify Current Mode Change\n"); + err = TestVerifyCurrentModeChange_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Change to Unsupported Mode\n"); + err = TestChangeToUnsupportedMode_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Toggle OnOff\n"); + err = TestToggleOnOff_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Toggle OnOff\n"); + err = TestToggleOnOff_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Verify Current Mode does not change when OnMode is null\n"); + err = TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Change OnMode\n"); + err = TestChangeOnMode_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Verify OnMode\n"); + err = TestVerifyOnMode_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Toggle OnOff\n"); + err = TestToggleOnOff_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Toggle OnOff\n"); + err = TestToggleOnOff_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Verify Current Mode Changes if OnMode is not null\n"); + err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_17(); break; } @@ -55875,7 +55911,7 @@ class TestModeSelectCluster : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; @@ -55888,20 +55924,20 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadCurrentMode_1() + CHIP_ERROR TestReadDescription_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentMode Error: %@", err); + [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read Description Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, 0)); + VerifyOrReturn(CheckValueAsString("Description", actualValue, @"Coffee")); } NextTest(); @@ -55910,20 +55946,21 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadOnMode_2() + CHIP_ERROR TestReadStandardNamespace_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OnMode Error: %@", err); + [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read StandardNamespace Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("OnMode", actualValue, 0)); + VerifyOrReturn(CheckValueNonNull("StandardNamespace", actualValue)); + VerifyOrReturn(CheckValue("StandardNamespace", actualValue, 0U)); } NextTest(); @@ -55932,20 +55969,35 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadStartUpMode_3() + CHIP_ERROR TestReadSupportedModes_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StartUpMode Error: %@", err); + [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read SupportedModes Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("StartUpMode", actualValue, 0)); + VerifyOrReturn(CheckValue("SupportedModes", [actualValue count], static_cast(3))); + VerifyOrReturn( + CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label, @"Black")); + VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode, 0)); + VerifyOrReturn( + CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag, 0UL)); + VerifyOrReturn( + CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label, @"Cappuccino")); + VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode, 4)); + VerifyOrReturn( + CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag, 0UL)); + VerifyOrReturn( + CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label, @"Espresso")); + VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode, 7)); + VerifyOrReturn( + CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag, 0UL)); } NextTest(); @@ -55954,20 +56006,20 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadDescription_4() + CHIP_ERROR TestReadCurrentMode_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Description Error: %@", err); + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read CurrentMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValueAsString("Description", actualValue, @"Coffee")); + VerifyOrReturn(CheckValue("CurrentMode", actualValue, 0)); } NextTest(); @@ -55976,35 +56028,43 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadSupportedModes_5() + CHIP_ERROR TestReadStartUpMode_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read SupportedModes Error: %@", err); + [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read StartUpMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); { id actualValue = value; - VerifyOrReturn(CheckValue("SupportedModes", [actualValue count], static_cast(3))); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label, @"Black")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode, 0)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag, 0UL)); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label, @"Cappuccino")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode, 4)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag, 0UL)); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label, @"Espresso")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode, 7)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag, 0UL)); + VerifyOrReturn(CheckValueNonNull("StartUpMode", actualValue)); + VerifyOrReturn(CheckValue("StartUpMode", actualValue, 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadOnMode_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read OnMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNull("OnMode", actualValue)); } NextTest(); @@ -56013,7 +56073,7 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestChangeToSupportedMode_6() + CHIP_ERROR TestChangeToSupportedMode_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -56032,8 +56092,9 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull currentModeBeforeToggle; - CHIP_ERROR TestVerifyCurrentModeChange_7() + CHIP_ERROR TestVerifyCurrentModeChange_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -56048,6 +56109,9 @@ class TestModeSelectCluster : public TestCommandBridge { id actualValue = value; VerifyOrReturn(CheckValue("CurrentMode", actualValue, 4)); } + { + currentModeBeforeToggle = value; + } NextTest(); }]; @@ -56055,7 +56119,7 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestChangeToUnsupportedMode_8() + CHIP_ERROR TestChangeToUnsupportedMode_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -56073,6 +56137,165 @@ class TestModeSelectCluster : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestToggleOnOff_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestToggleOnOff_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Current Mode does not change when OnMode is null Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("CurrentMode", actualValue, currentModeBeforeToggle)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestChangeOnMode_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id onModeArgument; + onModeArgument = [NSNumber numberWithUnsignedChar:7]; + [cluster writeAttributeOnModeWithValue:onModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Change OnMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nullable OnModeValue; + + CHIP_ERROR TestVerifyOnMode_14() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify OnMode Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("OnMode", actualValue)); + VerifyOrReturn(CheckValue("OnMode", actualValue, 7)); + } + { + OnModeValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestToggleOnOff_15() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster offWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestToggleOnOff_16() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster onWithCompletionHandler:^(NSError * _Nullable err) { + NSLog(@"Toggle OnOff Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestVerifyCurrentModeChangesIfOnModeIsNotNull_17() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Verify Current Mode Changes if OnMode is not null Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("CurrentMode", actualValue, OnModeValue)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class TestBinding : public TestCommandBridge { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index ed13027280c22d..747637defbc220 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7153,11 +7153,12 @@ class WriteUserLabelLabelList : public WriteAttribute | * ChangeToMode | 0x00 | |------------------------------------------------------------------------------| | Attributes: | | -| * CurrentMode | 0x0000 | -| * SupportedModes | 0x0001 | -| * OnMode | 0x0002 | -| * StartUpMode | 0x0003 | -| * Description | 0x0004 | +| * Description | 0x0000 | +| * StandardNamespace | 0x0001 | +| * SupportedModes | 0x0002 | +| * CurrentMode | 0x0003 | +| * StartUpMode | 0x0004 | +| * OnMode | 0x0005 | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * AttributeList | 0xFFFB | @@ -7211,16 +7212,16 @@ class WriteModeSelectOnMode : public WriteAttribute CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override { - return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x00000050, 0x00000002, mValue); + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x00000050, 0x00000005, mValue); } CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex, chip::NodeId senderNodeId) override { - return WriteAttribute::SendGroupCommand(groupId, fabricIndex, senderNodeId, 0x00000050, 0x00000002, mValue); + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, senderNodeId, 0x00000050, 0x00000005, mValue); } private: - uint8_t mValue; + chip::app::DataModel::Nullable mValue; }; /*----------------------------------------------------------------------------*\ @@ -21783,11 +21784,12 @@ void registerClusterModeSelect(Commands & commands, CredentialIssuerCommands * c // Attributes // make_unique(Id, credsIssuerConfig), // - make_unique(Id, "current-mode", Attributes::CurrentMode::Id, credsIssuerConfig), // + make_unique(Id, "description", Attributes::Description::Id, credsIssuerConfig), // + make_unique(Id, "standard-namespace", Attributes::StandardNamespace::Id, credsIssuerConfig), // make_unique(Id, "supported-modes", Attributes::SupportedModes::Id, credsIssuerConfig), // - make_unique(Id, "on-mode", Attributes::OnMode::Id, credsIssuerConfig), // + make_unique(Id, "current-mode", Attributes::CurrentMode::Id, credsIssuerConfig), // make_unique(Id, "start-up-mode", Attributes::StartUpMode::Id, credsIssuerConfig), // - make_unique(Id, "description", Attributes::Description::Id, credsIssuerConfig), // + make_unique(Id, "on-mode", Attributes::OnMode::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // @@ -21796,11 +21798,12 @@ void registerClusterModeSelect(Commands & commands, CredentialIssuerCommands * c make_unique(Id, credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // - make_unique(Id, "current-mode", Attributes::CurrentMode::Id, credsIssuerConfig), // + make_unique(Id, "description", Attributes::Description::Id, credsIssuerConfig), // + make_unique(Id, "standard-namespace", Attributes::StandardNamespace::Id, credsIssuerConfig), // make_unique(Id, "supported-modes", Attributes::SupportedModes::Id, credsIssuerConfig), // - make_unique(Id, "on-mode", Attributes::OnMode::Id, credsIssuerConfig), // + make_unique(Id, "current-mode", Attributes::CurrentMode::Id, credsIssuerConfig), // make_unique(Id, "start-up-mode", Attributes::StartUpMode::Id, credsIssuerConfig), // - make_unique(Id, "description", Attributes::Description::Id, credsIssuerConfig), // + make_unique(Id, "on-mode", Attributes::OnMode::Id, credsIssuerConfig), // make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 15733702d14e41..befae0228c0eae 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -7243,30 +7243,35 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP case ModeSelect::Id: { switch (path.mAttributeId) { - case ModeSelect::Attributes::CurrentMode::Id: { - uint8_t value; + case ModeSelect::Attributes::Description::Id: { + chip::CharSpan value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("CurrentMode", 1, value); + return DataModelLogger::LogValue("Description", 1, value); + } + case ModeSelect::Attributes::StandardNamespace::Id: { + chip::app::DataModel::Nullable value; + ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); + return DataModelLogger::LogValue("StandardNamespace", 1, value); } case ModeSelect::Attributes::SupportedModes::Id: { chip::app::DataModel::DecodableList value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("SupportedModes", 1, value); } - case ModeSelect::Attributes::OnMode::Id: { + case ModeSelect::Attributes::CurrentMode::Id: { uint8_t value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("OnMode", 1, value); + return DataModelLogger::LogValue("CurrentMode", 1, value); } case ModeSelect::Attributes::StartUpMode::Id: { - uint8_t value; + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("StartUpMode", 1, value); } - case ModeSelect::Attributes::Description::Id: { - chip::CharSpan value; + case ModeSelect::Attributes::OnMode::Id: { + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); - return DataModelLogger::LogValue("Description", 1, value); + return DataModelLogger::LogValue("OnMode", 1, value); } case ModeSelect::Attributes::GeneratedCommandList::Id: { chip::app::DataModel::DecodableList value; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index b864c52c471460..e1d3c5f98bbc09 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -90204,36 +90204,72 @@ class TestModeSelectClusterSuite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Read CurrentMode\n"); - err = TestReadCurrentMode_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read Description\n"); + err = TestReadDescription_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read OnMode\n"); - err = TestReadOnMode_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read StandardNamespace\n"); + err = TestReadStandardNamespace_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read StartUpMode\n"); - err = TestReadStartUpMode_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read SupportedModes\n"); + err = TestReadSupportedModes_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read Description\n"); - err = TestReadDescription_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentMode\n"); + err = TestReadCurrentMode_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read SupportedModes\n"); - err = TestReadSupportedModes_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read StartUpMode\n"); + err = TestReadStartUpMode_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Change to Supported Mode\n"); - err = TestChangeToSupportedMode_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read OnMode\n"); + err = TestReadOnMode_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Verify Current Mode Change\n"); - err = TestVerifyCurrentModeChange_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Change to Supported Mode\n"); + err = TestChangeToSupportedMode_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Change to Unsupported Mode\n"); - err = TestChangeToUnsupportedMode_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Verify Current Mode Change\n"); + err = TestVerifyCurrentModeChange_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Change to Unsupported Mode\n"); + err = TestChangeToUnsupportedMode_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Toggle OnOff\n"); + err = TestToggleOnOff_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Toggle OnOff\n"); + err = TestToggleOnOff_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Verify Current Mode does not change when OnMode is null\n"); + err = TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Change OnMode\n"); + err = TestChangeOnMode_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Verify OnMode\n"); + err = TestVerifyOnMode_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Toggle OnOff\n"); + err = TestToggleOnOff_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Toggle OnOff\n"); + err = TestToggleOnOff_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Verify Current Mode Changes if OnMode is not null\n"); + err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_17(); break; } @@ -90251,13 +90287,16 @@ class TestModeSelectClusterSuite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 9; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + uint8_t currentModeBeforeToggle; + chip::app::DataModel::Nullable OnModeValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override { bool isExpectedDnssdResult = false; @@ -90271,9 +90310,9 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnFailureResponse_1(error); } - static void OnSuccessCallback_1(void * context, uint8_t currentMode) + static void OnSuccessCallback_1(void * context, chip::CharSpan description) { - (static_cast(context))->OnSuccessResponse_1(currentMode); + (static_cast(context))->OnSuccessResponse_1(description); } static void OnFailureCallback_2(void * context, CHIP_ERROR error) @@ -90281,9 +90320,9 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, uint8_t onMode) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & standardNamespace) { - (static_cast(context))->OnSuccessResponse_2(onMode); + (static_cast(context))->OnSuccessResponse_2(standardNamespace); } static void OnFailureCallback_3(void * context, CHIP_ERROR error) @@ -90291,9 +90330,12 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context, uint8_t startUpMode) + static void OnSuccessCallback_3( + void * context, + const chip::app::DataModel::DecodableList & + supportedModes) { - (static_cast(context))->OnSuccessResponse_3(startUpMode); + (static_cast(context))->OnSuccessResponse_3(supportedModes); } static void OnFailureCallback_4(void * context, CHIP_ERROR error) @@ -90301,9 +90343,9 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context, chip::CharSpan description) + static void OnSuccessCallback_4(void * context, uint8_t currentMode) { - (static_cast(context))->OnSuccessResponse_4(description); + (static_cast(context))->OnSuccessResponse_4(currentMode); } static void OnFailureCallback_5(void * context, CHIP_ERROR error) @@ -90311,22 +90353,69 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnFailureResponse_5(error); } - static void OnSuccessCallback_5( - void * context, - const chip::app::DataModel::DecodableList & - supportedModes) + static void OnSuccessCallback_5(void * context, const chip::app::DataModel::Nullable & startUpMode) { - (static_cast(context))->OnSuccessResponse_5(supportedModes); + (static_cast(context))->OnSuccessResponse_5(startUpMode); } - static void OnFailureCallback_7(void * context, CHIP_ERROR error) + static void OnFailureCallback_6(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_6(error); + } + + static void OnSuccessCallback_6(void * context, const chip::app::DataModel::Nullable & onMode) + { + (static_cast(context))->OnSuccessResponse_6(onMode); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8(void * context, uint8_t currentMode) + { + (static_cast(context))->OnSuccessResponse_8(currentMode); + } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context, uint8_t currentMode) { - (static_cast(context))->OnFailureResponse_7(error); + (static_cast(context))->OnSuccessResponse_12(currentMode); } - static void OnSuccessCallback_7(void * context, uint8_t currentMode) + static void OnFailureCallback_13(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_13(error); + } + + static void OnSuccessCallback_13(void * context) { - (static_cast(context))->OnSuccessResponse_7(currentMode); + (static_cast(context))->OnSuccessResponse_13(); + } + + static void OnFailureCallback_14(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_14(error); + } + + static void OnSuccessCallback_14(void * context, const chip::app::DataModel::Nullable & onMode) + { + (static_cast(context))->OnSuccessResponse_14(onMode); + } + + static void OnFailureCallback_17(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_17(error); + } + + static void OnSuccessCallback_17(void * context, uint8_t currentMode) + { + (static_cast(context))->OnSuccessResponse_17(currentMode); } // @@ -90339,13 +90428,13 @@ class TestModeSelectClusterSuite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadCurrentMode_1() + CHIP_ERROR TestReadDescription_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } @@ -90356,20 +90445,20 @@ class TestModeSelectClusterSuite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t currentMode) + void OnSuccessResponse_1(chip::CharSpan description) { - VerifyOrReturn(CheckValue("currentMode", currentMode, 0)); + VerifyOrReturn(CheckValueAsString("description", description, chip::CharSpan("Coffee", 6))); NextTest(); } - CHIP_ERROR TestReadOnMode_2() + CHIP_ERROR TestReadStandardNamespace_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } @@ -90380,20 +90469,21 @@ class TestModeSelectClusterSuite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t onMode) + void OnSuccessResponse_2(const chip::app::DataModel::Nullable & standardNamespace) { - VerifyOrReturn(CheckValue("onMode", onMode, 0)); + VerifyOrReturn(CheckValueNonNull("standardNamespace", standardNamespace)); + VerifyOrReturn(CheckValue("standardNamespace.Value()", standardNamespace.Value(), 0U)); NextTest(); } - CHIP_ERROR TestReadStartUpMode_3() + CHIP_ERROR TestReadSupportedModes_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } @@ -90404,20 +90494,38 @@ class TestModeSelectClusterSuite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_3(uint8_t startUpMode) + void OnSuccessResponse_3( + const chip::app::DataModel::DecodableList & + supportedModes) { - VerifyOrReturn(CheckValue("startUpMode", startUpMode, 0)); + { + auto iter_0 = supportedModes.begin(); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("supportedModes[0].label", iter_0.GetValue().label, chip::CharSpan("Black", 5))); + VerifyOrReturn(CheckValue("supportedModes[0].mode", iter_0.GetValue().mode, 0)); + VerifyOrReturn(CheckValue("supportedModes[0].semanticTag", iter_0.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 1)); + VerifyOrReturn( + CheckValueAsString("supportedModes[1].label", iter_0.GetValue().label, chip::CharSpan("Cappuccino", 10))); + VerifyOrReturn(CheckValue("supportedModes[1].mode", iter_0.GetValue().mode, 4)); + VerifyOrReturn(CheckValue("supportedModes[1].semanticTag", iter_0.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 2)); + VerifyOrReturn(CheckValueAsString("supportedModes[2].label", iter_0.GetValue().label, chip::CharSpan("Espresso", 8))); + VerifyOrReturn(CheckValue("supportedModes[2].mode", iter_0.GetValue().mode, 7)); + VerifyOrReturn(CheckValue("supportedModes[2].semanticTag", iter_0.GetValue().semanticTag, 0UL)); + VerifyOrReturn(CheckNoMoreListItems("supportedModes", iter_0, 3)); + } NextTest(); } - CHIP_ERROR TestReadDescription_4() + CHIP_ERROR TestReadCurrentMode_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } @@ -90428,20 +90536,20 @@ class TestModeSelectClusterSuite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_4(chip::CharSpan description) + void OnSuccessResponse_4(uint8_t currentMode) { - VerifyOrReturn(CheckValueAsString("description", description, chip::CharSpan("Coffee", 6))); + VerifyOrReturn(CheckValue("currentMode", currentMode, 0)); NextTest(); } - CHIP_ERROR TestReadSupportedModes_5() + CHIP_ERROR TestReadStartUpMode_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_5, OnFailureCallback_5, true)); return CHIP_NO_ERROR; } @@ -90452,32 +90560,39 @@ class TestModeSelectClusterSuite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_5( - const chip::app::DataModel::DecodableList & - supportedModes) + void OnSuccessResponse_5(const chip::app::DataModel::Nullable & startUpMode) { - { - auto iter_0 = supportedModes.begin(); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 0)); - VerifyOrReturn(CheckValueAsString("supportedModes[0].label", iter_0.GetValue().label, chip::CharSpan("Black", 5))); - VerifyOrReturn(CheckValue("supportedModes[0].mode", iter_0.GetValue().mode, 0)); - VerifyOrReturn(CheckValue("supportedModes[0].semanticTag", iter_0.GetValue().semanticTag, 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 1)); - VerifyOrReturn( - CheckValueAsString("supportedModes[1].label", iter_0.GetValue().label, chip::CharSpan("Cappuccino", 10))); - VerifyOrReturn(CheckValue("supportedModes[1].mode", iter_0.GetValue().mode, 4)); - VerifyOrReturn(CheckValue("supportedModes[1].semanticTag", iter_0.GetValue().semanticTag, 0UL)); - VerifyOrReturn(CheckNextListItemDecodes("supportedModes", iter_0, 2)); - VerifyOrReturn(CheckValueAsString("supportedModes[2].label", iter_0.GetValue().label, chip::CharSpan("Espresso", 8))); - VerifyOrReturn(CheckValue("supportedModes[2].mode", iter_0.GetValue().mode, 7)); - VerifyOrReturn(CheckValue("supportedModes[2].semanticTag", iter_0.GetValue().semanticTag, 0UL)); - VerifyOrReturn(CheckNoMoreListItems("supportedModes", iter_0, 3)); - } + VerifyOrReturn(CheckValueNonNull("startUpMode", startUpMode)); + VerifyOrReturn(CheckValue("startUpMode.Value()", startUpMode.Value(), 0)); + + NextTest(); + } + + CHIP_ERROR TestReadOnMode_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_6(const chip::app::DataModel::Nullable & onMode) + { + VerifyOrReturn(CheckValueNull("onMode", onMode)); NextTest(); } - CHIP_ERROR TestChangeToSupportedMode_6() + CHIP_ERROR TestChangeToSupportedMode_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; @@ -90486,50 +90601,51 @@ class TestModeSelectClusterSuite : public TestCommand request.newMode = 4; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_6(); + (static_cast(context))->OnSuccessResponse_7(); }; auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_6(error); + (static_cast(context))->OnFailureResponse_7(error); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_6(CHIP_ERROR error) + void OnFailureResponse_7(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_6() { NextTest(); } + void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestVerifyCurrentModeChange_7() + CHIP_ERROR TestVerifyCurrentModeChange_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ModeSelectClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); + this, OnSuccessCallback_8, OnFailureCallback_8, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(CHIP_ERROR error) + void OnFailureResponse_8(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_7(uint8_t currentMode) + void OnSuccessResponse_8(uint8_t currentMode) { VerifyOrReturn(CheckValue("currentMode", currentMode, 4)); + currentModeBeforeToggle = currentMode; NextTest(); } - CHIP_ERROR TestChangeToUnsupportedMode_8() + CHIP_ERROR TestChangeToUnsupportedMode_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; @@ -90538,25 +90654,230 @@ class TestModeSelectClusterSuite : public TestCommand request.newMode = 2; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); + (static_cast(context))->OnSuccessResponse_9(); }; auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); + (static_cast(context))->OnFailureResponse_9(error); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_8(CHIP_ERROR error) + void OnFailureResponse_9(CHIP_ERROR error) { chip::app::StatusIB status(error); VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); NextTest(); } - void OnSuccessResponse_8() { ThrowSuccessResponse(); } + void OnSuccessResponse_9() { ThrowSuccessResponse(); } + + CHIP_ERROR TestToggleOnOff_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_10(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_10(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_10() { NextTest(); } + + CHIP_ERROR TestToggleOnOff_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_11(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_11(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_12(uint8_t currentMode) + { + VerifyOrReturn(CheckValue("currentMode", currentMode, currentModeBeforeToggle)); + + NextTest(); + } + + CHIP_ERROR TestChangeOnMode_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::Nullable onModeArgument; + onModeArgument.SetNonNull(); + onModeArgument.Value() = 7; + + ReturnErrorOnFailure(cluster.WriteAttribute( + onModeArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_13() { NextTest(); } + + CHIP_ERROR TestVerifyOnMode_14() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_14, OnFailureCallback_14, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_14(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_14(const chip::app::DataModel::Nullable & onMode) + { + VerifyOrReturn(CheckValueNonNull("onMode", onMode)); + VerifyOrReturn(CheckValue("onMode.Value()", onMode.Value(), 7)); + + OnModeValue = onMode; + NextTest(); + } + + CHIP_ERROR TestToggleOnOff_15() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::Off::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_15(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_15(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_15(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_15() { NextTest(); } + + CHIP_ERROR TestToggleOnOff_16() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::OnOff::Commands::On::Type; + + RequestType request; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_16(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_16(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_16(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_16() { NextTest(); } + + CHIP_ERROR TestVerifyCurrentModeChangesIfOnModeIsNotNull_17() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_17, OnFailureCallback_17, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_17(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_17(uint8_t currentMode) + { + VerifyOrReturn(CheckValue("currentMode", currentMode, OnModeValue)); + + NextTest(); + } }; class TestSystemCommandsSuite : public TestCommand From ae5a36a56c9487752a667a6859f2b40bf574642a Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Wed, 23 Mar 2022 09:54:22 +0100 Subject: [PATCH 20/70] [logging] Refactored logged messages (#16528) Many messages are logged in the scope that doesn't seem to be appropriate (errors as progress, very detail info as progress etc.) * Briefly reviewed ChipLog calls and changed scopes where it seemed to be valuable For nrfconnect: * Added setting gn chip logging flags depending on Kconfig CONFIG_MATTER_LOG_LEVEL option * Disabled not used shell modules * Changed Zephyr modules default log level from info to warning (all Zephyr modules are set to warning and only those that are important are set to info) --- config/nrfconnect/app/sample-defaults.conf | 10 +++++++ config/nrfconnect/chip-module/CMakeLists.txt | 8 ++++-- examples/lighting-app/nrfconnect/prj.conf | 1 + examples/lock-app/nrfconnect/prj.conf | 1 + src/app/EventManagement.cpp | 2 +- src/app/InteractionModelEngine.cpp | 6 ++--- src/app/ReadClient.cpp | 8 +++--- src/app/ReadHandler.cpp | 12 ++++----- src/app/WriteClient.cpp | 4 +-- src/app/WriteHandler.cpp | 4 +-- src/app/app-platform/ContentAppPlatform.cpp | 26 +++++++++---------- src/app/clusters/bindings/bindings.cpp | 2 +- .../general-diagnostics-server.cpp | 10 +++---- .../software-diagnostics-server.cpp | 2 +- src/app/reporting/Engine.cpp | 4 +-- src/app/server/Dnssd.cpp | 12 ++++----- src/app/server/OnboardingCodesUtil.cpp | 20 +++++++------- .../GenericPlatformManagerImpl_Zephyr.ipp | 2 +- src/lib/dnssd/Discovery_ImplPlatform.cpp | 2 +- ...nericThreadStackManagerImpl_OpenThread.cpp | 4 +-- src/platform/Zephyr/BLEManagerImpl.cpp | 2 +- src/platform/Zephyr/NFCManagerImpl.cpp | 2 +- src/protocols/secure_channel/CASEServer.cpp | 2 +- src/protocols/secure_channel/CASESession.cpp | 12 ++++----- src/system/SystemPacketBuffer.cpp | 2 +- 25 files changed, 87 insertions(+), 73 deletions(-) diff --git a/config/nrfconnect/app/sample-defaults.conf b/config/nrfconnect/app/sample-defaults.conf index 8ad73904dfb977..7145c2d7b704c9 100644 --- a/config/nrfconnect/app/sample-defaults.conf +++ b/config/nrfconnect/app/sample-defaults.conf @@ -22,6 +22,7 @@ CONFIG_STD_CPP14=y CONFIG_LOG=y CONFIG_LOG_MODE_MINIMAL=y CONFIG_MATTER_LOG_LEVEL_DBG=y +CONFIG_LOG_DEFAULT_LEVEL=2 CONFIG_PRINTK_SYNC=y CONFIG_ASSERT=y CONFIG_HW_STACK_PROTECTION=y @@ -107,3 +108,12 @@ CONFIG_MBEDTLS_POLY1305_C=n CONFIG_MBEDTLS_CHACHAPOLY_C=n CONFIG_MBEDTLS_GCM_C=n CONFIG_MBEDTLS_RSA_C=n + +# Disable not used shell modules +CONFIG_SENSOR_SHELL=n +CONFIG_DEVICE_SHELL=n +CONFIG_DATE_SHELL=n +CONFIG_DEVMEM_SHELL=n +CONFIG_MCUBOOT_SHELL=n +CONFIG_CLOCK_CONTROL_NRF_SHELL=n +CONFIG_FLASH_SHELL=n diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index e1b593e0f04b6f..bdc434f656a6e2 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -63,8 +63,8 @@ macro(chip_gn_arg_string ARG STRING) string(APPEND CHIP_GN_ARGS "--arg-string\n${ARG}\n${STRING}\n") endmacro() -macro(chip_gn_arg_bool ARG BOOLEAN) - if (${BOOLEAN}) +macro(chip_gn_arg_bool ARG) + if (${ARGN}) string(APPEND CHIP_GN_ARGS "--arg\n${ARG}\ntrue\n") else() string(APPEND CHIP_GN_ARGS "--arg\n${ARG}\nfalse\n") @@ -214,6 +214,10 @@ chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TE chip_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) chip_gn_arg_bool ("chip_inet_config_enable_tcp_endpoint" CONFIG_CHIP_BUILD_TESTS) chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL) +chip_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 1) +chip_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) +chip_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) +chip_gn_arg_bool ("chip_automation_logging" "false") if (CONFIG_CHIP_ROTATING_DEVICE_ID) chip_gn_arg_bool("chip_enable_rotating_device_id" "true") diff --git a/examples/lighting-app/nrfconnect/prj.conf b/examples/lighting-app/nrfconnect/prj.conf index 387d0c698da6aa..9851733db5f347 100644 --- a/examples/lighting-app/nrfconnect/prj.conf +++ b/examples/lighting-app/nrfconnect/prj.conf @@ -37,6 +37,7 @@ CONFIG_BT_DEVICE_NAME="MatterLight" # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/examples/lock-app/nrfconnect/prj.conf b/examples/lock-app/nrfconnect/prj.conf index 5a059b5108bc08..dabdbeef761f31 100644 --- a/examples/lock-app/nrfconnect/prj.conf +++ b/examples/lock-app/nrfconnect/prj.conf @@ -38,6 +38,7 @@ CONFIG_BT_DEVICE_NAME="MatterLock" # Additional configs for debbugging experience. CONFIG_THREAD_NAME=y CONFIG_MPU_STACK_GUARD=y +CONFIG_RESET_ON_FATAL_ERROR=n # CHIP configuration CONFIG_CHIP_PROJECT_CONFIG="main/include/CHIPProjectConfig.h" diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index 88d4b7be7808f6..7de40feb570f12 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -183,7 +183,7 @@ CHIP_ERROR EventManagement::CopyToNextBuffer(CircularEventBuffer * apEventBuffer err = writer.Finalize(); SuccessOrExit(err); - ChipLogProgress(EventLogging, "Copy Event to next buffer with priority %u", static_cast(nextBuffer->GetPriority())); + ChipLogDetail(EventLogging, "Copy Event to next buffer with priority %u", static_cast(nextBuffer->GetPriority())); exit: if (err != CHIP_NO_ERROR) { diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 5c2703c484b2ce..12f352e8f2c76c 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -315,7 +315,7 @@ CHIP_ERROR InteractionModelEngine::OnReadInitialRequest(Messaging::ExchangeConte if (aInteractionType == ReadHandler::InteractionType::Subscribe && ((handlerPoolCapacity - GetNumActiveReadHandlers()) == 1) && !HasActiveRead()) { - ChipLogProgress(InteractionModel, "Reserve the last ReadHandler for IM read Interaction"); + ChipLogDetail(InteractionModel, "Reserve the last ReadHandler for IM read Interaction"); aStatus = Protocols::InteractionModel::Status::ResourceExhausted; return CHIP_NO_ERROR; } @@ -474,8 +474,8 @@ CHIP_ERROR InteractionModelEngine::OnMessageReceived(Messaging::ExchangeContext void InteractionModelEngine::OnResponseTimeout(Messaging::ExchangeContext * ec) { - ChipLogProgress(InteractionModel, "Time out! Failed to receive IM response from Exchange: " ChipLogFormatExchange, - ChipLogValueExchange(ec)); + ChipLogError(InteractionModel, "Time out! Failed to receive IM response from Exchange: " ChipLogFormatExchange, + ChipLogValueExchange(ec)); } void InteractionModelEngine::AddReadClient(ReadClient * apReadClient) diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index 4966a71c93d131..c30dac9849b06c 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -553,8 +553,8 @@ CHIP_ERROR ReadClient::ProcessReportData(System::PacketBufferHandle && aPayload) void ReadClient::OnResponseTimeout(Messaging::ExchangeContext * apExchangeContext) { - ChipLogProgress(DataManagement, "Time out! failed to receive report data from Exchange: " ChipLogFormatExchange, - ChipLogValueExchange(apExchangeContext)); + ChipLogError(DataManagement, "Time out! failed to receive report data from Exchange: " ChipLogFormatExchange, + ChipLogValueExchange(apExchangeContext)); Close(CHIP_ERROR_TIMEOUT); } @@ -888,7 +888,7 @@ bool ReadClient::ResubscribeIfNeeded() uint32_t intervalMsec = 0; if (mReadPrepareParams.mResubscribePolicy == nullptr) { - ChipLogProgress(DataManagement, "mResubscribePolicy is null"); + ChipLogDetail(DataManagement, "mResubscribePolicy is null"); return false; } mReadPrepareParams.mResubscribePolicy(mNumRetries, intervalMsec, shouldResubscribe); @@ -901,7 +901,7 @@ bool ReadClient::ResubscribeIfNeeded() System::Clock::Milliseconds32(intervalMsec), OnResubscribeTimerCallback, this); if (err != CHIP_NO_ERROR) { - ChipLogProgress(DataManagement, "Fail to resubscribe with error %" CHIP_ERROR_FORMAT, err.Format()); + ChipLogError(DataManagement, "Fail to resubscribe with error %" CHIP_ERROR_FORMAT, err.Format()); return false; } diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 0ef94fd1f80706..09f008f683bb2b 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -290,8 +290,8 @@ CHIP_ERROR ReadHandler::OnUnknownMsgType(Messaging::ExchangeContext * apExchange void ReadHandler::OnResponseTimeout(Messaging::ExchangeContext * apExchangeContext) { - ChipLogProgress(DataManagement, "Time out! failed to receive status response from Exchange: " ChipLogFormatExchange, - ChipLogValueExchange(apExchangeContext)); + ChipLogError(DataManagement, "Time out! failed to receive status response from Exchange: " ChipLogFormatExchange, + ChipLogValueExchange(apExchangeContext)); Close(); } @@ -706,7 +706,7 @@ void ReadHandler::OnUnblockHoldReportCallback(System::Layer * apSystemLayer, voi { VerifyOrReturn(apAppState != nullptr); ReadHandler * readHandler = static_cast(apAppState); - ChipLogProgress(DataManagement, "Unblock report hold after min %d seconds", readHandler->mMinIntervalFloorSeconds); + ChipLogDetail(DataManagement, "Unblock report hold after min %d seconds", readHandler->mMinIntervalFloorSeconds); readHandler->mHoldReport = false; if (readHandler->mDirty) { @@ -722,14 +722,14 @@ void ReadHandler::OnRefreshSubscribeTimerSyncCallback(System::Layer * apSystemLa VerifyOrReturn(apAppState != nullptr); ReadHandler * readHandler = static_cast(apAppState); readHandler->mHoldSync = false; - ChipLogProgress(DataManagement, "Refresh subscribe timer sync after %d seconds", - readHandler->mMaxIntervalCeilingSeconds - readHandler->mMinIntervalFloorSeconds); + ChipLogDetail(DataManagement, "Refresh subscribe timer sync after %d seconds", + readHandler->mMaxIntervalCeilingSeconds - readHandler->mMinIntervalFloorSeconds); InteractionModelEngine::GetInstance()->GetReportingEngine().ScheduleRun(); } CHIP_ERROR ReadHandler::RefreshSubscribeSyncTimer() { - ChipLogProgress(DataManagement, "Refresh Subscribe Sync Timer with max %d seconds", mMaxIntervalCeilingSeconds); + ChipLogDetail(DataManagement, "Refresh Subscribe Sync Timer with max %d seconds", mMaxIntervalCeilingSeconds); InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer( OnUnblockHoldReportCallback, this); InteractionModelEngine::GetInstance()->GetExchangeManager()->GetSessionManager()->SystemLayer()->CancelTimer( diff --git a/src/app/WriteClient.cpp b/src/app/WriteClient.cpp index e8f3490b896142..56969167c8ca63 100644 --- a/src/app/WriteClient.cpp +++ b/src/app/WriteClient.cpp @@ -498,8 +498,8 @@ CHIP_ERROR WriteClient::OnMessageReceived(Messaging::ExchangeContext * apExchang void WriteClient::OnResponseTimeout(Messaging::ExchangeContext * apExchangeContext) { - ChipLogProgress(DataManagement, "Time out! failed to receive write response from Exchange: " ChipLogFormatExchange, - ChipLogValueExchange(apExchangeContext)); + ChipLogError(DataManagement, "Time out! failed to receive write response from Exchange: " ChipLogFormatExchange, + ChipLogValueExchange(apExchangeContext)); if (mpCallback != nullptr) { diff --git a/src/app/WriteHandler.cpp b/src/app/WriteHandler.cpp index 5377b3512ab818..26b3492652279c 100644 --- a/src/app/WriteHandler.cpp +++ b/src/app/WriteHandler.cpp @@ -163,8 +163,8 @@ CHIP_ERROR WriteHandler::OnMessageReceived(Messaging::ExchangeContext * apExchan void WriteHandler::OnResponseTimeout(Messaging::ExchangeContext * apExchangeContext) { - ChipLogProgress(DataManagement, "Time out! failed to receive status response from Exchange: " ChipLogFormatExchange, - ChipLogValueExchange(apExchangeContext)); + ChipLogError(DataManagement, "Time out! failed to receive status response from Exchange: " ChipLogFormatExchange, + ChipLogValueExchange(apExchangeContext)); Close(); } diff --git a/src/app/app-platform/ContentAppPlatform.cpp b/src/app/app-platform/ContentAppPlatform.cpp index d8b7e589356620..a46e1246195cc2 100644 --- a/src/app/app-platform/ContentAppPlatform.cpp +++ b/src/app/app-platform/ContentAppPlatform.cpp @@ -52,7 +52,7 @@ EmberAfStatus emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterI { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - ChipLogProgress(DeviceLayer, "emberAfExternalAttributeReadCallback endpoint %d ", endpointIndex); + ChipLogDetail(DeviceLayer, "emberAfExternalAttributeReadCallback endpoint %d ", endpointIndex); EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; @@ -70,7 +70,7 @@ EmberAfStatus emberAfExternalAttributeWriteCallback(EndpointId endpoint, Cluster { uint16_t endpointIndex = emberAfGetDynamicIndexFromEndpoint(endpoint); - ChipLogProgress(DeviceLayer, "emberAfExternalAttributeWriteCallback endpoint %d ", endpointIndex); + ChipLogDetail(DeviceLayer, "emberAfExternalAttributeWriteCallback endpoint %d ", endpointIndex); EmberAfStatus ret = EMBER_ZCL_STATUS_FAILURE; @@ -124,7 +124,7 @@ EndpointId ContentAppPlatform::AddContentApp(ContentApp * app, EmberAfEndpointTy } else if (ret != EMBER_ZCL_STATUS_DUPLICATE_EXISTS) { - ChipLogProgress(DeviceLayer, "Adding ContentApp error=%d", ret); + ChipLogError(DeviceLayer, "Adding ContentApp error=%d", ret); return kNoCurrentEndpointId; } // Handle wrap condition @@ -136,7 +136,7 @@ EndpointId ContentAppPlatform::AddContentApp(ContentApp * app, EmberAfEndpointTy } index++; } - ChipLogProgress(DeviceLayer, "Failed to add dynamic endpoint: No endpoints available!"); + ChipLogError(DeviceLayer, "Failed to add dynamic endpoint: No endpoints available!"); return kNoCurrentEndpointId; } @@ -168,7 +168,7 @@ EndpointId ContentAppPlatform::RemoveContentApp(ContentApp * app) void ContentAppPlatform::SetupAppPlatform() { - ChipLogProgress(DeviceLayer, "AppPlatform::SetupAppPlatform()"); + ChipLogDetail(DeviceLayer, "AppPlatform::SetupAppPlatform()"); // Clear out the device database uint8_t index = 0; @@ -189,8 +189,8 @@ void ContentAppPlatform::SetupAppPlatform() mCurrentEndpointId = emberAfFixedEndpointCount(); } - ChipLogProgress(DeviceLayer, "emberAfFixedEndpointCount()=%d mCurrentEndpointId=%d", emberAfFixedEndpointCount(), - mCurrentEndpointId); + ChipLogDetail(DeviceLayer, "emberAfFixedEndpointCount()=%d mCurrentEndpointId=%d", emberAfFixedEndpointCount(), + mCurrentEndpointId); // Disable last fixed endpoint, which is used as a placeholder for all of the // supported clusters so that ZAP will generated the requisite code. @@ -238,8 +238,8 @@ ContentApp * ContentAppPlatform::LoadContentAppByClient(uint16_t vendorId, uint1 CHIP_ERROR err = mContentAppFactory->LookupCatalogVendorApp(vendorId, productId, &vendorApp); if (err != CHIP_NO_ERROR) { - ChipLogProgress(DeviceLayer, "GetLoadContentAppByVendorId() - failed to find an app for vendorId %d, productId %d", - vendorId, productId); + ChipLogError(DeviceLayer, "GetLoadContentAppByVendorId() - failed to find an app for vendorId %d, productId %d", vendorId, + productId); return nullptr; } return LoadContentAppInternal(&vendorApp); @@ -255,8 +255,8 @@ ContentApp * ContentAppPlatform::LoadContentApp(const CatalogVendorApp & vendorA CHIP_ERROR err = mContentAppFactory->ConvertToPlatformCatalogVendorApp(vendorApp, &destinationApp); if (err != CHIP_NO_ERROR) { - ChipLogProgress(DeviceLayer, "GetLoadContentApp() - failed to find an app for catalog vendorId %d, appId %s", - vendorApp.catalogVendorId, vendorApp.applicationId); + ChipLogError(DeviceLayer, "GetLoadContentApp() - failed to find an app for catalog vendorId %d, appId %s", + vendorApp.catalogVendorId, vendorApp.applicationId); return nullptr; } return LoadContentAppInternal(&destinationApp); @@ -272,8 +272,8 @@ ContentApp * ContentAppPlatform::GetContentApp(const CatalogVendorApp & vendorAp CHIP_ERROR err = mContentAppFactory->ConvertToPlatformCatalogVendorApp(vendorApp, &destinationApp); if (err != CHIP_NO_ERROR) { - ChipLogProgress(DeviceLayer, "GetContentApp() - failed to find an app for catalog vendorId %d, appId %s", - vendorApp.catalogVendorId, vendorApp.applicationId); + ChipLogError(DeviceLayer, "GetContentApp() - failed to find an app for catalog vendorId %d, appId %s", + vendorApp.catalogVendorId, vendorApp.applicationId); return nullptr; } return GetContentAppInternal(&destinationApp); diff --git a/src/app/clusters/bindings/bindings.cpp b/src/app/clusters/bindings/bindings.cpp index ac4b1fce548cf8..98103b494e8a38 100644 --- a/src/app/clusters/bindings/bindings.cpp +++ b/src/app/clusters/bindings/bindings.cpp @@ -233,7 +233,7 @@ void AddBindingEntry(const EmberBindingTableEntry & entry) if (err != CHIP_NO_ERROR) { // Unicast connection failure can happen if peer is offline. We'll retry connection on-demand. - ChipLogProgress( + ChipLogError( Zcl, "Binding: Failed to create session for unicast binding to device " ChipLogFormatX64 ": %" CHIP_ERROR_FORMAT, ChipLogValueX64(entry.nodeId), err.Format()); } diff --git a/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp b/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp index 834f855b69d7b0..8608c1f99a9748 100644 --- a/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp +++ b/src/app/clusters/general-diagnostics-server/general-diagnostics-server.cpp @@ -189,7 +189,7 @@ class GeneralDiagnosticsDelegate : public DeviceLayer::ConnectivityManagerDelega // Gets called when any network interface on the Node is updated. void OnNetworkInfoChanged() override { - ChipLogProgress(Zcl, "GeneralDiagnosticsDelegate: OnNetworkInfoChanged"); + ChipLogDetail(Zcl, "GeneralDiagnosticsDelegate: OnNetworkInfoChanged"); ReportAttributeOnAllEndpoints(GeneralDiagnostics::Attributes::NetworkInterfaces::Id); } @@ -197,7 +197,7 @@ class GeneralDiagnosticsDelegate : public DeviceLayer::ConnectivityManagerDelega // Gets called when the device has been rebooted. void OnDeviceRebooted(chip::DeviceLayer::BootReasonType bootReason) override { - ChipLogProgress(Zcl, "GeneralDiagnosticsDelegate: OnDeviceRebooted"); + ChipLogDetail(Zcl, "GeneralDiagnosticsDelegate: OnDeviceRebooted"); ReportAttributeOnAllEndpoints(GeneralDiagnostics::Attributes::BootReasons::Id); @@ -217,7 +217,7 @@ class GeneralDiagnosticsDelegate : public DeviceLayer::ConnectivityManagerDelega void OnHardwareFaultsDetected(GeneralFaults & previous, GeneralFaults & current) override { - ChipLogProgress(Zcl, "GeneralDiagnosticsDelegate: OnHardwareFaultsDetected"); + ChipLogDetail(Zcl, "GeneralDiagnosticsDelegate: OnHardwareFaultsDetected"); for (auto endpointId : EnabledEndpointsWithServerCluster(GeneralDiagnostics::Id)) { @@ -243,7 +243,7 @@ class GeneralDiagnosticsDelegate : public DeviceLayer::ConnectivityManagerDelega // Get called when the Node detects a radio fault has been raised. void OnRadioFaultsDetected(GeneralFaults & previous, GeneralFaults & current) override { - ChipLogProgress(Zcl, "GeneralDiagnosticsDelegate: OnHardwareFaultsDetected"); + ChipLogDetail(Zcl, "GeneralDiagnosticsDelegate: OnRadioFaultsDetected"); for (auto endpointId : EnabledEndpointsWithServerCluster(GeneralDiagnostics::Id)) { @@ -269,7 +269,7 @@ class GeneralDiagnosticsDelegate : public DeviceLayer::ConnectivityManagerDelega // Get called when the Node detects a network fault has been raised. void OnNetworkFaultsDetected(GeneralFaults & previous, GeneralFaults & current) override { - ChipLogProgress(Zcl, "GeneralDiagnosticsDelegate: OnHardwareFaultsDetected"); + ChipLogDetail(Zcl, "GeneralDiagnosticsDelegate: OnNetworkFaultsDetected"); for (auto endpointId : EnabledEndpointsWithServerCluster(GeneralDiagnostics::Id)) { diff --git a/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp b/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp index 62f0f3a8b18704..b320cf361fa7b3 100644 --- a/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp +++ b/src/app/clusters/software-diagnostics-server/software-diagnostics-server.cpp @@ -130,7 +130,7 @@ class SoftwareDiagnosticsDelegate : public DeviceLayer::SoftwareDiagnosticsDeleg // Gets called when a software fault that has taken place on the Node. void OnSoftwareFaultDetected(SoftwareDiagnostics::Structs::SoftwareFaultStruct::Type & softwareFault) override { - ChipLogProgress(Zcl, "SoftwareDiagnosticsDelegate: OnSoftwareFaultDetected"); + ChipLogDetail(Zcl, "SoftwareDiagnosticsDelegate: OnSoftwareFaultDetected"); for (auto endpoint : EnabledEndpointsWithServerCluster(SoftwareDiagnostics::Id)) { diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index 557f6f185ae5d7..c807783dbb47c3 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -728,8 +728,8 @@ CHIP_ERROR Engine::ScheduleBufferPressureEventDelivery(uint32_t aBytesWritten) GetMinEventLogPosition(minEventLogPosition); if (aBytesWritten - minEventLogPosition > CHIP_CONFIG_EVENT_LOGGING_BYTE_THRESHOLD) { - ChipLogProgress(DataManagement, " Buffer overfilled CHIP_CONFIG_EVENT_LOGGING_BYTE_THRESHOLD %d, schedule engine run", - CHIP_CONFIG_EVENT_LOGGING_BYTE_THRESHOLD); + ChipLogDetail(DataManagement, " Buffer overfilled CHIP_CONFIG_EVENT_LOGGING_BYTE_THRESHOLD %d, schedule engine run", + CHIP_CONFIG_EVENT_LOGGING_BYTE_THRESHOLD); return ScheduleRun(); } return CHIP_NO_ERROR; diff --git a/src/app/server/Dnssd.cpp b/src/app/server/Dnssd.cpp index e544b43e99ba7e..59cefa261346da 100644 --- a/src/app/server/Dnssd.cpp +++ b/src/app/server/Dnssd.cpp @@ -325,7 +325,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi uint32_t val32; if (DeviceLayer::ConfigurationMgr().GetVendorId(value) != CHIP_NO_ERROR) { - ChipLogProgress(Discovery, "Vendor ID not known"); + ChipLogDetail(Discovery, "Vendor ID not known"); } else { @@ -334,7 +334,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi if (DeviceLayer::ConfigurationMgr().GetProductId(value) != CHIP_NO_ERROR) { - ChipLogProgress(Discovery, "Product ID not known"); + ChipLogDetail(Discovery, "Product ID not known"); } else { @@ -382,7 +382,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi { if (DeviceLayer::ConfigurationMgr().GetInitialPairingHint(value) != CHIP_NO_ERROR) { - ChipLogProgress(Discovery, "DNS-SD Pairing Hint not set"); + ChipLogDetail(Discovery, "DNS-SD Pairing Hint not set"); } else { @@ -391,7 +391,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi if (DeviceLayer::ConfigurationMgr().GetInitialPairingInstruction(pairingInst, sizeof(pairingInst)) != CHIP_NO_ERROR) { - ChipLogProgress(Discovery, "DNS-SD Pairing Instruction not set"); + ChipLogDetail(Discovery, "DNS-SD Pairing Instruction not set"); } else { @@ -402,7 +402,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi { if (DeviceLayer::ConfigurationMgr().GetSecondaryPairingHint(value) != CHIP_NO_ERROR) { - ChipLogProgress(Discovery, "DNS-SD Pairing Hint not set"); + ChipLogDetail(Discovery, "DNS-SD Pairing Hint not set"); } else { @@ -411,7 +411,7 @@ CHIP_ERROR DnssdServer::Advertise(bool commissionableNode, chip::Dnssd::Commissi if (DeviceLayer::ConfigurationMgr().GetSecondaryPairingInstruction(pairingInst, sizeof(pairingInst)) != CHIP_NO_ERROR) { - ChipLogProgress(Discovery, "DNS-SD Pairing Instruction not set"); + ChipLogDetail(Discovery, "DNS-SD Pairing Instruction not set"); } else { diff --git a/src/app/server/OnboardingCodesUtil.cpp b/src/app/server/OnboardingCodesUtil.cpp index 41bd12d15d23e2..9cfd99999f7e62 100644 --- a/src/app/server/OnboardingCodesUtil.cpp +++ b/src/app/server/OnboardingCodesUtil.cpp @@ -42,7 +42,7 @@ void PrintOnboardingCodes(chip::RendezvousInformationFlags aRendezvousFlags) CHIP_ERROR err = GetSetupPayload(payload, aRendezvousFlags); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "GetSetupPayload() failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "GetSetupPayload() failed: %s", chip::ErrorStr(err)); } PrintOnboardingCodes(payload); @@ -101,8 +101,7 @@ CHIP_ERROR GetSetupPayload(chip::SetupPayload & aSetupPayload, chip::RendezvousI err = GetCommissionableDataProvider()->GetSetupPasscode(aSetupPayload.setUpPINCode); if (err != CHIP_NO_ERROR) { - ChipLogError(AppServer, "GetCommissionableDataProvider()->GetSetupPasscode() failed: %s", - chip::ErrorStr(err)); + ChipLogError(AppServer, "GetCommissionableDataProvider()->GetSetupPasscode() failed: %s", chip::ErrorStr(err)); #if defined(CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE) && CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE ChipLogProgress(AppServer, "*** Using default EXAMPLE passcode %u ***", static_cast(CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE)); @@ -115,22 +114,21 @@ CHIP_ERROR GetSetupPayload(chip::SetupPayload & aSetupPayload, chip::RendezvousI err = GetCommissionableDataProvider()->GetSetupDiscriminator(aSetupPayload.discriminator); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "GetCommissionableDataProvider()->GetSetupDiscriminator() failed: %s", - chip::ErrorStr(err)); + ChipLogError(AppServer, "GetCommissionableDataProvider()->GetSetupDiscriminator() failed: %s", chip::ErrorStr(err)); return err; } err = ConfigurationMgr().GetVendorId(aSetupPayload.vendorID); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "ConfigurationMgr().GetVendorId() failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "ConfigurationMgr().GetVendorId() failed: %s", chip::ErrorStr(err)); return err; } err = ConfigurationMgr().GetProductId(aSetupPayload.productID); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "ConfigurationMgr().GetProductId() failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "ConfigurationMgr().GetProductId() failed: %s", chip::ErrorStr(err)); return err; } @@ -144,7 +142,7 @@ CHIP_ERROR GetQRCode(std::string & aQRCode, chip::RendezvousInformationFlags aRe CHIP_ERROR err = GetSetupPayload(payload, aRendezvousFlags); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "GetSetupPayload() failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "GetSetupPayload() failed: %s", chip::ErrorStr(err)); return err; } @@ -158,7 +156,7 @@ CHIP_ERROR GetQRCode(std::string & aQRCode, const chip::SetupPayload & payload) CHIP_ERROR err = chip::QRCodeSetupPayloadGenerator(payload).payloadBase38Representation(aQRCode); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "Generating QR Code failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "Generating QR Code failed: %s", chip::ErrorStr(err)); return err; } @@ -186,7 +184,7 @@ CHIP_ERROR GetManualPairingCode(std::string & aManualPairingCode, chip::Rendezvo CHIP_ERROR err = GetSetupPayload(payload, aRendezvousFlags); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "GetSetupPayload() failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "GetSetupPayload() failed: %s", chip::ErrorStr(err)); return err; } return GetManualPairingCode(aManualPairingCode, payload); @@ -197,7 +195,7 @@ CHIP_ERROR GetManualPairingCode(std::string & aManualPairingCode, const chip::Se CHIP_ERROR err = chip::ManualSetupPayloadGenerator(payload).payloadDecimalStringRepresentation(aManualPairingCode); if (err != CHIP_NO_ERROR) { - ChipLogProgress(AppServer, "Generating Manual Pairing Code failed: %s", chip::ErrorStr(err)); + ChipLogError(AppServer, "Generating Manual Pairing Code failed: %s", chip::ErrorStr(err)); return err; } diff --git a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp index 61814944d1fbfc..89fea684bee9ce 100644 --- a/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp +++ b/src/include/platform/internal/GenericPlatformManagerImpl_Zephyr.ipp @@ -175,7 +175,7 @@ void GenericPlatformManagerImpl_Zephyr::_RunEventLoop(void) template void GenericPlatformManagerImpl_Zephyr::EventLoopTaskMain(void * thisPtr, void *, void *) { - ChipLogDetail(DeviceLayer, "CHIP task running"); + ChipLogProgress(DeviceLayer, "CHIP task running"); static_cast *>(thisPtr)->Impl()->RunEventLoop(); } diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index d68b07ac436671..eee9518c930fb5 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -445,7 +445,7 @@ void DiscoveryImplPlatform::HandleDnssdPublish(void * context, const char * type } else { - ChipLogProgress(Discovery, "mDNS service published error: %s", chip::ErrorStr(error)); + ChipLogError(Discovery, "mDNS service published error: %s", chip::ErrorStr(error)); } } diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp index ffbfa33d1fb185..090075f1c6aa8b 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.cpp @@ -750,7 +750,7 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_GetAndLogThread otNeighborInfo neighborInfo[TELEM_NEIGHBOR_TABLE_SIZE]; otNeighborInfoIterator iter; otNeighborInfoIterator iterCopy; - char printBuf[TELEM_PRINT_BUFFER_SIZE] = {0}; + char printBuf[TELEM_PRINT_BUFFER_SIZE] = { 0 }; uint16_t rloc16; uint16_t routerId; uint16_t leaderRouterId; @@ -1889,7 +1889,7 @@ void GenericThreadStackManagerImpl_OpenThread::OnSrpClientNotificatio switch (aError) { case OT_ERROR_NONE: { - ChipLogProgress(DeviceLayer, "OnSrpClientNotification: Last requested operation completed successfully"); + ChipLogDetail(DeviceLayer, "OnSrpClientNotification: Last requested operation completed successfully"); if (aHostInfo) { diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index 1734adeb3c43d3..a244b915555f28 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -448,7 +448,7 @@ CHIP_ERROR BLEManagerImpl::HandleGAPConnect(const ChipDeviceEvent * event) } else { - ChipLogProgress(DeviceLayer, "BLE connection failed (reason: 0x%02" PRIx16 ")", connEvent->HciResult); + ChipLogError(DeviceLayer, "BLE connection failed (reason: 0x%02" PRIx16 ")", connEvent->HciResult); } ChipLogProgress(DeviceLayer, "Current number of connections: %" PRIu16 "/%" PRIu16, NumConnections(), CONFIG_BT_MAX_CONN); diff --git a/src/platform/Zephyr/NFCManagerImpl.cpp b/src/platform/Zephyr/NFCManagerImpl.cpp index cfbf6f4e292881..d1a89be3e3fdf8 100644 --- a/src/platform/Zephyr/NFCManagerImpl.cpp +++ b/src/platform/Zephyr/NFCManagerImpl.cpp @@ -81,7 +81,7 @@ CHIP_ERROR NFCManagerImpl::_StartTagEmulation(const char * payload, size_t paylo exit: if (error != CHIP_NO_ERROR) - ChipLogProgress(DeviceLayer, "Starting NFC Tag emulation failed: %s", chip::ErrorStr(error)); + ChipLogError(DeviceLayer, "Starting NFC Tag emulation failed: %s", chip::ErrorStr(error)); return error; } diff --git a/src/protocols/secure_channel/CASEServer.cpp b/src/protocols/secure_channel/CASEServer.cpp index 275e63da08cff6..e54362a100a19b 100644 --- a/src/protocols/secure_channel/CASEServer.cpp +++ b/src/protocols/secure_channel/CASEServer.cpp @@ -114,7 +114,7 @@ void CASEServer::Cleanup() void CASEServer::OnSessionEstablishmentError(CHIP_ERROR err) { - ChipLogProgress(Inet, "CASE Session establishment failed: %s", ErrorStr(err)); + ChipLogError(Inet, "CASE Session establishment failed: %s", ErrorStr(err)); mSessionIDAllocator.Free(mSessionKeyId); Cleanup(); } diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index bc4dd71514e201..abda82f306563f 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -387,7 +387,7 @@ CHIP_ERROR CASESession::SendSigma1() mState = kSentSigma1; - ChipLogDetail(SecureChannel, "Sent Sigma1 msg"); + ChipLogProgress(SecureChannel, "Sent Sigma1 msg"); mDelegate->OnSessionEstablishmentStarted(); @@ -412,7 +412,7 @@ CHIP_ERROR CASESession::HandleSigma1(System::PacketBufferHandle && msg) ByteSpan destinationIdentifier; ByteSpan initiatorRandom; - ChipLogDetail(SecureChannel, "Received Sigma1 msg"); + ChipLogProgress(SecureChannel, "Received Sigma1 msg"); bool sessionResumptionRequested = false; ByteSpan resumptionId; @@ -657,7 +657,7 @@ CHIP_ERROR CASESession::SendSigma2() mState = kSentSigma2; - ChipLogDetail(SecureChannel, "Sent Sigma2 msg"); + ChipLogProgress(SecureChannel, "Sent Sigma2 msg"); return CHIP_NO_ERROR; } @@ -775,7 +775,7 @@ CHIP_ERROR CASESession::HandleSigma2(System::PacketBufferHandle && msg) VerifyOrExit(buf != nullptr, err = CHIP_ERROR_MESSAGE_INCOMPLETE); - ChipLogDetail(SecureChannel, "Received Sigma2 msg"); + ChipLogProgress(SecureChannel, "Received Sigma2 msg"); tlvReader.Init(std::move(msg)); SuccessOrExit(err = tlvReader.Next(containerType, TLV::AnonymousTag())); @@ -1015,7 +1015,7 @@ CHIP_ERROR CASESession::SendSigma3() SendFlags(SendMessageFlags::kExpectResponse)); SuccessOrExit(err); - ChipLogDetail(SecureChannel, "Sent Sigma3 msg"); + ChipLogProgress(SecureChannel, "Sent Sigma3 msg"); err = mCommissioningHash.Finish(messageDigestSpan); SuccessOrExit(err); @@ -1064,7 +1064,7 @@ CHIP_ERROR CASESession::HandleSigma3(System::PacketBufferHandle && msg) uint32_t decodeTagIdSeq = 0; - ChipLogDetail(SecureChannel, "Received Sigma3 msg"); + ChipLogProgress(SecureChannel, "Received Sigma3 msg"); tlvReader.Init(std::move(msg)); SuccessOrExit(err = tlvReader.Next(containerType, TLV::AnonymousTag())); diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index 4ff2c68fe02a82..55fd5fe593338e 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -170,7 +170,7 @@ void PacketBufferHandle::InternalRightSize() { mBuffer = lNewPacket; SYSTEM_STATS_UPDATE_LWIP_PBUF_COUNTS(); - ChipLogProgress(chipSystemLayer, "PacketBuffer: RightSize Copied"); + ChipLogDetail(chipSystemLayer, "PacketBuffer: RightSize Copied"); } } From 83df109ac68ed4764742b1a27e71b0f1c8c2754d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Wed, 23 Mar 2022 13:04:06 +0100 Subject: [PATCH 21/70] [zap] Regenerate to fix ZAP CI (#16560) --- .../placeholder/linux/apps/app1/config.matter | 28 ++++++++++++------- .../placeholder/linux/apps/app2/config.matter | 28 ++++++++++++------- .../app1/zap-generated/endpoint_config.h | 17 +++++------ .../app2/zap-generated/endpoint_config.h | 17 +++++------ 4 files changed, 54 insertions(+), 36 deletions(-) diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index 52cc0ea6df0025..ebd2f5bd9274c7 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1010,17 +1010,21 @@ server cluster LevelControl = 8 { } client cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + readonly attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; @@ -1035,17 +1039,21 @@ client cluster ModeSelect = 80 { } server cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + readonly attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index 52cc0ea6df0025..ebd2f5bd9274c7 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1010,17 +1010,21 @@ server cluster LevelControl = 8 { } client cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + readonly attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; @@ -1035,17 +1039,21 @@ client cluster ModeSelect = 80 { } server cluster ModeSelect = 80 { + bitmap ModeSelectFeature : BITMAP32 { + kDeponoff = 0x1; + } + struct ModeOptionStruct { CHAR_STRING<32> label = 0; INT8U mode = 1; INT32U semanticTag = 2; } - readonly attribute int8u currentMode = 0; - readonly attribute ModeOptionStruct supportedModes[] = 1; - attribute int8u onMode = 2; - readonly attribute int8u startUpMode = 3; - readonly attribute char_string<32> description = 4; + readonly attribute char_string<32> description = 0; + readonly attribute nullable enum16 standardNamespace = 1; + readonly attribute ModeOptionStruct supportedModes[] = 2; + readonly attribute int8u currentMode = 3; + readonly attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h index a732031ae25e2b..37b3d6ee24766d 100644 --- a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h @@ -366,11 +366,12 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Mode Select (server) */ \ - { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ - { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ - { 0x00000002, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ - { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x00000004, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ + { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ + { 0x00000001, ZAP_TYPE(ENUM16), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StandardNamespace */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ @@ -957,7 +958,7 @@ .clusterId = 0x00000050, \ .attributes = ZAP_ATTRIBUTE_INDEX(68), \ .attributeCount = 7, \ - .clusterSize = 42, \ + .clusterSize = 41, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ @@ -1249,7 +1250,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 31, 455 }, { ZAP_CLUSTER_INDEX(31), 8, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 31, 454 }, { ZAP_CLUSTER_INDEX(31), 8, 72 }, \ } // Largest attribute size is needed for various buffers @@ -1261,7 +1262,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (78) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (527) +#define ATTRIBUTE_MAX_SIZE (526) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h index a732031ae25e2b..37b3d6ee24766d 100644 --- a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h @@ -366,11 +366,12 @@ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Mode Select (server) */ \ - { 0x00000000, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ - { 0x00000001, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ - { 0x00000002, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ - { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x00000004, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ + { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_EMPTY_DEFAULT() }, /* Description */ \ + { 0x00000001, ZAP_TYPE(ENUM16), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StandardNamespace */ \ + { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ @@ -957,7 +958,7 @@ .clusterId = 0x00000050, \ .attributes = ZAP_ATTRIBUTE_INDEX(68), \ .attributeCount = 7, \ - .clusterSize = 42, \ + .clusterSize = 41, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ @@ -1249,7 +1250,7 @@ // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 31, 455 }, { ZAP_CLUSTER_INDEX(31), 8, 72 }, \ + { ZAP_CLUSTER_INDEX(0), 31, 454 }, { ZAP_CLUSTER_INDEX(31), 8, 72 }, \ } // Largest attribute size is needed for various buffers @@ -1261,7 +1262,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (78) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (527) +#define ATTRIBUTE_MAX_SIZE (526) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) From 7172ac9ebd5f7717d875526bfe6444fe66d42889 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 23 Mar 2022 08:36:11 -0400 Subject: [PATCH 22/70] Exclude some redundant things from Darwin build CI. (#16551) --- .github/workflows/build.yaml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 84b0c28d9873e5..6e220b7ab0bd47 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -321,14 +321,21 @@ jobs: scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" - name: Setup Build, Run Build and Run Tests timeout-minutes: 120 - # Just go ahead and do the "all" build; on Darwin that's fairly - # fast. If this ever becomes slow, we can think about ways to do - # the examples-linux-standalone.yaml tests on darwin without too - # much code duplication. run: | - for BUILD_TYPE in clang python_lib; do + for BUILD_TYPE in default python_lib; do case $BUILD_TYPE in - "clang") GN_ARGS='is_clang=true target_os="all" is_asan=true pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; + # We want to build various standalone example apps + # (similar to what examples-linux-standalone.yaml + # does), so use target_os="all" to get those picked + # up as part of the "unified" build. But then to + # save CI resources we want to exclude a few + # redundant things: + # + # * the mbedtls build, since we don't really plan to + # use that on Darwin. + # * the "host clang" build, which uses the pigweed + # clang. + "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false enable_host_gcc_mbedtls_build=false pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';; esac scripts/build/gn_gen.sh --args="$GN_ARGS" From ed8d8cf57ab68b9998a10a4dd7d8045ed93abe37 Mon Sep 17 00:00:00 2001 From: Michael Rupp <95718139+mykrupp@users.noreply.github.com> Date: Wed, 23 Mar 2022 09:45:17 -0400 Subject: [PATCH 23/70] [EFR32] Add generation of EFR OTA image file to build process (#16193) * add automatic generation of gbl file to build process * remove an extra find call * clenaup * Restyled by whitespace * Restyled by shellharden * Restyled by shfmt * typo * Remove everything before delimiter in BUILD_DIR_TRIMMED * fix pathing * fix substring * syntax * syntax * fix chars * don't generate gbl depending on path * Restyled by whitespace * Restyled by shellharden * remove unnecessary else statement * add end fi statement Co-authored-by: Restyled.io --- scripts/examples/gn_efr32_example.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index 22913392fc8972..1b0bf0ff50e3c1 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -158,4 +158,18 @@ else #print stats arm-none-eabi-size -A "$BUILD_DIR"/*.out + # Generate bootloader file + if [ "${BUILD_DIR:0:2}" == "./"]; then + BUILD_DIR_TRIMMED="${BUILD_DIR:2}" + S37_PATH=$(find "$BUILD_DIR_TRIMMED" -type f -name "*.s37") + if [ -z "$S37_PATH" ]; then + echo "Bootloader could not be built" + else + TARGET_PATH=${S37_PATH%????} + OTA_PATH="$TARGET_PATH".ota + commander gbl create "$TARGET_PATH".gbl --app "$S37_PATH" + GBL_PATH="$TARGET_PATH".gbl + ./src/app/ota_image_tool.py create -v 0xFFF1 -p 0x8005 -vn 1 -vs "1.0" -da sha256 "$GBL_PATH" "$OTA_PATH" + fi + fi fi From 4a33c9873f7c48ee55f21a1f6bf91d0d49055a12 Mon Sep 17 00:00:00 2001 From: krypton36 Date: Wed, 23 Mar 2022 07:02:49 -0700 Subject: [PATCH 24/70] Add multi admin test (#16529) * Update Multi Admin tests to run correct steps. * Generated Code --- .../suites/certification/Test_TC_MF_1_3.yaml | 503 +++++------------- .../chip-tool/zap-generated/test/Commands.h | 416 ++++++++++++++- 2 files changed, 545 insertions(+), 374 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_MF_1_3.yaml b/src/app/tests/suites/certification/Test_TC_MF_1_3.yaml index 5841b8b5583060..344cdcda33cafd 100644 --- a/src/app/tests/suites/certification/Test_TC_MF_1_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_MF_1_3.yaml @@ -16,391 +16,152 @@ name: 22.1.3. [TC-MF-1.3] Node Behavior using ECM [DUT - Commissionee] config: nodeId: 0x12344321 - cluster: "Basic" + nodeId2: + type: NODE_ID + defaultValue: 0xCAFE endpoint: 0 + discriminator: + type: INT16U + defaultValue: 3840 + payload: + type: CHAR_STRING + defaultValue: "MT:0000000000I31506010" # This value needs to be generated automatically tests: + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + - label: "TH_CR1 starts a commissioning process with DUT_CE" - verification: - "1. Provision the device using chip-tool of first controller on the - raspi (use above instructions) " - disabled: true + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: 1 + + - label: "Open Commissioning Window" + cluster: "AdministratorCommissioning" + command: "OpenCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 + - name: "PAKEVerifier" + value: "\x06\xc7\x56\xdf\xfc\xd7\x22\x65\x34\x52\xa1\x2d\xcd\x94\x5d\x8c\x54\xda\x2b\x0f\x3c\xbd\x1b\x4d\xc3\xf1\xad\xb2\x23\xae\xb2\x6b\x04\x7c\xd2\x4c\x96\x86\x6f\x97\x9b\x1d\x83\xec\x50\xe2\xb4\xae\x30\xcd\xf2\xfd\xb3\x2b\xd8\xa2\x11\xb8\x37\xdc\x94\xed\xcd\x56\xf4\xd1\x43\x77\x19\x10\x76\xbf\xc5\x9d\x99\xb7\xdd\x30\x53\xef\xd6\xf0\x2c\x44\x34\xf2\xbd\xd2\x7a\xa4\xf9\xce\xa7\x0d\x73\x8e\x4c" + - name: "discriminator" + value: 3840 + - name: "iterations" + value: 1000 + - name: "salt" + value: "SPAKE2P Key Salt" - label: - "TH_CR1 opens a commissioning window on DUT_CE using a commissioning - timeout of PIXIT_COMM_WIN seconds using ECM" - verification: - "On 1st controller, using chip-tool, send the - open-commissioning-window CMD for ECM. -t stands for timeout value, -o - for OriginalSetupCode/TokenWithRandomPIN/TokenWithProvidedPIN , -d for - descriminator -i for iteration count. Ref to cmd help. ./chip-tool - pairing open-commissioning-window 1 1 200 1000 3840 - [1635864513.699433][3850:3855] CHIP:DMG: ICR moving to [CommandSen] - [1635864513.699489][3850:3855] CHIP:CTL: Manual pairing code: - [36177160937] [1635864513.699566][3850:3855] CHIP:CTL: SetupQRCode: - [MT:00000CQM00YZN476420] [1635864513.699636][3850:3855] CHIP:EM: - Sending Standalone Ack for MessageCounter:2599714227 on exchange - 60688i [1635864513.699685][3850:3855] CHIP:IN: Prepared plaintext - message 0xffff8a7cd960 to 0x0000000000000000 of type 0x10 and - protocolId (0, 0) on exchange 60688i with MessageCounter:3019982536. - [1635864513.699737][3850:3855] CHIP:IN: Sending plaintext msg - 0xffff8a7cd960 with MessageCounter:3019982536 to 0x0000000000000000 at - monotonic time: 6085358 msec [1635864513.699834][3850:3855] CHIP:EM: - Flushed pending ack for MessageCounter:2599714227 on exchange 60688i - The setup pin code is extracted from the manual pairing code in the - log and that will be used when pairing the 2nd admin controller." - disabled: true + "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "writeAttribute" + cluster: "Basic" + attribute: "NodeLabel" + arguments: + value: "chiptest" - label: - "TH_CR1 writes and reads the Basic Information Clusters NodeLabel - mandatory attribute of DUT_CE" - verification: - "On 1st controller, using chip-tool write attribute and read attribute - ./chip-tool basic write node-label te5 1 0 - [1635864770.858600][3868:3873] CHIP:EM: Removed CHIP MessageCounter:0 - from RetransTable on exchange 46498i [1635864770.858661][3868:3873] - CHIP:DMG: WriteResponse = [1635864770.858702][3868:3873] CHIP:DMG: { - [1635864770.858735][3868:3873] CHIP:DMG: AttributeStatusList = - [1635864770.858774][3868:3873] CHIP:DMG: [ - [1635864770.858806][3868:3873] CHIP:DMG: AttributeStatusIB = - [1635864770.858847][3868:3873] CHIP:DMG: { - [1635864770.858887][3868:3873] CHIP:DMG: AttributePath = - [1635864770.858936][3868:3873] CHIP:DMG: { - [1635864770.858978][3868:3873] CHIP:DMG: FieldTag = 0x0000_0005, - [1635864770.859036][3868:3873] CHIP:DMG: NodeId = 0x0, - [1635864770.859093][3868:3873] CHIP:DMG: ClusterId = 0x28, - [1635864770.859149][3868:3873] CHIP:DMG: EndpointId = 0x0, - [1635864770.859196][3868:3873] CHIP:DMG: } - [1635864770.859248][3868:3873] CHIP:DMG: - [1635864770.859288][3868:3873] CHIP:DMG: StatusIB = - [1635864770.859334][3868:3873] CHIP:DMG: { - [1635864770.859380][3868:3873] CHIP:DMG: status = 0x0, - [1635864770.859426][3868:3873] CHIP:DMG: }, - [1635864770.859473][3868:3873] CHIP:DMG: - [1635864770.859516][3868:3873] CHIP:DMG: }, - [1635864770.859560][3868:3873] CHIP:DMG: - [1635864770.859596][3868:3873] CHIP:DMG: ], - [1635864770.859642][3868:3873] CHIP:DMG: - [1635864770.859671][3868:3873] CHIP:DMG: } - [1635864770.859746][3868:3873] CHIP:ZCL: WriteResponse: - [1635864770.859779][3868:3873] CHIP:ZCL: status: Success (0x0000) - [1635864770.859816][3868:3873] CHIP:TOO: Default Success Response - ./chip-tool basic read node-label 1 0 [1635864806.038797][3875:3880] - CHIP:DMG: ReportData = [1635864806.038839][3875:3880] CHIP:DMG: { - [1635864806.038872][3875:3880] CHIP:DMG: AttributeDataList = - [1635864806.038910][3875:3880] CHIP:DMG: [ - [1635864806.038948][3875:3880] CHIP:DMG: AttributeDataElement = - [1635864806.038993][3875:3880] CHIP:DMG: { - [1635864806.039030][3875:3880] CHIP:DMG: AttributePath = - [1635864806.039069][3875:3880] CHIP:DMG: { - [1635864806.039115][3875:3880] CHIP:DMG: NodeId = 0x1, - [1635864806.039166][3875:3880] CHIP:DMG: EndpointId = 0x0, - [1635864806.039222][3875:3880] CHIP:DMG: ClusterId = 0x28, - [1635864806.039277][3875:3880] CHIP:DMG: FieldTag = 0x0000_0005, - [1635864806.039324][3875:3880] CHIP:DMG: } - [1635864806.039374][3875:3880] CHIP:DMG: - [1635864806.039426][3875:3880] CHIP:DMG: Data = 'te5', - [1635864806.039471][3875:3880] CHIP:DMG: DataElementVersion = 0x0, - [1635864806.039508][3875:3880] CHIP:DMG: }, - [1635864806.039551][3875:3880] CHIP:DMG: - [1635864806.039587][3875:3880] CHIP:DMG: ], - [1635864806.039630][3875:3880] CHIP:DMG: - [1635864806.039664][3875:3880] CHIP:DMG: } - [1635864806.039779][3875:3880] CHIP:ZCL: ReadAttributesResponse: - [1635864806.039809][3875:3880] CHIP:ZCL: ClusterId: 0x0000_0028 - [1635864806.039840][3875:3880] CHIP:ZCL: attributeId: 0x0000_0005 - [1635864806.039873][3875:3880] CHIP:ZCL: status: Success (0x0000) - [1635864806.039899][3875:3880] CHIP:ZCL: attribute TLV Type: 0x0c - [1635864806.039931][3875:3880] CHIP:TOO: CharString attribute - Response: te5" - disabled: true + "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "readAttribute" + cluster: "Basic" + attribute: "NodeLabel" + response: + value: "chiptest" + constraints: + type: string + maxLength: 32 + + - label: "Commission from beta" + identity: "beta" + cluster: "CommissionerCommands" + command: "PairWithQRCode" + arguments: + values: + - name: "nodeId" + value: 1 + - name: "payload" + value: payload - label: "TH_CR2 starts a commissioning process with DUT_CE" - verification: - "1. On 2nd controller, using chip-tool connect using manual code. - Below is the example when using chip tool as controller (considering - 36177160937 as the manual code generated by 1st controller) - ./chip-tool pairing manualcode 1 36177160937" - disabled: true + identity: "beta" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: 1 - - label: "TH_CR1 reads the list of Fabrics on DUT_CE" - verification: - "On 1st controller, using chip tool read fabric list ./chip-tool - operationalcredentials read fabrics-list 1 0 - [1635864875.632895][3884:3889] CHIP:DMG: ReportData = - [1635864875.632926][3884:3889] CHIP:DMG: { - [1635864875.632956][3884:3889] CHIP:DMG: AttributeDataList = - [1635864875.632991][3884:3889] CHIP:DMG: [ - [1635864875.633021][3884:3889] CHIP:DMG: AttributeDataElement = - [1635864875.633058][3884:3889] CHIP:DMG: { - [1635864875.633091][3884:3889] CHIP:DMG: AttributePath = - [1635864875.633138][3884:3889] CHIP:DMG: { - [1635864875.633173][3884:3889] CHIP:DMG: NodeId = 0x1, - [1635864875.633225][3884:3889] CHIP:DMG: EndpointId = 0x0, - [1635864875.633277][3884:3889] CHIP:DMG: ClusterId = 0x3e, - [1635864875.633329][3884:3889] CHIP:DMG: FieldTag = 0x0000_0001, - [1635864875.633372][3884:3889] CHIP:DMG: } - [1635864875.633442][3884:3889] CHIP:DMG: - [1635864875.633486][3884:3889] CHIP:DMG: Data = [ - [1635864875.633530][3884:3889] CHIP:DMG: - [1635864875.633572][3884:3889] CHIP:DMG: { - [1635864875.633618][3884:3889] CHIP:DMG: 0x0 = 1, - [1635864875.633662][3884:3889] CHIP:DMG: 0x1 = [ - [1635864875.633723][3884:3889] CHIP:DMG: 0x4, 0x9e, 0x26, 0x54, 0x2, - 0x45, 0x18, 0xca, 0x68, 0x9c, 0xa0, 0x77, 0xef, 0xb4, 0x37, 0x0, 0xce, - 0xb7, 0x15, 0x8d, 0x4a, 0xc7, 0x6a, 0x67, 0x31, 0xf2, 0xba, 0x52, - 0x8f, 0xb9, 0xfd, 0x93, 0xed, 0xc0, 0xdc, 0xce, 0xf7, 0x9d, 0x3, 0x3b, - 0xc8, 0x63, 0 [1635864875.633785][3884:3889] CHIP:DMG: ] - [1635864875.633829][3884:3889] CHIP:DMG: 0x2 = 30024, - [1635864875.633873][3884:3889] CHIP:DMG: 0x3 = 0, - [1635864875.633916][3884:3889] CHIP:DMG: 0x4 = 1, - [1635864875.633961][3884:3889] CHIP:DMG: 0x5 = ', - [1635864875.634002][3884:3889] CHIP:DMG: }, - [1635864875.634051][3884:3889] CHIP:DMG: { - [1635864875.634096][3884:3889] CHIP:DMG: 0x0 = 2, - [1635864875.634143][3884:3889] CHIP:DMG: 0x1 = [ - [1635864875.634203][3884:3889] CHIP:DMG: 0x4, 0x5b, 0x93, 0x38, 0xab, - 0x50, 0x6, 0x85, 0xc0, 0x50, 0xfe, 0x7d, 0x6c, 0xeb, 0x9d, 0xbd, 0x55, - 0x90, 0x5e, 0x4f, 0x54, 0xed, 0x94, 0x21, 0xc0, 0x8d, 0x9d, 0x4f, - 0x60, 0x48, 0xdb, 0x38, 0x4a, 0xf4, 0xe2, 0xa3, 0xf9, 0xd0, 0x55, - 0xd5, 0x63, 0xd0, [1635864875.634253][3884:3889] CHIP:DMG: ] - [1635864875.634307][3884:3889] CHIP:DMG: 0x2 = 45896, - [1635864875.634354][3884:3889] CHIP:DMG: 0x3 = 0, - [1635864875.634398][3884:3889] CHIP:DMG: 0x4 = 2, - [1635864875.634441][3884:3889] CHIP:DMG: 0x5 = ', - [1635864875.634483][3884:3889] CHIP:DMG: }, - [1635864875.634533][3884:3889] CHIP:DMG: ], - [1635864875.634575][3884:3889] CHIP:DMG: DataElementVersion = 0x0, - [1635864875.634615][3884:3889] CHIP:DMG: }, - [1635864875.634670][3884:3889] CHIP:DMG: - [1635864875.634702][3884:3889] CHIP:DMG: ], - [1635864875.634749][3884:3889] CHIP:DMG: - [1635864875.634780][3884:3889] CHIP:DMG: } - [1635864875.634907][3884:3889] CHIP:ZCL: ReadAttributesResponse: - [1635864875.634937][3884:3889] CHIP:ZCL: ClusterId: 0x0000_003E - [1635864875.634969][3884:3889] CHIP:ZCL: attributeId: 0x0000_0001 - [1635864875.634999][3884:3889] CHIP:ZCL: status: Success (0x0000) - [1635864875.635031][3884:3889] CHIP:ZCL: attribute TLV Type: 0x16 - [1635864875.635085][3884:3889] CHIP:TOO: - OnOperationalCredentialsFabricsListListAttributeResponse: 2 entries - [1635864875.635181][3884:3889] CHIP:TOO: FabricDescriptor[1]: - [1635864875.635212][3884:3889] CHIP:TOO: fabricIndex: 1 - [1635864875.635242][3884:3889] CHIP:ZCL: RootPublicKey: 65 - [1635864875.635265][3884:3889] CHIP:TOO: vendorId: 30024 - [1635864875.635290][3884:3889] CHIP:TOO: fabricId: 0 - [1635864875.635316][3884:3889] CHIP:TOO: nodeId: 1 - [1635864875.635340][3884:3889] CHIP:ZCL: Label: - [1635864875.635377][3884:3889] CHIP:TOO: FabricDescriptor[2]: - [1635864875.635407][3884:3889] CHIP:TOO: fabricIndex: 2 - [1635864875.635430][3884:3889] CHIP:ZCL: RootPublicKey: 65 - [1635864875.635456][3884:3889] CHIP:TOO: vendorId: 45896 - [1635864875.635480][3884:3889] CHIP:TOO: fabricId: 0 - [1635864875.635506][3884:3889] CHIP:TOO: nodeId: 2 - [1635864875.635535][3884:3889] CHIP:ZCL: Label: - [1635864875.635633][3884:3889] CHIP:EM: Piggybacking Ack for - MessageCounter:1 on exchange: 44071i" - disabled: true + - label: "Query fabrics list" + command: "readAttribute" + cluster: "Operational Credentials" + attribute: "Fabrics" + response: + value: [{ Label: "", nodeId: nodeId }] + constraints: + type: list - - label: "TH_CR2 reads the list of Fabrics on DUT_CE" - verification: - "On 2nd controller, using chip tool read fabric list ./chip-tool - operationalcredentials read fabrics-list 2 0 - [1635864972.823843][6022:6027] CHIP:DMG: ReportData = - [1635864972.823882][6022:6027] CHIP:DMG: { - [1635864972.823915][6022:6027] CHIP:DMG: AttributeDataList = - [1635864972.823959][6022:6027] CHIP:DMG: [ - [1635864972.824000][6022:6027] CHIP:DMG: AttributeDataElement = - [1635864972.824042][6022:6027] CHIP:DMG: { - [1635864972.824111][6022:6027] CHIP:DMG: AttributePath = - [1635864972.824187][6022:6027] CHIP:DMG: { - [1635864972.824234][6022:6027] CHIP:DMG: NodeId = 0x2, - [1635864972.824311][6022:6027] CHIP:DMG: EndpointId = 0x0, - [1635864972.824390][6022:6027] CHIP:DMG: ClusterId = 0x3e, - [1635864972.824502][6022:6027] CHIP:DMG: FieldTag = 0x0000_0001, - [1635864972.824552][6022:6027] CHIP:DMG: } - [1635864972.824619][6022:6027] CHIP:DMG: - [1635864972.824671][6022:6027] CHIP:DMG: Data = [ - [1635864972.824717][6022:6027] CHIP:DMG: - [1635864972.824762][6022:6027] CHIP:DMG: { - [1635864972.824814][6022:6027] CHIP:DMG: 0x0 = 1, - [1635864972.824893][6022:6027] CHIP:DMG: 0x1 = [ - [1635864972.824979][6022:6027] CHIP:DMG: 0x4, 0x9e, 0x26, 0x54, 0x2, - 0x45, 0x18, 0xca, 0x68, 0x9c, 0xa0, 0x77, 0xef, 0xb4, 0x37, 0x0, 0xce, - 0xb7, 0x15, 0x8d, 0x4a, 0xc7, 0x6a, 0x67, 0x31, 0xf2, 0xba, 0x52, - 0x8f, 0xb9, 0xfd, 0x93, 0xed, 0xc0, 0xdc, 0xce, 0xf7, 0x9d, 0x3, 0x3b, - 0xc8, 0x63, 0 [1635864972.825048][6022:6027] CHIP:DMG: ] - [1635864972.825110][6022:6027] CHIP:DMG: 0x2 = 30024, - [1635864972.825171][6022:6027] CHIP:DMG: 0x3 = 0, - [1635864972.825233][6022:6027] CHIP:DMG: 0x4 = 1, - [1635864972.825293][6022:6027] CHIP:DMG: 0x5 = ', - [1635864972.825388][6022:6027] CHIP:DMG: }, - [1635864972.825467][6022:6027] CHIP:DMG: { - [1635864972.825558][6022:6027] CHIP:DMG: 0x0 = 2, - [1635864972.825613][6022:6027] CHIP:DMG: 0x1 = [ - [1635864972.825693][6022:6027] CHIP:DMG: 0x4, 0x5b, 0x93, 0x38, 0xab, - 0x50, 0x6, 0x85, 0xc0, 0x50, 0xfe, 0x7d, 0x6c, 0xeb, 0x9d, 0xbd, 0x55, - 0x90, 0x5e, 0x4f, 0x54, 0xed, 0x94, 0x21, 0xc0, 0x8d, 0x9d, 0x4f, - 0x60, 0x48, 0xdb, 0x38, 0x4a, 0xf4, 0xe2, 0xa3, 0xf9, 0xd0, 0x55, - 0xd5, 0x63, 0xd0, [1635864972.825760][6022:6027] CHIP:DMG: ] - [1635864972.825821][6022:6027] CHIP:DMG: 0x2 = 45896, - [1635864972.825882][6022:6027] CHIP:DMG: 0x3 = 0, - [1635864972.825942][6022:6027] CHIP:DMG: 0x4 = 2, - [1635864972.826002][6022:6027] CHIP:DMG: 0x5 = ', - [1635864972.826095][6022:6027] CHIP:DMG: }, - [1635864972.826172][6022:6027] CHIP:DMG: ], - [1635864972.826246][6022:6027] CHIP:DMG: DataElementVersion = 0x0, - [1635864972.826292][6022:6027] CHIP:DMG: }, - [1635864972.826360][6022:6027] CHIP:DMG: - [1635864972.826406][6022:6027] CHIP:DMG: ], - [1635864972.826471][6022:6027] CHIP:DMG: - [1635864972.826520][6022:6027] CHIP:DMG: } - [1635864972.826691][6022:6027] CHIP:ZCL: ReadAttributesResponse: - [1635864972.826732][6022:6027] CHIP:ZCL: ClusterId: 0x0000_003E - [1635864972.826776][6022:6027] CHIP:ZCL: attributeId: 0x0000_0001 - [1635864972.826816][6022:6027] CHIP:ZCL: status: Success (0x0000) - [1635864972.826858][6022:6027] CHIP:ZCL: attribute TLV Type: 0x16 - [1635864972.826923][6022:6027] CHIP:TOO: - OnOperationalCredentialsFabricsListListAttributeResponse: 2 entries - [1635864972.827030][6022:6027] CHIP:TOO: FabricDescriptor[1]: - [1635864972.827067][6022:6027] CHIP:TOO: fabricIndex: 1 - [1635864972.827105][6022:6027] CHIP:ZCL: RootPublicKey: 65 - [1635864972.827143][6022:6027] CHIP:TOO: vendorId: 30024 - [1635864972.827182][6022:6027] CHIP:TOO: fabricId: 0 - [1635864972.827215][6022:6027] CHIP:TOO: nodeId: 1 - [1635864972.827251][6022:6027] CHIP:ZCL: Label: - [1635864972.827298][6022:6027] CHIP:TOO: FabricDescriptor[2]: - [1635864972.827338][6022:6027] CHIP:TOO: fabricIndex: 2 - [1635864972.827375][6022:6027] CHIP:ZCL: RootPublicKey: 65 - [1635864972.827440][6022:6027] CHIP:TOO: vendorId: 45896 - [1635864972.827479][6022:6027] CHIP:TOO: fabricId: 0 - [1635864972.827517][6022:6027] CHIP:TOO: nodeId: 2" - disabled: true + - label: "Query fabrics list" + identity: "beta" + command: "readAttribute" + cluster: "Operational Credentials" + attribute: "Fabrics" + fabricFiltered: false + response: + value: [{ Label: "", nodeId: nodeId }, { Label: "", nodeId: nodeId2 }] + constraints: + type: list - - label: "" - verification: - "1. Verify if the DUT is broadcasting using $ avahi-browse -rt - _matter._tcp" - disabled: true + - label: + "TH_CR1 writes the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "writeAttribute" + cluster: "Basic" + attribute: "NodeLabel" + arguments: + value: "chiptest1" + + - label: + "TH_CR1 reads the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + command: "readAttribute" + cluster: "Basic" + attribute: "NodeLabel" + response: + value: "chiptest1" + constraints: + type: string + maxLength: 32 - label: - "TH_CR1 writes and reads the Basic Information Clusters NodeLabel - mandatory attribute of DUT_CE" - verification: - "On 1st controller, using chip tool, write and read Basic Information - Clusters NodeLabel mandatory attribute of DUT_CE ./chip-tool basic - write user-label te5new 1 0 [1635865045.162985][3895:3900] CHIP:DMG: - WriteResponse = [1635865045.163024][3895:3900] CHIP:DMG: { - [1635865045.163056][3895:3900] CHIP:DMG: AttributeStatusList = - [1635865045.163091][3895:3900] CHIP:DMG: [ - [1635865045.163127][3895:3900] CHIP:DMG: AttributeStatusIB = - [1635865045.163188][3895:3900] CHIP:DMG: { - [1635865045.163227][3895:3900] CHIP:DMG: AttributePath = - [1635865045.163295][3895:3900] CHIP:DMG: { - [1635865045.163377][3895:3900] CHIP:DMG: FieldTag = 0x0000_0005, - [1635865045.163427][3895:3900] CHIP:DMG: NodeId = 0x0, - [1635865045.163494][3895:3900] CHIP:DMG: ClusterId = 0x28, - [1635865045.163563][3895:3900] CHIP:DMG: EndpointId = 0x0, - [1635865045.163602][3895:3900] CHIP:DMG: } - [1635865045.163648][3895:3900] CHIP:DMG: - [1635865045.163689][3895:3900] CHIP:DMG: StatusIB = - [1635865045.163731][3895:3900] CHIP:DMG: { - [1635865045.163773][3895:3900] CHIP:DMG: status = 0x0, - [1635865045.163839][3895:3900] CHIP:DMG: }, - [1635865045.163880][3895:3900] CHIP:DMG: - [1635865045.163915][3895:3900] CHIP:DMG: }, - [1635865045.163983][3895:3900] CHIP:DMG: - [1635865045.164016][3895:3900] CHIP:DMG: ], - [1635865045.164060][3895:3900] CHIP:DMG: - [1635865045.164089][3895:3900] CHIP:DMG: } - [1635865045.164163][3895:3900] CHIP:ZCL: WriteResponse: - [1635865045.164194][3895:3900] CHIP:ZCL: status: Success (0x0000) - [1635865045.164231][3895:3900] CHIP:TOO: Default Success Response - ./chip-tool basic read user-label 1 0 1635865075.828727][3904:3909] - CHIP:DMG: ReportData = [1635865075.828767][3904:3909] CHIP:DMG: { - [1635865075.828800][3904:3909] CHIP:DMG: AttributeDataList = - [1635865075.828838][3904:3909] CHIP:DMG: [ - [1635865075.828870][3904:3909] CHIP:DMG: AttributeDataElement = - [1635865075.828913][3904:3909] CHIP:DMG: { - [1635865075.828951][3904:3909] CHIP:DMG: AttributePath = - [1635865075.829017][3904:3909] CHIP:DMG: { - [1635865075.829058][3904:3909] CHIP:DMG: NodeId = 0x1, - [1635865075.829129][3904:3909] CHIP:DMG: EndpointId = 0x0, - [1635865075.829181][3904:3909] CHIP:DMG: ClusterId = 0x28, - [1635865075.829251][3904:3909] CHIP:DMG: FieldTag = 0x0000_0005, - [1635865075.829317][3904:3909] CHIP:DMG: } - [1635865075.829422][3904:3909] CHIP:DMG: - [1635865075.829490][3904:3909] CHIP:DMG: Data = 'te5new', - [1635865075.829552][3904:3909] CHIP:DMG: DataElementVersion = 0x0, - [1635865075.829592][3904:3909] CHIP:DMG: }, - [1635865075.829638][3904:3909] CHIP:DMG: - [1635865075.829669][3904:3909] CHIP:DMG: ], - [1635865075.829712][3904:3909] CHIP:DMG: - [1635865075.829741][3904:3909] CHIP:DMG: } - [1635865075.829849][3904:3909] CHIP:ZCL: ReadAttributesResponse: - [1635865075.829883][3904:3909] CHIP:ZCL: ClusterId: 0x0000_0028 - [1635865075.829918][3904:3909] CHIP:ZCL: attributeId: 0x0000_0005 - [1635865075.829950][3904:3909] CHIP:ZCL: status: Success (0x0000)" - disabled: true + "TH_CR2 writes the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + identity: "beta" + command: "writeAttribute" + cluster: "Basic" + attribute: "NodeLabel" + arguments: + value: "chiptest2" - label: - "TH_CR2 writes and reads the Basic Information Clusters NodeLabel - mandatory attribute of DUT_CE" - verification: - "On 2nd controller, using chip tool, write and read Basic Information - Clusters NodeLabel mandatory attribute of DUT_CE ./chip-tool basic - write user-label te5new 2 0 1635865200.088770][6038:6043] CHIP:DMG: - WriteResponse = [1635865200.088808][6038:6043] CHIP:DMG: { - [1635865200.088842][6038:6043] CHIP:DMG: AttributeStatusList = - [1635865200.088879][6038:6043] CHIP:DMG: [ - [1635865200.089000][6038:6043] CHIP:DMG: AttributeStatusIB = - [1635865200.089041][6038:6043] CHIP:DMG: { - [1635865200.089078][6038:6043] CHIP:DMG: AttributePath = - [1635865200.089131][6038:6043] CHIP:DMG: { - [1635865200.089173][6038:6043] CHIP:DMG: FieldTag = 0x0000_0005, - [1635865200.089213][6038:6043] CHIP:DMG: NodeId = 0x0, - [1635865200.089257][6038:6043] CHIP:DMG: ClusterId = 0x28, - [1635865200.089299][6038:6043] CHIP:DMG: EndpointId = 0x0, - [1635865200.089339][6038:6043] CHIP:DMG: } - [1635865200.089389][6038:6043] CHIP:DMG: - [1635865200.089424][6038:6043] CHIP:DMG: StatusIB = - [1635865200.089468][6038:6043] CHIP:DMG: { - [1635865200.089517][6038:6043] CHIP:DMG: status = 0x0, - [1635865200.089561][6038:6043] CHIP:DMG: }, - [1635865200.089606][6038:6043] CHIP:DMG: - [1635865200.089643][6038:6043] CHIP:DMG: }, - [1635865200.089688][6038:6043] CHIP:DMG: - [1635865200.089723][6038:6043] CHIP:DMG: ], - [1635865200.089763][6038:6043] CHIP:DMG: - [1635865200.089790][6038:6043] CHIP:DMG: } - [1635865200.089854][6038:6043] CHIP:ZCL: WriteResponse: - [1635865200.089928][6038:6043] CHIP:ZCL: status: Success (0x0000) - [1635865200.089961][6038:6043] CHIP:TOO: Default Success Response - ./chip-tool basic read user-label 2 0 [1635865237.894944][6047:6052] - CHIP:DMG: ReportData = [1635865237.894978][6047:6052] CHIP:DMG: { - [1635865237.895008][6047:6052] CHIP:DMG: AttributeDataList = - [1635865237.895042][6047:6052] CHIP:DMG: [ - [1635865237.895077][6047:6052] CHIP:DMG: AttributeDataElement = - [1635865237.895119][6047:6052] CHIP:DMG: { - [1635865237.895154][6047:6052] CHIP:DMG: AttributePath = - [1635865237.895200][6047:6052] CHIP:DMG: { - [1635865237.895249][6047:6052] CHIP:DMG: NodeId = 0x2, - [1635865237.895304][6047:6052] CHIP:DMG: EndpointId = 0x0, - [1635865237.895352][6047:6052] CHIP:DMG: ClusterId = 0x28, - [1635865237.895397][6047:6052] CHIP:DMG: FieldTag = 0x0000_0005, - [1635865237.895439][6047:6052] CHIP:DMG: } - [1635865237.895482][6047:6052] CHIP:DMG: - [1635865237.895537][6047:6052] CHIP:DMG: Data = 'te5new', - [1635865237.895582][6047:6052] CHIP:DMG: DataElementVersion = 0x0, - [1635865237.895625][6047:6052] CHIP:DMG: }, - [1635865237.895672][6047:6052] CHIP:DMG: - [1635865237.895705][6047:6052] CHIP:DMG: ], - [1635865237.895748][6047:6052] CHIP:DMG: - [1635865237.895775][6047:6052] CHIP:DMG: } - [1635865237.895872][6047:6052] CHIP:ZCL: ReadAttributesResponse: - [1635865237.895903][6047:6052] CHIP:ZCL: ClusterId: 0x0000_0028 - [1635865237.895936][6047:6052] CHIP:ZCL: attributeId: 0x0000_0005 - [1635865237.895966][6047:6052] CHIP:ZCL: status: Success (0x0000) - [1635865237.895995][6047:6052] CHIP:ZCL: attribute TLV Type: 0x0c - [1635865237.896029][6047:6052] CHIP:TOO: CharString attribute - Response: te5new" - disabled: true + "TH_CR2 reads the Basic Information Clusters NodeLabel mandatory + attribute of DUT_CE" + identity: "beta" + command: "readAttribute" + cluster: "Basic" + attribute: "NodeLabel" + response: + value: "chiptest2" + constraints: + type: string + maxLength: 32 diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index e1d3c5f98bbc09..7c7bc0c30ff825 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -111690,8 +111690,10 @@ class Test_TC_MF_1_3Suite : public TestCommand TestCommand("Test_TC_MF_1_3", credsIssuerConfig), mTestIndex(0) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); + AddArgument("nodeId2", 0, UINT64_MAX, &mNodeId2); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("payload", &mPayload); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -111722,6 +111724,70 @@ class Test_TC_MF_1_3Suite : public TestCommand // incorrect mTestIndex value observed when we get the response. switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); + err = TestRebootTargetDevice_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH_CR1 starts a commissioning process with DUT_CE\n"); + err = TestThCr1StartsACommissioningProcessWithDutCe_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Open Commissioning Window\n"); + err = TestOpenCommissioningWindow_2(); + break; + case 3: + ChipLogProgress( + chipTool, + " ***** Test Step 3 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3(); + break; + case 4: + ChipLogProgress( + chipTool, + " ***** Test Step 4 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Commission from beta\n"); + err = TestCommissionFromBeta_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : TH_CR2 starts a commissioning process with DUT_CE\n"); + err = TestThCr2StartsACommissioningProcessWithDutCe_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Query fabrics list\n"); + err = TestQueryFabricsList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Query fabrics list\n"); + err = TestQueryFabricsList_8(); + break; + case 9: + ChipLogProgress( + chipTool, + " ***** Test Step 9 : TH_CR1 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9(); + break; + case 10: + ChipLogProgress( + chipTool, + " ***** Test Step 10 : TH_CR1 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10(); + break; + case 11: + ChipLogProgress( + chipTool, + " ***** Test Step 11 : TH_CR2 writes the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr2WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11(); + break; + case 12: + ChipLogProgress( + chipTool, + " ***** Test Step 12 : TH_CR2 reads the Basic Information Clusters NodeLabel mandatory attribute of DUT_CE\n"); + err = TestThCr2ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12(); + break; } if (CHIP_NO_ERROR != err) @@ -111738,11 +111804,13 @@ class Test_TC_MF_1_3Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 0; + const uint16_t mTestCount = 13; chip::Optional mNodeId; - chip::Optional mCluster; + chip::Optional mNodeId2; chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mPayload; chip::Optional mTimeout; void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override @@ -111753,9 +111821,351 @@ class Test_TC_MF_1_3Suite : public TestCommand NextTest(); } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_4(nodeLabel); + } + + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void + OnSuccessCallback_7(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + (static_cast(context))->OnSuccessResponse_7(fabrics); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void + OnSuccessCallback_8(void * context, + const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + (static_cast(context))->OnSuccessResponse_8(fabrics); + } + + static void OnFailureCallback_9(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_9(error); + } + + static void OnSuccessCallback_9(void * context) { (static_cast(context))->OnSuccessResponse_9(); } + + static void OnFailureCallback_10(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_10(error); + } + + static void OnSuccessCallback_10(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_10(nodeLabel); + } + + static void OnFailureCallback_11(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_11(error); + } + + static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context, chip::CharSpan nodeLabel) + { + (static_cast(context))->OnSuccessResponse_12(nodeLabel); + } + // // Tests methods // + + CHIP_ERROR TestRebootTargetDevice_0() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestThCr1StartsACommissioningProcessWithDutCe_1() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(1); + } + + CHIP_ERROR TestOpenCommissioningWindow_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenCommissioningWindow::Type; + + RequestType request; + request.commissioningTimeout = 120U; + request.PAKEVerifier = chip::ByteSpan( + chip::Uint8::from_const_char("\006\307V\337\374\327\042e4R\241-\315\224]\214T\332+\017<\275\033M\303\361\255\262#" + "\256\262k\004|\322L\226\206o\227\233\035\203\354P\342\264\2560\315\362\375\263+" + "\330\242\021\2707\334\224\355\315V\364\321Cw\031\020v\277\305\235\231\267\3350S\357\326" + "\360,D4\362\275\322z\244\371\316\247\015s\216Lgarbage: not in length on purpose"), + 97); + request.discriminator = 3840U; + request.iterations = 1000UL; + request.salt = chip::ByteSpan(chip::Uint8::from_const_char("SPAKE2P Key Saltgarbage: not in length on purpose"), 16); + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_2(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptestgarbage: not in length on purpose", 8); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest", 8))); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestCommissionFromBeta_5() + { + SetIdentity(kIdentityBeta); + return PairWithQRCode(1, mPayload.HasValue() ? mPayload.Value() : chip::CharSpan::fromCharString("MT:0000000000I31506010")); + } + + CHIP_ERROR TestThCr2StartsACommissioningProcessWithDutCe_6() + { + SetIdentity(kIdentityBeta); + return WaitForCommissionee(1); + } + + CHIP_ERROR TestQueryFabricsList_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 1)); + } + VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); + NextTest(); + } + + CHIP_ERROR TestQueryFabricsList_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::OperationalCredentialsClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, false)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8(const chip::app::DataModel::DecodableList< + chip::app::Clusters::OperationalCredentials::Structs::FabricDescriptor::DecodableType> & fabrics) + { + { + auto iter_0 = fabrics.begin(); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 0)); + VerifyOrReturn(CheckValueAsString("fabrics[0].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNextListItemDecodes("fabrics", iter_0, 1)); + VerifyOrReturn(CheckValueAsString("fabrics[1].label", iter_0.GetValue().label, chip::CharSpan("", 0))); + VerifyOrReturn(CheckNoMoreListItems("fabrics", iter_0, 2)); + } + VerifyOrReturn(CheckConstraintType("fabrics", "", "list")); + NextTest(); + } + + CHIP_ERROR TestThCr1WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptest1garbage: not in length on purpose", 9); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestThCr1ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_10(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest1", 9))); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); + NextTest(); + } + + CHIP_ERROR TestThCr2WritesTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + chip::CharSpan nodeLabelArgument; + nodeLabelArgument = chip::Span("chiptest2garbage: not in length on purpose", 9); + + ReturnErrorOnFailure(cluster.WriteAttribute( + nodeLabelArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_11() { NextTest(); } + + CHIP_ERROR TestThCr2ReadsTheBasicInformationClustersNodeLabelMandatoryAttributeOfDutCe_12() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::BasicClusterTest cluster; + cluster.Associate(mDevices[kIdentityBeta], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_12(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_12(chip::CharSpan nodeLabel) + { + VerifyOrReturn(CheckValueAsString("nodeLabel", nodeLabel, chip::CharSpan("chiptest2", 9))); + VerifyOrReturn(CheckConstraintType("nodeLabel", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("nodeLabel", nodeLabel.size(), 32)); + NextTest(); + } }; class Test_TC_MF_1_4Suite : public TestCommand From 4505e872b2cce504222b41ec2a10ac86e4006d6a Mon Sep 17 00:00:00 2001 From: Carol Yang Date: Wed, 23 Mar 2022 09:38:26 -0700 Subject: [PATCH 25/70] [OTA] Add support for applying image for Linux/Darwin platform (#16482) - Make sure driver restores the core states if there is a problem detected at initialization --- config/standalone/CHIPProjectConfig.h | 8 ++ .../nxp/k32w/k32w0/main/AppTask.cpp | 2 +- .../ota-requestor-app/efr32/src/AppTask.cpp | 2 +- examples/ota-requestor-app/linux/main.cpp | 18 ++- examples/platform/efr32/OTAConfig.cpp | 2 +- .../DefaultOTARequestorStorage.cpp | 34 +++++ .../DefaultOTARequestorStorage.h | 8 ++ .../GenericOTARequestorDriver.cpp | 11 ++ .../clusters/ota-requestor/OTARequestor.cpp | 128 ++++++++++++++++-- src/app/clusters/ota-requestor/OTARequestor.h | 58 +++----- .../ota-requestor/OTARequestorInterface.h | 17 ++- .../ota-requestor/OTARequestorStorage.h | 9 ++ .../tests/TestDefaultOTARequestorStorage.cpp | 41 +++++- .../python/test/test_scripts/base.py | 4 +- src/lib/shell/commands/Ota.cpp | 4 +- src/lib/support/DefaultStorageKeyAllocator.h | 2 + src/platform/CYW30739/PlatformManagerImpl.cpp | 5 + src/platform/EFR32/OTAImageProcessorImpl.h | 4 +- src/platform/Linux/OTAImageProcessorImpl.cpp | 70 +++++++--- src/platform/Linux/OTAImageProcessorImpl.h | 12 +- .../nxp/k32w/k32w0/OTAImageProcessorImpl.cpp | 8 +- .../nxp/k32w/k32w0/OTAImageProcessorImpl.h | 4 +- 22 files changed, 351 insertions(+), 100 deletions(-) diff --git a/config/standalone/CHIPProjectConfig.h b/config/standalone/CHIPProjectConfig.h index 4b008de5f09d3b..919897fcf7ecae 100644 --- a/config/standalone/CHIPProjectConfig.h +++ b/config/standalone/CHIPProjectConfig.h @@ -69,6 +69,14 @@ #define CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT 4 #endif +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 1 +#endif + +#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING +#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0" +#endif + // // Default of 8 ECs is not sufficient for some of the unit tests // that try to validate multiple simultaneous interactions. diff --git a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp index 2d0fbf08c1e918..375cf6d8aa960d 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp +++ b/examples/lighting-app/nxp/k32w/k32w0/main/AppTask.cpp @@ -127,7 +127,7 @@ CHIP_ERROR AppTask::Init() gRequestorCore.Init(Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - gImageProcessor.SetOTAImageFile(CharSpan("test.txt")); + gImageProcessor.SetOTAImageFile("test.txt"); gImageProcessor.SetOTADownloader(&gDownloader); // Connect the gDownloader and Image Processor objects diff --git a/examples/ota-requestor-app/efr32/src/AppTask.cpp b/examples/ota-requestor-app/efr32/src/AppTask.cpp index 0659962b174a9d..95d2e9f36ca41c 100644 --- a/examples/ota-requestor-app/efr32/src/AppTask.cpp +++ b/examples/ota-requestor-app/efr32/src/AppTask.cpp @@ -542,7 +542,7 @@ void AppTask::InitOTARequestor() gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - gImageProcessor.SetOTAImageFile(CharSpan("test.txt")); + gImageProcessor.SetOTAImageFile("test.txt"); gImageProcessor.SetOTADownloader(&gDownloader); // Connect the Downloader and Image Processor objects diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index add907124b41c5..df982509d4d8c8 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -139,7 +139,7 @@ static void InitOTARequestor(void) gRequestorCore.Init(chip::Server::GetInstance(), gRequestorStorage, gRequestorUser, gDownloader); gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - gImageProcessor.SetOTAImageFile(CharSpan::fromCharString(gOtaDownloadPath)); + gImageProcessor.SetOTAImageFile(gOtaDownloadPath); gImageProcessor.SetOTADownloader(&gDownloader); // Set the image processor instance used for handling image being downloaded @@ -213,5 +213,21 @@ int main(int argc, char * argv[]) { VerifyOrDie(ChipLinuxAppInit(argc, argv, &cmdLineOptions) == 0); ChipLinuxAppMainLoop(); + + // If the event loop had been stopped due to an update being applied, boot into the new image + if (gRequestorCore.GetCurrentUpdateState() == OTARequestor::OTAUpdateStateEnum::kApplying) + { + if (kMaxFilePathSize <= strlen(kImageExecPath)) + { + ChipLogError(SoftwareUpdate, "Buffer too small for the new image file path: %s", kImageExecPath); + return -1; + } + + argv[0] = kImageExecPath; + execv(argv[0], argv); + + // If successfully executing the new iamge, execv should not return + ChipLogError(SoftwareUpdate, "The OTA image is invalid"); + } return 0; } diff --git a/examples/platform/efr32/OTAConfig.cpp b/examples/platform/efr32/OTAConfig.cpp index c46fab91deb76b..b656fcfb3ff4b1 100644 --- a/examples/platform/efr32/OTAConfig.cpp +++ b/examples/platform/efr32/OTAConfig.cpp @@ -79,7 +79,7 @@ void OTAConfig::Init() gRequestorUser.SetPeriodicQueryTimeout(OTA_PERIODIC_TIMEOUT); gRequestorUser.Init(&gRequestorCore, &gImageProcessor); - gImageProcessor.SetOTAImageFile(chip::CharSpan("test.txt")); + gImageProcessor.SetOTAImageFile("test.txt"); gImageProcessor.SetOTADownloader(&gDownloader); // Connect the Downloader and Image Processor objects diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp b/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp index e16a10f0300350..17374b43e7dc99 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp +++ b/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.cpp @@ -134,6 +134,40 @@ CHIP_ERROR DefaultOTARequestorStorage::LoadUpdateToken(MutableByteSpan & updateT return Load(DefaultStorageKeyAllocator::OTAUpdateToken(), updateToken); } +CHIP_ERROR DefaultOTARequestorStorage::StoreCurrentUpdateState(OTAUpdateStateEnum currentUpdateState) +{ + return mPersistentStorage->SyncSetKeyValue(DefaultStorageKeyAllocator::OTACurrentUpdateState(), ¤tUpdateState, + sizeof(currentUpdateState)); +} + +CHIP_ERROR DefaultOTARequestorStorage::LoadCurrentUpdateState(OTAUpdateStateEnum & currentUpdateState) +{ + uint16_t size = static_cast(sizeof(currentUpdateState)); + return mPersistentStorage->SyncGetKeyValue(DefaultStorageKeyAllocator::OTACurrentUpdateState(), ¤tUpdateState, size); +} + +CHIP_ERROR DefaultOTARequestorStorage::ClearCurrentUpdateState() +{ + return mPersistentStorage->SyncDeleteKeyValue(DefaultStorageKeyAllocator::OTACurrentUpdateState()); +} + +CHIP_ERROR DefaultOTARequestorStorage::StoreTargetVersion(uint32_t targetVersion) +{ + return mPersistentStorage->SyncSetKeyValue(DefaultStorageKeyAllocator::OTATargetVersion(), &targetVersion, + sizeof(targetVersion)); +} + +CHIP_ERROR DefaultOTARequestorStorage::LoadTargetVersion(uint32_t & targetVersion) +{ + uint16_t size = static_cast(sizeof(targetVersion)); + return mPersistentStorage->SyncGetKeyValue(DefaultStorageKeyAllocator::OTATargetVersion(), &targetVersion, size); +} + +CHIP_ERROR DefaultOTARequestorStorage::ClearTargetVersion() +{ + return mPersistentStorage->SyncDeleteKeyValue(DefaultStorageKeyAllocator::OTATargetVersion()); +} + CHIP_ERROR DefaultOTARequestorStorage::Load(const char * key, MutableByteSpan & buffer) { uint16_t size = static_cast(buffer.size()); diff --git a/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.h b/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.h index a9f973de43c726..048e8d4d09d973 100644 --- a/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.h +++ b/src/app/clusters/ota-requestor/DefaultOTARequestorStorage.h @@ -40,6 +40,14 @@ class DefaultOTARequestorStorage : public OTARequestorStorage CHIP_ERROR ClearUpdateToken() override; CHIP_ERROR LoadUpdateToken(MutableByteSpan & updateToken) override; + CHIP_ERROR StoreCurrentUpdateState(OTAUpdateStateEnum currentUpdateState) override; + CHIP_ERROR LoadCurrentUpdateState(OTAUpdateStateEnum & currentUpdateState) override; + CHIP_ERROR ClearCurrentUpdateState() override; + + CHIP_ERROR StoreTargetVersion(uint32_t targetVersion) override; + CHIP_ERROR LoadTargetVersion(uint32_t & targetVersion) override; + CHIP_ERROR ClearTargetVersion() override; + private: CHIP_ERROR Load(const char * key, MutableByteSpan & buffer); PersistentStorageDelegate * mPersistentStorage = nullptr; diff --git a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp index 7f0cda72eeaa3f..cc2bdb109a82e3 100644 --- a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp +++ b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp @@ -70,12 +70,23 @@ void GenericOTARequestorDriver::Init(OTARequestorInterface * requestor, OTAImage if (error != CHIP_NO_ERROR) { ChipLogError(SoftwareUpdate, "Failed to confirm image: %" CHIP_ERROR_FORMAT, error.Format()); + mRequestor->Reset(); return; } mRequestor->NotifyUpdateApplied(); }); } + else if ((mRequestor->GetCurrentUpdateState() != OTAUpdateStateEnum::kIdle)) + { + // Not running a new image for the first time but also not in the idle state may indicate there is a problem + mRequestor->Reset(); + } + else + { + // Start the first periodic query timer + StartDefaultProviderTimer(); + } } bool GenericOTARequestorDriver::CanConsent() diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index 059c590f035fbd..f6b19f5981922c 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -107,12 +107,35 @@ void OTARequestor::InitState(intptr_t context) OTARequestor * requestorCore = reinterpret_cast(context); VerifyOrDie(requestorCore != nullptr); - // This results in the initial periodic timer kicking off - requestorCore->RecordNewUpdateState(OTAUpdateStateEnum::kIdle, OTAChangeReasonEnum::kSuccess); - + // This initialization may occur due to the following: + // 1) Regular boot up - the states should already be correct + // 2) Reboot from applying an image - once the image has been confirmed, the provider will be notified of the new version and + // all relevant states will reset for a new OTA update. If the image cannot be confirmed, the driver will be responsible for + // resetting the states appropriately, including the current update state. + OtaRequestorServerSetUpdateState(requestorCore->mCurrentUpdateState); OtaRequestorServerSetUpdateStateProgress(app::DataModel::NullNullable); } +CHIP_ERROR OTARequestor::Init(Server & server, OTARequestorStorage & storage, OTARequestorDriver & driver, + BDXDownloader & downloader) +{ + mServer = &server; + mCASESessionManager = server.GetCASESessionManager(); + mStorage = &storage; + mOtaRequestorDriver = &driver; + mBdxDownloader = &downloader; + + ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(mCurrentVersion)); + + // Load data from KVS + LoadCurrentUpdateInfo(); + + // Schedule the initializations that needs to be performed in the CHIP context + DeviceLayer::PlatformMgr().ScheduleWork(InitState, reinterpret_cast(this)); + + return chip::DeviceLayer::PlatformMgrImpl().AddEventHandler(OnCommissioningCompleteRequestor, reinterpret_cast(this)); +} + void OTARequestor::OnQueryImageResponse(void * context, const QueryImageResponse::DecodableType & response) { LogQueryImageResponse(response); @@ -159,7 +182,6 @@ void OTARequestor::OnQueryImageResponse(void * context, const QueryImageResponse memcpy(fileDesignator.data(), update.fileDesignator.data(), update.fileDesignator.size()); fileDesignator.reduce_size(update.fileDesignator.size()); requestorCore->mFileDesignator = fileDesignator; - requestorCore->StoreCurrentUpdateInfo(); requestorCore->mOtaRequestorDriver->UpdateAvailable(update, System::Clock::Seconds32(response.delayedActionTime.ValueOr(0))); @@ -253,6 +275,22 @@ void OTARequestor::OnNotifyUpdateAppliedFailure(void * context, CHIP_ERROR error requestorCore->RecordErrorUpdateState(UpdateFailureState::kNotifying, error); } +void OTARequestor::Reset() +{ + mProviderLocation.ClearValue(); + mUpdateToken.reduce_size(0); + RecordNewUpdateState(OTAUpdateStateEnum::kIdle, OTAChangeReasonEnum::kSuccess); + mTargetVersion = 0; + + // Persist in case of a reboot or crash + StoreCurrentUpdateInfo(); +} + +void OTARequestor::Shutdown(void) +{ + mServer->DispatchShutDownAndStopEventLoop(); +} + EmberAfStatus OTARequestor::HandleAnnounceOTAProvider(app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const AnnounceOtaProvider::DecodableType & commandData) @@ -365,14 +403,14 @@ void OTARequestor::CancelImageUpdate() RecordNewUpdateState(OTAUpdateStateEnum::kIdle, OTAChangeReasonEnum::kUnknown); } -CHIP_ERROR OTARequestor::GetUpdateProgress(EndpointId endpointId, app::DataModel::Nullable & progress) +CHIP_ERROR OTARequestor::GetUpdateStateProgressAttribute(EndpointId endpointId, app::DataModel::Nullable & progress) { VerifyOrReturnError(OtaRequestorServerGetUpdateStateProgress(endpointId, progress) == EMBER_ZCL_STATUS_SUCCESS, CHIP_ERROR_BAD_REQUEST); return CHIP_NO_ERROR; } -CHIP_ERROR OTARequestor::GetState(EndpointId endpointId, OTAUpdateStateEnum & state) +CHIP_ERROR OTARequestor::GetUpdateStateAttribute(EndpointId endpointId, OTAUpdateStateEnum & state) { VerifyOrReturnError(OtaRequestorServerGetUpdateState(endpointId, state) == EMBER_ZCL_STATUS_SUCCESS, CHIP_ERROR_BAD_REQUEST); return CHIP_NO_ERROR; @@ -504,6 +542,10 @@ void OTARequestor::DownloadUpdateDelayedOnUserConsent() void OTARequestor::ApplyUpdate() { RecordNewUpdateState(OTAUpdateStateEnum::kApplying, OTAChangeReasonEnum::kSuccess); + + // If image is successfully applied, the device will reboot so persist all relevant data + StoreCurrentUpdateInfo(); + ConnectToProvider(kApplyUpdate); } @@ -520,9 +562,6 @@ void OTARequestor::NotifyUpdateApplied() OtaRequestorServerOnVersionApplied(mCurrentVersion, productId); - // There is no response for a notify so consider this OTA complete - RecordNewUpdateState(OTAUpdateStateEnum::kIdle, OTAChangeReasonEnum::kSuccess); - ConnectToProvider(kNotifyUpdateApplied); } @@ -788,7 +827,9 @@ CHIP_ERROR OTARequestor::SendNotifyUpdateAppliedRequest(OperationalDeviceProxy & Controller::OtaSoftwareUpdateProviderCluster cluster; cluster.Associate(&deviceProxy, mProviderLocation.Value().endpoint); - mProviderLocation.ClearValue(); // Clearing the last used provider location to start afresh on reboot + // There is no response for a notify so consider this OTA complete. Clear the provider location and reset any states to indicate + // so. + Reset(); return cluster.InvokeCommand(args, this, OnNotifyUpdateAppliedResponse, OnNotifyUpdateAppliedFailure); } @@ -796,19 +837,78 @@ CHIP_ERROR OTARequestor::SendNotifyUpdateAppliedRequest(OperationalDeviceProxy & void OTARequestor::StoreCurrentUpdateInfo() { // TODO: change OTA requestor storage interface to store both values at once - CHIP_ERROR error = mStorage->StoreCurrentProviderLocation(mProviderLocation.Value()); + CHIP_ERROR error = CHIP_NO_ERROR; + if (mProviderLocation.HasValue()) + { + error = mStorage->StoreCurrentProviderLocation(mProviderLocation.Value()); + } + else + { + error = mStorage->ClearCurrentProviderLocation(); + } - if (error == CHIP_NO_ERROR) + if ((error == CHIP_NO_ERROR) || (error == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)) + { + if (mUpdateToken.size() > 0) + { + error = mStorage->StoreUpdateToken(mUpdateToken); + } + else + { + error = mStorage->ClearUpdateToken(); + } + } + + if ((error == CHIP_NO_ERROR) || (error == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)) { - mStorage->StoreUpdateToken(mUpdateToken); + error = mStorage->StoreCurrentUpdateState(mCurrentUpdateState); } - if (error != CHIP_NO_ERROR) + if ((error == CHIP_NO_ERROR) || (error == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)) + { + if (mTargetVersion > 0) + { + error = mStorage->StoreTargetVersion(mTargetVersion); + } + else + { + error = mStorage->ClearTargetVersion(); + } + } + + if ((error != CHIP_NO_ERROR) && (error != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND)) { ChipLogError(SoftwareUpdate, "Failed to store current update: %" CHIP_ERROR_FORMAT, error.Format()); } } +void OTARequestor::LoadCurrentUpdateInfo() +{ + mStorage->LoadDefaultProviders(mDefaultOtaProviderList); + + ProviderLocationType providerLocation; + if (mStorage->LoadCurrentProviderLocation(providerLocation) == CHIP_NO_ERROR) + { + mProviderLocation.SetValue(providerLocation); + } + + MutableByteSpan updateToken(mUpdateTokenBuffer); + if (mStorage->LoadUpdateToken(updateToken) == CHIP_NO_ERROR) + { + mUpdateToken = updateToken; + } + + if (mStorage->LoadCurrentUpdateState(mCurrentUpdateState) != CHIP_NO_ERROR) + { + mCurrentUpdateState = OTAUpdateStateEnum::kIdle; + } + + if (mStorage->LoadTargetVersion(mTargetVersion) != CHIP_NO_ERROR) + { + mTargetVersion = 0; + } +} + // Invoked when the device becomes commissioned void OTARequestor::OnCommissioningCompleteRequestor(const DeviceLayer::ChipDeviceEvent * event, intptr_t arg) { diff --git a/src/app/clusters/ota-requestor/OTARequestor.h b/src/app/clusters/ota-requestor/OTARequestor.h index 7ac6d08a0bae8b..664bf4c9b97947 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.h +++ b/src/app/clusters/ota-requestor/OTARequestor.h @@ -40,6 +40,9 @@ class OTARequestor : public OTARequestorInterface, public BDXDownloader::StateDe OTARequestor() : mOnConnectedCallback(OnConnected, this), mOnConnectionFailureCallback(OnConnectionFailure, this) {} //////////// OTARequestorInterface Implementation /////////////// + void Reset(void) override; + void Shutdown(void) override; + EmberAfStatus HandleAnnounceOTAProvider( app::CommandHandler * commandObj, const app::ConcreteCommandPath & commandPath, const app::Clusters::OtaSoftwareUpdateRequestor::Commands::AnnounceOtaProvider::DecodableType & commandData) override; @@ -63,15 +66,19 @@ class OTARequestor : public OTARequestorInterface, public BDXDownloader::StateDe // Initiate the session to send NotifyUpdateApplied command void NotifyUpdateApplied() override; - // Get image update progress in percents unit - CHIP_ERROR GetUpdateProgress(EndpointId endpointId, app::DataModel::Nullable & progress) override; + // Get the value of the UpdateStateProgress attribute (in percentage) of the OTA Software Update Requestor Cluster on the given + // endpoint + CHIP_ERROR GetUpdateStateProgressAttribute(EndpointId endpointId, app::DataModel::Nullable & progress) override; - // Get requestor state - CHIP_ERROR GetState(EndpointId endpointId, OTAUpdateStateEnum & state) override; + // Get the value of the UpdateState attribute of the OTA Software Update Requestor Cluster on the given endpoint + CHIP_ERROR GetUpdateStateAttribute(EndpointId endpointId, OTAUpdateStateEnum & state) override; // Get the current state of the OTA update OTAUpdateStateEnum GetCurrentUpdateState() override { return mCurrentUpdateState; } + // Get the target version of the OTA update + uint32_t GetTargetVersion() override { return mTargetVersion; } + // Application directs the Requestor to cancel image update in progress. All the Requestor state is // cleared, UpdateState is reset to Idle void CancelImageUpdate() override; @@ -100,42 +107,10 @@ class OTARequestor : public OTARequestorInterface, public BDXDownloader::StateDe //////////// OTARequestor public APIs /////////////// /** - * Called to perform some initialization including: - * - Set server instance used to get access to the system resources necessary to open CASE sessions and drive - * BDX transfers - * - Set the OTA requestor driver instance used to communicate download progress and errors - * - Set the BDX downloader instance used for initiating BDX downloads + * Called to perform some initialization. Note that some states that must be initalized in the CHIP context will be deferred to + * InitState. */ - CHIP_ERROR Init(Server & server, OTARequestorStorage & storage, OTARequestorDriver & driver, BDXDownloader & downloader) - { - mServer = &server; - mCASESessionManager = server.GetCASESessionManager(); - mStorage = &storage; - mOtaRequestorDriver = &driver; - mBdxDownloader = &downloader; - - ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(mCurrentVersion)); - - storage.LoadDefaultProviders(mDefaultOtaProviderList); - - ProviderLocationType providerLocation; - if (storage.LoadCurrentProviderLocation(providerLocation) == CHIP_NO_ERROR) - { - mProviderLocation.SetValue(providerLocation); - } - - MutableByteSpan updateToken(mUpdateTokenBuffer); - if (storage.LoadUpdateToken(updateToken) == CHIP_NO_ERROR) - { - mUpdateToken = updateToken; - } - - // Schedule the initializations that needs to be performed in the CHIP context - DeviceLayer::PlatformMgr().ScheduleWork(InitState, reinterpret_cast(this)); - - return chip::DeviceLayer::PlatformMgrImpl().AddEventHandler(OnCommissioningCompleteRequestor, - reinterpret_cast(this)); - } + CHIP_ERROR Init(Server & server, OTARequestorStorage & storage, OTARequestorDriver & driver, BDXDownloader & downloader); private: using QueryImageResponseDecodableType = app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::DecodableType; @@ -285,6 +260,11 @@ class OTARequestor : public OTARequestorInterface, public BDXDownloader::StateDe */ void StoreCurrentUpdateInfo(); + /** + * Load current update information to KVS + */ + void LoadCurrentUpdateInfo(); + /** * Session connection callbacks */ diff --git a/src/app/clusters/ota-requestor/OTARequestorInterface.h b/src/app/clusters/ota-requestor/OTARequestorInterface.h index f878fae67edfd1..855e08233b3f45 100644 --- a/src/app/clusters/ota-requestor/OTARequestorInterface.h +++ b/src/app/clusters/ota-requestor/OTARequestorInterface.h @@ -153,6 +153,12 @@ class OTARequestorInterface kWrongState = 2 }; + // Reset any relevant states + virtual void Reset(void) = 0; + + // Perform any clean up necessary + virtual void Shutdown(void) = 0; + // Handler for the AnnounceOTAProvider command virtual EmberAfStatus HandleAnnounceOTAProvider( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, @@ -180,15 +186,20 @@ class OTARequestorInterface // Initiate the session to send NotifyUpdateApplied command virtual void NotifyUpdateApplied() = 0; - // Get image update progress in percents unit - virtual CHIP_ERROR GetUpdateProgress(EndpointId endpointId, chip::app::DataModel::Nullable & progress) = 0; + // Get the value of the UpdateStateProgress attribute (in percentage) of the OTA Software Update Requestor Cluster on the given + // endpoint + virtual CHIP_ERROR GetUpdateStateProgressAttribute(EndpointId endpointId, + chip::app::DataModel::Nullable & progress) = 0; // Get the value of the UpdateState attribute of the OTA Software Update Requestor Cluster on the given endpoint - virtual CHIP_ERROR GetState(EndpointId endpointId, OTAUpdateStateEnum & state) = 0; + virtual CHIP_ERROR GetUpdateStateAttribute(EndpointId endpointId, OTAUpdateStateEnum & state) = 0; // Get the current state of the OTA update virtual OTAUpdateStateEnum GetCurrentUpdateState() = 0; + // Get the target version of the OTA update + virtual uint32_t GetTargetVersion() = 0; + // Application directs the Requestor to cancel image update in progress. All the Requestor state is // cleared, UpdateState is reset to Idle virtual void CancelImageUpdate() = 0; diff --git a/src/app/clusters/ota-requestor/OTARequestorStorage.h b/src/app/clusters/ota-requestor/OTARequestorStorage.h index 42a918be21f795..5275146e1fc8ac 100644 --- a/src/app/clusters/ota-requestor/OTARequestorStorage.h +++ b/src/app/clusters/ota-requestor/OTARequestorStorage.h @@ -29,6 +29,7 @@ class OTARequestorStorage { public: using ProviderLocationType = app::Clusters::OtaSoftwareUpdateRequestor::Structs::ProviderLocation::Type; + using OTAUpdateStateEnum = app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum; virtual ~OTARequestorStorage() {} @@ -42,6 +43,14 @@ class OTARequestorStorage virtual CHIP_ERROR StoreUpdateToken(ByteSpan updateToken) = 0; virtual CHIP_ERROR LoadUpdateToken(MutableByteSpan & updateToken) = 0; virtual CHIP_ERROR ClearUpdateToken() = 0; + + virtual CHIP_ERROR StoreCurrentUpdateState(OTAUpdateStateEnum currentUpdateState) = 0; + virtual CHIP_ERROR LoadCurrentUpdateState(OTAUpdateStateEnum & currentUpdateState) = 0; + virtual CHIP_ERROR ClearCurrentUpdateState() = 0; + + virtual CHIP_ERROR StoreTargetVersion(uint32_t targetVersion) = 0; + virtual CHIP_ERROR LoadTargetVersion(uint32_t & targetVersion) = 0; + virtual CHIP_ERROR ClearTargetVersion() = 0; }; } // namespace chip diff --git a/src/app/tests/TestDefaultOTARequestorStorage.cpp b/src/app/tests/TestDefaultOTARequestorStorage.cpp index 168fc52c32c4d9..908d7cc7ea80d6 100644 --- a/src/app/tests/TestDefaultOTARequestorStorage.cpp +++ b/src/app/tests/TestDefaultOTARequestorStorage.cpp @@ -147,10 +147,49 @@ void TestUpdateToken(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadUpdateToken(readUpdateToken)); } +void TestCurrentUpdateState(nlTestSuite * inSuite, void * inContext) +{ + TestPersistentStorageDelegate persistentStorage; + DefaultOTARequestorStorage otaStorage; + otaStorage.Init(persistentStorage); + + OTARequestorStorage::OTAUpdateStateEnum updateState = OTARequestorStorage::OTAUpdateStateEnum::kApplying; + + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreCurrentUpdateState(updateState)); + + updateState = OTARequestorStorage::OTAUpdateStateEnum::kUnknown; + + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadCurrentUpdateState(updateState)); + NL_TEST_ASSERT(inSuite, updateState == OTARequestorStorage::OTAUpdateStateEnum::kApplying); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearCurrentUpdateState()); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadCurrentUpdateState(updateState)); +} + +void TestTargetVersion(nlTestSuite * inSuite, void * inContext) +{ + TestPersistentStorageDelegate persistentStorage; + DefaultOTARequestorStorage otaStorage; + otaStorage.Init(persistentStorage); + + uint32_t targetVersion = 2; + + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.StoreTargetVersion(targetVersion)); + + targetVersion = 0; + + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.LoadTargetVersion(targetVersion)); + NL_TEST_ASSERT(inSuite, targetVersion == 2); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == otaStorage.ClearTargetVersion()); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR != otaStorage.LoadTargetVersion(targetVersion)); +} + const nlTest sTests[] = { NL_TEST_DEF("Test default providers", TestDefaultProviders), NL_TEST_DEF("Test default providers (empty list)", TestDefaultProvidersEmpty), NL_TEST_DEF("Test current provider location", TestCurrentProviderLocation), - NL_TEST_DEF("Test update token", TestUpdateToken), NL_TEST_SENTINEL() }; + NL_TEST_DEF("Test update token", TestUpdateToken), + NL_TEST_DEF("Test current update state", TestCurrentUpdateState), + NL_TEST_DEF("Test target version", TestTargetVersion), + NL_TEST_SENTINEL() }; int TestSetup(void * inContext) { diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index c06431411da516..d0f17af28e3d69 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -576,8 +576,8 @@ def TestReadBasicAttributes(self, nodeid: int, endpoint: int, group: int): "Location": "XX", "HardwareVersion": 0, "HardwareVersionString": "TEST_VERSION", - "SoftwareVersion": 0, - "SoftwareVersionString": "prerelease", + "SoftwareVersion": 1, + "SoftwareVersionString": "1.0", } failed_zcl = {} for basic_attr, expected_value in basic_cluster_attrs.items(): diff --git a/src/lib/shell/commands/Ota.cpp b/src/lib/shell/commands/Ota.cpp index 1b144dce750ee0..4cc005c5d423bf 100644 --- a/src/lib/shell/commands/Ota.cpp +++ b/src/lib/shell/commands/Ota.cpp @@ -59,7 +59,7 @@ CHIP_ERROR NotifyImageHandler(int argc, char ** argv) static void HandleState(intptr_t context) { app::Clusters::OtaSoftwareUpdateRequestor::OTAUpdateStateEnum state; - CHIP_ERROR err = GetRequestorInstance()->GetState(0, state); + CHIP_ERROR err = GetRequestorInstance()->GetUpdateStateAttribute(0, state); if (err == CHIP_NO_ERROR) { @@ -108,7 +108,7 @@ static void HandleState(intptr_t context) static void HandleProgress(intptr_t context) { chip::app::DataModel::Nullable progress; - CHIP_ERROR err = GetRequestorInstance()->GetUpdateProgress(0, progress); + CHIP_ERROR err = GetRequestorInstance()->GetUpdateStateProgressAttribute(0, progress); if (err == CHIP_NO_ERROR) { diff --git a/src/lib/support/DefaultStorageKeyAllocator.h b/src/lib/support/DefaultStorageKeyAllocator.h index bd46209f3c8f6c..971e2f301b5e3d 100644 --- a/src/lib/support/DefaultStorageKeyAllocator.h +++ b/src/lib/support/DefaultStorageKeyAllocator.h @@ -79,6 +79,8 @@ class DefaultStorageKeyAllocator static const char * OTADefaultProviders() { return "o/dp"; } static const char * OTACurrentProvider() { return "o/cp"; } static const char * OTAUpdateToken() { return "o/ut"; } + static const char * OTACurrentUpdateState() { return "o/us"; } + static const char * OTATargetVersion() { return "o/tv"; } // [G]lobal [D]NS-related keys static const char * DNSExtendedDiscoveryTimeout() { return "g/d/edt"; } diff --git a/src/platform/CYW30739/PlatformManagerImpl.cpp b/src/platform/CYW30739/PlatformManagerImpl.cpp index d2db833c176b17..233e1b3fcc9f01 100644 --- a/src/platform/CYW30739/PlatformManagerImpl.cpp +++ b/src/platform/CYW30739/PlatformManagerImpl.cpp @@ -127,6 +127,11 @@ CHIP_ERROR PlatformManagerImpl::_StartEventLoopTask(void) return err; } +CHIP_ERROR PlatformManagerImpl::_StopEventLoopTask() +{ + return CHIP_NO_ERROR; +} + void PlatformManagerImpl::_LockChipStack(void) { const wiced_result_t result = wiced_rtos_lock_mutex(mMutex); diff --git a/src/platform/EFR32/OTAImageProcessorImpl.h b/src/platform/EFR32/OTAImageProcessorImpl.h index 7bb97dd2c96eae..b1198e71bb77ce 100644 --- a/src/platform/EFR32/OTAImageProcessorImpl.h +++ b/src/platform/EFR32/OTAImageProcessorImpl.h @@ -40,7 +40,7 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface CHIP_ERROR ConfirmCurrentImage() override { return CHIP_NO_ERROR; } void SetOTADownloader(OTADownloader * downloader) { mDownloader = downloader; } - void SetOTAImageFile(CharSpan name) { mImageFile = name; } + void SetOTAImageFile(const char * imageFile) { mImageFile = imageFile; } private: //////////// Actual handlers for the OTAImageProcessorInterface /////////////// @@ -66,7 +66,7 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface MutableByteSpan mBlock; OTADownloader * mDownloader; OTAImageHeaderParser mHeaderParser; - CharSpan mImageFile; + const char * mImageFile = nullptr; }; } // namespace chip diff --git a/src/platform/Linux/OTAImageProcessorImpl.cpp b/src/platform/Linux/OTAImageProcessorImpl.cpp index 048e397266c5a0..b9668ffc5e61c7 100644 --- a/src/platform/Linux/OTAImageProcessorImpl.cpp +++ b/src/platform/Linux/OTAImageProcessorImpl.cpp @@ -21,11 +21,13 @@ #include "OTAImageProcessorImpl.h" +#include + namespace chip { CHIP_ERROR OTAImageProcessorImpl::PrepareDownload() { - if (mImageFile.empty()) + if (mImageFile == nullptr) { ChipLogError(SoftwareUpdate, "Invalid output image file supplied"); return CHIP_ERROR_INTERNAL; @@ -49,7 +51,7 @@ CHIP_ERROR OTAImageProcessorImpl::Apply() CHIP_ERROR OTAImageProcessorImpl::Abort() { - if (mImageFile.empty()) + if (mImageFile == nullptr) { ChipLogError(SoftwareUpdate, "Invalid output image file supplied"); return CHIP_ERROR_INTERNAL; @@ -82,6 +84,35 @@ CHIP_ERROR OTAImageProcessorImpl::ProcessBlock(ByteSpan & block) return CHIP_NO_ERROR; } +bool OTAImageProcessorImpl::IsFirstImageRun() +{ + OTARequestorInterface * requestor = chip::GetRequestorInstance(); + if (requestor == nullptr) + { + return false; + } + + return requestor->GetCurrentUpdateState() == OTARequestorInterface::OTAUpdateStateEnum::kApplying; +} + +CHIP_ERROR OTAImageProcessorImpl::ConfirmCurrentImage() +{ + OTARequestorInterface * requestor = chip::GetRequestorInstance(); + if (requestor == nullptr) + { + return CHIP_ERROR_INTERNAL; + } + + uint32_t currentVersion; + ReturnErrorOnFailure(DeviceLayer::ConfigurationMgr().GetSoftwareVersion(currentVersion)); + if (currentVersion != requestor->GetTargetVersion()) + { + return CHIP_ERROR_INCORRECT_STATE; + } + + return CHIP_NO_ERROR; +} + void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) { auto * imageProcessor = reinterpret_cast(context); @@ -96,16 +127,16 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) return; } + unlink(imageProcessor->mImageFile); + imageProcessor->mHeaderParser.Init(); - imageProcessor->mOfs.open(imageProcessor->mImageFile.data(), std::ofstream::out | std::ofstream::ate | std::ofstream::app); + imageProcessor->mOfs.open(imageProcessor->mImageFile, std::ofstream::out | std::ofstream::ate | std::ofstream::app); if (!imageProcessor->mOfs.good()) { imageProcessor->mDownloader->OnPreparedForDownload(CHIP_ERROR_OPEN_FAILED); return; } - // TODO: if file already exists and is not empty, erase previous contents - imageProcessor->mDownloader->OnPreparedForDownload(CHIP_NO_ERROR); } @@ -120,24 +151,24 @@ void OTAImageProcessorImpl::HandleFinalize(intptr_t context) imageProcessor->mOfs.close(); imageProcessor->ReleaseBlock(); - ChipLogProgress(SoftwareUpdate, "OTA image downloaded to %s", imageProcessor->mImageFile.data()); + ChipLogProgress(SoftwareUpdate, "OTA image downloaded to %s", imageProcessor->mImageFile); } void OTAImageProcessorImpl::HandleApply(intptr_t context) { auto * imageProcessor = reinterpret_cast(context); - if (imageProcessor == nullptr) - { - return; - } + VerifyOrReturn(imageProcessor != nullptr); OTARequestorInterface * requestor = chip::GetRequestorInstance(); - if (requestor != nullptr) - { - // TODO: Implement restarting into new image instead of changing the version - DeviceLayer::ConfigurationMgr().StoreSoftwareVersion(imageProcessor->mSoftwareVersion); - requestor->NotifyUpdateApplied(); - } + VerifyOrReturn(requestor != nullptr); + + // Move the downloaded image to the location where the new image is to be executed from + unlink(kImageExecPath); + rename(imageProcessor->mImageFile, kImageExecPath); + chmod(kImageExecPath, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); + + // Shutdown the stack and expect to boot into the new image once shutdown is complete + requestor->Shutdown(); } void OTAImageProcessorImpl::HandleAbort(intptr_t context) @@ -149,7 +180,7 @@ void OTAImageProcessorImpl::HandleAbort(intptr_t context) } imageProcessor->mOfs.close(); - remove(imageProcessor->mImageFile.data()); + unlink(imageProcessor->mImageFile); imageProcessor->ReleaseBlock(); } @@ -197,11 +228,6 @@ CHIP_ERROR OTAImageProcessorImpl::ProcessHeader(ByteSpan & block) ReturnErrorCodeIf(error == CHIP_ERROR_BUFFER_TOO_SMALL, CHIP_NO_ERROR); ReturnErrorOnFailure(error); - // We save the software version to be used in the next NotifyUpdateApplied, but it's a non-standard - // behavior of the Linux implementation and the pattern should not be blindly followed by real-life - // products. In general, it's up to the implementation to decide which header fields will be - // validated or presented to the user. - mSoftwareVersion = header.mSoftwareVersion; mParams.totalFileBytes = header.mPayloadSize; mHeaderParser.Clear(); } diff --git a/src/platform/Linux/OTAImageProcessorImpl.h b/src/platform/Linux/OTAImageProcessorImpl.h index 79638334c447c5..a8939512e113dd 100644 --- a/src/platform/Linux/OTAImageProcessorImpl.h +++ b/src/platform/Linux/OTAImageProcessorImpl.h @@ -27,6 +27,9 @@ namespace chip { +// Full file path to where the new image will be executed from post-download +static char kImageExecPath[] = "/tmp/ota.update"; + class OTAImageProcessorImpl : public OTAImageProcessorInterface { public: @@ -36,11 +39,11 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface CHIP_ERROR Apply() override; CHIP_ERROR Abort() override; CHIP_ERROR ProcessBlock(ByteSpan & block) override; - bool IsFirstImageRun() override { return false; } - CHIP_ERROR ConfirmCurrentImage() override { return CHIP_NO_ERROR; } + bool IsFirstImageRun() override; + CHIP_ERROR ConfirmCurrentImage() override; void SetOTADownloader(OTADownloader * downloader) { mDownloader = downloader; } - void SetOTAImageFile(CharSpan name) { mImageFile = name; } + void SetOTAImageFile(const char * imageFile) { mImageFile = imageFile; } private: //////////// Actual handlers for the OTAImageProcessorInterface /////////////// @@ -66,8 +69,7 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface MutableByteSpan mBlock; OTADownloader * mDownloader; OTAImageHeaderParser mHeaderParser; - uint32_t mSoftwareVersion; - CharSpan mImageFile; + const char * mImageFile = nullptr; }; } // namespace chip diff --git a/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.cpp b/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.cpp index 67decb387c2639..895f116bc0d11c 100644 --- a/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.cpp +++ b/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.cpp @@ -28,7 +28,7 @@ namespace chip { CHIP_ERROR OTAImageProcessorImpl::PrepareDownload() { - if (mImageFile.empty()) + if (mImageFile == nullptr) { ChipLogError(SoftwareUpdate, "Invalid output image file supplied"); return CHIP_ERROR_INTERNAL; @@ -51,7 +51,7 @@ CHIP_ERROR OTAImageProcessorImpl::Apply() CHIP_ERROR OTAImageProcessorImpl::Abort() { - if (mImageFile.empty()) + if (mImageFile == nullptr) { ChipLogError(SoftwareUpdate, "Invalid output image file supplied"); return CHIP_ERROR_INTERNAL; @@ -95,7 +95,7 @@ void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) if (gOtaSuccess_c == OTA_ClientInit()) { - if (gOtaSuccess_c == OTA_StartImage(imageProcessor->mImageFile.size())) + if (gOtaSuccess_c == OTA_StartImage(strlen(imageProcessor->mImageFile))) { imageProcessor->mDownloader->OnPreparedForDownload(CHIP_NO_ERROR); } @@ -110,7 +110,7 @@ void OTAImageProcessorImpl::HandleAbort(intptr_t context) return; } - remove(imageProcessor->mImageFile.data()); + remove(imageProcessor->mImageFile); imageProcessor->ReleaseBlock(); } diff --git a/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.h b/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.h index 419ee4fb493266..845c43bfc85eea 100644 --- a/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.h +++ b/src/platform/nxp/k32w/k32w0/OTAImageProcessorImpl.h @@ -37,7 +37,7 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface CHIP_ERROR ConfirmCurrentImage() override { return CHIP_NO_ERROR; } void SetOTADownloader(OTADownloader * downloader) { mDownloader = downloader; } - void SetOTAImageFile(CharSpan name) { mImageFile = name; } + void SetOTAImageFile(const char * imageFile) { mImageFile = imageFile; } private: //////////// Actual handlers for the OTAImageProcessorInterface /////////////// @@ -58,7 +58,7 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface OTADownloader * mDownloader; MutableByteSpan mBlock; - CharSpan mImageFile; + const char * mImageFile = nullptr; }; } // namespace chip From a8dcee462277b8ad2dc4485c15f4d1344e4a0bba Mon Sep 17 00:00:00 2001 From: Evgeny Margolis Date: Wed, 23 Mar 2022 09:50:37 -0700 Subject: [PATCH 26/70] Added CASE Authenticated Tag (CAT) Support To the Commissioner APIs. (#15117) --- .../chip-tool/commands/common/CHIPCommand.cpp | 3 +- .../common/CredentialIssuerCommands.h | 9 +- .../example/ExampleCredentialIssuerCommands.h | 10 +- .../chip-tool/config/PersistentStorage.cpp | 39 ++++- examples/chip-tool/config/PersistentStorage.h | 8 +- examples/platform/linux/AppMain.cpp | 6 +- .../ExampleOperationalCredentialsIssuer.cpp | 14 +- .../ExampleOperationalCredentialsIssuer.h | 8 +- .../java/AndroidDeviceControllerWrapper.cpp | 6 +- .../java/AndroidDeviceControllerWrapper.h | 4 +- .../AndroidOperationalCredentialsIssuer.cpp | 12 +- .../AndroidOperationalCredentialsIssuer.h | 8 +- .../java/CHIPDeviceController-JNI.cpp | 6 +- src/controller/python/OpCredsBinding.cpp | 11 +- .../python/chip/configuration/__init__.py | 27 ++- .../python/chip/internal/CommissionerImpl.cpp | 10 +- .../python/chip/internal/commissioner.py | 10 +- src/credentials/CHIPCert.cpp | 13 ++ src/credentials/CHIPCert.h | 9 + src/credentials/tests/TestChipCert.cpp | 164 +++++++++++++----- .../Framework/CHIP/CHIPDeviceController.mm | 4 +- .../CHIP/CHIPOperationalCredentialsDelegate.h | 5 +- .../CHIPOperationalCredentialsDelegate.mm | 14 +- src/lib/core/CASEAuthTag.h | 26 ++- src/lib/core/CHIPVendorIdentifiers.hpp | 7 +- 25 files changed, 321 insertions(+), 112 deletions(-) diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index fe981615def3b8..d69c5be7408e5f 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -224,6 +224,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f ReturnLogErrorOnFailure(ephemeralKey.Initialize()); ReturnLogErrorOnFailure(mCredIssuerCmds->GenerateControllerNOCChain(mCommissionerStorage.GetLocalNodeId(), fabricId, + mCommissionerStorage.GetCommissionerCATs(), ephemeralKey, rcacSpan, icacSpan, nocSpan)); commissionerParams.operationalKeypair = &ephemeralKey; commissionerParams.controllerRCAC = rcacSpan; diff --git a/examples/chip-tool/commands/common/CredentialIssuerCommands.h b/examples/chip-tool/commands/common/CredentialIssuerCommands.h index 0682aef4876da5..951ef86efceb40 100644 --- a/examples/chip-tool/commands/common/CredentialIssuerCommands.h +++ b/examples/chip-tool/commands/common/CredentialIssuerCommands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -63,6 +63,7 @@ class CredentialIssuerCommands * * @param[in] nodeId The desired NodeId for the generated NOC Chain - May be optional/unused in some implementations. * @param[in] fabricId The desired FabricId for the generated NOC Chain - May be optional/unused in some implementations. + * @param[in] cats The desired CATs for the generated NOC Chain - May be optional/unused in some implementations. * @param[in] keypair The desired Keypair for the generated NOC Chain - May be optional/unused in some implementations. * @param[in,out] rcac Buffer to hold the Root Certificate of the generated NOC Chain. * @param[in,out] icac Buffer to hold the Intermediate Certificate of the generated NOC Chain. @@ -70,7 +71,7 @@ class CredentialIssuerCommands * * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error code. */ - virtual CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, chip::Crypto::P256Keypair & keypair, - chip::MutableByteSpan & rcac, chip::MutableByteSpan & icac, - chip::MutableByteSpan & noc) = 0; + virtual CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, + chip::Crypto::P256Keypair & keypair, chip::MutableByteSpan & rcac, + chip::MutableByteSpan & icac, chip::MutableByteSpan & noc) = 0; }; diff --git a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h index 8d6f7deeeb30d8..74646c8b5f10ba 100644 --- a/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h +++ b/examples/chip-tool/commands/example/ExampleCredentialIssuerCommands.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,11 +42,11 @@ class ExampleCredentialIssuerCommands : public CredentialIssuerCommands return CHIP_NO_ERROR; } chip::Controller::OperationalCredentialsDelegate * GetCredentialIssuer() override { return &mOpCredsIssuer; } - CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, chip::Crypto::P256Keypair & keypair, - chip::MutableByteSpan & rcac, chip::MutableByteSpan & icac, - chip::MutableByteSpan & noc) override + CHIP_ERROR GenerateControllerNOCChain(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, + chip::Crypto::P256Keypair & keypair, chip::MutableByteSpan & rcac, + chip::MutableByteSpan & icac, chip::MutableByteSpan & noc) override { - return mOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, keypair.Pubkey(), rcac, icac, noc); + return mOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, cats, keypair.Pubkey(), rcac, icac, noc); } private: diff --git a/examples/chip-tool/config/PersistentStorage.cpp b/examples/chip-tool/config/PersistentStorage.cpp index f5ef4eaf94ab6e..d580a80ece50a7 100644 --- a/examples/chip-tool/config/PersistentStorage.cpp +++ b/examples/chip-tool/config/PersistentStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -32,11 +32,12 @@ using namespace ::chip; using namespace ::chip::Controller; using namespace ::chip::Logging; -constexpr const char kDefaultSectionName[] = "Default"; -constexpr const char kPortKey[] = "ListenPort"; -constexpr const char kLoggingKey[] = "LoggingLevel"; -constexpr const char kLocalNodeIdKey[] = "LocalNodeId"; -constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Detail; +constexpr const char kDefaultSectionName[] = "Default"; +constexpr const char kPortKey[] = "ListenPort"; +constexpr const char kLoggingKey[] = "LoggingLevel"; +constexpr const char kLocalNodeIdKey[] = "LocalNodeId"; +constexpr const char kCommissionerCATsKey[] = "CommissionerCATs"; +constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Detail; std::string GetFilename(const char * name) { @@ -238,3 +239,29 @@ CHIP_ERROR PersistentStorage::SetLocalNodeId(NodeId value) uint64_t nodeId = Encoding::LittleEndian::HostSwap64(value); return SyncSetKeyValue(kLocalNodeIdKey, &nodeId, sizeof(nodeId)); } + +CATValues PersistentStorage::GetCommissionerCATs() +{ + CHIP_ERROR err = CHIP_NO_ERROR; + CATValues cats; + chip::CATValues::Serialized serializedCATs; + uint16_t size = chip::CATValues::kSerializedLength; + err = SyncGetKeyValue(kCommissionerCATsKey, serializedCATs, size); + if (err == CHIP_NO_ERROR && size == chip::CATValues::kSerializedLength) + { + err = cats.Deserialize(serializedCATs); + if (err == CHIP_NO_ERROR) + { + return cats; + } + } + return chip::kUndefinedCATs; +} + +CHIP_ERROR PersistentStorage::SetCommissionerCATs(const CATValues & cats) +{ + chip::CATValues::Serialized serializedCATs; + ReturnErrorOnFailure(cats.Serialize(serializedCATs)); + + return SyncSetKeyValue(kCommissionerCATsKey, serializedCATs, sizeof(serializedCATs)); +} diff --git a/examples/chip-tool/config/PersistentStorage.h b/examples/chip-tool/config/PersistentStorage.h index fd06571c1b6b61..35c5e8653d607f 100644 --- a/examples/chip-tool/config/PersistentStorage.h +++ b/examples/chip-tool/config/PersistentStorage.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -42,6 +42,12 @@ class PersistentStorage : public chip::PersistentStorageDelegate // Store local node id. CHIP_ERROR SetLocalNodeId(chip::NodeId nodeId); + // Return the stored local device (commissioner) CASE Authenticated Tags (CATs). + chip::CATValues GetCommissionerCATs(); + + // Store local CATs. + CHIP_ERROR SetCommissionerCATs(const chip::CATValues & cats); + private: CHIP_ERROR CommitConfig(const char * name); inipp::Ini mConfig; diff --git a/examples/platform/linux/AppMain.cpp b/examples/platform/linux/AppMain.cpp index f8fb1dd1fb8bcd..a3901bd2c990da 100644 --- a/examples/platform/linux/AppMain.cpp +++ b/examples/platform/linux/AppMain.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -416,8 +416,8 @@ CHIP_ERROR InitCommissioner() Crypto::P256Keypair ephemeralKey; ReturnErrorOnFailure(ephemeralKey.Initialize()); - ReturnErrorOnFailure(gOpCredsIssuer.GenerateNOCChainAfterValidation(gLocalId, /* fabricId = */ 1, ephemeralKey.Pubkey(), - rcacSpan, icacSpan, nocSpan)); + ReturnErrorOnFailure(gOpCredsIssuer.GenerateNOCChainAfterValidation(gLocalId, /* fabricId = */ 1, chip::kUndefinedCATs, + ephemeralKey.Pubkey(), rcacSpan, icacSpan, nocSpan)); params.operationalKeypair = &ephemeralKey; params.controllerRCAC = rcacSpan; diff --git a/src/controller/ExampleOperationalCredentialsIssuer.cpp b/src/controller/ExampleOperationalCredentialsIssuer.cpp index 34a823cb872065..97b704be471dbc 100644 --- a/src/controller/ExampleOperationalCredentialsIssuer.cpp +++ b/src/controller/ExampleOperationalCredentialsIssuer.cpp @@ -111,6 +111,7 @@ CHIP_ERROR ExampleOperationalCredentialsIssuer::Initialize(PersistentStorageDele } CHIP_ERROR ExampleOperationalCredentialsIssuer::GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, + const CATValues & cats, const Crypto::P256PublicKey & pubkey, MutableByteSpan & rcac, MutableByteSpan & icac, MutableByteSpan & noc) @@ -118,13 +119,13 @@ CHIP_ERROR ExampleOperationalCredentialsIssuer::GenerateNOCChainAfterValidation( ChipDN noc_dn; // TODO: Is there a way to make this code less error-prone for consumers? // The consumer doesn't need to know the exact OID value. - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, nodeId); - // TODO: Add support for the CASE Authenticated Tags attributes + ReturnErrorOnFailure(noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId)); + ReturnErrorOnFailure(noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, nodeId)); + ReturnErrorOnFailure(noc_dn.AddCATs(cats)); ChipDN icac_dn; - icac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, mIntermediateIssuerId); + ReturnErrorOnFailure(icac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, mIntermediateIssuerId)); ChipDN rcac_dn; - rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, mIssuerId); + ReturnErrorOnFailure(rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, mIssuerId)); ChipLogProgress(Controller, "Generating NOC"); X509CertRequestParams noc_request = { 1, mNow, mNow + mValidity, noc_dn, icac_dn }; @@ -223,7 +224,8 @@ CHIP_ERROR ExampleOperationalCredentialsIssuer::GenerateNOCChain(const ByteSpan ReturnErrorCodeIf(!rcac.Alloc(kMaxCHIPDERCertLength), CHIP_ERROR_NO_MEMORY); MutableByteSpan rcacSpan(rcac.Get(), kMaxCHIPDERCertLength); - ReturnErrorOnFailure(GenerateNOCChainAfterValidation(assignedId, mNextFabricId, pubkey, rcacSpan, icacSpan, nocSpan)); + ReturnErrorOnFailure( + GenerateNOCChainAfterValidation(assignedId, mNextFabricId, chip::kUndefinedCATs, pubkey, rcacSpan, icacSpan, nocSpan)); ChipLogProgress(Controller, "Providing certificate chain to the commissioner"); onCompletion->mCall(onCompletion->mContext, CHIP_NO_ERROR, nocSpan, icacSpan, rcacSpan, Optional(), diff --git a/src/controller/ExampleOperationalCredentialsIssuer.h b/src/controller/ExampleOperationalCredentialsIssuer.h index 96023a4945dc5a..47b6392caecc94 100644 --- a/src/controller/ExampleOperationalCredentialsIssuer.h +++ b/src/controller/ExampleOperationalCredentialsIssuer.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -99,8 +100,9 @@ class DLL_EXPORT ExampleOperationalCredentialsIssuer : public OperationalCredent * This method is expected to be called once all the checks (e.g. device attestation, CSR verification etc) * have been completed, or not required (e.g. for self trusted devices such as commissioner apps). */ - CHIP_ERROR GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, const Crypto::P256PublicKey & pubkey, - MutableByteSpan & rcac, MutableByteSpan & icac, MutableByteSpan & noc); + CHIP_ERROR GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, const CATValues & cats, + const Crypto::P256PublicKey & pubkey, MutableByteSpan & rcac, MutableByteSpan & icac, + MutableByteSpan & noc); private: Crypto::P256Keypair mIssuer; diff --git a/src/controller/java/AndroidDeviceControllerWrapper.cpp b/src/controller/java/AndroidDeviceControllerWrapper.cpp index f396492773051f..2c30deae8981a2 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.cpp +++ b/src/controller/java/AndroidDeviceControllerWrapper.cpp @@ -62,7 +62,7 @@ void AndroidDeviceControllerWrapper::CallJavaMethod(const char * methodName, jin AndroidDeviceControllerWrapper * AndroidDeviceControllerWrapper::AllocateNew(JavaVM * vm, jobject deviceControllerObj, chip::NodeId nodeId, - chip::System::Layer * systemLayer, + const chip::CATValues & cats, chip::System::Layer * systemLayer, chip::Inet::EndPointManager * tcpEndPointManager, chip::Inet::EndPointManager * udpEndPointManager, AndroidOperationalCredentialsIssuerPtr opCredsIssuerPtr, CHIP_ERROR * errInfoOnFailure) @@ -163,8 +163,8 @@ AndroidDeviceControllerWrapper::AllocateNew(JavaVM * vm, jobject deviceControlle return nullptr; } - *errInfoOnFailure = opCredsIssuer->GenerateNOCChainAfterValidation(nodeId, /* fabricId = */ 1, ephemeralKey.Pubkey(), rcacSpan, - icacSpan, nocSpan); + *errInfoOnFailure = opCredsIssuer->GenerateNOCChainAfterValidation(nodeId, /* fabricId = */ 1, cats, ephemeralKey.Pubkey(), + rcacSpan, icacSpan, nocSpan); if (*errInfoOnFailure != CHIP_NO_ERROR) { return nullptr; diff --git a/src/controller/java/AndroidDeviceControllerWrapper.h b/src/controller/java/AndroidDeviceControllerWrapper.h index d8887aecb42ec1..24c87433a0ff27 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.h +++ b/src/controller/java/AndroidDeviceControllerWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -72,7 +72,7 @@ class AndroidDeviceControllerWrapper : public chip::Controller::DevicePairingDel using AndroidOperationalCredentialsIssuerPtr = std::unique_ptr; static AndroidDeviceControllerWrapper * AllocateNew(JavaVM * vm, jobject deviceControllerObj, chip::NodeId nodeId, - chip::System::Layer * systemLayer, + const chip::CATValues & cats, chip::System::Layer * systemLayer, chip::Inet::EndPointManager * tcpEndPointManager, chip::Inet::EndPointManager * udpEndPointManager, AndroidOperationalCredentialsIssuerPtr opCredsIssuer, diff --git a/src/controller/java/AndroidOperationalCredentialsIssuer.cpp b/src/controller/java/AndroidOperationalCredentialsIssuer.cpp index 7a6bdf23f29349..2555acfabd0f4c 100644 --- a/src/controller/java/AndroidOperationalCredentialsIssuer.cpp +++ b/src/controller/java/AndroidOperationalCredentialsIssuer.cpp @@ -19,6 +19,7 @@ #include "AndroidOperationalCredentialsIssuer.h" #include #include +#include #include #include #include @@ -76,15 +77,17 @@ CHIP_ERROR AndroidOperationalCredentialsIssuer::Initialize(PersistentStorageDele } CHIP_ERROR AndroidOperationalCredentialsIssuer::GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, + const CATValues & cats, const Crypto::P256PublicKey & pubkey, MutableByteSpan & rcac, MutableByteSpan & icac, MutableByteSpan & noc) { ChipDN noc_dn; - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, nodeId); + ReturnErrorOnFailure(noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId)); + ReturnErrorOnFailure(noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, nodeId)); + ReturnErrorOnFailure(noc_dn.AddCATs(cats)); ChipDN rcac_dn; - rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, mIssuerId); + ReturnErrorOnFailure(rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, mIssuerId)); ChipLogProgress(Controller, "Generating NOC"); chip::Credentials::X509CertRequestParams noc_request = { 1, mNow, mNow + mValidity, noc_dn, rcac_dn }; @@ -172,7 +175,8 @@ CHIP_ERROR AndroidOperationalCredentialsIssuer::GenerateNOCChain(const ByteSpan MutableByteSpan icacSpan; - ReturnErrorOnFailure(GenerateNOCChainAfterValidation(assignedId, mNextFabricId, pubkey, rcacSpan, icacSpan, nocSpan)); + ReturnErrorOnFailure( + GenerateNOCChainAfterValidation(assignedId, mNextFabricId, chip::kUndefinedCATs, pubkey, rcacSpan, icacSpan, nocSpan)); onCompletion->mCall(onCompletion->mContext, CHIP_NO_ERROR, nocSpan, ByteSpan(), rcacSpan, Optional(), Optional()); diff --git a/src/controller/java/AndroidOperationalCredentialsIssuer.h b/src/controller/java/AndroidOperationalCredentialsIssuer.h index 54a5cfcb376005..b770f73833b38c 100644 --- a/src/controller/java/AndroidOperationalCredentialsIssuer.h +++ b/src/controller/java/AndroidOperationalCredentialsIssuer.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 Project CHIP Authors * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -81,8 +82,9 @@ class DLL_EXPORT AndroidOperationalCredentialsIssuer : public OperationalCredent * This method is expected to be called once all the checks (e.g. device attestation, CSR verification etc) * have been completed, or not required (e.g. for self trusted devices such as commissioner apps). */ - CHIP_ERROR GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, const Crypto::P256PublicKey & pubkey, - MutableByteSpan & rcac, MutableByteSpan & icac, MutableByteSpan & noc); + CHIP_ERROR GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, const CATValues & cats, + const Crypto::P256PublicKey & pubkey, MutableByteSpan & rcac, MutableByteSpan & icac, + MutableByteSpan & noc); private: Crypto::P256Keypair mIssuer; diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 001bdf0445ca01..f4456bd11c888d 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -160,9 +160,9 @@ JNI_METHOD(jlong, newDeviceController)(JNIEnv * env, jobject self) ChipLogProgress(Controller, "newDeviceController() called"); std::unique_ptr opCredsIssuer( new chip::Controller::AndroidOperationalCredentialsIssuer()); - wrapper = AndroidDeviceControllerWrapper::AllocateNew(sJVM, self, kLocalDeviceId, &DeviceLayer::SystemLayer(), - DeviceLayer::TCPEndPointManager(), DeviceLayer::UDPEndPointManager(), - std::move(opCredsIssuer), &err); + wrapper = AndroidDeviceControllerWrapper::AllocateNew(sJVM, self, kLocalDeviceId, chip::kUndefinedCATs, + &DeviceLayer::SystemLayer(), DeviceLayer::TCPEndPointManager(), + DeviceLayer::UDPEndPointManager(), std::move(opCredsIssuer), &err); SuccessOrExit(err); // Create and start the IO thread. Must be called after Controller()->Init diff --git a/src/controller/python/OpCredsBinding.cpp b/src/controller/python/OpCredsBinding.cpp index 5dbf928dd7e2a9..25ffe5daa7aab4 100644 --- a/src/controller/python/OpCredsBinding.cpp +++ b/src/controller/python/OpCredsBinding.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020-2021 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * Copyright (c) 2019-2020 Google LLC. * Copyright (c) 2013-2018 Nest Labs, Inc. * All rights reserved. @@ -59,10 +59,10 @@ class OperationalCredentialsAdapter : public OperationalCredentialsDelegate CHIP_ERROR Initialize(PersistentStorageDelegate & storageDelegate) { return mExampleOpCredsIssuer.Initialize(storageDelegate); } - CHIP_ERROR GenerateNOCChain(NodeId nodeId, FabricId fabricId, const Crypto::P256PublicKey & pubKey, MutableByteSpan & rcac, - MutableByteSpan & icac, MutableByteSpan & noc) + CHIP_ERROR GenerateNOCChain(NodeId nodeId, FabricId fabricId, const CATValues & cats, const Crypto::P256PublicKey & pubKey, + MutableByteSpan & rcac, MutableByteSpan & icac, MutableByteSpan & noc) { - return mExampleOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, pubKey, rcac, icac, noc); + return mExampleOpCredsIssuer.GenerateNOCChainAfterValidation(nodeId, fabricId, cats, pubKey, rcac, icac, noc); } private: @@ -159,7 +159,8 @@ ChipError::StorageType pychip_OpCreds_AllocateController(OpCredsContext * contex ReturnErrorCodeIf(!rcac.Alloc(Controller::kMaxCHIPDERCertLength), CHIP_ERROR_NO_MEMORY.AsInteger()); MutableByteSpan rcacSpan(rcac.Get(), Controller::kMaxCHIPDERCertLength); - err = context->mAdapter->GenerateNOCChain(nodeId, fabricId, ephemeralKey.Pubkey(), rcacSpan, icacSpan, nocSpan); + err = context->mAdapter->GenerateNOCChain(nodeId, fabricId, chip::kUndefinedCATs, ephemeralKey.Pubkey(), rcacSpan, icacSpan, + nocSpan); VerifyOrReturnError(err == CHIP_NO_ERROR, err.AsInteger()); Controller::SetupParams initParams; diff --git a/src/controller/python/chip/configuration/__init__.py b/src/controller/python/chip/configuration/__init__.py index 3cb5ca535dfe2d..b64b5f0fa35de5 100644 --- a/src/controller/python/chip/configuration/__init__.py +++ b/src/controller/python/chip/configuration/__init__.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2021-2022 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. @@ -19,8 +19,10 @@ # Represents the node ID that is to be used when creating device # controllers/commissioning devices _local_node_id: Optional[int] = None +_local_cat: Optional[int] = None DEFAULT_LOCAL_NODE_ID = 12345 +DEFAULT_COMMISSIONER_CAT = 0xABCD0010 def SetLocalNodeId(node_id: int): @@ -44,3 +46,26 @@ def GetLocalNodeId() -> int: SetLocalNodeId(DEFAULT_LOCAL_NODE_ID) return _local_node_id + + +def SetCommissionerCAT(cat: int): + """Local (controllers/commissioning) device CASE Authenticated Tag (CAT). + Can be set at the start of scripts, however once set it cannot be reassigned. + """ + global _local_cat + + if _local_cat is not None: + raise Exception('Local CAT is already set.') + + _local_cat = cat + + +def GetCommissionerCAT() -> int: + """Returns the current local (controllers/commissioning) device CAT. If none has been set, + a default is set and used.""" + global _local_cat + + if _local_cat is None: + SetCommissionerCAT(DEFAULT_COMMISSIONER_CAT) + + return _local_cat diff --git a/src/controller/python/chip/internal/CommissionerImpl.cpp b/src/controller/python/chip/internal/CommissionerImpl.cpp index 94fe9b1dd27673..4ac48a0993f54a 100644 --- a/src/controller/python/chip/internal/CommissionerImpl.cpp +++ b/src/controller/python/chip/internal/CommissionerImpl.cpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 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. @@ -93,7 +93,8 @@ pychip_internal_PairingDelegate_SetPairingCompleteCallback(ScriptDevicePairingDe gPairingDelegate.SetPairingCompleteCallback(callback); } -extern "C" chip::Controller::DeviceCommissioner * pychip_internal_Commissioner_New(uint64_t localDeviceId) +extern "C" chip::Controller::DeviceCommissioner * pychip_internal_Commissioner_New(uint64_t localDeviceId, + uint32_t localCommissionerCAT) { std::unique_ptr result; CHIP_ERROR err; @@ -138,8 +139,9 @@ extern "C" chip::Controller::DeviceCommissioner * pychip_internal_Commissioner_N chip::MutableByteSpan nocSpan(noc.Get(), chip::Controller::kMaxCHIPDERCertLength); chip::MutableByteSpan icacSpan(icac.Get(), chip::Controller::kMaxCHIPDERCertLength); chip::MutableByteSpan rcacSpan(rcac.Get(), chip::Controller::kMaxCHIPDERCertLength); - err = gOperationalCredentialsIssuer.GenerateNOCChainAfterValidation(localDeviceId, /* fabricId = */ 1, - ephemeralKey.Pubkey(), rcacSpan, icacSpan, nocSpan); + err = gOperationalCredentialsIssuer.GenerateNOCChainAfterValidation( + localDeviceId, /* fabricId = */ 1, { { localCommissionerCAT, chip::kUndefinedCAT, chip::kUndefinedCAT } }, + ephemeralKey.Pubkey(), rcacSpan, icacSpan, nocSpan); SuccessOrExit(err); commissionerParams.operationalCredentialsDelegate = &gOperationalCredentialsIssuer; diff --git a/src/controller/python/chip/internal/commissioner.py b/src/controller/python/chip/internal/commissioner.py index 7976c93c09c5ca..46766faeb374c9 100644 --- a/src/controller/python/chip/internal/commissioner.py +++ b/src/controller/python/chip/internal/commissioner.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2021 Project CHIP Authors +# Copyright (c) 2021-2022 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. @@ -14,6 +14,7 @@ # limitations under the License. # from chip.configuration import GetLocalNodeId +from chip.configuration import GetCommissionerCAT from chip.native import NativeLibraryHandleMethodArguments, GetLibraryHandle from enum import Enum from typing import Optional @@ -103,7 +104,7 @@ def _SetNativeCallSignatues(handle: ctypes.CDLL): setter = NativeLibraryHandleMethodArguments(handle) setter.Set('pychip_internal_Commissioner_New', - Commissioner_p, [ctypes.c_uint64]) + Commissioner_p, [ctypes.c_uint64, ctypes.c_uint32]) setter.Set('pychip_internal_Commissioner_Unpair', ctypes.c_uint32, [Commissioner_p, ctypes.c_uint64]) setter.Set('pychip_internal_Commissioner_BleConnectForPairing', @@ -119,7 +120,7 @@ def _SetNativeCallSignatues(handle: ctypes.CDLL): def GetCommissioner() -> Commissioner: """Gets a reference to the global commissioner singleton. - Uses the configuration GetLocalNodeId(). + Uses the configuration GetLocalNodeId() and GetCommissionerCAT(). """ global commissionerSingleton @@ -128,7 +129,8 @@ def GetCommissioner() -> Commissioner: handle = GetLibraryHandle() _SetNativeCallSignatues(handle) - native = handle.pychip_internal_Commissioner_New(GetLocalNodeId()) + native = handle.pychip_internal_Commissioner_New( + GetLocalNodeId(), GetCommissionerCAT()) if not native: raise Exception('Failed to create commissioner object.') diff --git a/src/credentials/CHIPCert.cpp b/src/credentials/CHIPCert.cpp index 4b92d0e9e79686..d053bc4e087d52 100644 --- a/src/credentials/CHIPCert.cpp +++ b/src/credentials/CHIPCert.cpp @@ -576,6 +576,19 @@ CHIP_ERROR ChipDN::AddAttribute(chip::ASN1::OID oid, uint64_t val) return CHIP_NO_ERROR; } +CHIP_ERROR ChipDN::AddCATs(const chip::CATValues & cats) +{ + for (auto & cat : cats.values) + { + if (cat != kUndefinedCAT) + { + ReturnErrorOnFailure(AddAttribute(chip::ASN1::kOID_AttributeType_ChipCASEAuthenticatedTag, cat)); + } + } + + return CHIP_NO_ERROR; +} + CHIP_ERROR ChipDN::AddAttribute(chip::ASN1::OID oid, CharSpan val, bool isPrintableString) { uint8_t rdnCount = RDNCount(); diff --git a/src/credentials/CHIPCert.h b/src/credentials/CHIPCert.h index 660d9e9c449ce4..872a6e59f9262d 100644 --- a/src/credentials/CHIPCert.h +++ b/src/credentials/CHIPCert.h @@ -230,6 +230,15 @@ class ChipDN **/ CHIP_ERROR AddAttribute(chip::ASN1::OID oid, uint64_t val); + /** + * @brief Add CASE Authenticated Tags (CATs) attributes to the DN. + * + * @param cats Array of CAT values. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR AddCATs(const chip::CATValues & cats); + /** * @brief Add string attribute to the DN. * diff --git a/src/credentials/tests/TestChipCert.cpp b/src/credentials/tests/TestChipCert.cpp index ed14292b892706..d532e33cba72ac 100644 --- a/src/credentials/tests/TestChipCert.cpp +++ b/src/credentials/tests/TestChipCert.cpp @@ -185,6 +185,56 @@ static void TestChipCert_X509ToChip(nlTestSuite * inSuite, void * inContext) } } +static void TestChipCert_ChipDN(nlTestSuite * inSuite, void * inContext) +{ + const static char noc_rdn[] = "Test NOC"; + const static char noc_rdn2[] = "John"; + const static CATValues noc_cats = { { 0xABCD0001, chip::kUndefinedCAT, chip::kUndefinedCAT } }; + + ChipDN chip_dn; + NL_TEST_ASSERT(inSuite, + chip_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(noc_rdn, strlen(noc_rdn)), false) == + CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, chip_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAAAABBBBCCCCDDDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, chip_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + chip_dn.AddAttribute(chip::ASN1::kOID_AttributeType_GivenName, CharSpan(noc_rdn2, strlen(noc_rdn2)), true) == + CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, chip_dn.AddCATs(noc_cats) == CHIP_NO_ERROR); + + NL_TEST_ASSERT(inSuite, + chip_dn.AddAttribute(chip::ASN1::kOID_AttributeType_GivenName, CharSpan(noc_rdn2, strlen(noc_rdn2)), true) == + CHIP_ERROR_NO_MEMORY); + + uint8_t certType; + NL_TEST_ASSERT(inSuite, chip_dn.GetCertType(certType) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, certType == kCertType_Node); + + uint64_t certId; + NL_TEST_ASSERT(inSuite, chip_dn.GetCertChipId(certId) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, certId == 0xAAAABBBBCCCCDDDD); + + uint64_t fabricId; + NL_TEST_ASSERT(inSuite, chip_dn.GetCertFabricId(fabricId) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, fabricId == 0xFAB00000FAB00001); + + chip_dn.Clear(); + NL_TEST_ASSERT(inSuite, chip_dn.GetCertType(certType) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, chip_dn.IsEmpty() == true); + NL_TEST_ASSERT(inSuite, certType == kCertType_NotSpecified); + + CATValues noc_cats2; + chip::CATValues::Serialized serializedCATs; + NL_TEST_ASSERT(inSuite, noc_cats.Serialize(serializedCATs) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_cats2.Deserialize(serializedCATs) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, memcmp(&noc_cats, &noc_cats2, chip::CATValues::kSerializedLength) == 0); + + CATValues noc_cats3 = { { 0xABCD0001, 0xFFEEAA00, 0x0001F012 } }; + NL_TEST_ASSERT(inSuite, noc_cats3.Serialize(serializedCATs) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_cats2.Deserialize(serializedCATs) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, memcmp(&noc_cats3, &noc_cats2, chip::CATValues::kSerializedLength) == 0); +} + static void TestChipCert_CertValidation(nlTestSuite * inSuite, void * inContext) { CHIP_ERROR err; @@ -739,7 +789,7 @@ static void TestChipCert_GenerateRootCert(nlTestSuite * inSuite, void * inContex ChipCertificateData certData; ChipDN root_dn; - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd) == CHIP_NO_ERROR); X509CertRequestParams root_params = { 1234, 631161876, 729942000, root_dn, root_dn }; MutableByteSpan signed_cert_span(signed_cert); @@ -754,22 +804,27 @@ static void TestChipCert_GenerateRootCert(nlTestSuite * inSuite, void * inContex // Test error case: root cert subject provided ICA OID Attribute. root_params.SubjectDN.Clear(); - root_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xabcdabcd); + NL_TEST_ASSERT(inSuite, + root_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xabcdabcd) == CHIP_NO_ERROR); root_params.IssuerDN.Clear(); - root_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xabcdabcd); + NL_TEST_ASSERT(inSuite, + root_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xabcdabcd) == CHIP_NO_ERROR); MutableByteSpan signed_cert_span1(signed_cert); NL_TEST_ASSERT(inSuite, NewRootX509Cert(root_params, keypair, signed_cert_span1) == CHIP_ERROR_INVALID_ARGUMENT); // Test error case: root cert provided different subject and issuer DNs. root_params.SubjectDN.Clear(); - root_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd); + NL_TEST_ASSERT(inSuite, + root_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd) == CHIP_NO_ERROR); root_params.IssuerDN.Clear(); - root_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xffffeeee); + NL_TEST_ASSERT(inSuite, + root_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xffffeeee) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, NewRootX509Cert(root_params, keypair, signed_cert_span1) == CHIP_ERROR_INVALID_ARGUMENT); // Test that serial number cannot be negative root_params.IssuerDN.Clear(); - root_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd); + NL_TEST_ASSERT(inSuite, + root_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd) == CHIP_NO_ERROR); root_params.SerialNumber = -1; NL_TEST_ASSERT(inSuite, NewRootX509Cert(root_params, keypair, signed_cert_span1) == CHIP_ERROR_INVALID_ARGUMENT); } @@ -788,8 +843,8 @@ static void TestChipCert_GenerateRootFabCert(nlTestSuite * inSuite, void * inCon MutableByteSpan outCert(outCertBuf); ChipDN root_dn; - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd); - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xabcd); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xabcdabcd) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xabcd) == CHIP_NO_ERROR); X509CertRequestParams root_params_fabric = { 1234, 631161876, 729942000, root_dn, root_dn }; @@ -815,9 +870,9 @@ static void TestChipCert_GenerateICACert(nlTestSuite * inSuite, void * inContext ChipCertificateData certData; ChipDN ica_dn; - ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xABCDABCDABCDABCD); + NL_TEST_ASSERT(inSuite, ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xABCDABCDABCDABCD) == CHIP_NO_ERROR); ChipDN issuer_dn; - issuer_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0x43215678FEDCABCD); + NL_TEST_ASSERT(inSuite, issuer_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0x43215678FEDCABCD) == CHIP_NO_ERROR); X509CertRequestParams ica_params = { 1234, 631161876, 729942000, ica_dn, issuer_dn }; P256Keypair ica_keypair; @@ -832,15 +887,19 @@ static void TestChipCert_GenerateICACert(nlTestSuite * inSuite, void * inContext // Test error case: ICA cert subject provided a node ID attribute ica_params.SubjectDN.Clear(); - ica_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD); - ica_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); + NL_TEST_ASSERT( + inSuite, ica_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + ica_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == + CHIP_NO_ERROR); MutableByteSpan signed_cert_span1(signed_cert); NL_TEST_ASSERT(inSuite, NewICAX509Cert(ica_params, ica_keypair.Pubkey(), keypair, signed_cert_span1) == CHIP_ERROR_INVALID_ARGUMENT); // Test that serial number cannot be negative ica_params.SubjectDN.Clear(); - ica_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xABCDABCDABCDABCD); + NL_TEST_ASSERT( + inSuite, ica_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xABCDABCDABCDABCD) == CHIP_NO_ERROR); ica_params.SerialNumber = -1; NL_TEST_ASSERT(inSuite, NewICAX509Cert(ica_params, ica_keypair.Pubkey(), keypair, signed_cert_span1) == CHIP_ERROR_INVALID_ARGUMENT); @@ -860,10 +919,10 @@ static void TestChipCert_GenerateNOCRoot(nlTestSuite * inSuite, void * inContext ChipCertificateData certData; ChipDN noc_dn; - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == CHIP_NO_ERROR); ChipDN issuer_dn; - issuer_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0x8888999944442222); + NL_TEST_ASSERT(inSuite, issuer_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0x8888999944442222) == CHIP_NO_ERROR); X509CertRequestParams noc_params = { 123456, 631161876, 729942000, noc_dn, issuer_dn }; P256Keypair noc_keypair; @@ -879,7 +938,9 @@ static void TestChipCert_GenerateNOCRoot(nlTestSuite * inSuite, void * inContext // Test error case: NOC cert subject doesn't have NodeId attribute noc_params.SubjectDN.Clear(); - noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); + NL_TEST_ASSERT(inSuite, + noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == + CHIP_NO_ERROR); MutableByteSpan signed_cert_span1(signed_cert, sizeof(signed_cert)); NL_TEST_ASSERT(inSuite, @@ -888,7 +949,8 @@ static void TestChipCert_GenerateNOCRoot(nlTestSuite * inSuite, void * inContext // Test error case: NOC cert subject doesn't have fabric ID attribute noc_params.SubjectDN.Clear(); - noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD); + NL_TEST_ASSERT( + inSuite, noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, NewNodeOperationalX509Cert(noc_params, noc_keypair.Pubkey(), keypair, signed_cert_span1) == @@ -896,11 +958,17 @@ static void TestChipCert_GenerateNOCRoot(nlTestSuite * inSuite, void * inContext // Test error case: issuer cert DN type is Node certificate noc_params.SubjectDN.Clear(); - noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD); - noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); + NL_TEST_ASSERT( + inSuite, noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xABCDABCDABCDABCD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + noc_params.SubjectDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == + CHIP_NO_ERROR); noc_params.IssuerDN.Clear(); - noc_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0x8888999944442222); - noc_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); + NL_TEST_ASSERT( + inSuite, noc_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0x8888999944442222) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + noc_params.IssuerDN.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == + CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, NewNodeOperationalX509Cert(noc_params, noc_keypair.Pubkey(), keypair, signed_cert_span1) == @@ -928,15 +996,21 @@ static void TestChipCert_GenerateNOCICA(nlTestSuite * inSuite, void * inContext) const static char noc_name_rdn[] = "Smith"; ChipDN noc_dn; - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(noc_cn_rdn, strlen(noc_cn_rdn)), false); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAAAABBBBCCCCDDDD); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_GivenName, CharSpan(noc_givenname_rdn, strlen(noc_givenname_rdn)), true); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_Name, CharSpan(noc_name_rdn, strlen(noc_name_rdn)), true); + NL_TEST_ASSERT(inSuite, + noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(noc_cn_rdn, strlen(noc_cn_rdn)), + false) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAAAABBBBCCCCDDDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_GivenName, + CharSpan(noc_givenname_rdn, strlen(noc_givenname_rdn)), true) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_Name, CharSpan(noc_name_rdn, strlen(noc_name_rdn)), true) == + CHIP_NO_ERROR); ChipDN ica_dn; - ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0x8888999944442222); - ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001); + NL_TEST_ASSERT(inSuite, ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0x8888999944442222) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB00000FAB00001) == CHIP_NO_ERROR); X509CertRequestParams noc_params = { 12348765, 631161876, 729942000, noc_dn, ica_dn }; P256Keypair noc_keypair; @@ -963,8 +1037,8 @@ static void TestChipCert_VerifyGeneratedCerts(nlTestSuite * inSuite, void * inCo static uint8_t root_cert[kMaxDERCertLength]; ChipDN root_dn; - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xAAAABBBBCCCCDDDD); - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xAAAABBBBCCCCDDDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888) == CHIP_NO_ERROR); X509CertRequestParams root_params = { 1234, 631161876, 729942000, root_dn, root_dn }; MutableByteSpan root_cert_span(root_cert); @@ -973,8 +1047,8 @@ static void TestChipCert_VerifyGeneratedCerts(nlTestSuite * inSuite, void * inCo static uint8_t ica_cert[kMaxDERCertLength]; ChipDN ica_dn; - ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xAABBCCDDAABBCCDD); - ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888); + NL_TEST_ASSERT(inSuite, ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipICAId, 0xAABBCCDDAABBCCDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, ica_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888) == CHIP_NO_ERROR); X509CertRequestParams ica_params = { 12345, 631161876, 729942000, ica_dn, root_dn }; P256Keypair ica_keypair; @@ -986,8 +1060,8 @@ static void TestChipCert_VerifyGeneratedCerts(nlTestSuite * inSuite, void * inCo static uint8_t noc_cert[kMaxDERCertLength]; ChipDN noc_dn; - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAABBCCDDAABBCCDD); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAABBCCDDAABBCCDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888) == CHIP_NO_ERROR); X509CertRequestParams noc_params = { 123456, 631161876, 729942000, noc_dn, ica_dn }; P256Keypair noc_keypair; @@ -1043,9 +1117,11 @@ static void TestChipCert_VerifyGeneratedCertsNoICA(nlTestSuite * inSuite, void * const static char root_cn_rdn[] = "Test Root Operational Cert"; ChipDN root_dn; - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(root_cn_rdn, strlen(root_cn_rdn)), false); - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xAAAABBBBCCCCDDDD); - root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888); + NL_TEST_ASSERT(inSuite, + root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(root_cn_rdn, strlen(root_cn_rdn)), + false) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, 0xAAAABBBBCCCCDDDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, root_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888) == CHIP_NO_ERROR); X509CertRequestParams root_params = { 1234, 631161876, 729942000, root_dn, root_dn }; MutableByteSpan root_cert_span(root_cert); @@ -1056,10 +1132,13 @@ static void TestChipCert_VerifyGeneratedCertsNoICA(nlTestSuite * inSuite, void * const static char noc_cn_rdn[] = "Test NOC"; ChipDN noc_dn; - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(noc_cn_rdn, strlen(noc_cn_rdn)), true); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAABBCCDDAABBCCDD); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipCASEAuthenticatedTag, 0xABCD0010); + NL_TEST_ASSERT(inSuite, + noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_CommonName, CharSpan(noc_cn_rdn, strlen(noc_cn_rdn)), true) == + CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, 0xAABBCCDDAABBCCDD) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, 0xFAB0000000008888) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, + noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipCASEAuthenticatedTag, 0xABCD0010) == CHIP_NO_ERROR); X509CertRequestParams noc_params = { 1234, 631161876, 729942000, noc_dn, root_dn }; P256Keypair noc_keypair; @@ -1422,6 +1501,7 @@ int TestChipCert_Teardown(void * inContext) static const nlTest sTests[] = { NL_TEST_DEF("Test CHIP Certificate CHIP to X509 Conversion", TestChipCert_ChipToX509), NL_TEST_DEF("Test CHIP Certificate X509 to CHIP Conversion", TestChipCert_X509ToChip), + NL_TEST_DEF("Test CHIP Certificate Distinguish Name", TestChipCert_ChipDN), NL_TEST_DEF("Test CHIP Certificate Validation", TestChipCert_CertValidation), NL_TEST_DEF("Test CHIP Certificate Validation time", TestChipCert_CertValidTime), NL_TEST_DEF("Test CHIP Certificate Usage", TestChipCert_CertUsage), diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.mm b/src/darwin/Framework/CHIP/CHIPDeviceController.mm index 8d4e54ae952f97..bfbf7b3f46e722 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.mm @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020-2022 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. @@ -214,7 +214,7 @@ - (BOOL)startup:(_Nullable id)storageDelegate chip::MutableByteSpan icac; errorCode = _operationalCredentialsDelegate->GenerateNOCChainAfterValidation( - _localDeviceId, /* fabricId = */ 1, ephemeralKey.Pubkey(), rcac, icac, noc); + _localDeviceId, /* fabricId = */ 1, chip::kUndefinedCATs, ephemeralKey.Pubkey(), rcac, icac, noc); if ([self checkForStartError:(CHIP_NO_ERROR == errorCode) logMsg:kErrorCommissionerInit]) { return; } diff --git a/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.h b/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.h index 64d2e7c9414881..f2d92873ebf4f8 100644 --- a/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.h +++ b/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.h @@ -1,6 +1,6 @@ /** * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 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. @@ -25,6 +25,7 @@ #import "CHIPPersistentStorageDelegateBridge.h" #include +#include #include NS_ASSUME_NONNULL_BEGIN @@ -52,7 +53,7 @@ class CHIPOperationalCredentialsDelegate : public chip::Controller::OperationalC void SetDeviceID(chip::NodeId deviceId) { mDeviceBeingPaired = deviceId; } void ResetDeviceID() { mDeviceBeingPaired = chip::kUndefinedNodeId; } - CHIP_ERROR GenerateNOCChainAfterValidation(chip::NodeId nodeId, chip::FabricId fabricId, + CHIP_ERROR GenerateNOCChainAfterValidation(chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, const chip::Crypto::P256PublicKey & pubkey, chip::MutableByteSpan & rcac, chip::MutableByteSpan & icac, chip::MutableByteSpan & noc); diff --git a/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.mm b/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.mm index 8351632b57383f..de132ee91df2a4 100644 --- a/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.mm +++ b/src/darwin/Framework/CHIP/CHIPOperationalCredentialsDelegate.mm @@ -188,7 +188,8 @@ static BOOL isRunningTests(void) } CHIP_ERROR CHIPOperationalCredentialsDelegate::GenerateNOCChainAfterValidation(NodeId nodeId, FabricId fabricId, - const Crypto::P256PublicKey & pubkey, MutableByteSpan & rcac, MutableByteSpan & icac, MutableByteSpan & noc) + const chip::CATValues & cats, const Crypto::P256PublicKey & pubkey, MutableByteSpan & rcac, MutableByteSpan & icac, + MutableByteSpan & noc) { uint32_t validityStart, validityEnd; @@ -203,11 +204,12 @@ static BOOL isRunningTests(void) } ChipDN noc_dn; - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId); - noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, nodeId); + ReturnErrorOnFailure(noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId)); + ReturnErrorOnFailure(noc_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipNodeId, nodeId)); + ReturnErrorOnFailure(noc_dn.AddCATs(cats)); ChipDN rcac_dn; - rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, mIssuerId); - rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId); + ReturnErrorOnFailure(rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipRootId, mIssuerId)); + ReturnErrorOnFailure(rcac_dn.AddAttribute(chip::ASN1::kOID_AttributeType_ChipFabricId, fabricId)); X509CertRequestParams noc_request = { 1, validityStart, validityEnd, noc_dn, rcac_dn }; ReturnErrorOnFailure(NewNodeOperationalX509Cert(noc_request, pubkey, *mIssuerKey, noc)); @@ -280,7 +282,7 @@ static BOOL isRunningTests(void) MutableByteSpan icac; - ReturnErrorOnFailure(GenerateNOCChainAfterValidation(assignedId, mNextFabricId, pubkey, rcac, icac, noc)); + ReturnErrorOnFailure(GenerateNOCChainAfterValidation(assignedId, mNextFabricId, chip::kUndefinedCATs, pubkey, rcac, icac, noc)); onCompletion->mCall(onCompletion->mContext, CHIP_NO_ERROR, noc, icac, rcac, Optional(), Optional()); diff --git a/src/lib/core/CASEAuthTag.h b/src/lib/core/CASEAuthTag.h index fcc9c9b536c5e0..cd490d70d28334 100644 --- a/src/lib/core/CASEAuthTag.h +++ b/src/lib/core/CASEAuthTag.h @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2021 Project CHIP Authors + * Copyright (c) 2021-2022 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. @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include @@ -56,6 +57,29 @@ struct CATValues } return false; } + + static constexpr size_t kSerializedLength = kMaxSubjectCATAttributeCount * sizeof(CASEAuthTag); + typedef uint8_t Serialized[kSerializedLength]; + + CHIP_ERROR Serialize(Serialized & outSerialized) const + { + uint8_t * p = outSerialized; + for (size_t i = 0; i < kMaxSubjectCATAttributeCount; i++) + { + Encoding::LittleEndian::Write32(p, values[i]); + } + return CHIP_NO_ERROR; + } + + CHIP_ERROR Deserialize(const Serialized & inSerialized) + { + const uint8_t * p = inSerialized; + for (size_t i = 0; i < kMaxSubjectCATAttributeCount; i++) + { + values[i] = Encoding::LittleEndian::Read32(p); + } + return CHIP_NO_ERROR; + } }; static constexpr CATValues kUndefinedCATs = { { kUndefinedCAT } }; diff --git a/src/lib/core/CHIPVendorIdentifiers.hpp b/src/lib/core/CHIPVendorIdentifiers.hpp index 8de7b14ed9bd5f..bd894e608a4017 100644 --- a/src/lib/core/CHIPVendorIdentifiers.hpp +++ b/src/lib/core/CHIPVendorIdentifiers.hpp @@ -1,6 +1,6 @@ /* * - * Copyright (c) 2020-2021 Project CHIP Authors + * Copyright (c) 2020-2022 Project CHIP Authors * Copyright (c) 2014-2017 Nest Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -50,4 +50,9 @@ enum VendorId : uint16_t NotSpecified = 0xFFFFu }; +constexpr bool IsTestVendorId(VendorId vid) +{ + return (vid >= TestVendor1 && vid <= TestVendor4); +} + } // namespace chip From 545d9bf45b3fa34dfee30ee8ec34818b2a8a3886 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Wed, 23 Mar 2022 12:58:54 -0400 Subject: [PATCH 27/70] [EFR32] Clean up gn files for QRcode Lib (#16527) * clean up gn files --- examples/light-switch-app/efr32/BUILD.gn | 11 ++++- examples/lighting-app/efr32/BUILD.gn | 12 +++++- examples/lighting-app/efr32/src/AppTask.cpp | 2 + examples/lock-app/efr32/BUILD.gn | 13 ++++-- examples/lock-app/efr32/src/AppTask.cpp | 2 + examples/ota-requestor-app/efr32/BUILD.gn | 11 ++++- .../ota-requestor-app/efr32/src/AppTask.cpp | 2 + examples/platform/efr32/display/lcd.c | 10 +++++ examples/window-app/efr32/BUILD.gn | 16 ++++++-- .../window-app/efr32/src/WindowAppImpl.cpp | 8 +++- third_party/efr32_sdk/efr32_sdk.gni | 40 +++++++++---------- 11 files changed, 92 insertions(+), 35 deletions(-) diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 412917bba38279..62f164e933a0d3 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -66,6 +66,10 @@ declare_args() { if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } + +# Enables LCD on supported devices +lcd_on = show_qr_code + if (use_rs911x || use_wf200) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" if (use_rs911x) { @@ -163,7 +167,6 @@ efr32_executable("light_switch_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/light-switch-app/light-switch-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", @@ -218,9 +221,13 @@ efr32_executable("light_switch_app") { include_dirs += wf200_plat_incs } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index ab64c2f757c2a4..9543da7df39507 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -66,6 +66,10 @@ declare_args() { if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } + +# Enables LCD on supported devices +lcd_on = show_qr_code + if (use_rs911x || use_wf200) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" if (use_rs911x) { @@ -161,7 +165,6 @@ efr32_executable("lighting_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lighting-app/lighting-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", @@ -216,9 +219,14 @@ efr32_executable("lighting_app") { include_dirs += wf200_plat_incs } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { diff --git a/examples/lighting-app/efr32/src/AppTask.cpp b/examples/lighting-app/efr32/src/AppTask.cpp index 1ed50c2a8bb952..21f47ad76072e4 100644 --- a/examples/lighting-app/efr32/src/AppTask.cpp +++ b/examples/lighting-app/efr32/src/AppTask.cpp @@ -21,8 +21,10 @@ #include "AppConfig.h" #include "AppEvent.h" #include "LEDWidget.h" +#ifdef DISPLAY_ENABLED #include "lcd.h" #include "qrcodegen.h" +#endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include #include diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 870737f8047f42..4b28d1732ddcd2 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -65,6 +65,10 @@ declare_args() { if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } + +# Enables LCD on supported devices +lcd_on = show_qr_code + if (use_rs911x || use_wf200) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" if (use_rs911x) { @@ -160,7 +164,6 @@ efr32_executable("lock_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/lock-app/lock-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", @@ -218,10 +221,14 @@ efr32_executable("lock_app") { include_dirs += wf200_plat_incs } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] - defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { diff --git a/examples/lock-app/efr32/src/AppTask.cpp b/examples/lock-app/efr32/src/AppTask.cpp index 59a5c7b22c6654..ec4bb10f44a964 100644 --- a/examples/lock-app/efr32/src/AppTask.cpp +++ b/examples/lock-app/efr32/src/AppTask.cpp @@ -21,8 +21,10 @@ #include "AppConfig.h" #include "AppEvent.h" #include "LEDWidget.h" +#ifdef DISPLAY_ENABLED #include "lcd.h" #include "qrcodegen.h" +#endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include #include diff --git a/examples/ota-requestor-app/efr32/BUILD.gn b/examples/ota-requestor-app/efr32/BUILD.gn index 5a860287976351..fe27b4ceaa8e63 100644 --- a/examples/ota-requestor-app/efr32/BUILD.gn +++ b/examples/ota-requestor-app/efr32/BUILD.gn @@ -54,6 +54,9 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false } +# Enables LCD on supported devices +lcd_on = show_qr_code + efr32_sdk("sdk") { sources = [ "${efr32_project_dir}/include/CHIPProjectConfig.h", @@ -102,7 +105,6 @@ efr32_executable("ota_requestor_app") { deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/ota-requestor-app/ota-requestor-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", @@ -123,9 +125,14 @@ efr32_executable("ota_requestor_app") { ] } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c" ] defines += [ "DISPLAY_ENABLED" ] + if (show_qr_code) { + defines += [ "QR_CODE_ENABLED" ] + + deps += [ "${chip_root}/examples/common/QRCode" ] + } } if (chip_enable_pw_rpc) { diff --git a/examples/ota-requestor-app/efr32/src/AppTask.cpp b/examples/ota-requestor-app/efr32/src/AppTask.cpp index 95d2e9f36ca41c..f2a37c63ccce0d 100644 --- a/examples/ota-requestor-app/efr32/src/AppTask.cpp +++ b/examples/ota-requestor-app/efr32/src/AppTask.cpp @@ -21,8 +21,10 @@ #include "AppConfig.h" #include "AppEvent.h" #include "LEDWidget.h" +#ifdef DISPLAY_ENABLED #include "lcd.h" #include "qrcodegen.h" +#endif // DISPLAY_ENABLED #include "sl_simple_led_instances.h" #include #include diff --git a/examples/platform/efr32/display/lcd.c b/examples/platform/efr32/display/lcd.c index 04cdd6fa6f4e34..a62f89c8ba25ab 100644 --- a/examples/platform/efr32/display/lcd.c +++ b/examples/platform/efr32/display/lcd.c @@ -23,7 +23,11 @@ #include "dmd.h" #include "glib.h" + +#ifdef QR_CODE_ENABLED #include "qrcodegen.h" +#endif // QR_CODE_ENABLED + #include "sl_board_control.h" #define LCD_SIZE 128 @@ -32,10 +36,14 @@ #define QR_CODE_BORDER_SIZE 0 static GLIB_Context_t glibContext; +#ifdef QR_CODE_ENABLED static uint8_t qrCode[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)]; static uint8_t workBuffer[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)]; +#endif // QR_CODE_ENABLED +#ifdef QR_CODE_ENABLED static void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h); +#endif // QR_CODE_ENABLED void initLCD(void) { @@ -92,6 +100,7 @@ int LCD_update(void) return DMD_updateDisplay(); } +#ifdef QR_CODE_ENABLED void LCDWriteQRCode(uint8_t * str) { if (!qrcodegen_encodeText((const char *) str, workBuffer, qrCode, qrcodegen_Ecc_LOW, QR_CODE_VERSION, QR_CODE_VERSION, @@ -134,3 +143,4 @@ void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h) } } } +#endif // QR_CODE_ENABLED diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 6b1b894c73a0ba..7d6e4961e71a9b 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -51,14 +51,19 @@ declare_args() { sl_wfx_config_softap = false sl_wfx_config_scan = true - # Enables LCD Qr Code on supported devices + # Enables Qr Code on supported devices show_qr_code = true } +# Enables LCD on supported devices +lcd_on = true + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false + lcd_on = false } + if (use_rs911x || use_wf200) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" if (use_rs911x) { @@ -180,7 +185,6 @@ efr32_executable("window_app") { } deps = [ ":sdk", - "${chip_root}/examples/common/QRCode", "${chip_root}/examples/window-app/common:window-common", "${chip_root}/src/lib", "${chip_root}/src/setup_payload", @@ -205,13 +209,17 @@ efr32_executable("window_app") { } } - if (show_qr_code) { + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c", "src/LcdPainter.cpp", ] - defines += [ "DISPLAY_ENABLED" ] + + if (show_qr_code) { + deps += [ "${chip_root}/examples/common/QRCode" ] + defines += [ "QR_CODE_ENABLED" ] + } } if (enable_heap_monitoring) { diff --git a/examples/window-app/efr32/src/WindowAppImpl.cpp b/examples/window-app/efr32/src/WindowAppImpl.cpp index 3f2e08bf81aedc..0e754efb9cae3f 100644 --- a/examples/window-app/efr32/src/WindowAppImpl.cpp +++ b/examples/window-app/efr32/src/WindowAppImpl.cpp @@ -26,7 +26,9 @@ #include #include #include +#ifdef QR_CODE_ENABLED #include +#endif // QR_CODE_ENABLED #include #include #include @@ -413,7 +415,7 @@ void WindowAppImpl::UpdateLCD() if (mState.isThreadProvisioned) #else if (mState.isWiFiProvisioned) -#endif +#endif // CHIP_ENABLE_OPENTHREAD { Cover & cover = GetCover(); chip::app::DataModel::Nullable lift; @@ -431,6 +433,7 @@ void WindowAppImpl::UpdateLCD() LcdPainter::Paint(type, static_cast(lift.Value()), static_cast(tilt.Value()), mIcon); } } +#ifdef QR_CODE_ENABLED else { if (GetQRCode(mQRCode, chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)) == CHIP_NO_ERROR) @@ -438,7 +441,8 @@ void WindowAppImpl::UpdateLCD() LCDWriteQRCode((uint8_t *) mQRCode.c_str()); } } -#endif +#endif // QR_CODE_ENABLED +#endif // DISPLAY_ENABLED } void WindowAppImpl::OnMainLoop() diff --git a/third_party/efr32_sdk/efr32_sdk.gni b/third_party/efr32_sdk/efr32_sdk.gni index 92bb1d824e7796..5af0f01991c1da 100644 --- a/third_party/efr32_sdk/efr32_sdk.gni +++ b/third_party/efr32_sdk/efr32_sdk.gni @@ -175,7 +175,8 @@ template("efr32_sdk") { # USART include files if ((defined(invoker.chip_enable_pw_rpc) && invoker.chip_enable_pw_rpc) || chip_build_libshell || enable_openthread_cli || - (defined(invoker.show_qr_code) && invoker.show_qr_code)) { + (defined(invoker.show_qr_code) && invoker.show_qr_code) || + (defined(invoker.lcd_on) && invoker.lcd_on)) { defines += [ "CONFIG_ENABLE_UART" ] _include_dirs += [ @@ -505,25 +506,24 @@ template("efr32_sdk") { } } - if (defined(invoker.show_qr_code)) { - if (invoker.show_qr_code) { - sources += [ - "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd.c", - "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd_display.c", - "${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/bmp.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_bitmap.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_circle.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_narrow_6x8.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_normal_8x8.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_number_16x20.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_line.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c", - "${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c", - ] - } + if ((defined(invoker.show_qr_code) && invoker.show_qr_code) || + (defined(invoker.lcd_on) && invoker.lcd_on)) { + sources += [ + "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd.c", + "${efr32_sdk_root}/hardware/driver/memlcd/src/sl_memlcd_display.c", + "${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/bmp.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_bitmap.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_circle.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_narrow_6x8.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_normal_8x8.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_font_number_16x20.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_line.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c", + ] } if (use_wf200) { sources += [ From b24efd91106d2f46958a30b1befb8df1522d8b69 Mon Sep 17 00:00:00 2001 From: "Hui.Li-TCL" Date: Thu, 24 Mar 2022 01:00:42 +0800 Subject: [PATCH 28/70] Extended Discovery has no timeout on android (#16285) * added app init before running Matter main loop and added SetExtendedDiscoveryTimeoutSecs * fix restyled-io and ci errors * remove weak ApplicationInit() in app server as PR request * fix restyled-io and ci errors * move ApplicationInit to TvApp-JNI, we do not need it call in main loop --- .../chip/chiptvserver/service/MatterServant.java | 7 +++++++ examples/tv-app/android/java/TVApp-JNI.cpp | 14 ++++++++++++++ .../android/java/src/com/tcl/chip/tvapp/TvApp.java | 3 +++ 3 files changed, 24 insertions(+) diff --git a/examples/tv-app/android/App/app/src/main/java/com/tcl/chip/chiptvserver/service/MatterServant.java b/examples/tv-app/android/App/app/src/main/java/com/tcl/chip/chiptvserver/service/MatterServant.java index 6f88c05a895a33..1a1c6f914b0d57 100644 --- a/examples/tv-app/android/App/app/src/main/java/com/tcl/chip/chiptvserver/service/MatterServant.java +++ b/examples/tv-app/android/App/app/src/main/java/com/tcl/chip/chiptvserver/service/MatterServant.java @@ -53,6 +53,11 @@ public static MatterServant get() { } public void init(@NonNull Context context) { + // The order is important, must + // first new TvApp to load dynamic library + // then chipPlatform to prepare platform + // then TvApp.postInit to init app which needs platform + // then start ChipAppServer TvApp tvApp = new TvApp( (app, clusterId, endpoint) -> { @@ -92,6 +97,8 @@ public void init(@NonNull Context context) { new ChipMdnsCallbackImpl(), new DiagnosticDataProviderImpl(applicationContext)); + tvApp.postInit(); + chipAppServer = new ChipAppServer(); chipAppServer.startApp(); } diff --git a/examples/tv-app/android/java/TVApp-JNI.cpp b/examples/tv-app/android/java/TVApp-JNI.cpp index caea0a1fbdebe9..71a659abcf789c 100644 --- a/examples/tv-app/android/java/TVApp-JNI.cpp +++ b/examples/tv-app/android/java/TVApp-JNI.cpp @@ -26,13 +26,20 @@ #include "MediaPlaybackManager.h" #include "WakeOnLanManager.h" #include "credentials/DeviceAttestationCredsProvider.h" +#include #include +#include +#include #include #include #include #include using namespace chip; +using namespace chip::app; +using namespace chip::Credentials; + +#define EXTENDED_DISCOVERY_TIMEOUT_SEC 20 #define JNI_METHOD(RETURN, METHOD_NAME) extern "C" JNIEXPORT RETURN JNICALL Java_com_tcl_chip_tvapp_TvApp_##METHOD_NAME @@ -130,3 +137,10 @@ JNI_METHOD(void, setDACProvider)(JNIEnv *, jobject, jobject provider) chip::Credentials::SetDeviceAttestationCredentialsProvider(p); } } + +JNI_METHOD(void, postInit)(JNIEnv *, jobject app) +{ +#if CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY + DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(EXTENDED_DISCOVERY_TIMEOUT_SEC); +#endif +} diff --git a/examples/tv-app/android/java/src/com/tcl/chip/tvapp/TvApp.java b/examples/tv-app/android/java/src/com/tcl/chip/tvapp/TvApp.java index 289cbacea8d2d7..1479dc73a3b0e0 100644 --- a/examples/tv-app/android/java/src/com/tcl/chip/tvapp/TvApp.java +++ b/examples/tv-app/android/java/src/com/tcl/chip/tvapp/TvApp.java @@ -37,6 +37,9 @@ private void postClusterInit(int clusterId, int endpoint) { public native void nativeInit(); + // post native init after platform is inited + public native void postInit(); + public native void setKeypadInputManager(int endpoint, KeypadInputManager manager); public native void setWakeOnLanManager(int endpoint, WakeOnLanManager manager); From 2b7a67ec04819cb78bc9b8fbe4ef44be81ed3dcc Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 23 Mar 2022 14:06:16 -0400 Subject: [PATCH 29/70] Add an access control delegate implementation for the Darwin framework. (#16546) --- .../Framework/CHIP.xcodeproj/project.pbxproj | 14 +++- src/darwin/Framework/CHIP/BUILD.gn | 3 + .../CHIP/CHIPControllerAccessControl.h | 36 +++++++++ .../CHIP/CHIPControllerAccessControl.mm | 75 +++++++++++++++++++ .../Framework/CHIP/CHIPDeviceController.mm | 3 + src/darwin/Framework/CHIP/CHIPIMDispatch.mm | 3 +- 6 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 src/darwin/Framework/CHIP/CHIPControllerAccessControl.h create mode 100644 src/darwin/Framework/CHIP/CHIPControllerAccessControl.mm diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index cc9f004573bff8..8fe08ec62fc0e9 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -41,6 +41,8 @@ 51B22C222740CB1D008D5055 /* CHIPCommandPayloadsObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 51B22C262740CB32008D5055 /* CHIPStructsObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B22C252740CB32008D5055 /* CHIPStructsObjc.mm */; }; 51B22C2A2740CB47008D5055 /* CHIPCommandPayloadsObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B22C292740CB47008D5055 /* CHIPCommandPayloadsObjc.mm */; }; + 51E0310027EA20D20083DC9C /* CHIPControllerAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E030FE27EA20D20083DC9C /* CHIPControllerAccessControl.h */; }; + 51E0310127EA20D20083DC9C /* CHIPControllerAccessControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E030FF27EA20D20083DC9C /* CHIPControllerAccessControl.mm */; }; 51E24E73274E0DAC007CCF6E /* CHIPErrorTestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E24E72274E0DAC007CCF6E /* CHIPErrorTestUtils.mm */; }; 5A6FEC9027B563D900F25F42 /* CHIPDeviceControllerOverXPC.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A6FEC8F27B563D900F25F42 /* CHIPDeviceControllerOverXPC.m */; }; 5A6FEC9227B5669C00F25F42 /* CHIPDeviceControllerOverXPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A6FEC8D27B5624E00F25F42 /* CHIPDeviceControllerOverXPC.h */; }; @@ -133,6 +135,8 @@ 51B22C212740CB1D008D5055 /* CHIPCommandPayloadsObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CHIPCommandPayloadsObjc.h; path = "zap-generated/CHIPCommandPayloadsObjc.h"; sourceTree = ""; }; 51B22C252740CB32008D5055 /* CHIPStructsObjc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPStructsObjc.mm; path = "zap-generated/CHIPStructsObjc.mm"; sourceTree = ""; }; 51B22C292740CB47008D5055 /* CHIPCommandPayloadsObjc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CHIPCommandPayloadsObjc.mm; path = "zap-generated/CHIPCommandPayloadsObjc.mm"; sourceTree = ""; }; + 51E030FE27EA20D20083DC9C /* CHIPControllerAccessControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPControllerAccessControl.h; sourceTree = ""; }; + 51E030FF27EA20D20083DC9C /* CHIPControllerAccessControl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPControllerAccessControl.mm; sourceTree = ""; }; 51E24E72274E0DAC007CCF6E /* CHIPErrorTestUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPErrorTestUtils.mm; sourceTree = ""; }; 5A6FEC8B27B5609C00F25F42 /* CHIPDeviceOverXPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceOverXPC.h; sourceTree = ""; }; 5A6FEC8D27B5624E00F25F42 /* CHIPDeviceControllerOverXPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceControllerOverXPC.h; sourceTree = ""; }; @@ -262,6 +266,8 @@ 1ED276E126C5812A00547A89 /* CHIPCluster.mm */, 2C5EEEF4268A85C400CAE3D3 /* CHIPDeviceConnectionBridge.h */, 51431AF827D2973E008A7943 /* CHIPIMDispatch.mm */, + 51E030FE27EA20D20083DC9C /* CHIPControllerAccessControl.h */, + 51E030FF27EA20D20083DC9C /* CHIPControllerAccessControl.mm */, 2C5EEEF5268A85C400CAE3D3 /* CHIPDeviceConnectionBridge.mm */, 1E857311265519DE0050A4D9 /* CHIPApp */, 2C1B02792641DB4E00780EF1 /* CHIPOperationalCredentialsDelegate.h */, @@ -382,6 +388,7 @@ 5A830D6A27CFCB640053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.h in Headers */, 998F286F26D55EC5001846C6 /* CHIPP256KeypairBridge.h in Headers */, 2C222ADF255C811800E446B9 /* CHIPDevice_Internal.h in Headers */, + 51E0310027EA20D20083DC9C /* CHIPControllerAccessControl.h in Headers */, 991DC08B247704DC00C13860 /* CHIPLogging.h in Headers */, 5A7947E527C0129F00434CF2 /* CHIPDeviceController+XPC.h in Headers */, B2E0D7B4245B0B5C003C5B48 /* CHIPError_Internal.h in Headers */, @@ -522,6 +529,7 @@ 991DC0892475F47D00C13860 /* CHIPDeviceController.mm in Sources */, B2E0D7B7245B0B5C003C5B48 /* CHIPQRCodeSetupPayloadParser.mm in Sources */, 1EC4CE5D25CC26E900D7304F /* CHIPClustersObjc.mm in Sources */, + 51E0310127EA20D20083DC9C /* CHIPControllerAccessControl.mm in Sources */, 1ED276E226C5812A00547A89 /* CHIPCluster.mm in Sources */, B2E0D7B3245B0B5C003C5B48 /* CHIPError.mm in Sources */, 1E85730C265519AE0050A4D9 /* callback-stub.cpp in Sources */, @@ -612,7 +620,7 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", + "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", "$(inherited)", ); GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -647,7 +655,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( CHIP_HAVE_CONFIG_H, - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", + "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", "$(inherited)", ); HEADER_SEARCH_PATHS = ( @@ -790,7 +798,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREPROCESSOR_DEFINITIONS = ( CHIP_HAVE_CONFIG_H, - "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", + "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", "$(inherited)", ); HEADER_SEARCH_PATHS = ( diff --git a/src/darwin/Framework/CHIP/BUILD.gn b/src/darwin/Framework/CHIP/BUILD.gn index d823e741f78a6b..198fdf371da18a 100644 --- a/src/darwin/Framework/CHIP/BUILD.gn +++ b/src/darwin/Framework/CHIP/BUILD.gn @@ -30,6 +30,8 @@ static_library("framework") { sources = [ "CHIP.h", "CHIPCluster.mm", + "CHIPControllerAccessControl.h", + "CHIPControllerAccessControl.mm", "CHIPDevice.h", "CHIPDevice.mm", "CHIPDeviceConnectionBridge.mm", @@ -42,6 +44,7 @@ static_library("framework") { "CHIPError.h", "CHIPError.mm", "CHIPError_Internal.h", + "CHIPIMDispatch.mm", "CHIPLogging.h", "CHIPManualSetupPayloadParser.h", "CHIPManualSetupPayloadParser.mm", diff --git a/src/darwin/Framework/CHIP/CHIPControllerAccessControl.h b/src/darwin/Framework/CHIP/CHIPControllerAccessControl.h new file mode 100644 index 00000000000000..0a2b291670ae34 --- /dev/null +++ b/src/darwin/Framework/CHIP/CHIPControllerAccessControl.h @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2022 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. + */ +#pragma once + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CHIPControllerAccessControl : NSObject + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; ++ (instancetype)alloc NS_UNAVAILABLE; + +/** + * Initialize the access control module. Must be called on the Matter task + * queue. + */ ++ (void)init; + +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/CHIPControllerAccessControl.mm b/src/darwin/Framework/CHIP/CHIPControllerAccessControl.mm new file mode 100644 index 00000000000000..e35e0c6742f699 --- /dev/null +++ b/src/darwin/Framework/CHIP/CHIPControllerAccessControl.mm @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2022 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. + */ + +#import "CHIPControllerAccessControl.h" + +#include +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::Access; +using namespace chip::app::Clusters; + +namespace { +// TODO: Maybe consider making this configurable? See also +// CHIPIMDispatch.mm. +constexpr EndpointId kSupportedEndpoint = 0; + +// TODO: Make the policy more configurable by consumers. +class AccessControlDelegate : public Access::AccessControl::Delegate { + CHIP_ERROR Check( + const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, Privilege requestPrivilege) override + { + if (requestPath.endpoint != kSupportedEndpoint || requestPath.cluster != OtaSoftwareUpdateProvider::Id) { + // We only allow access to OTA software update provider. + return CHIP_ERROR_ACCESS_DENIED; + } + + if (requestPrivilege != Privilege::kOperate) { + // The commands on OtaSoftwareUpdateProvider all require + // Operate; we should not be asked for anything else. + return CHIP_ERROR_ACCESS_DENIED; + } + + if (subjectDescriptor.authMode != AuthMode::kCase && subjectDescriptor.authMode != AuthMode::kPase) { + // No idea who is asking; deny for now. + return CHIP_ERROR_ACCESS_DENIED; + } + + // TODO do we care about the fabric index here? Probably not. + + return CHIP_NO_ERROR; + } +}; + +AccessControlDelegate gDelegate; +} // anonymous namespace + +@implementation CHIPControllerAccessControl + ++ (void)init +{ + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + GetAccessControl().Init(&gDelegate); + }); +} + +@end diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.mm b/src/darwin/Framework/CHIP/CHIPDeviceController.mm index bfbf7b3f46e722..b11abb160d61b3 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.mm @@ -17,6 +17,7 @@ #import "CHIPDeviceController.h" #import "CHIPCommissioningParameters.h" +#import "CHIPControllerAccessControl.h" #import "CHIPDevicePairingDelegateBridge.h" #import "CHIPDevice_Internal.h" #import "CHIPError_Internal.h" @@ -158,6 +159,8 @@ - (BOOL)startup:(_Nullable id)storageDelegate return; } + [CHIPControllerAccessControl init]; + CHIP_ERROR errorCode = CHIP_ERROR_INCORRECT_STATE; _persistentStorageDelegateBridge->setFrameworkDelegate(storageDelegate); diff --git a/src/darwin/Framework/CHIP/CHIPIMDispatch.mm b/src/darwin/Framework/CHIP/CHIPIMDispatch.mm index 9b2f69db080156..07beba3e0788a6 100644 --- a/src/darwin/Framework/CHIP/CHIPIMDispatch.mm +++ b/src/darwin/Framework/CHIP/CHIPIMDispatch.mm @@ -52,7 +52,8 @@ namespace { -// TODO: Maybe consider making this configurable? +// TODO: Maybe consider making this configurable? See also +// CHIPControllerAccessControl.mm. constexpr EndpointId kSupportedEndpoint = 0; } // anonymous namespace From 395bb1fdeb90139cf82b82af6e78430ab21be018 Mon Sep 17 00:00:00 2001 From: Vijay Selvaraj Date: Wed, 23 Mar 2022 15:36:37 -0400 Subject: [PATCH 30/70] Implemented trust store and added official DCL trusted PAAs (#16125) --- .../fetch-development-paa-certs-from-dcl.py | 131 ++++++++++++++++++ .../Chip-Test-PAA-FFF1-Cert.der | Bin 0 -> 449 bytes .../Chip-Test-PAA-FFF1-Cert.pem | 12 ++ .../Chip-Test-PAA-NoVID-Cert.der | Bin 0 -> 405 bytes .../Chip-Test-PAA-NoVID-Cert.pem | 11 ++ .../dcld_mirror_CN_Matter_Development_PAA.der | Bin 0 -> 420 bytes .../dcld_mirror_CN_Matter_Development_PAA.pem | 11 ++ ...Google_C_US_1361413724421_130436303036.der | Bin 0 -> 497 bytes ...Google_C_US_1361413724421_130436303036.pem | 13 ++ ..._Non_Production_ONLY_-_XFN_PAA_Class_3.der | Bin 0 -> 462 bytes ..._Non_Production_ONLY_-_XFN_PAA_Class_3.pem | 12 ++ examples/chip-tool/BUILD.gn | 1 + .../chip-tool/commands/common/CHIPCommand.cpp | 30 +++- scripts/requirements.txt | 2 + scripts/tests/chiptest/test_definition.py | 7 +- scripts/tests/run_python_test.py | 4 +- scripts/tools/check_includes_config.py | 3 + src/controller/python/BUILD.gn | 5 +- src/controller/python/OpCredsBinding.cpp | 17 ++- src/controller/python/chip-device-ctrl.py | 3 +- src/controller/python/chip/ChipDeviceCtrl.py | 4 +- src/controller/python/chip/FabricAdmin.py | 4 +- .../python/chip/internal/CommissionerImpl.cpp | 13 +- .../python/test/test_scripts/base.py | 15 +- .../test/test_scripts/commissioning_test.py | 13 +- .../test/test_scripts/mobile-device-test.py | 10 +- .../test_scripts/split_commissioning_test.py | 13 +- src/credentials/BUILD.gn | 14 ++ .../DefaultDeviceAttestationVerifier.cpp | 1 - .../FileAttestationTrustStore.cpp | 122 ++++++++++++++++ .../FileAttestationTrustStore.h | 49 +++++++ .../DeviceAttestationCredsExample.cpp | 2 +- .../linux-cirque/CommissioningTest.py | 6 +- .../linux-cirque/MobileDeviceTest.py | 6 +- .../linux-cirque/SplitCommissioningTest.py | 5 +- 35 files changed, 504 insertions(+), 35 deletions(-) create mode 100644 credentials/development/fetch-development-paa-certs-from-dcl.py create mode 100644 credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.der create mode 100644 credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem create mode 100644 credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.der create mode 100644 credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem create mode 100644 credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.der create mode 100644 credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem create mode 100644 credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.der create mode 100644 credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem create mode 100644 credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.der create mode 100644 credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.pem create mode 100644 src/credentials/attestation_verifier/FileAttestationTrustStore.cpp create mode 100644 src/credentials/attestation_verifier/FileAttestationTrustStore.h diff --git a/credentials/development/fetch-development-paa-certs-from-dcl.py b/credentials/development/fetch-development-paa-certs-from-dcl.py new file mode 100644 index 00000000000000..7ac67b275c220f --- /dev/null +++ b/credentials/development/fetch-development-paa-certs-from-dcl.py @@ -0,0 +1,131 @@ +#!/usr/bin/python + +# +# Copyright (c) 2022 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. +# + +# Script that was used to fetch CHIP Development Product Attestation Authority (PAA) +# certificates from DCL. +# The script expects the path to the dcld tool binary as an input argument. +# +# Usage example when the script is run from the CHIP SDK root directory: +# python ./credentials/development/fetch-development-paa-certs-from-dcl.py /path/to/dcld +# +# The result will be stored in: +# credentials/development/paa-root-certs +# + +import os +import sys +import subprocess +import copy +import re +from cryptography.hazmat.primitives import serialization +from cryptography import x509 + + +def parse_paa_root_certs(cmdpipe, paa_list): + """ + example output of a query to all x509 root certs in DCL: + + certs: + - subject: CN=Non Production ONLY - XFN PAA Class 3 + subject_key_id: F8:99:A9:D5:AD:71:71:E4:C3:81:7F:14:10:7F:78:F0:D9:F7:62:E9 + - subject: CN=Matter Development PAA + subject_key_id: FA:92:CF:9:5E:FA:42:E1:14:30:65:16:32:FE:FE:1B:2C:77:A7:C8 + - subject: CN=Matter PAA 1,O=Google,C=US,1.3.6.1.4.1.37244.2.1=#130436303036 + subject_key_id: B0:0:56:81:B8:88:62:89:62:80:E1:21:18:A1:A8:BE:9:DE:93:21 + - subject: CN=Matter Test PAA,1.3.6.1.4.1.37244.2.1=#130431323544 + subject_key_id: E2:90:8D:36:9C:3C:A3:C1:13:BB:9:E2:4D:C1:CC:C5:A6:66:91:D4 + + Brief: + This method will search for the first line that contains ': ' char sequence. + From there, it assumes every 2 lines contain subject and subject key id info of + a valid PAA root certificate. + The paa_list parameter will contain a list of all valid PAA Root certificates + from DCL. + """ + + result = {} + + while True: + line = cmdpipe.stdout.readline() + if not line: + break + else: + if b': ' in line: + key, value = line.split(b': ') + result[key.strip(b' -')] = value.strip() + parse_paa_root_certs.counter += 1 + if parse_paa_root_certs.counter % 2 == 0: + paa_list.append(copy.deepcopy(result)) + + +def write_paa_root_cert(cmdpipe, subject): + filename = 'paa-root-certs/dcld_mirror_' + \ + re.sub('[^a-zA-Z0-9_-]', '', re.sub('[=, ]', '_', subject)) + with open(filename + '.pem', 'wb+') as outfile: + while True: + line = cmdpipe.stdout.readline() + if not line: + break + else: + if b'pem_cert: |' in line: + while True: + line = cmdpipe.stdout.readline() + outfile.write(line.strip(b' \t')) + if b'-----END CERTIFICATE-----' in line: + break + # convert pem file to der + with open(filename + '.pem', 'rb') as infile: + pem_certificate = x509.load_pem_x509_certificate(infile.read()) + with open(filename + '.der', 'wb+') as outfile: + der_certificate = pem_certificate.public_bytes( + serialization.Encoding.DER) + outfile.write(der_certificate) + + +def main(): + if len(sys.argv) == 2: + dcld = sys.argv[1] + else: + sys.exit( + "Error: Please specify exactly one input argument; the path to the dcld tool binary") + + previous_dir = os.getcwd() + abspath = os.path.dirname(sys.argv[0]) + os.chdir(abspath) + + os.makedirs('paa-root-certs', exist_ok=True) + + cmdpipe = subprocess.Popen([dcld, 'query', 'pki', 'all-x509-root-certs'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + paa_list = [] + parse_paa_root_certs.counter = 0 + parse_paa_root_certs(cmdpipe, paa_list) + + for paa in paa_list: + cmdpipe = subprocess.Popen( + [dcld, 'query', 'pki', 'x509-cert', '-u', + paa[b'subject'].decode("utf-8"), '-k', paa[b'subject_key_id'].decode("utf-8")], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + write_paa_root_cert(cmdpipe, paa[b'subject'].decode("utf-8")) + + os.chdir(previous_dir) + + +if __name__ == "__main__": + main() diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.der b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..cb287bf8862bd4b41ea277a6415b94375bc55a3f GIT binary patch literal 449 zcmXqLV%%%c#F(;xnTe5!iNkNj3&W->GBO5SY#dr`9_MUXn3)U=3?&T2*qB3En0fep z6H7``ixfgqi%S#&932fs420OYwAmP07@HQ=FfsD5xVgC*8YqbK8W|dx8Ce*b7#W)w zM@jHo0)e5CF%X$rnp#GYVP>R(FdIAAO-zhX$1yXqGdnS`Y&)G?)KRag@pab;sg*aa z9y!abU3q<;ihini-OqD3jTZHtW!|+utN)aQmsEhM(==XJdjorUNhjG-x&D5sS+h$Q zrx~OGy}=wRE6m9FpM}GK4M;IDG8*uK#P~sCz+hlxGmr)G`B=nQM6&)WmCFapzu7P5 zI6Yn9&K<*rg>?qZE=&pms~VWT+%#IbfYst#aK>8x|0mw> zKDlrEt*{xU=VvVs+T;xWdcq8|bZi4*)Jf Bf!6>4 literal 0 HcmV?d00001 diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem new file mode 100644 index 00000000000000..04c5822162ee48 --- /dev/null +++ b/credentials/development/paa-root-certs/Chip-Test-PAA-FFF1-Cert.pem @@ -0,0 +1,12 @@ +-----BEGIN CERTIFICATE----- +MIIBvTCCAWSgAwIBAgIITqjoMYLUHBwwCgYIKoZIzj0EAwIwMDEYMBYGA1UEAwwP +TWF0dGVyIFRlc3QgUEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTAgFw0yMTA2Mjgx +NDIzNDNaGA85OTk5MTIzMTIzNTk1OVowMDEYMBYGA1UEAwwPTWF0dGVyIFRlc3Qg +UEFBMRQwEgYKKwYBBAGConwCAQwERkZGMTBZMBMGByqGSM49AgEGCCqGSM49AwEH +A0IABLbLY3KIfyko9brIGqnZOuJDHK2p154kL2UXfvnO2TKijs0Duq9qj8oYShpQ +NUKWDUU/MD8fGUIddR6Pjxqam3WjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYD +VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAfBgNV +HSMEGDAWgBRq/SJ3H1Ef7L8WQZdnENzcMaFxfjAKBggqhkjOPQQDAgNHADBEAiBQ +qoAC9NkyqaAFOPZTaK0P/8jvu8m+t9pWmDXPmqdRDgIgI7rI/g8j51RFtlM5CBpH +mUkpxyqvChVI1A0DTVFLJd4= +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.der b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.der new file mode 100644 index 0000000000000000000000000000000000000000..44898404bc0a27915efe438729d207e5fbabd0c0 GIT binary patch literal 405 zcmXqLVw`Bu#Av>NnTe5!iJiND*NVGs?+m!uIJDY4&e^gsGZ{!3N*IW-F^94+^YHs7 zmXxFxDTJgJmnZ}{IvOa5^BNf%m>F3Zniv_I7)MF)TLOWhkueaNTAEr$;nf{!Ak4-N zwugxkY9TWtJF^o5i@vBb$LNh|k9&#v)P?^PF`@cE4Z#@yV+aPCLKK%xJo5APPC fo$Jl((z~`y==+P92tE75LU$x8eJ>Xm#>D~v7YTvh literal 0 HcmV?d00001 diff --git a/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem new file mode 100644 index 00000000000000..119b901d2b128e --- /dev/null +++ b/credentials/development/paa-root-certs/Chip-Test-PAA-NoVID-Cert.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBkTCCATegAwIBAgIHC4+6qN2G7jAKBggqhkjOPQQDAjAaMRgwFgYDVQQDDA9N +YXR0ZXIgVGVzdCBQQUEwIBcNMjEwNjI4MTQyMzQzWhgPOTk5OTEyMzEyMzU5NTla +MBoxGDAWBgNVBAMMD01hdHRlciBUZXN0IFBBQTBZMBMGByqGSM49AgEGCCqGSM49 +AwEHA0IABBDvAqgah7aBIfuo0xl4+AejF+UKqKgoRGgokUuTPejt1KXDnJ/3Gkzj +ZH/X9iZTt9JJX8ukwPR/h2iAA54HIEqjZjBkMBIGA1UdEwEB/wQIMAYBAf8CAQEw +DgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR4XOcFuGuPTm/Hk6pgy0PqaWiC1TAf +BgNVHSMEGDAWgBR4XOcFuGuPTm/Hk6pgy0PqaWiC1TAKBggqhkjOPQQDAgNIADBF +AiEAue/bPqBqUuwL8B5h2u0sLRVt22zwFBAdq3mPrAX6R+UCIGAGHT411g2dSw1E +ja12EvfoXFguP8MS3Bh5TdNzcV5d +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.der new file mode 100644 index 0000000000000000000000000000000000000000..56f4e1d436ec53d52e3e871176bdc8bc1353baef GIT binary patch literal 420 zcmXqLVq9R*#OStwnTe5!i6i{-q6>0{jS~#G*f_M>JkHs&Ff$n_8p<2UvN4CUF!PA{ zCYF?>7Ad%-mZj$87v!eql_&%_IvOa5^BNf%m>F3Zniv_I7)MF)TLOWhkueaNTAEr$ z5o1WCfiN38*j6S+sP)W@?95IKEYkd{Q}k>nt-e;^Bc7j^0s+iHgf6_YT%TE}{gOn?? zNEnDUU{`hzfu o8P;EU>zy_8>5rp9vITN`e*O*KY3YB1|LDv~|Lvl8Z{sor0Dl#RegFUf literal 0 HcmV?d00001 diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem new file mode 100644 index 00000000000000..b55bd3978d74d2 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_Development_PAA.pem @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE----- +MIIBoDCCAUagAwIBAgIIV9Oi0B4xgZAwCgYIKoZIzj0EAwIwITEfMB0GA1UEAwwW +TWF0dGVyIERldmVsb3BtZW50IFBBQTAgFw0yMTA2MjgxNDIzNDNaGA85OTk5MTIz +MTIzNTk1OVowITEfMB0GA1UEAwwWTWF0dGVyIERldmVsb3BtZW50IFBBQTBZMBMG +ByqGSM49AgEGCCqGSM49AwEHA0IABBsPJZQuPZKr1nBMGieBoDjsUyEsTatYsL48 +QL37SSMjQhx53MetcBgQBxINyG8KiSU9iZPrN6tlLvjbE3XlsUWjZjBkMBIGA1Ud +EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBT6ks8JXvpC +4RQwZRYy/v4bLHenyDAfBgNVHSMEGDAWgBT6ks8JXvpC4RQwZRYy/v4bLHenyDAK +BggqhkjOPQQDAgNIADBFAiBQp5AzZLZT/w6kY9xoSobdJccxo57+s8IM0t7RtmB+ +LwIhAK/U7UtqmeX4xVIdcB68+f1TuTlP2A/FmZL/Plu7tgo1 +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.der new file mode 100644 index 0000000000000000000000000000000000000000..9b018d8fe77a3d19aed672a2d30a1304b4202ef9 GIT binary patch literal 497 zcmXqLVti}R#5j2YGZP~d6C`Z$oYaPB!LH7B*p~&|pJ;16~k^ zi-*lUKR-Pu)lk$x7$m^V!{eJ+Qj%Jv5a8&jU}z{}AjHO{&Bn;W*tDpIiIIoJ%)r3R zKtY_>$k5Qpz{1GD$jrbvN`l|W5JiBx)11%#7^JP7Exc)WUzhDg1EZ z>N_*8MSIExPcvU*U$gN|h_A*n#otGjlRtTd#2FbmhbVTOt3kSx#@Uks==j;ku$#wI6F>YQph?gC+csU>0OhvIIP^$?xBe06RpaFJ+Fli7^+`L HV*UsKSHXp5 literal 0 HcmV?d00001 diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem new file mode 100644 index 00000000000000..a22831feda63f3 --- /dev/null +++ b/credentials/development/paa-root-certs/dcld_mirror_CN_Matter_PAA_1_O_Google_C_US_1361413724421_130436303036.pem @@ -0,0 +1,13 @@ +-----BEGIN CERTIFICATE----- +MIIB7TCCAZOgAwIBAgIBATAKBggqhkjOPQQDAjBLMQswCQYDVQQGEwJVUzEPMA0G +A1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFBIDExFDASBgorBgEEAYKi +fAIBDAQ2MDA2MCAXDTIxMTIwODIwMjYwM1oYDzIxMjExMjA4MjAyNjAzWjBLMQsw +CQYDVQQGEwJVUzEPMA0GA1UECgwGR29vZ2xlMRUwEwYDVQQDDAxNYXR0ZXIgUEFB +IDExFDASBgorBgEEAYKifAIBDAQ2MDA2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD +QgAE8iZX+exx8NDV7jYKorx3EcsD1gessexUTSimIfvFI2PySlReMjJDVCGIzXor +hTYFOzwMAx4b6ogNMIUmcW7uT6NmMGQwEgYDVR0TAQH/BAgwBgEB/wIBATAOBgNV +HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFLAAVoG4iGKJYoDhIRihqL4J3pMhMB8GA1Ud +IwQYMBaAFLAAVoG4iGKJYoDhIRihqL4J3pMhMAoGCCqGSM49BAMCA0gAMEUCIQCV +c26cVlyqjhQfcgN3udpne6zZQdyVMNLRWZn3EENBkAIgasUeFU8zaUt8bKNWd0k+ +4RQp5Cp5wYzrE8AxJ9BiA/E= +-----END CERTIFICATE----- diff --git a/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.der b/credentials/development/paa-root-certs/dcld_mirror_CN_Non_Production_ONLY_-_XFN_PAA_Class_3.der new file mode 100644 index 0000000000000000000000000000000000000000..388fe3b6594076b2251016fecd46f88e4333ea34 GIT binary patch literal 462 zcmXqLVmxKg#8|L^nTe5!Nkq&&>}6R$FT)%4y7G%pQaWBo~U%#F>WB>0UCOo0Lh=1>7L%#1V;W@87tiHQ;FIA%t6W+w&~`6=_(bCsN) z@LIH0>w>7%_GW2=rzdv3+^Hn_d3n!f4!y_HkGsrxUuhGL& z5rO)O4>!Ljy)=*oDd1xfW5F)X2a@IonF$O=#x~?YW%gh&aAi`6P&#oh>yg #include +#include #include #include #include @@ -36,6 +37,22 @@ constexpr chip::FabricId kIdentityAlphaFabricId = 1; constexpr chip::FabricId kIdentityBetaFabricId = 2; constexpr chip::FabricId kIdentityGammaFabricId = 3; +namespace { +const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath) +{ + static chip::Credentials::FileAttestationTrustStore attestationTrustStore{ paaTrustStorePath }; + + if (attestationTrustStore.IsInitialized()) + { + return &attestationTrustStore; + } + else + { + return nullptr; + } +} +} // namespace + CHIP_ERROR CHIPCommand::Run() { StartTracing(); @@ -58,8 +75,17 @@ CHIP_ERROR CHIPCommand::Run() factoryInitParams.listenPort = port; ReturnLogErrorOnFailure(DeviceControllerFactory::GetInstance().Init(factoryInitParams)); - // TODO(issue #15209): Replace this trust store with file-based trust store - const chip::Credentials::AttestationTrustStore * trustStore = chip::Credentials::GetTestAttestationTrustStore(); + const chip::Credentials::AttestationTrustStore * trustStore = + GetTestFileAttestationTrustStore(mPaaTrustStorePath.HasValue() ? mPaaTrustStorePath.Value() : "."); + if (trustStore == nullptr) + { + ChipLogError(chipTool, "No PAAs found in path: %s", mPaaTrustStorePath.HasValue() ? mPaaTrustStorePath.Value() : "."); + ChipLogError(chipTool, + "Please specify a valid path containing trusted PAA certificates using [--paa-trust-store-path paa/file/path] " + "argument"); + + return CHIP_ERROR_INVALID_ARGUMENT; + } ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityNull, kIdentityNullFabricId, trustStore)); ReturnLogErrorOnFailure(InitializeCommissioner(kIdentityAlpha, kIdentityAlphaFabricId, trustStore)); diff --git a/scripts/requirements.txt b/scripts/requirements.txt index 0ed83234cb9126..b232e413e8a5bd 100644 --- a/scripts/requirements.txt +++ b/scripts/requirements.txt @@ -51,3 +51,5 @@ click # scripts/idl lark stringcase + +cryptography diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 0642c7a4513424..f9a6463a80984e 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -24,6 +24,7 @@ from random import randrange TEST_NODE_ID = '0x12344321' +DEVELOPMENT_PAA_LIST = './credentials/development/paa-root-certs' class App: @@ -240,11 +241,13 @@ def Run(self, runner, apps_register, paths: ApplicationPaths): app.start(str(randrange(1, 4096))) runner.RunSubprocess( - tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, app.setupCode], + tool_cmd + ['pairing', 'qrcode', TEST_NODE_ID, app.setupCode] + + ['--paa-trust-store-path', DEVELOPMENT_PAA_LIST], name='PAIR', dependencies=[apps_register]) runner.RunSubprocess( - tool_cmd + ['tests', self.run_name], + tool_cmd + ['tests', self.run_name] + + ['--paa-trust-store-path', DEVELOPMENT_PAA_LIST], name='TEST', dependencies=[apps_register]) except Exception: diff --git a/scripts/tests/run_python_test.py b/scripts/tests/run_python_test.py index 10d9e864f89aee..b94188d72f7a2a 100755 --- a/scripts/tests/run_python_test.py +++ b/scripts/tests/run_python_test.py @@ -31,6 +31,8 @@ DEFAULT_CHIP_ROOT = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..')) +MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" + def EnqueueLogOutput(fp, tag, q): for line in iter(fp.readline, b''): @@ -88,7 +90,7 @@ def main(app: str, factoryreset: bool, app_args: str, script: str, script_args: DumpProgramOutputToQueue( log_cooking_threads, "\33[34mAPP \33[0m", app_process, log_queue) - script_command = ["/usr/bin/env", "python3", script, + script_command = ["/usr/bin/env", "python3", script, "--paa-trust-store-path", os.path.join(DEFAULT_CHIP_ROOT, MATTER_DEVELOPMENT_PAA_ROOT_CERTS), '--log-format', '%(message)s'] + shlex.split(script_args) logging.info(f"Execute: {script_command}") test_script_process = subprocess.Popen( diff --git a/scripts/tools/check_includes_config.py b/scripts/tools/check_includes_config.py index 8b7b2e152b0d37..55b27e9e03e304 100644 --- a/scripts/tools/check_includes_config.py +++ b/scripts/tools/check_includes_config.py @@ -128,6 +128,9 @@ 'src/app/clusters/media-playback-server/media-playback-delegate.h': {'list'}, 'src/app/clusters/target-navigator-server/target-navigator-delegate.h': {'list'}, + 'src/credentials/attestation_verifier/FileAttestationTrustStore.h': {'vector'}, + 'src/credentials/attestation_verifier/FileAttestationTrustStore.cpp': {'string'}, + 'src/setup_payload/AdditionalDataPayload.h': {'string'}, 'src/setup_payload/AdditionalDataPayloadParser.cpp': {'vector'}, 'src/setup_payload/Base38Decode.h': {'string', 'vector'}, diff --git a/src/controller/python/BUILD.gn b/src/controller/python/BUILD.gn index 833b5860ecfa35..46e67a6bc98896 100644 --- a/src/controller/python/BUILD.gn +++ b/src/controller/python/BUILD.gn @@ -99,7 +99,10 @@ shared_library("ChipDeviceCtrl") { ] if (chip_controller) { - public_deps += [ "${chip_root}/src/controller/data_model" ] + public_deps += [ + "${chip_root}/src/controller/data_model", + "${chip_root}/src/credentials:file_attestation_trust_store", + ] } else { public_deps += [ "$chip_data_model" ] } diff --git a/src/controller/python/OpCredsBinding.cpp b/src/controller/python/OpCredsBinding.cpp index 25ffe5daa7aab4..a98bb834ea894b 100644 --- a/src/controller/python/OpCredsBinding.cpp +++ b/src/controller/python/OpCredsBinding.cpp @@ -37,6 +37,7 @@ #include #include +#include using namespace chip; @@ -48,6 +49,15 @@ using Py_GenerateNOCChainFunc = void (*)(void * pyContext, const char * using Py_SetNodeIdForNextNOCRequest = void (*)(void * pyContext, NodeId nodeId); using Py_SetFabricIdForNextNOCRequest = void (*)(void * pyContext, FabricId fabricId); +namespace { +const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath) +{ + static chip::Credentials::FileAttestationTrustStore attestationTrustStore{ paaTrustStorePath }; + + return &attestationTrustStore; +} +} // namespace + namespace chip { namespace Controller { namespace Python { @@ -129,7 +139,8 @@ void * pychip_OpCreds_InitializeDelegate(void * pyContext, uint32_t fabricCreden ChipError::StorageType pychip_OpCreds_AllocateController(OpCredsContext * context, chip::Controller::DeviceCommissioner ** outDevCtrl, uint8_t fabricIndex, - FabricId fabricId, chip::NodeId nodeId, bool useTestCommissioner) + FabricId fabricId, chip::NodeId nodeId, const char * paaTrustStorePath, + bool useTestCommissioner) { ChipLogDetail(Controller, "Creating New Device Controller"); @@ -139,8 +150,8 @@ ChipError::StorageType pychip_OpCreds_AllocateController(OpCredsContext * contex VerifyOrReturnError(devCtrl != nullptr, CHIP_ERROR_NO_MEMORY.AsInteger()); // Initialize device attestation verifier - // TODO: Replace testingRootStore with a AttestationTrustStore that has the necessary official PAA roots available - const chip::Credentials::AttestationTrustStore * testingRootStore = chip::Credentials::GetTestAttestationTrustStore(); + const chip::Credentials::AttestationTrustStore * testingRootStore = GetTestFileAttestationTrustStore( + paaTrustStorePath == nullptr ? "./credentials/development/paa-root-certs" : paaTrustStorePath); SetDeviceAttestationVerifier(GetDefaultDACVerifier(testingRootStore)); chip::Crypto::P256Keypair ephemeralKey; diff --git a/src/controller/python/chip-device-ctrl.py b/src/controller/python/chip-device-ctrl.py index cfd79eb1272d0b..7d8a5f245db57c 100755 --- a/src/controller/python/chip-device-ctrl.py +++ b/src/controller/python/chip-device-ctrl.py @@ -182,7 +182,8 @@ def __init__(self, rendezvousAddr=None, controllerNodeId=1, bluetoothAdapter=Non self.chipStack = ChipStack.ChipStack( bluetoothAdapter=bluetoothAdapter, persistentStoragePath='/tmp/chip-device-ctrl-storage.json') self.fabricAdmin = FabricAdmin.FabricAdmin() - self.devCtrl = self.fabricAdmin.NewController(controllerNodeId, True) + self.devCtrl = self.fabricAdmin.NewController( + nodeId=controllerNodeId, useTestCommissioner=True) self.commissionableNodeCtrl = ChipCommissionableNodeCtrl.ChipCommissionableNodeController( self.chipStack) diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 00645dd03ef8ad..6d01af635c9c00 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -84,7 +84,7 @@ class DCState(enum.IntEnum): class ChipDeviceController(): activeList = set() - def __init__(self, opCredsContext: ctypes.c_void_p, fabricId: int, fabricIndex: int, nodeId: int, useTestCommissioner: bool = False): + def __init__(self, opCredsContext: ctypes.c_void_p, fabricId: int, fabricIndex: int, nodeId: int, paaTrustStorePath: str = "", useTestCommissioner: bool = False): self.state = DCState.NOT_INITIALIZED self.devCtrl = None self._ChipStack = builtins.chipStack @@ -96,7 +96,7 @@ def __init__(self, opCredsContext: ctypes.c_void_p, fabricId: int, fabricIndex: res = self._ChipStack.Call( lambda: self._dmLib.pychip_OpCreds_AllocateController(ctypes.c_void_p( - opCredsContext), pointer(devCtrl), fabricIndex, fabricId, nodeId, useTestCommissioner) + opCredsContext), pointer(devCtrl), fabricIndex, fabricId, nodeId, ctypes.c_char_p(None if len(paaTrustStorePath) is 0 else str.encode(paaTrustStorePath)), useTestCommissioner) ) if res != 0: diff --git a/src/controller/python/chip/FabricAdmin.py b/src/controller/python/chip/FabricAdmin.py index 63e6c897a452c4..49cd924e561354 100644 --- a/src/controller/python/chip/FabricAdmin.py +++ b/src/controller/python/chip/FabricAdmin.py @@ -152,7 +152,7 @@ def __init__(self, rcac: bytes = None, icac: bytes = None, fabricIndex: int = No FabricAdmin.activeAdmins.add(self) - def NewController(self, nodeId: int = None, useTestCommissioner: bool = False): + def NewController(self, nodeId: int = None, paaTrustStorePath: str = "", useTestCommissioner: bool = False): ''' Vend a new controller on this fabric seeded with the right fabric details. ''' if (not(self._isActive)): @@ -166,7 +166,7 @@ def NewController(self, nodeId: int = None, useTestCommissioner: bool = False): print( f"Allocating new controller with FabricId: {self._fabricId}({self._fabricIndex}), NodeId: {nodeId}") controller = ChipDeviceCtrl.ChipDeviceController( - self.closure, self._fabricId, self._fabricIndex, nodeId, useTestCommissioner) + self.closure, self._fabricId, self._fabricIndex, nodeId, paaTrustStorePath, useTestCommissioner) return controller def ShutdownAll(): diff --git a/src/controller/python/chip/internal/CommissionerImpl.cpp b/src/controller/python/chip/internal/CommissionerImpl.cpp index 4ac48a0993f54a..318543d707b4af 100644 --- a/src/controller/python/chip/internal/CommissionerImpl.cpp +++ b/src/controller/python/chip/internal/CommissionerImpl.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -34,6 +35,13 @@ using DeviceControllerFactory = chip::Controller::DeviceControllerFactory; namespace { +const chip::Credentials::AttestationTrustStore * GetTestFileAttestationTrustStore(const char * paaTrustStorePath) +{ + static chip::Credentials::FileAttestationTrustStore attestationTrustStore{ paaTrustStorePath }; + + return &attestationTrustStore; +} + class ServerStorageDelegate : public chip::PersistentStorageDelegate { public: @@ -112,8 +120,9 @@ extern "C" chip::Controller::DeviceCommissioner * pychip_internal_Commissioner_N chip::Crypto::P256Keypair ephemeralKey; // Initialize device attestation verifier - // TODO: Replace testingRootStore with a AttestationTrustStore that has the necessary official PAA roots available - const chip::Credentials::AttestationTrustStore * testingRootStore = chip::Credentials::GetTestAttestationTrustStore(); + // TODO: add option to pass in custom PAA Trust Store path to the python controller app + const chip::Credentials::AttestationTrustStore * testingRootStore = + GetTestFileAttestationTrustStore("./credentials/development/paa-root-certs"); chip::Credentials::SetDeviceAttestationVerifier(chip::Credentials::GetDefaultDACVerifier(testingRootStore)); factoryParams.fabricIndependentStorage = &gServerStorage; diff --git a/src/controller/python/test/test_scripts/base.py b/src/controller/python/test/test_scripts/base.py index d0f17af28e3d69..b6cb22093a7955 100644 --- a/src/controller/python/test/test_scripts/base.py +++ b/src/controller/python/test/test_scripts/base.py @@ -167,13 +167,15 @@ def assertValueEqual(self, expected): class BaseTestHelper: - def __init__(self, nodeid: int, testCommissioner: bool = False): + def __init__(self, nodeid: int, paaTrustStorePath: str, testCommissioner: bool = False): self.chipStack = ChipStack('/tmp/repl_storage.json') self.fabricAdmin = chip.FabricAdmin.FabricAdmin( fabricId=1, fabricIndex=1) - self.devCtrl = self.fabricAdmin.NewController(nodeid, testCommissioner) + self.devCtrl = self.fabricAdmin.NewController( + nodeid, paaTrustStorePath, testCommissioner) self.controllerNodeId = nodeid self.logger = logger + self.paaTrustStorePath = paaTrustStorePath def _WaitForOneDiscoveredDevice(self, timeoutSeconds: int = 2): print("Waiting for device responses...") @@ -253,7 +255,8 @@ async def TestMultiFabric(self, ip: str, setuppin: int, nodeid: int): fabricAdmin2 = chip.FabricAdmin.FabricAdmin(fabricId=2, fabricIndex=2) self.logger.info("Creating Device Controller on 2nd Fabric") - devCtrl2 = fabricAdmin2.NewController(self.controllerNodeId) + devCtrl2 = fabricAdmin2.NewController( + self.controllerNodeId, self.paaTrustStorePath) if not devCtrl2.CommissionIP(ip.encode("utf-8"), setuppin, nodeid): self.logger.info( @@ -280,8 +283,10 @@ async def TestMultiFabric(self, ip: str, setuppin: int, nodeid: int): fabricId=1, fabricIndex=1) fabricAdmin2 = chip.FabricAdmin.FabricAdmin(fabricId=2, fabricIndex=2) - self.devCtrl = self.fabricAdmin.NewController(self.controllerNodeId) - self.devCtrl2 = fabricAdmin2.NewController(self.controllerNodeId) + self.devCtrl = self.fabricAdmin.NewController( + self.controllerNodeId, self.paaTrustStorePath) + self.devCtrl2 = fabricAdmin2.NewController( + self.controllerNodeId, self.paaTrustStorePath) data1 = await self.devCtrl.ReadAttribute(nodeid, [(Clusters.OperationalCredentials.Attributes.NOCs)], fabricFiltered=False) data2 = await self.devCtrl2.ReadAttribute(nodeid, [(Clusters.OperationalCredentials.Attributes.NOCs)], fabricFiltered=False) diff --git a/src/controller/python/test/test_scripts/commissioning_test.py b/src/controller/python/test/test_scripts/commissioning_test.py index 198de12b9c9f4a..3a0ecbb2b9f60f 100755 --- a/src/controller/python/test/test_scripts/commissioning_test.py +++ b/src/controller/python/test/test_scripts/commissioning_test.py @@ -68,13 +68,24 @@ def main(): help="Address of the device", metavar="", ) + optParser.add_option( + "-p", + "--paa-trust-store-path", + action="store", + dest="paaTrustStorePath", + default='', + type='str', + help="Path that contains valid and trusted PAA Root Certificates.", + metavar="" + ) (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) timeoutTicker = TestTimeout(options.testTimeout) timeoutTicker.start() - test = BaseTestHelper(nodeid=112233, testCommissioner=True) + test = BaseTestHelper( + nodeid=112233, paaTrustStorePath=options.paaTrustStorePath, testCommissioner=True) logger.info("Testing discovery") FailIfNot(test.TestDiscovery(discriminator=TEST_DISCRIMINATOR), diff --git a/src/controller/python/test/test_scripts/mobile-device-test.py b/src/controller/python/test/test_scripts/mobile-device-test.py index 4c8a137dc7afe0..140633e0af0fa2 100755 --- a/src/controller/python/test/test_scripts/mobile-device-test.py +++ b/src/controller/python/test/test_scripts/mobile-device-test.py @@ -153,11 +153,12 @@ def TestDatamodel(test: BaseTestHelper, device_nodeid: int): # asyncio.run(test.TestFabricSensitive(nodeid=device_nodeid)) -def do_tests(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin): +def do_tests(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin, paa_trust_store_path): timeoutTicker = TestTimeout(timeout) timeoutTicker.start() - test = BaseTestHelper(nodeid=controller_nodeid) + test = BaseTestHelper(nodeid=controller_nodeid, + paaTrustStorePath=paa_trust_store_path) chip.logging.RedirectToPythonLogging() @@ -198,7 +199,8 @@ def do_tests(controller_nodeid, device_nodeid, address, timeout, discriminator, @click.option('--log-level', default='WARN', type=click.Choice(['ERROR', 'WARN', 'INFO', 'DEBUG']), help="The log level of the test.") @click.option('--log-format', default=None, type=str, help="Override logging format") @click.option('--print-test-list', is_flag=True, help="Print a list of test cases and test sets that can be toggled via --enable-test and --disable-test, then exit") -def run(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin, enable_test, disable_test, log_level, log_format, print_test_list): +@click.option('--paa-trust-store-path', default='', type=str, help="Path that contains valid and trusted PAA Root Certificates.") +def run(controller_nodeid, device_nodeid, address, timeout, discriminator, setup_pin, enable_test, disable_test, log_level, log_format, print_test_list, paa_trust_store_path): coloredlogs.install(level=log_level, fmt=log_format, logger=logger) if print_test_list: @@ -219,7 +221,7 @@ def run(controller_nodeid, device_nodeid, address, timeout, discriminator, setup logger.info(f"\tDisabled Tests: {disable_test}") SetTestSet(enable_test, disable_test) do_tests(controller_nodeid, device_nodeid, address, timeout, - discriminator, setup_pin) + discriminator, setup_pin, paa_trust_store_path) if __name__ == "__main__": diff --git a/src/controller/python/test/test_scripts/split_commissioning_test.py b/src/controller/python/test/test_scripts/split_commissioning_test.py index 37f4dfd3478899..35794b15420ce0 100755 --- a/src/controller/python/test/test_scripts/split_commissioning_test.py +++ b/src/controller/python/test/test_scripts/split_commissioning_test.py @@ -74,13 +74,24 @@ def main(): type='str', help="Address of the second device", ) + optParser.add_option( + "-p", + "--paa-trust-store-path", + action="store", + dest="paaTrustStorePath", + default='', + type='str', + help="Path that contains valid and trusted PAA Root Certificates.", + metavar="" + ) (options, remainingArgs) = optParser.parse_args(sys.argv[1:]) timeoutTicker = TestTimeout(options.testTimeout) timeoutTicker.start() - test = BaseTestHelper(nodeid=112233, testCommissioner=False) + test = BaseTestHelper( + nodeid=112233, paaTrustStorePath=options.paaTrustStorePath, testCommissioner=False) FailIfNot(test.SetNetworkCommissioningParameters(dataset=TEST_THREAD_NETWORK_DATASET_TLV), "Failed to finish network commissioning") diff --git a/src/credentials/BUILD.gn b/src/credentials/BUILD.gn index d715ce595d8f4e..0d74130a061ec4 100644 --- a/src/credentials/BUILD.gn +++ b/src/credentials/BUILD.gn @@ -97,3 +97,17 @@ static_library("default_attestation_verifier") { "${nlassert_root}:nlassert", ] } + +static_library("file_attestation_trust_store") { + output_name = "libFileAttestationTrustStore" + + sources = [ + "attestation_verifier/FileAttestationTrustStore.cpp", + "attestation_verifier/FileAttestationTrustStore.h", + ] + + public_deps = [ + ":credentials", + "${nlassert_root}:nlassert", + ] +} diff --git a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp index 0f084cb50d28e3..459bf8f64aca6a 100644 --- a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp +++ b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp @@ -28,7 +28,6 @@ #include #include -// TODO: Remove once the Attestation Credentials storage mechanism is updated. namespace chip { namespace TestCerts { extern const ByteSpan sTestCert_PAA_FFF1_Cert; diff --git a/src/credentials/attestation_verifier/FileAttestationTrustStore.cpp b/src/credentials/attestation_verifier/FileAttestationTrustStore.cpp new file mode 100644 index 00000000000000..2f990f989a182f --- /dev/null +++ b/src/credentials/attestation_verifier/FileAttestationTrustStore.cpp @@ -0,0 +1,122 @@ +/* + * + * Copyright (c) 2022 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 "FileAttestationTrustStore.h" + +#include +#include +#include + +extern "C" { +#include +} + +namespace chip { +namespace Credentials { + +namespace { +const char * GetFilenameExtension(const char * filename) +{ + const char * dot = strrchr(filename, '.'); + if (!dot || dot == filename) + { + return ""; + } + return dot + 1; +} +} // namespace + +FileAttestationTrustStore::FileAttestationTrustStore(const char * paaTrustStorePath) +{ + DIR * dir; + + dir = opendir(paaTrustStorePath); + if (dir != NULL) + { + // Nested directories are not handled. + dirent * entry; + while ((entry = readdir(dir)) != NULL) + { + const char * fileExtension = GetFilenameExtension(entry->d_name); + if (strncmp(fileExtension, "der", strlen("der")) == 0) + { + FILE * file; + + std::array certificate; + std::string filename(paaTrustStorePath); + + filename += std::string("/") + std::string(entry->d_name); + + file = fopen(filename.c_str(), "rb"); + if (file != NULL) + { + uint32_t certificateLength = fread(certificate.data(), sizeof(uint8_t), kMaxDERCertLength, file); + if (certificateLength > 0) + { + mDerCerts.push_back(certificate); + mIsInitialized = true; + } + fclose(file); + } + else + { + Cleanup(); + break; + } + } + } + closedir(dir); + } +} + +FileAttestationTrustStore::~FileAttestationTrustStore() +{ + Cleanup(); +} + +void FileAttestationTrustStore::Cleanup() +{ + mDerCerts.clear(); + mIsInitialized = false; +} + +CHIP_ERROR FileAttestationTrustStore::GetProductAttestationAuthorityCert(const ByteSpan & skid, + MutableByteSpan & outPaaDerBuffer) const +{ + VerifyOrReturnError(!mDerCerts.empty(), CHIP_ERROR_CA_CERT_NOT_FOUND); + VerifyOrReturnError(!skid.empty() && (skid.data() != nullptr), CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(skid.size() == Crypto::kSubjectKeyIdentifierLength, CHIP_ERROR_INVALID_ARGUMENT); + + for (auto candidate : mDerCerts) + { + uint8_t skidBuf[Crypto::kSubjectKeyIdentifierLength] = { 0 }; + MutableByteSpan candidateSkidSpan{ skidBuf }; + VerifyOrReturnError(CHIP_NO_ERROR == + Crypto::ExtractSKIDFromX509Cert(ByteSpan{ candidate.data(), candidate.size() }, candidateSkidSpan), + CHIP_ERROR_INTERNAL); + + if (skid.data_equal(candidateSkidSpan)) + { + // Found a match + return CopySpanToMutableSpan(ByteSpan{ candidate.data(), candidate.size() }, outPaaDerBuffer); + } + } + + return CHIP_ERROR_CA_CERT_NOT_FOUND; +} + +} // namespace Credentials +} // namespace chip diff --git a/src/credentials/attestation_verifier/FileAttestationTrustStore.h b/src/credentials/attestation_verifier/FileAttestationTrustStore.h new file mode 100644 index 00000000000000..090be169367c63 --- /dev/null +++ b/src/credentials/attestation_verifier/FileAttestationTrustStore.h @@ -0,0 +1,49 @@ +/* + * + * Copyright (c) 2022 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. + */ +#pragma once + +#include +#include + +#include +#include + +namespace chip { +namespace Credentials { + +class FileAttestationTrustStore : public AttestationTrustStore +{ +public: + FileAttestationTrustStore(const char * paaTrustStorePath); + ~FileAttestationTrustStore(); + + bool IsInitialized() { return mIsInitialized; } + + CHIP_ERROR GetProductAttestationAuthorityCert(const ByteSpan & skid, MutableByteSpan & outPaaDerBuffer) const override; + size_t size() const { return mDerCerts.size(); } + +protected: + std::vector> mDerCerts; + +private: + bool mIsInitialized = false; + + void Cleanup(); +}; + +} // namespace Credentials +} // namespace chip diff --git a/src/credentials/examples/DeviceAttestationCredsExample.cpp b/src/credentials/examples/DeviceAttestationCredsExample.cpp index 92ee5a89881f96..617e3463bf0d07 100644 --- a/src/credentials/examples/DeviceAttestationCredsExample.cpp +++ b/src/credentials/examples/DeviceAttestationCredsExample.cpp @@ -57,7 +57,7 @@ CHIP_ERROR ExampleDACProvider::GetDeviceAttestationCert(MutableByteSpan & out_da CHIP_ERROR ExampleDACProvider::GetProductAttestationIntermediateCert(MutableByteSpan & out_pai_buffer) { - return CopySpanToMutableSpan(ByteSpan(DevelopmentCerts::kDevelopmentPAI_Cert_FFF1), out_pai_buffer); + return CopySpanToMutableSpan(ByteSpan(DevelopmentCerts::kPaiCert), out_pai_buffer); } CHIP_ERROR ExampleDACProvider::GetCertificationDeclaration(MutableByteSpan & out_cd_buffer) diff --git a/src/test_driver/linux-cirque/CommissioningTest.py b/src/test_driver/linux-cirque/CommissioningTest.py index 9ef3a838ea9859..24643e3080d10c 100755 --- a/src/test_driver/linux-cirque/CommissioningTest.py +++ b/src/test_driver/linux-cirque/CommissioningTest.py @@ -39,6 +39,7 @@ os.path.dirname(__file__)), "..", "..", "..") TEST_EXTPANID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 +MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" DEVICE_CONFIG = { 'device0': { @@ -92,10 +93,11 @@ def run_controller_test(self): self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join( CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl"))) - command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {}".format( + command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {} --paa-trust-store-path {}".format( os.path.join( CHIP_REPO, "src/controller/python/test/test_scripts/commissioning_test.py"), - ethernet_ip) + ethernet_ip, + os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS)) ret = self.execute_device_cmd(req_device_id, command) self.assertEqual(ret['return_code'], '0', diff --git a/src/test_driver/linux-cirque/MobileDeviceTest.py b/src/test_driver/linux-cirque/MobileDeviceTest.py index 90af77227bb533..0c988b0398971c 100755 --- a/src/test_driver/linux-cirque/MobileDeviceTest.py +++ b/src/test_driver/linux-cirque/MobileDeviceTest.py @@ -39,6 +39,7 @@ os.path.dirname(__file__)), "..", "..", "..") TEST_EXTPANID = "fedcba9876543210" TEST_DISCRIMINATOR = 3840 +MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" DEVICE_CONFIG = { 'device0': { @@ -92,9 +93,10 @@ def run_controller_test(self): self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join( CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl"))) - command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {}".format( + command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 -a {} --paa-trust-store-path {}".format( os.path.join( - CHIP_REPO, "src/controller/python/test/test_scripts/mobile-device-test.py"), ethernet_ip) + CHIP_REPO, "src/controller/python/test/test_scripts/mobile-device-test.py"), ethernet_ip, + os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS)) ret = self.execute_device_cmd(req_device_id, command) self.assertEqual(ret['return_code'], '0', diff --git a/src/test_driver/linux-cirque/SplitCommissioningTest.py b/src/test_driver/linux-cirque/SplitCommissioningTest.py index 9527cff2293f80..69235b86339d07 100755 --- a/src/test_driver/linux-cirque/SplitCommissioningTest.py +++ b/src/test_driver/linux-cirque/SplitCommissioningTest.py @@ -38,6 +38,7 @@ CHIP_REPO = os.path.join(os.path.abspath( os.path.dirname(__file__)), "..", "..", "..") TEST_EXTPANID = "fedcba9876543210" +MATTER_DEVELOPMENT_PAA_ROOT_CERTS = "credentials/development/paa-root-certs" DEVICE_CONFIG = { 'device0': { @@ -100,10 +101,10 @@ def run_controller_test(self): self.execute_device_cmd(req_device_id, "pip3 install {}".format(os.path.join( CHIP_REPO, "out/debug/linux_x64_gcc/controller/python/chip-0.0-cp37-abi3-linux_x86_64.whl"))) - command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 --address1 {} --address2 {}".format( + command = "gdb -return-child-result -q -ex run -ex bt --args python3 {} -t 150 --address1 {} --address2 {} --paa-trust-store-path {}".format( os.path.join( CHIP_REPO, "src/controller/python/test/test_scripts/split_commissioning_test.py"), - ethernet_ips[0], ethernet_ips[1]) + ethernet_ips[0], ethernet_ips[1], os.path.join(CHIP_REPO, MATTER_DEVELOPMENT_PAA_ROOT_CERTS)) ret = self.execute_device_cmd(req_device_id, command) self.assertEqual(ret['return_code'], '0', From c7b49135acc2a4bee7be0358962aaf04e94ead1b Mon Sep 17 00:00:00 2001 From: Marc Lepage <67919234+mlepage-google@users.noreply.github.com> Date: Wed, 23 Mar 2022 17:28:47 -0400 Subject: [PATCH 31/70] Add zap gen for Matter access privilege definitions (#16327) New zap template iterates over access definitions for app server clusters, for attributes/commands/events, to generate parallel arrays of custom privileges for read/write attribute, invoke command, and read event. New privilege storage source files provide an API to access the generated data, and an implementation using the generated data. The data is generated and the storage is built per-app. The library (DM, IM, app common) RequiredPrivilege module now uses the privilege-storage API to access populated data on a per-app basis. Weak implementations of the privilege storage API provide a default implementation lacking generated data, so test artifacts can be built. Fixes #14419 --- src/app/RequiredPrivilege.cpp | 116 +---- src/app/RequiredPrivilege.h | 44 +- src/app/chip_data_model.gni | 1 + src/app/util/privilege-storage.cpp | 133 ++++++ src/app/util/privilege-storage.h | 30 ++ src/app/zap-templates/app-templates.json | 5 + .../zap-templates/templates/app/access.zapt | 417 ++++++++++++++++++ .../chip/access-control-cluster.xml | 18 +- .../chip/access-control-definitions.xml | 32 ++ src/app/zap-templates/zcl/zcl.json | 2 + .../all-clusters-app/zap-generated/access.h | 206 +++++++++ .../bridge-app/zap-generated/access.h | 104 +++++ .../zap-generated/access.h | 50 +++ .../door-lock-app/zap-generated/access.h | 194 ++++++++ .../light-switch-app/zap-generated/access.h | 104 +++++ .../lighting-app/zap-generated/access.h | 104 +++++ zzz_generated/lock-app/zap-generated/access.h | 104 +++++ .../log-source-app/zap-generated/access.h | 104 +++++ .../ota-provider-app/zap-generated/access.h | 104 +++++ .../ota-requestor-app/zap-generated/access.h | 104 +++++ .../placeholder/app1/zap-generated/access.h | 92 ++++ .../placeholder/app2/zap-generated/access.h | 92 ++++ zzz_generated/pump-app/zap-generated/access.h | 104 +++++ .../zap-generated/access.h | 104 +++++ .../zap-generated/access.h | 104 +++++ .../thermostat/zap-generated/access.h | 104 +++++ zzz_generated/tv-app/zap-generated/access.h | 104 +++++ .../tv-casting-app/zap-generated/access.h | 104 +++++ .../window-app/zap-generated/access.h | 110 +++++ 29 files changed, 2777 insertions(+), 117 deletions(-) create mode 100644 src/app/util/privilege-storage.cpp create mode 100644 src/app/util/privilege-storage.h create mode 100644 src/app/zap-templates/templates/app/access.zapt create mode 100644 src/app/zap-templates/zcl/data-model/chip/access-control-definitions.xml create mode 100644 zzz_generated/all-clusters-app/zap-generated/access.h create mode 100644 zzz_generated/bridge-app/zap-generated/access.h create mode 100644 zzz_generated/controller-clusters/zap-generated/access.h create mode 100644 zzz_generated/door-lock-app/zap-generated/access.h create mode 100644 zzz_generated/light-switch-app/zap-generated/access.h create mode 100644 zzz_generated/lighting-app/zap-generated/access.h create mode 100644 zzz_generated/lock-app/zap-generated/access.h create mode 100644 zzz_generated/log-source-app/zap-generated/access.h create mode 100644 zzz_generated/ota-provider-app/zap-generated/access.h create mode 100644 zzz_generated/ota-requestor-app/zap-generated/access.h create mode 100644 zzz_generated/placeholder/app1/zap-generated/access.h create mode 100644 zzz_generated/placeholder/app2/zap-generated/access.h create mode 100644 zzz_generated/pump-app/zap-generated/access.h create mode 100644 zzz_generated/pump-controller-app/zap-generated/access.h create mode 100644 zzz_generated/temperature-measurement-app/zap-generated/access.h create mode 100644 zzz_generated/thermostat/zap-generated/access.h create mode 100644 zzz_generated/tv-app/zap-generated/access.h create mode 100644 zzz_generated/tv-casting-app/zap-generated/access.h create mode 100644 zzz_generated/window-app/zap-generated/access.h diff --git a/src/app/RequiredPrivilege.cpp b/src/app/RequiredPrivilege.cpp index 2da03d01122c8a..621105891431a3 100644 --- a/src/app/RequiredPrivilege.cpp +++ b/src/app/RequiredPrivilege.cpp @@ -18,120 +18,30 @@ #include "RequiredPrivilege.h" -#include - -namespace { - -using namespace chip; -using namespace chip::app; -using namespace chip::Access; - -// Privilege override entries are stored in a table per operation (read attribute, -// write attribute, invoke command, read entry). Cluster cannot be invalid, but -// endpoint and field can be invalid, which means wildcard. For each cluster, -// more specific entries should be before less specific entries, so they take effect. -struct PrivilegeOverride -{ - ClusterId mCluster; - EndpointId mEndpoint; - Privilege mPrivilege; // NOTE: here so packing is tighter - FieldId mField; - - constexpr PrivilegeOverride(ClusterId cluster, EndpointId endpoint, FieldId field, Privilege privilege) : - mCluster(cluster), mEndpoint(endpoint), mPrivilege(privilege), mField(field) - {} - - static_assert(sizeof(FieldId) >= sizeof(AttributeId), "FieldId must be able to hold AttributeId"); - static_assert(sizeof(FieldId) >= sizeof(CommandId), "FieldId must be able to hold CommandId"); - static_assert(sizeof(FieldId) >= sizeof(EventId), "FieldId must be able to hold EventId"); -}; - -// WARNING: for each cluster, put more specific entries before less specific entries -constexpr PrivilegeOverride kPrivilegeOverrideForReadAttribute[] = { - PrivilegeOverride(Clusters::AccessControl::Id, kInvalidEndpointId, kInvalidFieldId, Privilege::kAdminister), -}; - -// WARNING: for each cluster, put more specific entries before less specific entries -constexpr PrivilegeOverride kPrivilegeOverrideForWriteAttribute[] = { - PrivilegeOverride(Clusters::AccessControl::Id, kInvalidEndpointId, kInvalidFieldId, Privilege::kAdminister), -}; - -// WARNING: for each cluster, put more specific entries before less specific entries -constexpr PrivilegeOverride kPrivilegeOverrideForInvokeCommand[] = { - PrivilegeOverride(Clusters::AccessControl::Id, kInvalidEndpointId, kInvalidFieldId, Privilege::kAdminister), -}; - -// WARNING: for each cluster, put more specific entries before less specific entries -constexpr PrivilegeOverride kPrivilegeOverrideForReadEvent[] = { - PrivilegeOverride(Clusters::AccessControl::Id, kInvalidEndpointId, kInvalidFieldId, Privilege::kAdminister), -}; - -enum class Operation -{ - kReadAttribute = 0, - kWriteAttribute = 1, - kInvokeCommand = 2, - kReadEvent = 3 -}; - -constexpr Privilege kDefaultPrivilege[] = { - Privilege::kView, // for read attribute - Privilege::kOperate, // for write attribute - Privilege::kOperate, // for invoke command - Privilege::kView // for read event -}; - -const PrivilegeOverride * const kPrivilegeOverride[] = { kPrivilegeOverrideForReadAttribute, kPrivilegeOverrideForWriteAttribute, - kPrivilegeOverrideForInvokeCommand, kPrivilegeOverrideForReadEvent }; - -constexpr size_t kNumPrivilegeOverride[] = { ArraySize(kPrivilegeOverrideForReadAttribute), - ArraySize(kPrivilegeOverrideForWriteAttribute), - ArraySize(kPrivilegeOverrideForInvokeCommand), - ArraySize(kPrivilegeOverrideForReadEvent) }; - -Privilege GetRequiredPrivilege(Operation operation, ClusterId cluster, EndpointId endpoint, FieldId field) -{ - VerifyOrDie(cluster != kInvalidClusterId && endpoint != kInvalidEndpointId && field != kInvalidFieldId); - - const auto * const pStart = kPrivilegeOverride[static_cast(operation)]; - const auto * const pEnd = pStart + kNumPrivilegeOverride[static_cast(operation)]; - - for (const auto * p = pStart; p < pEnd; ++p) - { - if (p->mCluster == cluster && (p->mEndpoint == endpoint || p->mEndpoint == kInvalidEndpointId) && - (p->mField == field || p->mField == kInvalidFieldId)) - { - return p->mPrivilege; - } - } - - return kDefaultPrivilege[static_cast(operation)]; -} - -} // namespace - namespace chip { namespace app { -Privilege RequiredPrivilege::ForReadAttribute(const ConcreteAttributePath & path) +constexpr Access::Privilege RequiredPrivilege::kPrivilegeMapper[]; + +} // namespace app +} // namespace chip + +int __attribute__((weak)) MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute) { - return GetRequiredPrivilege(Operation::kReadAttribute, path.mClusterId, path.mEndpointId, path.mAttributeId); + return kMatterAccessPrivilegeAdminister; } -Privilege RequiredPrivilege::ForWriteAttribute(const ConcreteAttributePath & path) +int __attribute__((weak)) MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute) { - return GetRequiredPrivilege(Operation::kWriteAttribute, path.mClusterId, path.mEndpointId, path.mAttributeId); + return kMatterAccessPrivilegeAdminister; } -Privilege RequiredPrivilege::ForInvokeCommand(const ConcreteCommandPath & path) +int __attribute__((weak)) MatterGetAccessPrivilegeForInvokeCommand(chip::ClusterId cluster, chip::CommandId command) { - return GetRequiredPrivilege(Operation::kInvokeCommand, path.mClusterId, path.mEndpointId, path.mCommandId); + return kMatterAccessPrivilegeAdminister; } -Privilege RequiredPrivilege::ForReadEvent(const ConcreteEventPath & path) +int __attribute__((weak)) MatterGetAccessPrivilegeForReadEvent(chip::ClusterId cluster, chip::EventId event) { - return GetRequiredPrivilege(Operation::kReadEvent, path.mClusterId, path.mEndpointId, path.mEventId); + return kMatterAccessPrivilegeAdminister; } - -} // namespace app -} // namespace chip diff --git a/src/app/RequiredPrivilege.h b/src/app/RequiredPrivilege.h index ff2fec0e8b395c..9d61dae3b52ce9 100644 --- a/src/app/RequiredPrivilege.h +++ b/src/app/RequiredPrivilege.h @@ -22,6 +22,8 @@ #include "ConcreteCommandPath.h" #include "ConcreteEventPath.h" +#include + #include #include @@ -30,17 +32,47 @@ namespace chip { namespace app { -// This functionality is intended to come from Ember, but until Ember supports it, -// this class will provide a workable alternative. class RequiredPrivilege { using Privilege = Access::Privilege; + static constexpr Privilege kPrivilegeMapper[] = { Privilege::kView, Privilege::kOperate, Privilege::kManage, + Privilege::kAdminister }; + + static_assert(ArraySize(kPrivilegeMapper) > kMatterAccessPrivilegeView && + kPrivilegeMapper[kMatterAccessPrivilegeView] == Privilege::kView, + "Must map privilege correctly"); + static_assert(ArraySize(kPrivilegeMapper) > kMatterAccessPrivilegeOperate && + kPrivilegeMapper[kMatterAccessPrivilegeOperate] == Privilege::kOperate, + "Must map privilege correctly"); + static_assert(ArraySize(kPrivilegeMapper) > kMatterAccessPrivilegeManage && + kPrivilegeMapper[kMatterAccessPrivilegeManage] == Privilege::kManage, + "Must map privilege correctly"); + static_assert(ArraySize(kPrivilegeMapper) > kMatterAccessPrivilegeAdminister && + kPrivilegeMapper[kMatterAccessPrivilegeAdminister] == Privilege::kAdminister, + "Must map privilege correctly"); + static_assert(ArraySize(kPrivilegeMapper) > kMatterAccessPrivilegeMaxValue, "Must map all privileges"); + public: - static Privilege ForReadAttribute(const ConcreteAttributePath & path); - static Privilege ForWriteAttribute(const ConcreteAttributePath & path); - static Privilege ForInvokeCommand(const ConcreteCommandPath & path); - static Privilege ForReadEvent(const ConcreteEventPath & path); + static Privilege ForReadAttribute(const ConcreteAttributePath & path) + { + return kPrivilegeMapper[MatterGetAccessPrivilegeForReadAttribute(path.mClusterId, path.mAttributeId)]; + } + + static Privilege ForWriteAttribute(const ConcreteAttributePath & path) + { + return kPrivilegeMapper[MatterGetAccessPrivilegeForWriteAttribute(path.mClusterId, path.mAttributeId)]; + } + + static Privilege ForInvokeCommand(const ConcreteCommandPath & path) + { + return kPrivilegeMapper[MatterGetAccessPrivilegeForInvokeCommand(path.mClusterId, path.mCommandId)]; + } + + static Privilege ForReadEvent(const ConcreteEventPath & path) + { + return kPrivilegeMapper[MatterGetAccessPrivilegeForReadEvent(path.mClusterId, path.mEventId)]; + } }; } // namespace app diff --git a/src/app/chip_data_model.gni b/src/app/chip_data_model.gni index 1940af021400df..bff61fac451add 100644 --- a/src/app/chip_data_model.gni +++ b/src/app/chip_data_model.gni @@ -94,6 +94,7 @@ template("chip_data_model") { "${_app_root}/util/ember-print.cpp", "${_app_root}/util/error-mapping.cpp", "${_app_root}/util/message.cpp", + "${_app_root}/util/privilege-storage.cpp", "${_app_root}/util/util.cpp", "${chip_root}/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp", ] diff --git a/src/app/util/privilege-storage.cpp b/src/app/util/privilege-storage.cpp new file mode 100644 index 00000000000000..17315ae8fe3622 --- /dev/null +++ b/src/app/util/privilege-storage.cpp @@ -0,0 +1,133 @@ +/** + * + * Copyright (c) 2022 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 "privilege-storage.h" + +#include + +#include + +#include + +using chip::AttributeId; +using chip::ClusterId; +using chip::CommandId; +using chip::EventId; + +namespace { + +#ifdef GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER +namespace GeneratedAccessReadAttribute { +constexpr ClusterId kCluster[] = GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER; +constexpr AttributeId kAttribute[] = GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE; +constexpr uint8_t kPrivilege[] = GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE; +static_assert(ArraySize(kCluster) == ArraySize(kAttribute) && ArraySize(kAttribute) == ArraySize(kPrivilege), + "Generated parallel arrays must be same size"); +} // namespace GeneratedAccessReadAttribute +#endif + +#ifdef GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER +namespace GeneratedAccessWriteAttribute { +constexpr ClusterId kCluster[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER; +constexpr AttributeId kAttribute[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE; +constexpr uint8_t kPrivilege[] = GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE; +static_assert(ArraySize(kCluster) == ArraySize(kAttribute) && ArraySize(kAttribute) == ArraySize(kPrivilege), + "Generated parallel arrays must be same size"); +} // namespace GeneratedAccessWriteAttribute +#endif + +#ifdef GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER +namespace GeneratedAccessInvokeCommand { +constexpr ClusterId kCluster[] = GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER; +constexpr CommandId kCommand[] = GENERATED_ACCESS_INVOKE_COMMAND__COMMAND; +constexpr uint8_t kPrivilege[] = GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE; +static_assert(ArraySize(kCluster) == ArraySize(kCommand) && ArraySize(kCommand) == ArraySize(kPrivilege), + "Generated parallel arrays must be same size"); +} // namespace GeneratedAccessInvokeCommand +#endif + +#ifdef GENERATED_ACCESS_READ_EVENT__CLUSTER +namespace GeneratedAccessReadEvent { +constexpr ClusterId kCluster[] = GENERATED_ACCESS_READ_EVENT__CLUSTER; +constexpr EventId kEvent[] = GENERATED_ACCESS_READ_EVENT__EVENT; +constexpr uint8_t kPrivilege[] = GENERATED_ACCESS_READ_EVENT__PRIVILEGE; +static_assert(ArraySize(kCluster) == ArraySize(kEvent) && ArraySize(kEvent) == ArraySize(kPrivilege), + "Generated parallel arrays must be same size"); +} // namespace GeneratedAccessReadEvent +#endif + +} // anonymous namespace + +int MatterGetAccessPrivilegeForReadAttribute(ClusterId cluster, AttributeId attribute) +{ +#ifdef GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER + using namespace GeneratedAccessReadAttribute; + for (size_t i = 0; i < ArraySize(kCluster); ++i) + { + if (kCluster[i] == cluster && kAttribute[i] == attribute) + { + return kPrivilege[i]; + } + } +#endif + return kMatterAccessPrivilegeView; +} + +int MatterGetAccessPrivilegeForWriteAttribute(ClusterId cluster, AttributeId attribute) +{ +#ifdef GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER + using namespace GeneratedAccessWriteAttribute; + for (size_t i = 0; i < ArraySize(kCluster); ++i) + { + if (kCluster[i] == cluster && kAttribute[i] == attribute) + { + return kPrivilege[i]; + } + } +#endif + return kMatterAccessPrivilegeOperate; +} + +int MatterGetAccessPrivilegeForInvokeCommand(ClusterId cluster, CommandId command) +{ +#ifdef GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER + using namespace GeneratedAccessInvokeCommand; + for (size_t i = 0; i < ArraySize(kCluster); ++i) + { + if (kCluster[i] == cluster && kCommand[i] == command) + { + return kPrivilege[i]; + } + } +#endif + return kMatterAccessPrivilegeOperate; +} + +int MatterGetAccessPrivilegeForReadEvent(ClusterId cluster, EventId event) +{ +#ifdef GENERATED_ACCESS_READ_EVENT__CLUSTER + using namespace GeneratedAccessReadEvent; + for (size_t i = 0; i < ArraySize(kCluster); ++i) + { + if (kCluster[i] == cluster && kEvent[i] == event) + { + return kPrivilege[i]; + } + } +#endif + return kMatterAccessPrivilegeView; +} diff --git a/src/app/util/privilege-storage.h b/src/app/util/privilege-storage.h new file mode 100644 index 00000000000000..5253769e019ea3 --- /dev/null +++ b/src/app/util/privilege-storage.h @@ -0,0 +1,30 @@ +/** + * + * Copyright (c) 2022 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. + */ +#pragma once + +#include + +constexpr int kMatterAccessPrivilegeView = 0; +constexpr int kMatterAccessPrivilegeOperate = 1; +constexpr int kMatterAccessPrivilegeManage = 2; +constexpr int kMatterAccessPrivilegeAdminister = 3; +constexpr int kMatterAccessPrivilegeMaxValue = kMatterAccessPrivilegeAdminister; + +int MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute); +int MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute); +int MatterGetAccessPrivilegeForInvokeCommand(chip::ClusterId cluster, chip::CommandId command); +int MatterGetAccessPrivilegeForReadEvent(chip::ClusterId cluster, chip::EventId event); diff --git a/src/app/zap-templates/app-templates.json b/src/app/zap-templates/app-templates.json index 4381b76e02fbe8..553b0574c864ef 100644 --- a/src/app/zap-templates/app-templates.json +++ b/src/app/zap-templates/app-templates.json @@ -93,6 +93,11 @@ "path": "templates/app/MatterIDL.zapt", "name": "Human-readable Matter IDL", "output": "Clusters.matter" + }, + { + "path": "templates/app/access.zapt", + "name": "Matter access definitions", + "output": "access.h" } ] } diff --git a/src/app/zap-templates/templates/app/access.zapt b/src/app/zap-templates/templates/app/access.zapt new file mode 100644 index 00000000000000..55d599482f1759 --- /dev/null +++ b/src/app/zap-templates/templates/app/access.zapt @@ -0,0 +1,417 @@ +{{> header}} + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + {{/first}} + {{#chip_server_cluster_attributes}} + {{#access entity="attribute"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "read")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "operate")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/chip_server_cluster_attributes}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + {{/first}} + {{#chip_server_cluster_attributes}} + {{#access entity="attribute"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "read")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "operate")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/chip_server_cluster_attributes}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + {{/first}} + {{#chip_server_cluster_attributes}} + {{#access entity="attribute"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "read")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "operate")}} + kMatterAccessPrivilegeOperate, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + kMatterAccessPrivilegeManage, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + kMatterAccessPrivilegeAdminister, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/chip_server_cluster_attributes}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +//////////////////////////////////////////////////////////////////////////////// + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + {{/first}} + {{#chip_server_cluster_attributes}} + {{#access entity="attribute"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "write")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + ERROR: access has disallowed role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{else if (isStrEqual role "operate")}} + /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/chip_server_cluster_attributes}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + {{/first}} + {{#chip_server_cluster_attributes}} + {{#access entity="attribute"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "write")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + ERROR: access has disallowed role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{else if (isStrEqual role "operate")}} + /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/chip_server_cluster_attributes}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + {{/first}} + {{#chip_server_cluster_attributes}} + {{#access entity="attribute"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "write")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + ERROR: access has disallowed role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{else if (isStrEqual role "operate")}} + /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + kMatterAccessPrivilegeManage, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + kMatterAccessPrivilegeAdminister, /* Cluster: {{parent.parent.name}}, Attribute: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Attribute: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/chip_server_cluster_attributes}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +//////////////////////////////////////////////////////////////////////////////// + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ + {{/first}} + {{#all_incoming_commands_for_cluster name "server"}} + {{#access entity="command"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "invoke")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + ERROR: access has disallowed role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{else if (isStrEqual role "operate")}} + /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/all_incoming_commands_for_cluster}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ + {{/first}} + {{#all_incoming_commands_for_cluster name "server"}} + {{#access entity="command"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "invoke")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + ERROR: access has disallowed role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{else if (isStrEqual role "operate")}} + /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/all_incoming_commands_for_cluster}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ + {{/first}} + {{#all_incoming_commands_for_cluster name "server"}} + {{#access entity="command"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "invoke")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + ERROR: access has disallowed role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{else if (isStrEqual role "operate")}} + /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + kMatterAccessPrivilegeManage, /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + kMatterAccessPrivilegeAdminister, /* Cluster: {{parent.parent.name}}, Command: {{parent.commandName}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Command: {{parent.commandName}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/all_incoming_commands_for_cluster}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +//////////////////////////////////////////////////////////////////////////////// + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + {{/first}} + {{#zcl_events}} + {{#access entity="event"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "read")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "operate")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.parent.code}}, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Event: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Event: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/zcl_events}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + {{/first}} + {{#zcl_events}} + {{#access entity="event"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "read")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "operate")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + {{parent.code}}, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Event: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Event: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/zcl_events}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +{{#chip_server_clusters}} + {{#first}} +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + {{/first}} + {{#zcl_events}} + {{#access entity="event"}} + {{#if hasOperation}} + {{#if (isStrEqual operation "read")}} + {{#if hasRole}} + {{#if (isStrEqual role "view")}} + /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "operate")}} + kMatterAccessPrivilegeOperate, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "manage")}} + kMatterAccessPrivilegeManage, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else if (isStrEqual role "administer")}} + kMatterAccessPrivilegeAdminister, /* Cluster: {{parent.parent.name}}, Event: {{parent.name}}, Privilege: {{role}} */ \ + {{else}} + ERROR: access has unrecognized role/privilege [ Cluster: {{parent.parent.name}}, Event: {{parent.name}} ] + {{/if}} + {{else}} + ERROR: access has operation but no role/privilege [ Cluster: {{parent.parent.name}}, Event: {{parent.name}} ] + {{/if}} + {{/if}} + {{/if}} + {{/access}} + {{/zcl_events}} + {{#last}} +} + {{/last}} +{{/chip_server_clusters}} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml index 8132833cfe25c8..fa7d0eb82254ce 100644 --- a/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/access-control-cluster.xml @@ -75,16 +75,16 @@ limitations under the License. cluster instances. - ACL - - - + ACL + + + - Extension - - - + Extension + + + The cluster SHALL send AccessControlEntryChanged events whenever its ACL attribute data is changed by an Administrator. @@ -93,6 +93,7 @@ limitations under the License. + The cluster SHALL send AccessControlExtensionChanged events whenever its extension attribute data is changed by an Administrator. @@ -101,6 +102,7 @@ limitations under the License. + diff --git a/src/app/zap-templates/zcl/data-model/chip/access-control-definitions.xml b/src/app/zap-templates/zcl/data-model/chip/access-control-definitions.xml new file mode 100644 index 00000000000000..1f5519f0a9d6b8 --- /dev/null +++ b/src/app/zap-templates/zcl/data-model/chip/access-control-definitions.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index 5430b1dc0e22da..cb192e1802292d 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -1,7 +1,9 @@ { "version": "ZCL Test Data", "xmlRoot": [".", "./data-model/chip/", "./data-model/silabs/"], + "_comment": "Ensure access-control-definitions.xml is first in xmlFile array", "xmlFile": [ + "access-control-definitions.xml", "access-control-cluster.xml", "account-login-cluster.xml", "administrator-commissioning-cluster.xml", diff --git a/zzz_generated/all-clusters-app/zap-generated/access.h b/zzz_generated/all-clusters-app/zap-generated/access.h new file mode 100644 index 00000000000000..fe9b4ae81a0b16 --- /dev/null +++ b/zzz_generated/all-clusters-app/zap-generated/access.h @@ -0,0 +1,206 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Door Lock, Attribute: DoorOpenEvents, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: DoorClosedEvents, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OpenPeriod, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: Language, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableInsideStatusLED, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: view */ \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Door Lock, Attribute: DoorOpenEvents, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: DoorClosedEvents, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OpenPeriod, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: Language, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableInsideStatusLED, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: view */ \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Door Lock, Attribute: DoorOpenEvents, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: DoorClosedEvents, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OpenPeriod, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: Language, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableInsideStatusLED, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: view */ \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Attribute: DoorOpenEvents, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: DoorClosedEvents, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: OpenPeriod, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: Language, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: EnableInsideStatusLED, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: administer */ \ + 258, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 4, /* Cluster: Door Lock, Attribute: DoorOpenEvents, Privilege: manage */ \ + 5, /* Cluster: Door Lock, Attribute: DoorClosedEvents, Privilege: manage */ \ + 6, /* Cluster: Door Lock, Attribute: OpenPeriod, Privilege: manage */ \ + 33, /* Cluster: Door Lock, Attribute: Language, Privilege: manage */ \ + 35, /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: manage */ \ + 36, /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: manage */ \ + 37, /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: manage */ \ + 41, /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: manage */ \ + 42, /* Cluster: Door Lock, Attribute: EnableInsideStatusLED, Privilege: manage */ \ + 43, /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: manage */ \ + 48, /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: administer */ \ + 49, /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: administer */ \ + 51, /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: administer */ \ + 23, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: DoorOpenEvents, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: DoorClosedEvents, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: OpenPeriod, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: Language, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: EnableInsideStatusLED, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: manage */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ + 257, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: ClearUser, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: GetUser, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: SetUser, Privilege: administer */ \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ + 38, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 29, /* Cluster: Door Lock, Command: ClearUser, Privilege: administer */ \ + 36, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ + 27, /* Cluster: Door Lock, Command: GetUser, Privilege: administer */ \ + 34, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ + 26, /* Cluster: Door Lock, Command: SetUser, Privilege: administer */ \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearUser, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetUser, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetUser, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/bridge-app/zap-generated/access.h b/zzz_generated/bridge-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/bridge-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/controller-clusters/zap-generated/access.h b/zzz_generated/controller-clusters/zap-generated/access.h new file mode 100644 index 00000000000000..160a470081ffad --- /dev/null +++ b/zzz_generated/controller-clusters/zap-generated/access.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////// + + + + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/door-lock-app/zap-generated/access.h b/zzz_generated/door-lock-app/zap-generated/access.h new file mode 100644 index 00000000000000..d0873017c0cb20 --- /dev/null +++ b/zzz_generated/door-lock-app/zap-generated/access.h @@ -0,0 +1,194 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Door Lock, Attribute: Language, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Door Lock, Attribute: Language, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Door Lock, Attribute: Language, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: view */ \ + /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Attribute: Language, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: manage */ \ + 257, /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 33, /* Cluster: Door Lock, Attribute: Language, Privilege: manage */ \ + 35, /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: manage */ \ + 36, /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: manage */ \ + 37, /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: manage */ \ + 41, /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: manage */ \ + 43, /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: manage */ \ + 48, /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: administer */ \ + 49, /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: administer */ \ + 51, /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: Language, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: AutoRelockTime, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: SoundVolume, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: OperatingMode, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: EnableOneTouchLocking, Privilege: manage */ \ + kMatterAccessPrivilegeManage, /* Cluster: Door Lock, Attribute: EnablePrivacyModeButton, Privilege: manage */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Attribute: WrongCodeEntryLimit, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Attribute: UserCodeTemporaryDisableTime, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Attribute: RequirePINforRemoteOperation, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ + 257, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: ClearUser, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: ClearWeekDaySchedule, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: ClearYearDaySchedule, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: GetUser, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: GetWeekDaySchedule, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: GetYearDaySchedule, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: SetUser, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: SetWeekDaySchedule, Privilege: administer */ \ + 257, /* Cluster: Door Lock, Command: SetYearDaySchedule, Privilege: administer */ \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ + 38, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + 29, /* Cluster: Door Lock, Command: ClearUser, Privilege: administer */ \ + 13, /* Cluster: Door Lock, Command: ClearWeekDaySchedule, Privilege: administer */ \ + 16, /* Cluster: Door Lock, Command: ClearYearDaySchedule, Privilege: administer */ \ + 36, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ + 27, /* Cluster: Door Lock, Command: GetUser, Privilege: administer */ \ + 12, /* Cluster: Door Lock, Command: GetWeekDaySchedule, Privilege: administer */ \ + 15, /* Cluster: Door Lock, Command: GetYearDaySchedule, Privilege: administer */ \ + 34, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ + 26, /* Cluster: Door Lock, Command: SetUser, Privilege: administer */ \ + 11, /* Cluster: Door Lock, Command: SetWeekDaySchedule, Privilege: administer */ \ + 14, /* Cluster: Door Lock, Command: SetYearDaySchedule, Privilege: administer */ \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearCredential, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearUser, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearWeekDaySchedule, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: ClearYearDaySchedule, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetCredentialStatus, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetUser, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetWeekDaySchedule, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: GetYearDaySchedule, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetCredential, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetUser, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetWeekDaySchedule, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Door Lock, Command: SetYearDaySchedule, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/light-switch-app/zap-generated/access.h b/zzz_generated/light-switch-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/light-switch-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/lighting-app/zap-generated/access.h b/zzz_generated/lighting-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/lighting-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/lock-app/zap-generated/access.h b/zzz_generated/lock-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/lock-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/log-source-app/zap-generated/access.h b/zzz_generated/log-source-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/log-source-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/ota-provider-app/zap-generated/access.h b/zzz_generated/ota-provider-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/ota-provider-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/ota-requestor-app/zap-generated/access.h b/zzz_generated/ota-requestor-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/ota-requestor-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/placeholder/app1/zap-generated/access.h b/zzz_generated/placeholder/app1/zap-generated/access.h new file mode 100644 index 00000000000000..d654f8e81b7060 --- /dev/null +++ b/zzz_generated/placeholder/app1/zap-generated/access.h @@ -0,0 +1,92 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 258, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 23, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeManage, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/placeholder/app2/zap-generated/access.h b/zzz_generated/placeholder/app2/zap-generated/access.h new file mode 100644 index 00000000000000..d654f8e81b7060 --- /dev/null +++ b/zzz_generated/placeholder/app2/zap-generated/access.h @@ -0,0 +1,92 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 258, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 23, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeManage, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/pump-app/zap-generated/access.h b/zzz_generated/pump-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/pump-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/pump-controller-app/zap-generated/access.h b/zzz_generated/pump-controller-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/pump-controller-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/temperature-measurement-app/zap-generated/access.h b/zzz_generated/temperature-measurement-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/temperature-measurement-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/thermostat/zap-generated/access.h b/zzz_generated/thermostat/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/thermostat/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/tv-app/zap-generated/access.h b/zzz_generated/tv-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/tv-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/tv-casting-app/zap-generated/access.h b/zzz_generated/tv-casting-app/zap-generated/access.h new file mode 100644 index 00000000000000..f67cb03aee26a9 --- /dev/null +++ b/zzz_generated/tv-casting-app/zap-generated/access.h @@ -0,0 +1,104 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on diff --git a/zzz_generated/window-app/zap-generated/access.h b/zzz_generated/window-app/zap-generated/access.h new file mode 100644 index 00000000000000..503df86a1df249 --- /dev/null +++ b/zzz_generated/window-app/zap-generated/access.h @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2022 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. + */ + +// THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include + +// Prevent changing generated format +// clang-format off + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for read attribute +#define GENERATED_ACCESS_READ_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + /* Cluster: Window Covering, Attribute: Mode, Privilege: view */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, attribute, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__CLUSTER { \ + 31, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 31, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 258, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, *attribute*, privilege) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__ATTRIBUTE { \ + 0, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + 1, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + 23, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +// Parallel array data (cluster, attribute, *privilege*) for write attribute +#define GENERATED_ACCESS_WRITE_ATTRIBUTE__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: ACL, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Attribute: Extension, Privilege: administer */ \ + kMatterAccessPrivilegeManage, /* Cluster: Window Covering, Attribute: Mode, Privilege: manage */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, command, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__CLUSTER { \ +} + +// Parallel array data (cluster, *command*, privilege) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__COMMAND { \ +} + +// Parallel array data (cluster, command, *privilege*) for invoke command +#define GENERATED_ACCESS_INVOKE_COMMAND__PRIVILEGE { \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// Parallel array data (*cluster*, event, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__CLUSTER { \ + 31, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 31, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, *event*, privilege) for read event +#define GENERATED_ACCESS_READ_EVENT__EVENT { \ + 0, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + 1, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +// Parallel array data (cluster, event, *privilege*) for read event +#define GENERATED_ACCESS_READ_EVENT__PRIVILEGE { \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlEntryChanged, Privilege: administer */ \ + kMatterAccessPrivilegeAdminister, /* Cluster: Access Control, Event: AccessControlExtensionChanged, Privilege: administer */ \ +} + +//////////////////////////////////////////////////////////////////////////////// + +// clang-format on From 1f3467ec356cc7aebe56b62e64733394354bf60a Mon Sep 17 00:00:00 2001 From: Carol Yang Date: Wed, 23 Mar 2022 15:40:11 -0700 Subject: [PATCH 32/70] [OTA] Reset instead of cancel when auto-apply is off (#16588) - By the time UpdateDownloaded is called, the download has already completed and there is no need to cancel the download - Reset will make sure the state is transitioned to idle --- examples/ota-requestor-app/linux/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ota-requestor-app/linux/main.cpp b/examples/ota-requestor-app/linux/main.cpp index df982509d4d8c8..4a3365d4b867f1 100644 --- a/examples/ota-requestor-app/linux/main.cpp +++ b/examples/ota-requestor-app/linux/main.cpp @@ -122,8 +122,8 @@ void CustomOTARequestorDriver::UpdateDownloaded() } else { - // Cancelling will put the state back to idle - gRequestorCore.CancelImageUpdate(); + // Reset to put the state back to idle to allow the next OTA update to occur + gRequestorCore.Reset(); } } From cf6522fb197f2d58e3a09dd673af3b6f0b431536 Mon Sep 17 00:00:00 2001 From: Eugen Feraru <35931915+hubTab@users.noreply.github.com> Date: Wed, 23 Mar 2022 21:39:17 -0500 Subject: [PATCH 33/70] Updated the onoff-cluster.xml to use the specifications type definitions, instead of using the enum* directly. See issue #15528. (#16466) --- .../all-clusters-app.matter | 8 +- .../bridge-common/bridge-app.matter | 6 ++ .../light-switch-app.matter | 8 +- .../lighting-common/lighting-app.matter | 8 +- examples/lock-app/lock-common/lock-app.matter | 8 +- .../placeholder/linux/apps/app1/config.matter | 16 +++- .../placeholder/linux/apps/app2/config.matter | 16 +++- examples/pump-app/pump-common/pump-app.matter | 8 +- .../pump-controller-app.matter | 6 ++ examples/tv-app/tv-common/tv-app.matter | 6 ++ .../tv-casting-common/tv-casting-app.matter | 16 +++- .../clusters/on-off-server/on-off-server.cpp | 9 +- .../zcl/data-model/chip/onoff-cluster.xml | 9 +- .../data_model/controller-clusters.matter | 8 +- .../CHIPAttributeTLVValueDecoder.cpp | 2 +- .../java/zap-generated/CHIPReadCallbacks.cpp | 5 +- .../java/zap-generated/CHIPReadCallbacks.h | 3 +- .../python/chip/clusters/Objects.py | 13 ++- .../CHIPAttributeTLVValueDecoder.mm | 2 +- .../CHIP/zap-generated/CHIPCallbackBridge.mm | 52 ++++++++++ .../CHIPCallbackBridge_internal.h | 61 ++++++++++++ .../CHIP/zap-generated/CHIPClustersObjc.h | 6 ++ .../CHIP/zap-generated/CHIPClustersObjc.mm | 45 ++++----- .../zap-generated/endpoint_config.h | 95 ++++++++++--------- .../zap-generated/attributes/Accessors.cpp | 13 +-- .../zap-generated/attributes/Accessors.h | 8 +- .../app-common/zap-generated/cluster-enums.h | 8 ++ .../zap-generated/cluster-objects.h | 6 +- .../zap-generated/cluster/Commands.h | 2 +- .../cluster/logging/DataModelLogger.cpp | 2 +- .../chip-tool/zap-generated/test/Commands.h | 6 +- .../zap-generated/endpoint_config.h | 14 ++- .../lock-app/zap-generated/endpoint_config.h | 13 +-- .../app1/zap-generated/endpoint_config.h | 44 +++++---- .../app2/zap-generated/endpoint_config.h | 44 +++++---- .../pump-app/zap-generated/endpoint_config.h | 16 ++-- .../zap-generated/endpoint_config.h | 14 ++- 37 files changed, 434 insertions(+), 172 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index 4e8dd35960d890..a36db652a3dd62 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -2271,6 +2271,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -2283,7 +2289,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/bridge-app/bridge-common/bridge-app.matter b/examples/bridge-app/bridge-common/bridge-app.matter index 097b604c564f99..8f534c5f6478df 100644 --- a/examples/bridge-app/bridge-common/bridge-app.matter +++ b/examples/bridge-app/bridge-common/bridge-app.matter @@ -661,6 +661,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } diff --git a/examples/light-switch-app/light-switch-common/light-switch-app.matter b/examples/light-switch-app/light-switch-common/light-switch-app.matter index 139b4bb066fbd7..2b8a5b7a3ce829 100644 --- a/examples/light-switch-app/light-switch-common/light-switch-app.matter +++ b/examples/light-switch-app/light-switch-common/light-switch-app.matter @@ -1084,6 +1084,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1096,7 +1102,7 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute attrib_id attributeList[] = 65531; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/lighting-app/lighting-common/lighting-app.matter b/examples/lighting-app/lighting-common/lighting-app.matter index 411ac5a9a7a41f..30e7bd4a280f51 100644 --- a/examples/lighting-app/lighting-common/lighting-app.matter +++ b/examples/lighting-app/lighting-common/lighting-app.matter @@ -1162,6 +1162,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1174,7 +1180,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 4a626b3e1d55b9..308d393702ed8c 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -648,6 +648,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -660,7 +666,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index ebd2f5bd9274c7..df68c1024a08cd 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1208,6 +1208,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1220,7 +1226,7 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; @@ -1259,6 +1265,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1271,7 +1283,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index ebd2f5bd9274c7..df68c1024a08cd 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1208,6 +1208,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1220,7 +1226,7 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; @@ -1259,6 +1265,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1271,7 +1283,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/examples/pump-app/pump-common/pump-app.matter b/examples/pump-app/pump-common/pump-app.matter index 64c3ad82d5230d..ad2a8b6132d36b 100644 --- a/examples/pump-app/pump-common/pump-app.matter +++ b/examples/pump-app/pump-common/pump-app.matter @@ -890,6 +890,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -902,7 +908,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute int16u clusterRevision = 65533; request struct OffWithEffectRequest { diff --git a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter index 11355b3db0b9a9..3142742f267baa 100644 --- a/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter +++ b/examples/pump-controller-app/pump-controller-common/pump-controller-app.matter @@ -798,6 +798,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } diff --git a/examples/tv-app/tv-common/tv-app.matter b/examples/tv-app/tv-common/tv-app.matter index 6a970795f21c2e..b5d2fd098ef8b7 100644 --- a/examples/tv-app/tv-common/tv-app.matter +++ b/examples/tv-app/tv-common/tv-app.matter @@ -1410,6 +1410,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } diff --git a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter index dbda239e268312..563aaf8f08732c 100644 --- a/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter +++ b/examples/tv-casting-app/tv-casting-common/tv-casting-app.matter @@ -1436,6 +1436,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1448,7 +1454,7 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; @@ -1473,6 +1479,12 @@ server cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -1485,7 +1497,7 @@ server cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; diff --git a/src/app/clusters/on-off-server/on-off-server.cpp b/src/app/clusters/on-off-server/on-off-server.cpp index cf7780e63ed749..b82d3cbcfa8a5a 100644 --- a/src/app/clusters/on-off-server/on-off-server.cpp +++ b/src/app/clusters/on-off-server/on-off-server.cpp @@ -248,8 +248,7 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) // 0xff This value cannot happen. // null Set the OnOff attribute to its previous value. - // Initialize startUpOnOff to No action value 0xFE - app::DataModel::Nullable startUpOnOff; + app::DataModel::Nullable startUpOnOff; EmberAfStatus status = Attributes::StartUpOnOff::Get(endpoint, startUpOnOff); if (status == EMBER_ZCL_STATUS_SUCCESS) { @@ -262,13 +261,13 @@ void OnOffServer::initOnOffServer(chip::EndpointId endpoint) { switch (startUpOnOff.Value()) { - case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_OFF: + case OnOff::OnOffStartUpOnOff::kOff: updatedOnOff = 0; // Off break; - case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_ON: + case OnOff::OnOffStartUpOnOff::kOn: updatedOnOff = 1; // On break; - case EMBER_ZCL_START_UP_ON_OFF_VALUE_SET_TO_TOGGLE: + case OnOff::OnOffStartUpOnOff::kTogglePreviousOnOff: updatedOnOff = !updatedOnOff; break; default: diff --git a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml index d1073d46f4431e..daa871b4b28b69 100644 --- a/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/onoff-cluster.xml @@ -17,6 +17,13 @@ limitations under the License. + + + + + + + @@ -52,7 +59,7 @@ limitations under the License. GlobalSceneControl OnTime OffWaitTime - StartUpOnOff + StartUpOnOff On receipt of this command, a device SHALL enter its ‘Off’ state. This state is device dependent, but it is recommended that it is used for power off or similar functions. On receipt of the Off command, the OnTime attribute SHALL be set to 0. diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index b7cebe1026fa11..6b3398c3d7df27 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2684,6 +2684,12 @@ client cluster OnOff = 6 { kDyingLight = 1; } + enum OnOffStartUpOnOff : ENUM8 { + kOff = 0; + kOn = 1; + kTogglePreviousOnOff = 2; + } + bitmap OnOffControl : BITMAP8 { kAcceptOnlyWhenOn = 0x1; } @@ -2696,7 +2702,7 @@ client cluster OnOff = 6 { readonly attribute boolean globalSceneControl = 16384; attribute int16u onTime = 16385; attribute int16u offWaitTime = 16386; - attribute nullable enum8 startUpOnOff = 16387; + attribute nullable OnOffStartUpOnOff startUpOnOff = 16387; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp index f68a1c8cff23e5..2a63f0962084eb 100644 --- a/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp +++ b/src/controller/java/zap-generated/CHIPAttributeTLVValueDecoder.cpp @@ -9043,7 +9043,7 @@ jobject DecodeAttributeValue(const app::ConcreteAttributePath & aPath, TLV::TLVR std::string valueClassName = "java/lang/Integer"; std::string valueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(valueClassName.c_str(), valueCtorSignature.c_str(), - cppValue.Value(), value); + static_cast(cppValue.Value()), value); } return value; } diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp index a605129092dbef..92d765301a9dcf 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.cpp +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.cpp @@ -13621,7 +13621,8 @@ CHIPOnOffStartUpOnOffAttributeCallback::~CHIPOnOffStartUpOnOffAttributeCallback( env->DeleteGlobalRef(javaCallbackRef); } -void CHIPOnOffStartUpOnOffAttributeCallback::CallbackFn(void * context, const chip::app::DataModel::Nullable & value) +void CHIPOnOffStartUpOnOffAttributeCallback::CallbackFn( + void * context, const chip::app::DataModel::Nullable & value) { chip::DeviceLayer::StackUnlock unlock; CHIP_ERROR err = CHIP_NO_ERROR; @@ -13651,7 +13652,7 @@ void CHIPOnOffStartUpOnOffAttributeCallback::CallbackFn(void * context, const ch std::string javaValueClassName = "java/lang/Integer"; std::string javaValueCtorSignature = "(I)V"; chip::JniReferences::GetInstance().CreateBoxedObject(javaValueClassName.c_str(), javaValueCtorSignature.c_str(), - value.Value(), javaValue); + static_cast(value.Value()), javaValue); } env->CallVoidMethod(javaCallbackRef, javaMethod, javaValue); diff --git a/src/controller/java/zap-generated/CHIPReadCallbacks.h b/src/controller/java/zap-generated/CHIPReadCallbacks.h index 0ee1f7d24d7d2c..301df11bce6430 100644 --- a/src/controller/java/zap-generated/CHIPReadCallbacks.h +++ b/src/controller/java/zap-generated/CHIPReadCallbacks.h @@ -5661,7 +5661,8 @@ class CHIPOnOffStartUpOnOffAttributeCallback : public chip::Callback::Callback & value); + static void CallbackFn(void * context, + const chip::app::DataModel::Nullable & value); static void OnSubscriptionEstablished(void * context) { CHIP_ERROR err = chip::JniReferences::GetInstance().CallSubscriptionEstablished( diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index d76c0c80695f4b..64c763c56e3d8e 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -2562,7 +2562,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="globalSceneControl", Tag=0x00004000, Type=typing.Optional[bool]), ClusterObjectFieldDescriptor(Label="onTime", Tag=0x00004001, Type=typing.Optional[uint]), ClusterObjectFieldDescriptor(Label="offWaitTime", Tag=0x00004002, Type=typing.Optional[uint]), - ClusterObjectFieldDescriptor(Label="startUpOnOff", Tag=0x00004003, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="startUpOnOff", Tag=0x00004003, Type=typing.Union[None, Nullable, OnOff.Enums.OnOffStartUpOnOff]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="attributeList", Tag=0x0000FFFB, Type=typing.List[uint]), @@ -2574,7 +2574,7 @@ def descriptor(cls) -> ClusterObjectDescriptor: globalSceneControl: 'typing.Optional[bool]' = None onTime: 'typing.Optional[uint]' = None offWaitTime: 'typing.Optional[uint]' = None - startUpOnOff: 'typing.Union[None, Nullable, uint]' = None + startUpOnOff: 'typing.Union[None, Nullable, OnOff.Enums.OnOffStartUpOnOff]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None attributeList: 'typing.List[uint]' = None @@ -2594,6 +2594,11 @@ class OnOffEffectIdentifier(IntEnum): kDelayedAllOff = 0x00 kDyingLight = 0x01 + class OnOffStartUpOnOff(IntEnum): + kOff = 0x00 + kOn = 0x01 + kTogglePreviousOnOff = 0x02 + class Commands: @@ -2763,9 +2768,9 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, OnOff.Enums.OnOffStartUpOnOff]) - value: 'typing.Union[None, Nullable, uint]' = None + value: 'typing.Union[None, Nullable, OnOff.Enums.OnOffStartUpOnOff]' = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm index 37e7f6048f4c69..0b4e85b8f4a8ea 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPAttributeTLVValueDecoder.mm @@ -7487,7 +7487,7 @@ id CHIPDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader if (cppValue.IsNull()) { value = nil; } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; } return value; } diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm index 2ff761beb83516..12b53d4db03400 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge.mm @@ -11966,6 +11966,58 @@ } } +void CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge::OnSuccessFn( + void * context, chip::app::Clusters::OnOff::OnOffStartUpOnOff value) +{ + NSNumber * _Nonnull objCValue; + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value)]; + DispatchSuccess(context, objCValue); +}; + +void CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + +void CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge::OnSuccessFn( + void * context, const chip::app::DataModel::Nullable & value) +{ + NSNumber * _Nullable objCValue; + if (value.IsNull()) { + objCValue = nil; + } else { + objCValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(value.Value())]; + } + DispatchSuccess(context, objCValue); +}; + +void CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished(void * context) +{ + auto * self = static_cast(context); + if (!self->mQueue) { + return; + } + + if (self->mEstablishedHandler != nil) { + dispatch_async(self->mQueue, self->mEstablishedHandler); + // On failure, mEstablishedHandler will be cleaned up by our destructor, + // but we can clean it up earlier on successful subscription + // establishment. + self->mEstablishedHandler = nil; + } +} + void CHIPLevelControlClusterMoveModeAttributeCallbackBridge::OnSuccessFn( void * context, chip::app::Clusters::LevelControl::MoveMode value) { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h index 441bd083b713c3..725081af49cc2d 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPCallbackBridge_internal.h @@ -148,6 +148,9 @@ typedef void (*NullableOnOffClusterOnOffDyingLightEffectVariantAttributeCallback typedef void (*OnOffClusterOnOffEffectIdentifierAttributeCallback)(void *, chip::app::Clusters::OnOff::OnOffEffectIdentifier); typedef void (*NullableOnOffClusterOnOffEffectIdentifierAttributeCallback)( void *, const chip::app::DataModel::Nullable &); +typedef void (*OnOffClusterOnOffStartUpOnOffAttributeCallback)(void *, chip::app::Clusters::OnOff::OnOffStartUpOnOff); +typedef void (*NullableOnOffClusterOnOffStartUpOnOffAttributeCallback)( + void *, const chip::app::DataModel::Nullable &); typedef void (*LevelControlClusterMoveModeAttributeCallback)(void *, chip::app::Clusters::LevelControl::MoveMode); typedef void (*NullableLevelControlClusterMoveModeAttributeCallback)( void *, const chip::app::DataModel::Nullable &); @@ -9095,6 +9098,64 @@ class CHIPNullableOnOffClusterOnOffEffectIdentifierAttributeCallbackSubscription SubscriptionEstablishedHandler mEstablishedHandler; }; +class CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, keepAlive){}; + + static void OnSuccessFn(void * context, chip::app::Clusters::OnOff::OnOffStartUpOnOff value); +}; + +class CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge + : public CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge +{ +public: + CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + +class CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge + : public CHIPCallbackBridge +{ +public: + CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge(dispatch_queue_t queue, ResponseHandler handler, + CHIPActionBlock action, bool keepAlive = false) : + CHIPCallbackBridge(queue, handler, action, OnSuccessFn, + keepAlive){}; + + static void OnSuccessFn(void * context, + const chip::app::DataModel::Nullable & value); +}; + +class CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge + : public CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge +{ +public: + CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge( + dispatch_queue_t queue, ResponseHandler handler, CHIPActionBlock action, + SubscriptionEstablishedHandler establishedHandler) : + CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge(queue, handler, action, true), + mEstablishedHandler(establishedHandler) + {} + + static void OnSubscriptionEstablished(void * context); + +private: + SubscriptionEstablishedHandler mEstablishedHandler; +}; + class CHIPLevelControlClusterMoveModeAttributeCallbackBridge : public CHIPCallbackBridge { diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index ed6c0e230bc548..8bea9196da2f7b 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -14925,6 +14925,12 @@ typedef NS_ENUM(uint8_t, CHIPOnOffEffectIdentifier) { CHIPOnOffEffectIdentifierDyingLight = 0x01, }; +typedef NS_ENUM(uint8_t, CHIPOnOffStartUpOnOff) { + CHIPOnOffStartUpOnOffOff = 0x00, + CHIPOnOffStartUpOnOffOn = 0x01, + CHIPOnOffStartUpOnOffTogglePreviousOnOff = 0x02, +}; + typedef NS_OPTIONS(uint8_t, CHIPOnOffControl) { CHIPOnOffControlAcceptOnlyWhenOn = 0x1, }; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 59abda05bde02f..367dda050f27b3 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -29802,10 +29802,10 @@ new CHIPInt16uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * s - (void)readAttributeStartUpOnOffWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPNullableInt8uAttributeCallbackBridge( + new CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge( self.callbackQueue, completionHandler, ^(Cancelable * success, Cancelable * failure) { using TypeInfo = OnOff::Attributes::StartUpOnOff::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.ReadAttribute(successFn->mContext, successFn->mCall, failureFn->mCall); }); @@ -29826,7 +29826,7 @@ new CHIPDefaultSuccessCallbackBridge( cppValue.SetNull(); } else { auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; + nonNullValue_0 = static_cast>(value.unsignedCharValue); } auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); @@ -29840,7 +29840,7 @@ - (void)subscribeAttributeStartUpOnOffWithMinInterval:(NSNumber * _Nonnull)minIn subscriptionEstablished:(SubscriptionEstablishedHandler _Nullable)subscriptionEstablishedHandler reportHandler:(void (^)(NSNumber * _Nullable value, NSError * _Nullable error))reportHandler { - new CHIPNullableInt8uAttributeCallbackSubscriptionBridge( + new CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge( self.callbackQueue, reportHandler, ^(Cancelable * success, Cancelable * failure) { if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -29848,11 +29848,11 @@ new CHIPNullableInt8uAttributeCallbackSubscriptionBridge( return CHIP_ERROR_INVALID_ARGUMENT; } using TypeInfo = OnOff::Attributes::StartUpOnOff::TypeInfo; - auto successFn = Callback::FromCancelable(success); + auto successFn = Callback::FromCancelable(success); auto failureFn = Callback::FromCancelable(failure); return self.cppCluster.SubscribeAttribute(successFn->mContext, successFn->mCall, failureFn->mCall, [minInterval unsignedShortValue], [maxInterval unsignedShortValue], - CHIPNullableInt8uAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, + CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackSubscriptionBridge::OnSubscriptionEstablished, params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue], params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); }, @@ -29865,23 +29865,24 @@ + (void)readAttributeStartUpOnOffWithAttributeCache:(CHIPAttributeCacheContainer completionHandler: (void (^)(NSNumber * _Nullable value, NSError * _Nullable error))completionHandler { - new CHIPNullableInt8uAttributeCallbackBridge(queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { - if (attributeCacheContainer.cppAttributeCache) { - chip::app::ConcreteAttributePath path; - using TypeInfo = OnOff::Attributes::StartUpOnOff::TypeInfo; - path.mEndpointId = static_cast([endpoint unsignedShortValue]); - path.mClusterId = TypeInfo::GetClusterId(); - path.mAttributeId = TypeInfo::GetAttributeId(); - TypeInfo::DecodableType value; - CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); - auto successFn = Callback::FromCancelable(success); - if (err == CHIP_NO_ERROR) { - successFn->mCall(successFn->mContext, value); + new CHIPNullableOnOffClusterOnOffStartUpOnOffAttributeCallbackBridge( + queue, completionHandler, ^(Cancelable * success, Cancelable * failure) { + if (attributeCacheContainer.cppAttributeCache) { + chip::app::ConcreteAttributePath path; + using TypeInfo = OnOff::Attributes::StartUpOnOff::TypeInfo; + path.mEndpointId = static_cast([endpoint unsignedShortValue]); + path.mClusterId = TypeInfo::GetClusterId(); + path.mAttributeId = TypeInfo::GetAttributeId(); + TypeInfo::DecodableType value; + CHIP_ERROR err = attributeCacheContainer.cppAttributeCache->Get(path, value); + auto successFn = Callback::FromCancelable(success); + if (err == CHIP_NO_ERROR) { + successFn->mCall(successFn->mContext, value); + } + return err; } - return err; - } - return CHIP_ERROR_NOT_FOUND; - }); + return CHIP_ERROR_NOT_FOUND; + }); } - (void)readAttributeGeneratedCommandListWithCompletionHandler:(void (^)(NSArray * _Nullable value, diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 079fa1e2f326d6..760272f0ca8256 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -958,7 +958,7 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 40 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 42 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -971,6 +971,9 @@ /* Endpoint: 1, Cluster: Identify (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* identify time */ \ \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { (uint16_t) 0xFF, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 }, /* switch actions */ \ \ @@ -1026,9 +1029,9 @@ { (uint16_t) 0x46, (uint16_t) 0x14, (uint16_t) 0x64 }, /* nullable_range_restricted_int8u */ \ { (uint16_t) -0x14, (uint16_t) -0x28, (uint16_t) 0x32 }, /* nullable_range_restricted_int8s */ \ { (uint16_t) 0xC8, (uint16_t) 0x64, (uint16_t) 0x3E8 }, /* nullable_range_restricted_int16u */ \ - { \ - (uint16_t) - 0x64, (uint16_t) -0x96, (uint16_t) 0xC8 \ - } /* nullable_range_restricted_int16s */ \ + { (uint16_t) -0x64, (uint16_t) -0x96, (uint16_t) 0xC8 }, /* nullable_range_restricted_int16s */ \ + \ + /* Endpoint: 2, Cluster: On/Off (server) */ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 } /* StartUpOnOff */ \ } #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask @@ -1350,15 +1353,16 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_SIMPLE_DEFAULT(0xFF) }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: On/off Switch Configuration (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* switch type */ \ { 0x00000010, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* switch actions */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* switch actions */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ @@ -1370,7 +1374,7 @@ { 0x00000005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* min frequency */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* max frequency */ \ { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* options */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* options */ \ { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -1389,7 +1393,7 @@ \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ { 0x00000051, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* out of service */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* out of service */ \ { 0x00000055, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* present value */ \ { 0x0000006F, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* status flags */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ @@ -1482,9 +1486,9 @@ { 0x00000021, ZAP_TYPE(CHAR_STRING), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(398) }, /* Language */ \ { 0x00000023, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(401) }, /* AutoRelockTime */ \ { 0x00000024, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* SoundVolume */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(7) }, /* SoundVolume */ \ { 0x00000025, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(7) }, /* OperatingMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* OperatingMode */ \ { 0x00000026, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0xFFF6) }, /* SupportedOperatingModes */ \ { 0x00000027, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0) }, /* DefaultConfigurationRegister */ \ { 0x00000029, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -1493,9 +1497,9 @@ { 0x0000002B, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x00) }, /* EnablePrivacyModeButton */ \ { 0x00000030, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* WrongCodeEntryLimit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* WrongCodeEntryLimit */ \ { 0x00000031, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* UserCodeTemporaryDisableTime */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* UserCodeTemporaryDisableTime */ \ { 0x00000033, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* RequirePINforRemoteOperation */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(405) }, /* FeatureMap */ \ @@ -1532,7 +1536,7 @@ ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* InstalledClosedLimitTilt */ \ { 0x00000017, ZAP_TYPE(BITMAP8), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* Mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(409) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ @@ -1569,9 +1573,9 @@ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(419) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* OperationMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* ControlMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(423) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ @@ -1587,19 +1591,19 @@ { 0x00000012, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x07D0) }, /* occupied heating setpoint */ \ { 0x00000015, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* min heat setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* min heat setpoint limit */ \ { 0x00000016, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* max heat setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(15) }, /* max heat setpoint limit */ \ { 0x00000017, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(15) }, /* min cool setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(16) }, /* min cool setpoint limit */ \ { 0x00000018, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(16) }, /* max cool setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(17) }, /* max cool setpoint limit */ \ { 0x00000019, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(17) }, /* min setpoint dead band */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(18) }, /* min setpoint dead band */ \ { 0x0000001B, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(18) }, /* control sequence of operation */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(19) }, /* control sequence of operation */ \ { 0x0000001C, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(19) }, /* system mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(20) }, /* system mode */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ @@ -1608,11 +1612,11 @@ \ /* Endpoint: 1, Cluster: Thermostat User Interface Configuration (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(20) }, /* temperature display mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(21) }, /* temperature display mode */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(21) }, /* keypad lockout */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(22) }, /* keypad lockout */ \ { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(22) }, /* schedule programming visibility */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(23) }, /* schedule programming visibility */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Color Control (server) */ \ @@ -1647,23 +1651,23 @@ { 0x00000029, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* primary 6 y */ \ { 0x0000002A, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* primary 6 intensity */ \ { 0x00000030, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(23) }, /* white point x */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(24) }, /* white point x */ \ { 0x00000031, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(24) }, /* white point y */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(25) }, /* white point y */ \ { 0x00000032, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(25) }, /* color point r x */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(26) }, /* color point r x */ \ { 0x00000033, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(26) }, /* color point r y */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(27) }, /* color point r y */ \ { 0x00000034, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* color point r intensity */ \ { 0x00000036, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(27) }, /* color point g x */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(28) }, /* color point g x */ \ { 0x00000037, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(28) }, /* color point g y */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(29) }, /* color point g y */ \ { 0x00000038, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* color point g intensity */ \ { 0x0000003A, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(29) }, /* color point b x */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(30) }, /* color point b x */ \ { 0x0000003B, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(30) }, /* color point b y */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(31) }, /* color point b y */ \ { 0x0000003C, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* color point b intensity */ \ { 0x00004000, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* enhanced current hue */ \ { 0x00004001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* enhanced color mode */ \ @@ -1677,7 +1681,7 @@ { 0x0000400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* color temp physical max */ \ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(31) }, /* start up color temperature mireds */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(32) }, /* start up color temperature mireds */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Illuminance Measurement (server) */ \ @@ -1838,13 +1842,13 @@ { 0x00000025, ZAP_TYPE(STRUCT), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* struct_attr */ \ { 0x00000026, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(32) }, /* range_restricted_int8u */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(33) }, /* range_restricted_int8u */ \ { 0x00000027, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(33) }, /* range_restricted_int8s */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(34) }, /* range_restricted_int8s */ \ { 0x00000028, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(34) }, /* range_restricted_int16u */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(35) }, /* range_restricted_int16u */ \ { 0x00000029, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(35) }, /* range_restricted_int16s */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(36) }, /* range_restricted_int16s */ \ { 0x0000002A, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_EMPTY_DEFAULT() }, /* list_long_octet_string */ \ { 0x0000002B, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ @@ -1916,16 +1920,16 @@ ZAP_EMPTY_DEFAULT() }, /* nullable_struct */ \ { 0x00008026, ZAP_TYPE(INT8U), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(36) }, /* nullable_range_restricted_int8u */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(37) }, /* nullable_range_restricted_int8u */ \ { 0x00008027, ZAP_TYPE(INT8S), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(37) }, /* nullable_range_restricted_int8s */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(38) }, /* nullable_range_restricted_int8s */ \ { 0x00008028, ZAP_TYPE(INT16U), 2, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(38) }, /* nullable_range_restricted_int16u */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(39) }, /* nullable_range_restricted_int16u */ \ { 0x00008029, ZAP_TYPE(INT16S), 2, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(39) }, /* nullable_range_restricted_int16s */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(40) }, /* nullable_range_restricted_int16s */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Electrical Measurement (server) */ \ @@ -1951,8 +1955,9 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(41) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(679) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 196bd9a7ffb77e..1a059d2fe50daa 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -2848,9 +2848,9 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace StartUpOnOff { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadServerAttribute(endpoint, Clusters::OnOff::Id, Id, readable, sizeof(temp)); @@ -2865,9 +2865,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & valu } return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::OnOff::OnOffStartUpOnOff value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -2880,14 +2880,15 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) EmberAfStatus SetNull(chip::EndpointId endpoint) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType value; Traits::SetNull(value); uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); return emberAfWriteServerAttribute(endpoint, Clusters::OnOff::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); } -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +EmberAfStatus Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value) { if (value.IsNull()) { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index 59370c671dd012..ee8919ceef885a 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -512,10 +512,12 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); } // namespace OffWaitTime namespace StartUpOnOff { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // enum8 -EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +EmberAfStatus Get(chip::EndpointId endpoint, + DataModel::Nullable & value); // OnOffStartUpOnOff +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::OnOff::OnOffStartUpOnOff value); EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); +EmberAfStatus Set(chip::EndpointId endpoint, + const chip::app::DataModel::Nullable & value); } // namespace StartUpOnOff namespace FeatureMap { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index d37115f911985b..2eba257609d968 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -133,6 +133,14 @@ enum class OnOffEffectIdentifier : uint8_t using OnOffEffectIdentifier = EmberAfOnOffEffectIdentifier; #endif +// Enum for OnOffStartUpOnOff +enum class OnOffStartUpOnOff : uint8_t +{ + kOff = 0x00, + kOn = 0x01, + kTogglePreviousOnOff = 0x02, +}; + // Bitmap for OnOffControl enum class OnOffControl : uint8_t { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index b7aa0cee8eb298..eb14da02073d8b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -3154,9 +3154,9 @@ struct TypeInfo namespace StartUpOnOff { struct TypeInfo { - using Type = chip::app::DataModel::Nullable; - using DecodableType = chip::app::DataModel::Nullable; - using DecodableArgType = const chip::app::DataModel::Nullable &; + using Type = chip::app::DataModel::Nullable; + using DecodableType = chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable &; static constexpr ClusterId GetClusterId() { return Clusters::OnOff::Id; } static constexpr AttributeId GetAttributeId() { return Attributes::StartUpOnOff::Id; } diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index 747637defbc220..a6c6bdb48e050d 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -2603,7 +2603,7 @@ class WriteOnOffStartUpOnOff : public WriteAttribute } private: - chip::app::DataModel::Nullable mValue; + chip::app::DataModel::Nullable mValue; }; /*----------------------------------------------------------------------------*\ diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index befae0228c0eae..9d9eac50d44b31 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -7572,7 +7572,7 @@ CHIP_ERROR DataModelLogger::LogAttribute(const chip::app::ConcreteDataAttributeP return DataModelLogger::LogValue("OffWaitTime", 1, value); } case OnOff::Attributes::StartUpOnOff::Id: { - chip::app::DataModel::Nullable value; + chip::app::DataModel::Nullable value; ReturnErrorOnFailure(chip::app::DataModel::Decode(*data, value)); return DataModelLogger::LogValue("StartUpOnOff", 1, value); } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 7c7bc0c30ff825..c43ae121cefa38 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -32571,7 +32571,9 @@ class Test_TC_OO_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_5(error); } - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::Nullable & startUpOnOff) + static void + OnSuccessCallback_5(void * context, + const chip::app::DataModel::Nullable & startUpOnOff) { (static_cast(context))->OnSuccessResponse_5(startUpOnOff); } @@ -32695,7 +32697,7 @@ class Test_TC_OO_2_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_5(const chip::app::DataModel::Nullable & startUpOnOff) + void OnSuccessResponse_5(const chip::app::DataModel::Nullable & startUpOnOff) { VerifyOrReturn(CheckConstraintType("startUpOnOff", "", "enum8")); NextTest(); diff --git a/zzz_generated/lighting-app/zap-generated/endpoint_config.h b/zzz_generated/lighting-app/zap-generated/endpoint_config.h index a43d67c6fdd27c..739f48e59929ff 100644 --- a/zzz_generated/lighting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lighting-app/zap-generated/endpoint_config.h @@ -530,7 +530,7 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 4 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 5 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -540,6 +540,9 @@ /* Endpoint: 1, Cluster: Identify (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* identify time */ \ \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { (uint16_t) 0xFF, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ /* Endpoint: 1, Cluster: Level Control (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* options */ \ \ @@ -834,8 +837,9 @@ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ { 0x00004003, ZAP_TYPE(ENUM8), 1, \ - ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_SIMPLE_DEFAULT(0xFF) }, /* StartUpOnOff */ \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | \ + ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(351) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ @@ -848,7 +852,7 @@ { 0x00000005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* min frequency */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* max frequency */ \ { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* options */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* options */ \ { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -895,7 +899,7 @@ { 0x0000400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* color temp physical max */ \ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* start up color temperature mireds */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* start up color temperature mireds */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Occupancy Sensing (server) */ \ diff --git a/zzz_generated/lock-app/zap-generated/endpoint_config.h b/zzz_generated/lock-app/zap-generated/endpoint_config.h index 935cbc76f5927a..6bf4369c36bb9a 100644 --- a/zzz_generated/lock-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lock-app/zap-generated/endpoint_config.h @@ -558,14 +558,14 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 1 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 2 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ - { \ - (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 \ - } /* HourFormat */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* HourFormat */ \ + \ + /* Endpoint: 1, Cluster: On/Off (server) */ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 } /* StartUpOnOff */ \ } #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask @@ -840,8 +840,9 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(363) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ diff --git a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h index 37b3d6ee24766d..cc7101d2393a9c 100644 --- a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h @@ -214,12 +214,15 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 15 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 16 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ - /* Endpoint: 0, Cluster: Window Covering (server) */ \ - { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xF }, /* Mode */ \ + /* Endpoint: 0, Cluster: On/Off (server) */ \ + { (uint16_t) 0xFF, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ + /* Endpoint: 0, Cluster: Window Covering (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xF }, /* Mode */ \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* OperationMode */ \ @@ -259,8 +262,9 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_SIMPLE_DEFAULT(0xFF) }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ @@ -406,7 +410,7 @@ ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* InstalledClosedLimitTilt */ \ { 0x00000017, ZAP_TYPE(BITMAP8), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* Mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(44) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ @@ -436,9 +440,9 @@ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(54) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* OperationMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* ControlMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(58) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ @@ -453,19 +457,19 @@ { 0x00000012, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x07D0) }, /* occupied heating setpoint */ \ { 0x00000015, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* min heat setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* min heat setpoint limit */ \ { 0x00000016, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* max heat setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* max heat setpoint limit */ \ { 0x00000017, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* min cool setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* min cool setpoint limit */ \ { 0x00000018, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* max cool setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(7) }, /* max cool setpoint limit */ \ { 0x00000019, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(7) }, /* min setpoint dead band */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* min setpoint dead band */ \ { 0x0000001B, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* control sequence of operation */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* control sequence of operation */ \ { 0x0000001C, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* system mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* system mode */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ @@ -474,11 +478,11 @@ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* temperature display mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* temperature display mode */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* keypad lockout */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* keypad lockout */ \ { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* schedule programming visibility */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* schedule programming visibility */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(66) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ @@ -522,7 +526,7 @@ \ /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* identify time */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* identify time */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -595,7 +599,7 @@ ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* start up color temperature mireds */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(15) }, /* start up color temperature mireds */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ } diff --git a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h index 37b3d6ee24766d..cc7101d2393a9c 100644 --- a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h @@ -214,12 +214,15 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 15 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 16 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ - /* Endpoint: 0, Cluster: Window Covering (server) */ \ - { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xF }, /* Mode */ \ + /* Endpoint: 0, Cluster: On/Off (server) */ \ + { (uint16_t) 0xFF, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ + /* Endpoint: 0, Cluster: Window Covering (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xF }, /* Mode */ \ \ /* Endpoint: 0, Cluster: Pump Configuration and Control (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* OperationMode */ \ @@ -259,8 +262,9 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_SIMPLE_DEFAULT(0xFF) }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(0) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ @@ -406,7 +410,7 @@ ZAP_SIMPLE_DEFAULT(0xFFFF) }, /* InstalledClosedLimitTilt */ \ { 0x00000017, ZAP_TYPE(BITMAP8), 1, \ ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(0) }, /* Mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* Mode */ \ { 0x0000001A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* SafetyStatus */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(44) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(5) }, /* ClusterRevision */ \ @@ -436,9 +440,9 @@ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(54) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(1) }, /* OperationMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* ControlMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(58) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ @@ -453,19 +457,19 @@ { 0x00000012, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x07D0) }, /* occupied heating setpoint */ \ { 0x00000015, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* min heat setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* min heat setpoint limit */ \ { 0x00000016, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* max heat setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* max heat setpoint limit */ \ { 0x00000017, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* min cool setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* min cool setpoint limit */ \ { 0x00000018, ZAP_TYPE(INT16S), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(6) }, /* max cool setpoint limit */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(7) }, /* max cool setpoint limit */ \ { 0x00000019, ZAP_TYPE(INT8S), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(7) }, /* min setpoint dead band */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* min setpoint dead band */ \ { 0x0000001B, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(8) }, /* control sequence of operation */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* control sequence of operation */ \ { 0x0000001C, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(9) }, /* system mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* system mode */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* start of week */ \ { 0x00000021, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(7) }, /* number of weekly transitions */ \ { 0x00000022, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(4) }, /* number of daily transitions */ \ @@ -474,11 +478,11 @@ \ /* Endpoint: 0, Cluster: Thermostat User Interface Configuration (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(10) }, /* temperature display mode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* temperature display mode */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(11) }, /* keypad lockout */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* keypad lockout */ \ { 0x00000002, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(12) }, /* schedule programming visibility */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* schedule programming visibility */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(66) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ @@ -522,7 +526,7 @@ \ /* Endpoint: 1, Cluster: Identify (server) */ \ { 0x00000000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(13) }, /* identify time */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* identify time */ \ { 0x00000001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x0) }, /* identify type */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* ClusterRevision */ \ \ @@ -595,7 +599,7 @@ ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \ { 0x0000400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \ { 0x00004010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(14) }, /* start up color temperature mireds */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(15) }, /* start up color temperature mireds */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* ClusterRevision */ \ } diff --git a/zzz_generated/pump-app/zap-generated/endpoint_config.h b/zzz_generated/pump-app/zap-generated/endpoint_config.h index 0e0ae0fe24f04b..73b6d22a8185cf 100644 --- a/zzz_generated/pump-app/zap-generated/endpoint_config.h +++ b/zzz_generated/pump-app/zap-generated/endpoint_config.h @@ -444,7 +444,7 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 5 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 6 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -454,6 +454,9 @@ /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x1 }, /* HourFormat */ \ \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ /* Endpoint: 1, Cluster: Level Control (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* options */ \ \ @@ -727,8 +730,9 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* StartUpOnOff */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ /* Endpoint: 1, Cluster: Level Control (server) */ \ @@ -740,7 +744,7 @@ { 0x00000005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* min frequency */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* max frequency */ \ { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* options */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* options */ \ { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -787,9 +791,9 @@ { 0x00000017, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_LONG_DEFAULTS_INDEX(265) }, /* LifetimeEnergyConsumed */ \ { 0x00000020, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* OperationMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* OperationMode */ \ { 0x00000021, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* ControlMode */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(5) }, /* ControlMode */ \ { 0x00000022, ZAP_TYPE(BITMAP16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* AlarmMask */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(269) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ diff --git a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h index 9602097c7625a0..97107b31ebaa81 100644 --- a/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h +++ b/zzz_generated/tv-casting-app/zap-generated/endpoint_config.h @@ -580,7 +580,7 @@ } // This is an array of EmberAfAttributeMinMaxValue structures. -#define GENERATED_MIN_MAX_DEFAULT_COUNT 4 +#define GENERATED_MIN_MAX_DEFAULT_COUNT 5 #define GENERATED_MIN_MAX_DEFAULTS \ { \ \ @@ -590,6 +590,9 @@ /* Endpoint: 1, Cluster: Identify (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0xFE }, /* identify time */ \ \ + /* Endpoint: 1, Cluster: On/Off (server) */ \ + { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x2 }, /* StartUpOnOff */ \ + \ /* Endpoint: 1, Cluster: Level Control (server) */ \ { (uint16_t) 0x0, (uint16_t) 0x0, (uint16_t) 0x3 }, /* options */ \ \ @@ -888,8 +891,9 @@ { 0x00004000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* GlobalSceneControl */ \ { 0x00004001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OnTime */ \ { 0x00004002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* OffWaitTime */ \ - { 0x00004003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ - ZAP_EMPTY_DEFAULT() }, /* StartUpOnOff */ \ + { 0x00004003, ZAP_TYPE(ENUM8), 1, \ + ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* StartUpOnOff */ \ { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(355) }, /* FeatureMap */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(4) }, /* ClusterRevision */ \ \ @@ -902,7 +906,7 @@ { 0x00000005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* min frequency */ \ { 0x00000006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* max frequency */ \ { 0x0000000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(2) }, /* options */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* options */ \ { 0x00000010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_SIMPLE_DEFAULT(0x0000) }, /* on off transition time */ \ { 0x00000011, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ @@ -920,7 +924,7 @@ \ /* Endpoint: 1, Cluster: Binary Input (Basic) (server) */ \ { 0x00000051, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(MIN_MAX) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ - ZAP_MIN_MAX_DEFAULTS_INDEX(3) }, /* out of service */ \ + ZAP_MIN_MAX_DEFAULTS_INDEX(4) }, /* out of service */ \ { 0x00000055, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* present value */ \ { 0x0000006F, ZAP_TYPE(BITMAP8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* status flags */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* ClusterRevision */ \ From a40104a046cdbf5d28677efcd1a61219d46c2a6e Mon Sep 17 00:00:00 2001 From: Seth Rickard Date: Wed, 23 Mar 2022 21:40:40 -0500 Subject: [PATCH 34/70] [TI] Test Event #8 feedback (#16495) * Platform updates found from TE#8 OpenThread config added DNS client support to fully enable SRP. Configuration limiting OpenThread message buffers removed for higher memory devices. It was found that the OpenThread stack would not de-fragment the long packets needed for OTA. This ended up silently failing before the packets reached the LwIP stack. GN build updated to include missing dependencies. KVS updated to return proper CHIP_ERROR value instead of a platform error. AES hardware acceleration disabled due to a runtime error. This is likely a missing `mbedtls_aes_free()` call. Further debug is required before re-enabling. * Centralize TI OpenThread config * Restyled by whitespace * Restyled by clang-format * Restyled by gn * add CHIP DNS configuration * Update length calculation for NVS * Restyled by clang-format Co-authored-by: Restyled.io --- .../main/include/OpenThreadConfig.h | 33 +------------------ .../main/include/OpenThreadConfig.h | 33 +------------------ .../cc13x2x7_26x2x7/main/AppTask.cpp | 11 +++++-- .../main/include/OpenThreadConfig.h | 33 +------------------ src/platform/cc13x2_26x2/BUILD.gn | 2 ++ .../cc13x2_26x2/CC13X2_26X2Config.cpp | 22 ++++++++----- .../cc13x2_26x2/CHIPDevicePlatformConfig.h | 1 + .../cc13x2_26x2/ConfigurationManagerImpl.cpp | 1 + .../cc13x2_26x2/KeyValueStoreManagerImpl.cpp | 10 +++++- .../crypto/cc13x2_26x2-mbedtls-config.h | 2 +- .../openthread-core-cc13x2_26x2-config.h | 32 ++++++++++++++++++ 11 files changed, 71 insertions(+), 109 deletions(-) diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h b/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h index 4079b251280ddc..30f5633cc3bc7f 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h +++ b/examples/lock-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h @@ -23,38 +23,7 @@ * */ -#ifndef OPENTHREAD_PLATFORM_CONFIG_H -#define OPENTHREAD_PLATFORM_CONFIG_H - -// Disable the Nordic-supplied OpenThread logging facilities and use -// the facilities provided by the CHIP Device Layer -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 -#define UART_AS_SERIAL_TRANSPORT 1 -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#pragma once // Use the TI-supplied default platform configuration for remainder #include "openthread-core-cc13x2_26x2-config.h" - -#endif // OPENTHREAD_PLATFORM_CONFIG_H diff --git a/examples/pump-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h b/examples/pump-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h index 4079b251280ddc..30f5633cc3bc7f 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h +++ b/examples/pump-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h @@ -23,38 +23,7 @@ * */ -#ifndef OPENTHREAD_PLATFORM_CONFIG_H -#define OPENTHREAD_PLATFORM_CONFIG_H - -// Disable the Nordic-supplied OpenThread logging facilities and use -// the facilities provided by the CHIP Device Layer -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 -#define UART_AS_SERIAL_TRANSPORT 1 -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#pragma once // Use the TI-supplied default platform configuration for remainder #include "openthread-core-cc13x2_26x2-config.h" - -#endif // OPENTHREAD_PLATFORM_CONFIG_H diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp index 8ccd13b292aeb4..f96411cfa8d0de 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -31,8 +31,9 @@ #if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR) #include +#include +#include #include -#include #include #endif #include @@ -68,6 +69,7 @@ AppTask AppTask::sAppTask; #if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR) static OTARequestor sRequestorCore; +static DefaultOTARequestorStorage sRequestorStorage; static GenericOTARequestorDriver sRequestorUser; static BDXDownloader sDownloader; static OTAImageProcessorImpl sImageProcessor; @@ -77,7 +79,8 @@ void InitializeOTARequestor(void) // Initialize and interconnect the Requestor and Image Processor objects SetRequestorInstance(&sRequestorCore); - sRequestorCore.Init(&Server::GetInstance(), &sRequestorUser, &sDownloader); + sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); + sRequestorCore.Init(chip::Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader); sImageProcessor.SetOTADownloader(&sDownloader); sDownloader.SetImageProcessorDelegate(&sImageProcessor); sRequestorUser.Init(&sRequestorCore, &sImageProcessor); @@ -200,6 +203,10 @@ int AppTask::Init() ConfigurationMgr().LogDeviceConfig(); +#if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR) + InitializeOTARequestor(); +#endif + // QR code will be used with CHIP Tool PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h b/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h index 4079b251280ddc..30f5633cc3bc7f 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/main/include/OpenThreadConfig.h @@ -23,38 +23,7 @@ * */ -#ifndef OPENTHREAD_PLATFORM_CONFIG_H -#define OPENTHREAD_PLATFORM_CONFIG_H - -// Disable the Nordic-supplied OpenThread logging facilities and use -// the facilities provided by the CHIP Device Layer -#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP - -// When operating in a less than ideal RF environment, having a more forgiving configuration -// of OpenThread makes thread a great deal more reliable. -#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 -#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 -#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 - -// Enable periodic parent search to speed up finding a better parent. -#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 -#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 -#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 - -// Use smaller maximum interval to speed up reattaching. -#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms - -#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 -#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 -#define UART_AS_SERIAL_TRANSPORT 1 -#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 - -#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 -#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 -#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#pragma once // Use the TI-supplied default platform configuration for remainder #include "openthread-core-cc13x2_26x2-config.h" - -#endif // OPENTHREAD_PLATFORM_CONFIG_H diff --git a/src/platform/cc13x2_26x2/BUILD.gn b/src/platform/cc13x2_26x2/BUILD.gn index d110cb240eb81b..22292330ce3108 100644 --- a/src/platform/cc13x2_26x2/BUILD.gn +++ b/src/platform/cc13x2_26x2/BUILD.gn @@ -55,6 +55,8 @@ static_library("cc13x2_26x2") { "${chip_root}/src/crypto", "${chip_root}/src/platform:platform_base", ] + public_configs = + [ "${chip_root}/src/lib/address_resolve:default_address_resolve_config" ] if (chip_enable_ble) { sources += [ diff --git a/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp b/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp index f8a4493fb9461b..3795cf9aa77430 100644 --- a/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp +++ b/src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp @@ -212,6 +212,7 @@ CHIP_ERROR CC13X2_26X2Config::ReadKVS(const char * key, void * value, size_t val NVINTF_itemID_t val_item = CC13X2_26X2Config::kConfigKey_KVS_value.nvID; uint16_t subID; size_t len; + uint16_t read_len; VerifyOrExit(FindKVSSubID(key, subID) == NVINTF_SUCCESS, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); @@ -220,19 +221,22 @@ CHIP_ERROR CC13X2_26X2Config::ReadKVS(const char * key, void * value, size_t val len = sNvoctpFps.getItemLen(val_item); VerifyOrExit(len > 0, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // key not found - VerifyOrExit(sNvoctpFps.readItem(val_item, (uint16_t) offset_bytes, (uint16_t) value_size, value) == NVINTF_SUCCESS, + if ((offset_bytes + value_size) > len) + { + // trying to read up to the end of the element + read_len = len - offset_bytes; + } + else + { + read_len = value_size; + } + + VerifyOrExit(sNvoctpFps.readItem(val_item, (uint16_t) offset_bytes, read_len, value) == NVINTF_SUCCESS, err = CHIP_ERROR_PERSISTED_STORAGE_FAILED); if (read_bytes_size) { - if (len - offset_bytes > value_size) - { - *read_bytes_size = value_size; - } - else - { - *read_bytes_size = len - offset_bytes; - } + *read_bytes_size = read_len; } exit: diff --git a/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h b/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h index 5927b58b3c2c60..cd5e9c927dd6a6 100644 --- a/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h @@ -54,4 +54,5 @@ #define CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART 0 #define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1 +#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT 1 #define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1 diff --git a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp index 1db7197b6fdac1..108a6ef03805a4 100644 --- a/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp @@ -77,6 +77,7 @@ CHIP_ERROR ConfigurationManagerImpl::Init() } err = CHIP_NO_ERROR; +exit: return err; } diff --git a/src/platform/cc13x2_26x2/KeyValueStoreManagerImpl.cpp b/src/platform/cc13x2_26x2/KeyValueStoreManagerImpl.cpp index 118945be4337d2..b74146c1de3704 100644 --- a/src/platform/cc13x2_26x2/KeyValueStoreManagerImpl.cpp +++ b/src/platform/cc13x2_26x2/KeyValueStoreManagerImpl.cpp @@ -41,10 +41,18 @@ KeyValueStoreManagerImpl KeyValueStoreManagerImpl::sInstance; CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size, size_t offset_bytes) const { + CHIP_ERROR err; + VerifyOrReturnError(key, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(value, CHIP_ERROR_INVALID_ARGUMENT); - return CC13X2_26X2Config::ReadKVS(key, value, value_size, read_bytes_size, offset_bytes); + err = CC13X2_26X2Config::ReadKVS(key, value, value_size, read_bytes_size, offset_bytes); + + if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND) + { + err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND; + } + return err; } CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size) diff --git a/src/platform/cc13x2_26x2/crypto/cc13x2_26x2-mbedtls-config.h b/src/platform/cc13x2_26x2/crypto/cc13x2_26x2-mbedtls-config.h index 04e91bae54616b..44286fdb35e106 100644 --- a/src/platform/cc13x2_26x2/crypto/cc13x2_26x2-mbedtls-config.h +++ b/src/platform/cc13x2_26x2/crypto/cc13x2_26x2-mbedtls-config.h @@ -39,7 +39,7 @@ /* Enable Hardware Acceleration */ -#define MBEDTLS_AES_ALT +//#define MBEDTLS_AES_ALT #define MBEDTLS_ECDH_COMPUTE_SHARED_ALT #define MBEDTLS_ECDH_GEN_PUBLIC_ALT #define MBEDTLS_ECDSA_SIGN_ALT diff --git a/src/platform/cc13x2_26x2/openthread-core-cc13x2_26x2-config.h b/src/platform/cc13x2_26x2/openthread-core-cc13x2_26x2-config.h index b206345f339db2..0873f031b4355f 100644 --- a/src/platform/cc13x2_26x2/openthread-core-cc13x2_26x2-config.h +++ b/src/platform/cc13x2_26x2/openthread-core-cc13x2_26x2-config.h @@ -28,5 +28,37 @@ #pragma once +#ifdef DeviceFamily_CC13X2_CC26X2 + /* Number of message buffers reduced to fit into CC26x2x3 RAM */ #define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22 + +#endif // DeviceFamily_CC13X2_CC26X2 + +#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP + +// When operating in a less than ideal RF environment, having a more forgiving configuration +// of OpenThread makes thread a great deal more reliable. +#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800 +#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3 +#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0 +#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4 + +// Enable periodic parent search to speed up finding a better parent. +#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0 +#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65 +#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0 + +// Use smaller maximum interval to speed up reattaching. +#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms + +#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0 +#define UART_AS_SERIAL_TRANSPORT 1 +#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1 + +#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1 From d88beed86f245db867d28c8f6cabab3c50530441 Mon Sep 17 00:00:00 2001 From: Minh Le <98434995+minhlez@users.noreply.github.com> Date: Wed, 23 Mar 2022 21:12:05 -0700 Subject: [PATCH 35/70] Implement startup behavior with StartUpMode (#16039) * Implement StartUpMode behavior with validation * Disable TestModeSelectCluster for darwin. To be added back in #16514 * Update StartUpMode of ModeSelectCluster to use NVM storage option and generate code * Restyled by clang-format Co-authored-by: Restyled.io --- .../all-clusters-app.matter | 2 +- .../all-clusters-common/all-clusters-app.zap | 18 +- examples/chip-tool-darwin/templates/tests.js | 1 - .../placeholder/linux/apps/app1/config.matter | 4 +- .../placeholder/linux/apps/app2/config.matter | 4 +- .../mode-select-server/mode-select-server.cpp | 114 ++++ .../tests/suites/TestModeSelectCluster.yaml | 52 ++ src/app/zap-templates/templates/app/helper.js | 8 +- .../data-model/chip/mode-select-cluster.xml | 2 +- .../data_model/controller-clusters.matter | 2 +- .../zap-generated/CHIPClustersWrite-JNI.cpp | 60 ++ .../chip/devicecontroller/ChipClusters.java | 15 + .../devicecontroller/ClusterWriteMapping.java | 16 + .../python/chip/clusters/CHIPClusters.py | 1 + .../Framework/CHIP/templates/tests/tests.js | 1 - .../CHIP/zap-generated/CHIPClustersObjc.h | 1 + .../CHIP/zap-generated/CHIPClustersObjc.mm | 23 + .../CHIP/zap-generated/CHIPTestClustersObjc.h | 1 - .../zap-generated/CHIPTestClustersObjc.mm | 23 - .../Framework/CHIPTests/CHIPClustersTests.m | 412 -------------- .../zap-generated/endpoint_config.h | 13 +- .../cluster/CHIPTestClustersObjc.h | 1 - .../cluster/CHIPTestClustersObjc.mm | 23 - .../zap-generated/cluster/Commands.h | 35 ++ .../zap-generated/test/Commands.h | 512 ------------------ .../zap-generated/cluster/Commands.h | 27 + .../chip-tool/zap-generated/test/Commands.h | 208 ++++++- .../app1/zap-generated/endpoint_config.h | 15 +- .../app2/zap-generated/endpoint_config.h | 15 +- 29 files changed, 603 insertions(+), 1006 deletions(-) diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index a36db652a3dd62..245ad5d324e88c 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -1985,7 +1985,7 @@ server cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; attribute nullable int8u onMode = 5; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index c74772c8bc26f7..491c2d88690c48 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -8033,7 +8033,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -8048,7 +8048,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", @@ -8935,7 +8935,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -8950,7 +8950,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", @@ -10531,7 +10531,7 @@ "mfgCode": null, "side": "server", "included": 1, - "storageOption": "RAM", + "storageOption": "NVM", "singleton": 0, "bounded": 0, "defaultValue": "0", @@ -10571,7 +10571,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -10586,7 +10586,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", @@ -14842,7 +14842,7 @@ "reportableChange": 0 }, { - "name": "ServerGeneratedCommandList", + "name": "GeneratedCommandList", "code": 65528, "mfgCode": null, "side": "server", @@ -14857,7 +14857,7 @@ "reportableChange": 0 }, { - "name": "ClientGeneratedCommandList", + "name": "AcceptedCommandList", "code": 65529, "mfgCode": null, "side": "server", diff --git a/examples/chip-tool-darwin/templates/tests.js b/examples/chip-tool-darwin/templates/tests.js index 7cd1779c34e63a..87e68b38512571 100644 --- a/examples/chip-tool-darwin/templates/tests.js +++ b/examples/chip-tool-darwin/templates/tests.js @@ -234,7 +234,6 @@ function getTests() 'TestIdentifyCluster', 'TestLogCommands', 'TestOperationalCredentialsCluster', - 'TestModeSelectCluster', 'TestBinding', ]; diff --git a/examples/placeholder/linux/apps/app1/config.matter b/examples/placeholder/linux/apps/app1/config.matter index df68c1024a08cd..63037ef5627973 100644 --- a/examples/placeholder/linux/apps/app1/config.matter +++ b/examples/placeholder/linux/apps/app1/config.matter @@ -1024,7 +1024,7 @@ client cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; @@ -1053,7 +1053,7 @@ server cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/examples/placeholder/linux/apps/app2/config.matter b/examples/placeholder/linux/apps/app2/config.matter index df68c1024a08cd..63037ef5627973 100644 --- a/examples/placeholder/linux/apps/app2/config.matter +++ b/examples/placeholder/linux/apps/app2/config.matter @@ -1024,7 +1024,7 @@ client cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; @@ -1053,7 +1053,7 @@ server cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; readonly global attribute attrib_id attributeList[] = 65531; diff --git a/src/app/clusters/mode-select-server/mode-select-server.cpp b/src/app/clusters/mode-select-server/mode-select-server.cpp index 6b050a8cab4cf5..cb700bed4d0d4e 100644 --- a/src/app/clusters/mode-select-server/mode-select-server.cpp +++ b/src/app/clusters/mode-select-server/mode-select-server.cpp @@ -28,15 +28,23 @@ #include #include #include +#include +#include #include using namespace std; using namespace chip; using namespace chip::app; using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ModeSelect; +using namespace chip::Protocols; + +static InteractionModel::Status verifyModeValue(const EndpointId endpointId, const uint8_t newMode); namespace { +inline bool areStartUpModeAndCurrentModeNonVolatile(EndpointId endpoint); + class ModeSelectAttrAccess : public AttributeAccessInterface { public: @@ -103,7 +111,113 @@ bool emberAfModeSelectClusterChangeToModeCallback(CommandHandler * commandHandle return true; } +/** + * Callback for Mode Select Cluster Server Initialization. + * Enabled in src/app/zap-templates/templates/app/helper.js + * @param endpointId id of the endpoint that is being initialized + */ +void emberAfModeSelectClusterServerInitCallback(EndpointId endpointId) +{ + // StartUp behavior relies on CurrentMode StartUpMode attributes being non-volatile. + if (areStartUpModeAndCurrentModeNonVolatile(endpointId)) + { + // Read the StartUpMode attribute and set the CurrentMode attribute + // The StartUpMode attribute SHALL define the desired startup behavior of a + // device when it is supplied with power and this state SHALL be + // reflected in the CurrentMode attribute. The values of the StartUpMode + // attribute are listed below. + + DataModel::Nullable startUpMode; + EmberAfStatus status = Attributes::StartUpMode::Get(endpointId, startUpMode); + if (status == EMBER_ZCL_STATUS_SUCCESS && !startUpMode.IsNull()) + { + // Initialise currentMode to 0 + uint8_t currentMode = 0; + status = Attributes::CurrentMode::Get(endpointId, ¤tMode); + if (status == EMBER_ZCL_STATUS_SUCCESS && startUpMode.Value() != currentMode) + { + status = Attributes::CurrentMode::Set(endpointId, startUpMode.Value()); + if (status != EMBER_ZCL_STATUS_SUCCESS) + { + ChipLogError(Zcl, "ModeSelect: Error initializing CurrentMode, EmberAfStatus code 0x%02x", status); + } + else + { + emberAfPrintln(EMBER_AF_PRINT_DEBUG, "ModeSelect: Successfully initialized CurrentMode to %u", + startUpMode.Value()); + } + } + } + } + else + { + emberAfPrintln(EMBER_AF_PRINT_DEBUG, + "ModeSelect: Skipped initializing CurrentMode by StartUpMode because one of them is volatile"); + } +} + +namespace { + +/** + * Checks if StartUpMode and CurrentMode are non-volatile. + * @param endpointId id of the endpoint to check + * @return true if both attributes are non-volatile; false otherwise. + */ +inline bool areStartUpModeAndCurrentModeNonVolatile(EndpointId endpointId) +{ + return emberAfIsNonVolatileAttribute(endpointId, ModeSelect::Id, Attributes::CurrentMode::Id, true) && + emberAfIsNonVolatileAttribute(endpointId, ModeSelect::Id, Attributes::StartUpMode::Id, true); +} + +} // namespace + void MatterModeSelectPluginServerInitCallback(void) { registerAttributeAccessOverride(&gModeSelectAttrAccess); } + +/** + * Callback for Mode Select Cluster Server Pre Attribute Changed + * Enabled in src/app/zap-templates/templates/app/helper.js + * @param attributePath Concrete attribute path to be changed + * @param attributeType Attribute type + * @param size Attribute size + * @param value Attribute value + */ +InteractionModel::Status MatterModeSelectClusterServerPreAttributeChangedCallback(const ConcreteAttributePath & attributePath, + EmberAfAttributeType attributeType, uint16_t size, + uint8_t * value) +{ + const EndpointId endpointId = attributePath.mEndpointId; + InteractionModel::Status result; + + switch (attributePath.mAttributeId) + { + case ModeSelect::Attributes::StartUpMode::Id: + result = verifyModeValue(endpointId, *value); + break; + default: + result = InteractionModel::Status::Success; + } + + return result; +} + +/** + * Checks the new mode against the endpoint's supported modes. + * @param endpointId endpointId of the endpoint + * @param newMode value of the new mode + * @return Success status if the value is valid; InvalidValue otherwise. + */ +static InteractionModel::Status verifyModeValue(const EndpointId endpointId, const uint8_t newMode) +{ + const ModeSelect::Structs::ModeOptionStruct::Type * modeOptionPtr; + EmberAfStatus checkSupportedModeStatus = + ModeSelect::getSupportedModesManager()->getModeOptionByMode(endpointId, newMode, &modeOptionPtr); + if (EMBER_ZCL_STATUS_SUCCESS != checkSupportedModeStatus) + { + const InteractionModel::Status returnStatus = ToInteractionModelStatus(checkSupportedModeStatus); + return returnStatus; + } + return InteractionModel::Status::Success; +} diff --git a/src/app/tests/suites/TestModeSelectCluster.yaml b/src/app/tests/suites/TestModeSelectCluster.yaml index a27f110eb5aaf6..c3b070fe999904 100644 --- a/src/app/tests/suites/TestModeSelectCluster.yaml +++ b/src/app/tests/suites/TestModeSelectCluster.yaml @@ -18,6 +18,9 @@ config: nodeId: 0x12344321 cluster: "Mode Select" endpoint: 1 + discriminator: + type: INT16U + defaultValue: 3840 tests: - label: "Wait for the commissioned device to be retrieved" @@ -135,3 +138,52 @@ tests: attribute: "CurrentMode" response: value: OnModeValue + + - label: "Change to Unsupported StartUp Mode" + command: "writeAttribute" + attribute: "StartUpMode" + arguments: + value: 2 + response: + error: CONSTRAINT_ERROR + + - label: "Change to Supported StartUp Mode" + command: "writeAttribute" + attribute: "StartUpMode" + arguments: + value: 7 + + - label: "Verify StartUp Mode Change" + command: "readAttribute" + attribute: "StartUpMode" + response: + value: 7 + + - label: "Change CurrentMode to another value" + command: "changeToMode" + arguments: + values: + - name: "NewMode" + value: 0 + + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Verify Current Mode Change based on new StartUp Mode" + command: "readAttribute" + attribute: "CurrentMode" + response: + value: 7 diff --git a/src/app/zap-templates/templates/app/helper.js b/src/app/zap-templates/templates/app/helper.js index 1445874804c91b..04817befafbd26 100644 --- a/src/app/zap-templates/templates/app/helper.js +++ b/src/app/zap-templates/templates/app/helper.js @@ -120,6 +120,7 @@ var endpointClusterWithInit = [ 'Scenes', 'Time Format Localization', 'Thermostat', + 'Mode Select', ]; var endpointClusterWithAttributeChanged = [ 'Bridged Device Basic', @@ -129,7 +130,12 @@ var endpointClusterWithAttributeChanged = [ 'Window Covering', ]; var endpointClusterWithPreAttribute = [ - 'IAS Zone', 'Door Lock', 'Thermostat User Interface Configuration', 'Time Format Localization', 'Localization Configuration' + 'IAS Zone', + 'Door Lock', + 'Thermostat User Interface Configuration', + 'Time Format Localization', + 'Localization Configuration', + 'Mode Select', ]; var endpointClusterWithMessageSent = [ 'IAS Zone' ]; diff --git a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml index 6b41513b2990ad..af1e3cc22c17b9 100644 --- a/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/mode-select-cluster.xml @@ -45,7 +45,7 @@ limitations under the License. StandardNamespace SupportedModes CurrentMode - StartUpMode + StartUpMode OnMode diff --git a/src/controller/data_model/controller-clusters.matter b/src/controller/data_model/controller-clusters.matter index 6b3398c3d7df27..61edfa042933fe 100644 --- a/src/controller/data_model/controller-clusters.matter +++ b/src/controller/data_model/controller-clusters.matter @@ -2380,7 +2380,7 @@ client cluster ModeSelect = 80 { readonly attribute nullable enum16 standardNamespace = 1; readonly attribute ModeOptionStruct supportedModes[] = 2; readonly attribute int8u currentMode = 3; - readonly attribute nullable int8u startUpMode = 4; + attribute nullable int8u startUpMode = 4; attribute nullable int8u onMode = 5; readonly global attribute command_id generatedCommandList[] = 65528; readonly global attribute command_id acceptedCommandList[] = 65529; diff --git a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp index 7a1a6d0395f110..8097fdea6c08c0 100644 --- a/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp +++ b/src/controller/java/zap-generated/CHIPClustersWrite-JNI.cpp @@ -2609,6 +2609,66 @@ JNI_METHOD(void, LocalizationConfigurationCluster, writeActiveLocaleAttribute) onFailure.release(); } +JNI_METHOD(void, ModeSelectCluster, writeStartUpModeAttribute) +(JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) +{ + chip::DeviceLayer::StackLock lock; + ListFreer listFreer; + using TypeInfo = chip::app::Clusters::ModeSelect::Attributes::StartUpMode::TypeInfo; + TypeInfo::Type cppValue; + + std::vector> cleanupByteArrays; + std::vector> cleanupStrings; + + if (value == nullptr) + { + cppValue.SetNull(); + } + else + { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = static_cast>( + chip::JniReferences::GetInstance().IntegerToPrimitive(value)); + } + + std::unique_ptr onSuccess( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onSuccess.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native success callback", CHIP_ERROR_NO_MEMORY)); + + std::unique_ptr onFailure( + Platform::New(callback), Platform::Delete); + VerifyOrReturn(onFailure.get() != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Error creating native failure callback", CHIP_ERROR_NO_MEMORY)); + + CHIP_ERROR err = CHIP_NO_ERROR; + ModeSelectCluster * cppCluster = reinterpret_cast(clusterPtr); + VerifyOrReturn(cppCluster != nullptr, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException( + env, callback, "Could not get native cluster", CHIP_ERROR_INCORRECT_STATE)); + + auto successFn = chip::Callback::Callback::FromCancelable(onSuccess->Cancel()); + auto failureFn = chip::Callback::Callback::FromCancelable(onFailure->Cancel()); + + if (timedWriteTimeoutMs == nullptr) + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall); + } + else + { + err = cppCluster->WriteAttribute(cppValue, onSuccess->mContext, successFn->mCall, failureFn->mCall, + chip::JniReferences::GetInstance().IntegerToPrimitive(timedWriteTimeoutMs)); + } + VerifyOrReturn( + err == CHIP_NO_ERROR, + chip::AndroidClusterExceptions::GetInstance().ReturnIllegalStateException(env, callback, "Error writing attribute", err)); + + onSuccess.release(); + onFailure.release(); +} + JNI_METHOD(void, ModeSelectCluster, writeOnModeAttribute) (JNIEnv * env, jobject self, jlong clusterPtr, jobject callback, jobject value, jobject timedWriteTimeoutMs) { diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java index b591c9b7f39264..16d342275cc298 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ChipClusters.java @@ -11149,6 +11149,15 @@ public void readStartUpModeAttribute(StartUpModeAttributeCallback callback) { readStartUpModeAttribute(chipClusterPtr, callback); } + public void writeStartUpModeAttribute(DefaultClusterCallback callback, Integer value) { + writeStartUpModeAttribute(chipClusterPtr, callback, value, null); + } + + public void writeStartUpModeAttribute( + DefaultClusterCallback callback, Integer value, int timedWriteTimeoutMs) { + writeStartUpModeAttribute(chipClusterPtr, callback, value, timedWriteTimeoutMs); + } + public void subscribeStartUpModeAttribute( StartUpModeAttributeCallback callback, int minInterval, int maxInterval) { subscribeStartUpModeAttribute(chipClusterPtr, callback, minInterval, maxInterval); @@ -11253,6 +11262,12 @@ private native void subscribeCurrentModeAttribute( private native void readStartUpModeAttribute( long chipClusterPtr, StartUpModeAttributeCallback callback); + private native void writeStartUpModeAttribute( + long chipClusterPtr, + DefaultClusterCallback callback, + Integer value, + @Nullable Integer timedWriteTimeoutMs); + private native void subscribeStartUpModeAttribute( long chipClusterPtr, StartUpModeAttributeCallback callback, diff --git a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java index 1b767580eb505d..24518720f29eb5 100644 --- a/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java +++ b/src/controller/java/zap-generated/chip/devicecontroller/ClusterWriteMapping.java @@ -776,6 +776,22 @@ public Map> getWriteAttributeMap() { Map writeMediaPlaybackInteractionInfo = new LinkedHashMap<>(); writeAttributeMap.put("mediaPlayback", writeMediaPlaybackInteractionInfo); Map writeModeSelectInteractionInfo = new LinkedHashMap<>(); + Map writeModeSelectStartUpModeCommandParams = + new LinkedHashMap(); + CommandParameterInfo modeSelectstartUpModeCommandParameterInfo = + new CommandParameterInfo("value", Integer.class); + writeModeSelectStartUpModeCommandParams.put("value", modeSelectstartUpModeCommandParameterInfo); + InteractionInfo writeModeSelectStartUpModeAttributeInteractionInfo = + new InteractionInfo( + (cluster, callback, commandArguments) -> { + ((ChipClusters.ModeSelectCluster) cluster) + .writeStartUpModeAttribute( + (DefaultClusterCallback) callback, (Integer) commandArguments.get("value")); + }, + () -> new ClusterInfoMapping.DelegatedDefaultClusterCallback(), + writeModeSelectStartUpModeCommandParams); + writeModeSelectInteractionInfo.put( + "writeStartUpModeAttribute", writeModeSelectStartUpModeAttributeInteractionInfo); Map writeModeSelectOnModeCommandParams = new LinkedHashMap(); CommandParameterInfo modeSelectonModeCommandParameterInfo = diff --git a/src/controller/python/chip/clusters/CHIPClusters.py b/src/controller/python/chip/clusters/CHIPClusters.py index 532da158fd2628..de9d36bd47833b 100644 --- a/src/controller/python/chip/clusters/CHIPClusters.py +++ b/src/controller/python/chip/clusters/CHIPClusters.py @@ -3499,6 +3499,7 @@ class ChipClusters: "attributeId": 0x00000004, "type": "int", "reportable": True, + "writable": True, }, 0x00000005: { "attributeName": "OnMode", diff --git a/src/darwin/Framework/CHIP/templates/tests/tests.js b/src/darwin/Framework/CHIP/templates/tests/tests.js index ef894546f2615a..5d33a2b078cac4 100644 --- a/src/darwin/Framework/CHIP/templates/tests/tests.js +++ b/src/darwin/Framework/CHIP/templates/tests/tests.js @@ -255,7 +255,6 @@ function getTests() 'TestIdentifyCluster', 'TestLogCommands', 'TestOperationalCredentialsCluster', - 'TestModeSelectCluster', 'TestBinding', ]; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h index 8bea9196da2f7b..56c6deb418a178 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.h @@ -7249,6 +7249,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)readAttributeStartUpModeWithCompletionHandler:(void (^)( NSNumber * _Nullable value, NSError * _Nullable error))completionHandler; +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; /** * This API does not support setting autoResubscribe to NO in the * CHIPSubscribeParams. diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm index 367dda050f27b3..f9bcce15629f2a 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPClustersObjc.mm @@ -26927,6 +26927,29 @@ new CHIPNullableInt8uAttributeCallbackBridge( }); } +- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler +{ + new CHIPDefaultSuccessCallbackBridge( + self.callbackQueue, + ^(id _Nullable ignored, NSError * _Nullable error) { + completionHandler(error); + }, + ^(Cancelable * success, Cancelable * failure) { + ListFreer listFreer; + using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; + TypeInfo::Type cppValue; + if (value == nil) { + cppValue.SetNull(); + } else { + auto & nonNullValue_0 = cppValue.SetNonNull(); + nonNullValue_0 = value.unsignedCharValue; + } + auto successFn = Callback::FromCancelable(success); + auto failureFn = Callback::FromCancelable(failure); + return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); + }); +} + - (void)subscribeAttributeStartUpModeWithMinInterval:(NSNumber * _Nonnull)minInterval maxInterval:(NSNumber * _Nonnull)maxInterval params:(CHIPSubscribeParams * _Nullable)params diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h index c6753ae1bb6de0..601a1e3e207143 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.h @@ -701,7 +701,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm index 87bfd9a92e852f..2837ff1ceec708 100644 --- a/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/CHIPTestClustersObjc.mm @@ -9350,29 +9350,6 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index 180ffae02bacba..acc67d4f028669 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -48729,418 +48729,6 @@ - (void)testSendClusterTestOperationalCredentialsCluster_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTestModeSelectCluster_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read Description"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Description Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@"Coffee"]); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read StandardNamespace"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StandardNamespace Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000003_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read SupportedModes"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read SupportedModes Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue count], 3); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label isEqualToString:@"Black"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode unsignedCharValue], 0); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag unsignedIntValue], 0UL); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label isEqualToString:@"Cappuccino"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode unsignedCharValue], 4); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag unsignedIntValue], 0UL); - XCTAssertTrue([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label isEqualToString:@"Espresso"]); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode unsignedCharValue], 7); - XCTAssertEqual([((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag unsignedIntValue], 0UL); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read CurrentMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000005_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read StartUpMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StartUpMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000006_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read OnMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OnMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertTrue(actualValue == nil); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000007_ChangeToMode -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Change to Supported Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:4]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Supported Mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nonnull currentModeBeforeToggle; -- (void)testSendClusterTestModeSelectCluster_000008_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode Change"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Change Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 4); - } - { - id actualValue = value; - currentModeBeforeToggle = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000009_ChangeToMode -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Change to Unsupported Mode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:2]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Unsupported Mode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000010_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000011_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000012_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode does not change when OnMode is null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode does not change when OnMode is null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, currentModeBeforeToggle); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000013_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Change OnMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id onModeArgument; - onModeArgument = [NSNumber numberWithUnsignedChar:7]; - [cluster writeAttributeOnModeWithValue:onModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change OnMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -NSNumber * _Nullable OnModeValue; -- (void)testSendClusterTestModeSelectCluster_000014_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify OnMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify OnMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 7); - } - { - id actualValue = value; - OnModeValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000015_Off -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000016_On -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Toggle OnOff"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTestModeSelectCluster_000017_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Verify Current Mode Changes if OnMode is not null"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Changes if OnMode is not null Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqualObjects(actualValue, OnModeValue); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - - (void)testSendClusterTestBinding_000000_WaitForCommissionee { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; diff --git a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h index 760272f0ca8256..02e60deaa833c9 100644 --- a/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h +++ b/zzz_generated/all-clusters-app/zap-generated/endpoint_config.h @@ -1455,8 +1455,9 @@ { 0x00000000, ZAP_TYPE(CHAR_STRING), 33, 0, ZAP_LONG_DEFAULTS_INDEX(379) }, /* Description */ \ { 0x00000001, ZAP_TYPE(ENUM16), 2, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ - { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ - { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + { 0x00000003, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(TOKENIZE), ZAP_SIMPLE_DEFAULT(0) }, /* CurrentMode */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, \ + ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(0) }, /* StartUpMode */ \ { 0x00000005, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ ZAP_SIMPLE_DEFAULT(255) }, /* OnMode */ \ @@ -2027,6 +2028,10 @@ const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \ (EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayModeSelectServer[] = { \ + (EmberAfGenericClusterFunction) emberAfModeSelectClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterModeSelectClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayDoorLockServer[] = { \ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerAttributeChangedCallback, \ (EmberAfGenericClusterFunction) MatterDoorLockClusterServerPreAttributeChangedCallback, \ @@ -2873,8 +2878,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(272), \ .attributeCount = 8, \ .clusterSize = 44, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayModeSelectServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 125 ) ,\ .generatedCommandList = nullptr ,\ },\ diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h index c6753ae1bb6de0..601a1e3e207143 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.h @@ -701,7 +701,6 @@ NS_ASSUME_NONNULL_BEGIN - (void)writeAttributeStandardNamespaceWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeSupportedModesWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeCurrentModeWithValue:(NSNumber * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAcceptedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; - (void)writeAttributeAttributeListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm index 87bfd9a92e852f..2837ff1ceec708 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/CHIPTestClustersObjc.mm @@ -9350,29 +9350,6 @@ new CHIPDefaultSuccessCallbackBridge( }); } -- (void)writeAttributeStartUpModeWithValue:(NSNumber * _Nullable)value completionHandler:(StatusCompletion)completionHandler -{ - new CHIPDefaultSuccessCallbackBridge( - self.callbackQueue, - ^(id _Nullable ignored, NSError * _Nullable error) { - completionHandler(error); - }, - ^(Cancelable * success, Cancelable * failure) { - ListFreer listFreer; - using TypeInfo = ModeSelect::Attributes::StartUpMode::TypeInfo; - TypeInfo::Type cppValue; - if (value == nil) { - cppValue.SetNull(); - } else { - auto & nonNullValue_0 = cppValue.SetNonNull(); - nonNullValue_0 = value.unsignedCharValue; - } - auto successFn = Callback::FromCancelable(success); - auto failureFn = Callback::FromCancelable(failure); - return self.cppCluster.WriteAttribute(cppValue, successFn->mContext, successFn->mCall, failureFn->mCall); - }); -} - - (void)writeAttributeGeneratedCommandListWithValue:(NSArray * _Nonnull)value completionHandler:(StatusCompletion)completionHandler { new CHIPDefaultSuccessCallbackBridge( diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index e5b2fae755e46c..75df474bd97069 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -34949,6 +34949,40 @@ class ReadModeSelectStartUpMode : public ModelCommand { } }; +class WriteModeSelectStartUpMode : public ModelCommand { +public: + WriteModeSelectStartUpMode() + : ModelCommand("write") + { + AddArgument("attr-name", "start-up-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + ModelCommand::AddArguments(); + } + + ~WriteModeSelectStartUpMode() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000050) WriteAttribute (0x00000004) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPModeSelect * cluster = [[CHIPModeSelect alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIP_ERROR __block err = CHIP_NO_ERROR; + + NSNumber * _Nullable value = [NSNumber numberWithUnsignedChar:mValue]; + + [cluster writeAttributeStartUpModeWithValue:value + completionHandler:^(NSError * _Nullable error) { + err = [CHIPError errorToCHIPErrorCode:error]; + ChipLogError(chipTool, "ModeSelect StartUpMode Error: %s", chip::ErrorStr(err)); + SetCommandExitStatus(err); + }]; + return err; + } + +private: + uint8_t mValue; +}; + class SubscribeAttributeModeSelectStartUpMode : public ModelCommand { public: SubscribeAttributeModeSelectStartUpMode() @@ -73875,6 +73909,7 @@ void registerClusterModeSelect(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 3e7d79e5cf6b95..44fcafab7368ef 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -158,7 +158,6 @@ class TestList : public Command { printf("TestIdentifyCluster\n"); printf("TestLogCommands\n"); printf("TestOperationalCredentialsCluster\n"); - printf("TestModeSelectCluster\n"); printf("TestBinding\n"); printf("Test_TC_SWDIAG_1_1\n"); printf("Test_TC_SWDIAG_2_1\n"); @@ -55788,516 +55787,6 @@ class TestOperationalCredentialsCluster : public TestCommandBridge { } }; -class TestModeSelectCluster : public TestCommandBridge { -public: - TestModeSelectCluster() - : TestCommandBridge("TestModeSelectCluster") - , mTestIndex(0) - { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } - - ~TestModeSelectCluster() {} - - /////////// TestCommand Interface ///////// - void NextTest() override - { - CHIP_ERROR err = CHIP_NO_ERROR; - - if (0 == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Start: TestModeSelectCluster\n"); - } - - if (mTestCount == mTestIndex) { - ChipLogProgress(chipTool, " **** Test Complete: TestModeSelectCluster\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 Description\n"); - err = TestReadDescription_1(); - break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read StandardNamespace\n"); - err = TestReadStandardNamespace_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read SupportedModes\n"); - err = TestReadSupportedModes_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read CurrentMode\n"); - err = TestReadCurrentMode_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read StartUpMode\n"); - err = TestReadStartUpMode_5(); - break; - case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read OnMode\n"); - err = TestReadOnMode_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Change to Supported Mode\n"); - err = TestChangeToSupportedMode_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Verify Current Mode Change\n"); - err = TestVerifyCurrentModeChange_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Change to Unsupported Mode\n"); - err = TestChangeToUnsupportedMode_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Toggle OnOff\n"); - err = TestToggleOnOff_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : Toggle OnOff\n"); - err = TestToggleOnOff_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Verify Current Mode does not change when OnMode is null\n"); - err = TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Change OnMode\n"); - err = TestChangeOnMode_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Verify OnMode\n"); - err = TestVerifyOnMode_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Toggle OnOff\n"); - err = TestToggleOnOff_15(); - break; - case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Toggle OnOff\n"); - err = TestToggleOnOff_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Verify Current Mode Changes if OnMode is not null\n"); - err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_17(); - break; - } - - if (CHIP_NO_ERROR != err) { - ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); - SetCommandExitStatus(err); - } - } - - 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 = 18; - - chip::Optional mNodeId; - chip::Optional mCluster; - chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadDescription_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeDescriptionWithCompletionHandler:^(NSString * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read Description Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueAsString("Description", actualValue, @"Coffee")); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadStandardNamespace_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeStandardNamespaceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StandardNamespace Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("StandardNamespace", actualValue)); - VerifyOrReturn(CheckValue("StandardNamespace", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadSupportedModes_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeSupportedModesWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read SupportedModes Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("SupportedModes", [actualValue count], static_cast(3))); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).label, @"Black")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).mode, 0)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[0]).semanticTag, 0UL)); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).label, @"Cappuccino")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).mode, 4)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[1]).semanticTag, 0UL)); - VerifyOrReturn( - CheckValueAsString("Label", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).label, @"Espresso")); - VerifyOrReturn(CheckValue("Mode", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).mode, 7)); - VerifyOrReturn( - CheckValue("SemanticTag", ((CHIPModeSelectClusterModeOptionStruct *) actualValue[2]).semanticTag, 0UL)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadCurrentMode_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read CurrentMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadStartUpMode_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeStartUpModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read StartUpMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("StartUpMode", actualValue)); - VerifyOrReturn(CheckValue("StartUpMode", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadOnMode_6() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read OnMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNull("OnMode", actualValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestChangeToSupportedMode_7() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:4]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Supported Mode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nonnull currentModeBeforeToggle; - - CHIP_ERROR TestVerifyCurrentModeChange_8() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Change Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, 4)); - } - { - currentModeBeforeToggle = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestChangeToUnsupportedMode_9() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - __auto_type * params = [[CHIPModeSelectClusterChangeToModeParams alloc] init]; - params.newMode = [NSNumber numberWithUnsignedChar:2]; - [cluster changeToModeWithParams:params - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change to Unsupported Mode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_10() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_11() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyCurrentModeDoesNotChangeWhenOnModeIsNull_12() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode does not change when OnMode is null Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, currentModeBeforeToggle)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestChangeOnMode_13() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id onModeArgument; - onModeArgument = [NSNumber numberWithUnsignedChar:7]; - [cluster writeAttributeOnModeWithValue:onModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Change OnMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - NSNumber * _Nullable OnModeValue; - - CHIP_ERROR TestVerifyOnMode_14() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOnModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify OnMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("OnMode", actualValue)); - VerifyOrReturn(CheckValue("OnMode", actualValue, 7)); - } - { - OnModeValue = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_15() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster offWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestToggleOnOff_16() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestOnOff * cluster = [[CHIPTestOnOff alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster onWithCompletionHandler:^(NSError * _Nullable err) { - NSLog(@"Toggle OnOff Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestVerifyCurrentModeChangesIfOnModeIsNotNull_17() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestModeSelect * cluster = [[CHIPTestModeSelect alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Verify Current Mode Changes if OnMode is not null Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, OnModeValue)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } -}; - class TestBinding : public TestCommandBridge { public: TestBinding() @@ -57452,7 +56941,6 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), - make_unique(), make_unique(), make_unique(), make_unique(), diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index a6c6bdb48e050d..41a3b8c09bd0ff 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -7198,6 +7198,32 @@ class ModeSelectChangeToMode : public ClusterCommand chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type mRequest; }; +class WriteModeSelectStartUpMode : public WriteAttribute +{ +public: + WriteModeSelectStartUpMode(CredentialIssuerCommands * credsIssuerConfig) : WriteAttribute("StartUpMode", credsIssuerConfig) + { + AddArgument("attr-name", "start-up-mode"); + AddArgument("attr-value", 0, UINT8_MAX, &mValue); + WriteAttribute::AddArguments(); + } + + ~WriteModeSelectStartUpMode() {} + + CHIP_ERROR SendCommand(ChipDevice * device, std::vector endpointIds) override + { + return WriteAttribute::SendCommand(device, endpointIds.at(0), 0x00000050, 0x00000004, mValue); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex, chip::NodeId senderNodeId) override + { + return WriteAttribute::SendGroupCommand(groupId, fabricIndex, senderNodeId, 0x00000050, 0x00000004, mValue); + } + +private: + chip::app::DataModel::Nullable mValue; +}; + class WriteModeSelectOnMode : public WriteAttribute { public: @@ -21796,6 +21822,7 @@ void registerClusterModeSelect(Commands & commands, CredentialIssuerCommands * c make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // make_unique(credsIssuerConfig), // make_unique(Id, credsIssuerConfig), // make_unique(Id, "description", Attributes::Description::Id, credsIssuerConfig), // diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index c43ae121cefa38..767cce84c1d7fc 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -90171,6 +90171,7 @@ class TestModeSelectClusterSuite : public TestCommand AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); AddArgument("timeout", 0, UINT16_MAX, &mTimeout); } @@ -90273,6 +90274,34 @@ class TestModeSelectClusterSuite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 17 : Verify Current Mode Changes if OnMode is not null\n"); err = TestVerifyCurrentModeChangesIfOnModeIsNotNull_17(); break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Change to Unsupported StartUp Mode\n"); + err = TestChangeToUnsupportedStartUpMode_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Change to Supported StartUp Mode\n"); + err = TestChangeToSupportedStartUpMode_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Verify StartUp Mode Change\n"); + err = TestVerifyStartUpModeChange_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Change CurrentMode to another value\n"); + err = TestChangeCurrentModeToAnotherValue_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Reboot target device\n"); + err = TestRebootTargetDevice_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Verify Current Mode Change based on new StartUp Mode\n"); + err = TestVerifyCurrentModeChangeBasedOnNewStartUpMode_24(); + break; } if (CHIP_NO_ERROR != err) @@ -90289,11 +90318,12 @@ class TestModeSelectClusterSuite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 18; + const uint16_t mTestCount = 25; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; + chip::Optional mDiscriminator; chip::Optional mTimeout; uint8_t currentModeBeforeToggle; @@ -90420,6 +90450,46 @@ class TestModeSelectClusterSuite : public TestCommand (static_cast(context))->OnSuccessResponse_17(currentMode); } + static void OnFailureCallback_18(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_18(error); + } + + static void OnSuccessCallback_18(void * context) + { + (static_cast(context))->OnSuccessResponse_18(); + } + + static void OnFailureCallback_19(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_19(error); + } + + static void OnSuccessCallback_19(void * context) + { + (static_cast(context))->OnSuccessResponse_19(); + } + + static void OnFailureCallback_20(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_20(error); + } + + static void OnSuccessCallback_20(void * context, const chip::app::DataModel::Nullable & startUpMode) + { + (static_cast(context))->OnSuccessResponse_20(startUpMode); + } + + static void OnFailureCallback_24(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_24(error); + } + + static void OnSuccessCallback_24(void * context, uint8_t currentMode) + { + (static_cast(context))->OnSuccessResponse_24(currentMode); + } + // // Tests methods // @@ -90880,6 +90950,142 @@ class TestModeSelectClusterSuite : public TestCommand NextTest(); } + + CHIP_ERROR TestChangeToUnsupportedStartUpMode_18() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::Nullable startUpModeArgument; + startUpModeArgument.SetNonNull(); + startUpModeArgument.Value() = 2; + + ReturnErrorOnFailure(cluster.WriteAttribute( + startUpModeArgument, this, OnSuccessCallback_18, OnFailureCallback_18)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_18(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_18() { ThrowSuccessResponse(); } + + CHIP_ERROR TestChangeToSupportedStartUpMode_19() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + chip::app::DataModel::Nullable startUpModeArgument; + startUpModeArgument.SetNonNull(); + startUpModeArgument.Value() = 7; + + ReturnErrorOnFailure(cluster.WriteAttribute( + startUpModeArgument, this, OnSuccessCallback_19, OnFailureCallback_19)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_19(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_19() { NextTest(); } + + CHIP_ERROR TestVerifyStartUpModeChange_20() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_20, OnFailureCallback_20, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_20(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_20(const chip::app::DataModel::Nullable & startUpMode) + { + VerifyOrReturn(CheckValueNonNull("startUpMode", startUpMode)); + VerifyOrReturn(CheckValue("startUpMode.Value()", startUpMode.Value(), 7)); + + NextTest(); + } + + CHIP_ERROR TestChangeCurrentModeToAnotherValue_21() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + using RequestType = chip::app::Clusters::ModeSelect::Commands::ChangeToMode::Type; + + RequestType request; + request.newMode = 0; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_21(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_21(error); + }; + + ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_21(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_21() { NextTest(); } + + CHIP_ERROR TestRebootTargetDevice_22() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_23() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR TestVerifyCurrentModeChangeBasedOnNewStartUpMode_24() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ModeSelectClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_24, OnFailureCallback_24, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_24(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_24(uint8_t currentMode) + { + VerifyOrReturn(CheckValue("currentMode", currentMode, 7)); + + NextTest(); + } }; class TestSystemCommandsSuite : public TestCommand diff --git a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h index cc7101d2393a9c..f828fa6405832b 100644 --- a/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app1/zap-generated/endpoint_config.h @@ -375,9 +375,10 @@ ZAP_EMPTY_DEFAULT() }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ - { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Type */ \ @@ -616,6 +617,10 @@ const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayModeSelectServer[] = { \ + (EmberAfGenericClusterFunction) emberAfModeSelectClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterModeSelectClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \ (EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \ }; \ @@ -963,8 +968,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(68), \ .attributeCount = 7, \ .clusterSize = 41, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayModeSelectServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ .generatedCommandList = nullptr ,\ },\ diff --git a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h index cc7101d2393a9c..f828fa6405832b 100644 --- a/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h +++ b/zzz_generated/placeholder/app2/zap-generated/endpoint_config.h @@ -375,9 +375,10 @@ ZAP_EMPTY_DEFAULT() }, /* StandardNamespace */ \ { 0x00000002, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE), ZAP_EMPTY_DEFAULT() }, /* SupportedModes */ \ { 0x00000003, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* CurrentMode */ \ - { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ - { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ - { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + { 0x00000004, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE) | ZAP_ATTRIBUTE_MASK(NULLABLE), \ + ZAP_EMPTY_DEFAULT() }, /* StartUpMode */ \ + { 0x0000FFFC, ZAP_TYPE(BITMAP32), 4, 0, ZAP_LONG_DEFAULTS_INDEX(40) }, /* FeatureMap */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ /* Endpoint: 0, Cluster: Window Covering (server) */ \ { 0x00000000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Type */ \ @@ -616,6 +617,10 @@ const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \ (EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \ }; \ + const EmberAfGenericClusterFunction chipFuncArrayModeSelectServer[] = { \ + (EmberAfGenericClusterFunction) emberAfModeSelectClusterServerInitCallback, \ + (EmberAfGenericClusterFunction) MatterModeSelectClusterServerPreAttributeChangedCallback, \ + }; \ const EmberAfGenericClusterFunction chipFuncArrayWindowCoveringServer[] = { \ (EmberAfGenericClusterFunction) MatterWindowCoveringClusterServerAttributeChangedCallback, \ }; \ @@ -963,8 +968,8 @@ .attributes = ZAP_ATTRIBUTE_INDEX(68), \ .attributeCount = 7, \ .clusterSize = 41, \ - .mask = ZAP_CLUSTER_MASK(SERVER), \ - .functions = NULL, \ + .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ + .functions = chipFuncArrayModeSelectServer, \ .acceptedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 40 ) ,\ .generatedCommandList = nullptr ,\ },\ From 035911e5f6052bfc63938b657737a455899790c8 Mon Sep 17 00:00:00 2001 From: Kundok Park <97262718+kpark-apple@users.noreply.github.com> Date: Wed, 23 Mar 2022 22:16:54 -0700 Subject: [PATCH 36/70] Fix AttributeCache forwarding callback (#16566) * Fix forwarded OnAttributeData callback losing data by copying the TLV reader before its state changes for cache update. --- src/app/AttributeCache.cpp | 9 ++- src/app/tests/TestAttributeCache.cpp | 96 ++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 7 deletions(-) diff --git a/src/app/AttributeCache.cpp b/src/app/AttributeCache.cpp index 349a8563636144..e25f5958d15f6f 100644 --- a/src/app/AttributeCache.cpp +++ b/src/app/AttributeCache.cpp @@ -115,12 +115,19 @@ void AttributeCache::OnAttributeData(const ConcreteDataAttributePath & aPath, TL // VerifyOrDie(!aPath.IsListItemOperation()); + // Copy the reader for forwarding + TLV::TLVReader dataSnapshot; + if (apData) + { + dataSnapshot.Init(*apData); + } + UpdateCache(aPath, apData, aStatus); // // Forward the call through. // - mCallback.OnAttributeData(aPath, apData, aStatus); + mCallback.OnAttributeData(aPath, apData ? &dataSnapshot : nullptr, aStatus); } CHIP_ERROR AttributeCache::Get(const ConcreteAttributePath & path, TLV::TLVReader & reader) diff --git a/src/app/tests/TestAttributeCache.cpp b/src/app/tests/TestAttributeCache.cpp index 7683f71c9fc126..a4d26b59e4493a 100644 --- a/src/app/tests/TestAttributeCache.cpp +++ b/src/app/tests/TestAttributeCache.cpp @@ -105,6 +105,61 @@ uint8_t AttributeInstruction::sInstructionId = 0; using AttributeInstructionListType = std::vector; +class ForwardedDataCallbackValidator final +{ +public: + void SetExpectation(TLV::TLVReader & aData, EndpointId endpointId, AttributeInstruction::AttributeType attributeType) + { + auto length = aData.GetRemainingLength(); + std::vector buffer(aData.GetReadPoint(), aData.GetReadPoint() + length); + if (!mExpectedBuffers.empty() && endpointId == mLastEndpointId && attributeType == mLastAttributeType) + { + // For overriding test, the last buffered data is removed. + mExpectedBuffers.pop_back(); + } + mExpectedBuffers.push_back(buffer); + mLastEndpointId = endpointId; + mLastAttributeType = attributeType; + } + + void SetExpectation() { mExpectedBuffers.clear(); } + + void ValidateData(TLV::TLVReader & aData, bool isListOperation) + { + NL_TEST_ASSERT(gSuite, !mExpectedBuffers.empty()); + if (!mExpectedBuffers.empty() > 0) + { + auto buffer = mExpectedBuffers.front(); + mExpectedBuffers.erase(mExpectedBuffers.begin()); + uint32_t length = static_cast(buffer.size()); + if (isListOperation) + { + // List operation will attach end of container + NL_TEST_ASSERT(gSuite, length < aData.GetRemainingLength()); + } + else + { + NL_TEST_ASSERT(gSuite, length == aData.GetRemainingLength()); + } + if (length <= aData.GetRemainingLength() && length > 0) + { + NL_TEST_ASSERT(gSuite, memcmp(aData.GetReadPoint(), buffer.data(), length) == 0); + if (memcmp(aData.GetReadPoint(), buffer.data(), length) != 0) + { + ChipLogProgress(DataManagement, "Failed"); + } + } + } + } + + void ValidateNoData() { NL_TEST_ASSERT(gSuite, mExpectedBuffers.empty()); } + +private: + std::vector> mExpectedBuffers; + EndpointId mLastEndpointId; + AttributeInstruction::AttributeType mLastAttributeType; +}; + class DataSeriesGenerator { public: @@ -112,14 +167,14 @@ class DataSeriesGenerator mReadCallback(readCallback), mInstructionList(instructionList) {} - void Generate(); + void Generate(ForwardedDataCallbackValidator & dataCallbackValidator); private: ReadClient::Callback * mReadCallback; AttributeInstructionListType & mInstructionList; }; -void DataSeriesGenerator::Generate() +void DataSeriesGenerator::Generate(ForwardedDataCallbackValidator & dataCallbackValidator) { System::PacketBufferHandle handle; System::PacketBufferTLVWriter writer; @@ -197,12 +252,14 @@ void DataSeriesGenerator::Generate() writer.Finalize(&handle); reader.Init(std::move(handle)); NL_TEST_ASSERT(gSuite, reader.Next() == CHIP_NO_ERROR); + dataCallbackValidator.SetExpectation(reader, instruction.mEndpointId, instruction.mAttributeType); callback->OnAttributeData(path, &reader, status); } else { ChipLogProgress(DataManagement, "\t -- Generating Status"); status.mStatus = Protocols::InteractionModel::Status::Failure; + dataCallbackValidator.SetExpectation(); callback->OnAttributeData(path, nullptr, status); } @@ -215,12 +272,34 @@ void DataSeriesGenerator::Generate() class CacheValidator : public AttributeCache::Callback { public: - CacheValidator(AttributeInstructionListType & instructionList); + CacheValidator(AttributeInstructionListType & instructionList, ForwardedDataCallbackValidator & dataCallbackValidator); Clusters::TestCluster::Attributes::TypeInfo::DecodableType clusterValue; private: void OnDone() override {} + void OnAttributeData(const ConcreteDataAttributePath & aPath, TLV::TLVReader * apData, const StatusIB & aStatus) override + { + ChipLogProgress(DataManagement, "\t\t -- Validating OnAttributeData callback"); + // Ensure that the provided path is one that we're expecting to find + auto iter = mExpectedAttributes.find(aPath); + NL_TEST_ASSERT(gSuite, iter != mExpectedAttributes.end()); + + if (aStatus.IsSuccess()) + { + // Verify that the apData is passed as nonnull + NL_TEST_ASSERT(gSuite, apData != nullptr); + if (apData) + { + mDataCallbackValidator.ValidateData(*apData, aPath.IsListOperation()); + } + } + else + { + mDataCallbackValidator.ValidateNoData(); + } + } + void DecodeAttribute(const AttributeInstruction & instruction, const ConcreteAttributePath & path, AttributeCache * cache) { CHIP_ERROR err; @@ -431,9 +510,13 @@ class CacheValidator : public AttributeCache::Callback std::set mExpectedAttributes; std::set> mExpectedClusters; std::set mExpectedEndpoints; + + ForwardedDataCallbackValidator & mDataCallbackValidator; }; -CacheValidator::CacheValidator(AttributeInstructionListType & instructionList) +CacheValidator::CacheValidator(AttributeInstructionListType & instructionList, + ForwardedDataCallbackValidator & dataCallbackValidator) : + mDataCallbackValidator(dataCallbackValidator) { for (auto & instruction : instructionList) { @@ -452,10 +535,11 @@ CacheValidator::CacheValidator(AttributeInstructionListType & instructionList) void RunAndValidateSequence(AttributeInstructionListType list) { - CacheValidator client(list); + ForwardedDataCallbackValidator dataCallbackValidator; + CacheValidator client(list, dataCallbackValidator); AttributeCache cache(client); DataSeriesGenerator generator(&cache.GetBufferedCallback(), list); - generator.Generate(); + generator.Generate(dataCallbackValidator); } /* From 234648f74b0ce073fafe23c86983daee02bf4dc8 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Thu, 24 Mar 2022 01:18:47 -0400 Subject: [PATCH 37/70] [EFR32] Add comments to examples BUILD.gn (#16575) * Add coments to examples BUILD.gn * fix CI --- examples/light-switch-app/efr32/BUILD.gn | 123 +++++++++------- examples/lighting-app/efr32/BUILD.gn | 120 +++++++++------- examples/lock-app/efr32/BUILD.gn | 113 +++++++++------ .../platform/efr32/ldscripts/efr32mg12.ld | 2 +- examples/window-app/efr32/BUILD.gn | 136 ++++++++++-------- 5 files changed, 285 insertions(+), 209 deletions(-) diff --git a/examples/light-switch-app/efr32/BUILD.gn b/examples/light-switch-app/efr32/BUILD.gn index 62f164e933a0d3..599d6efa3ea182 100644 --- a/examples/light-switch-app/efr32/BUILD.gn +++ b/examples/light-switch-app/efr32/BUILD.gn @@ -62,6 +62,14 @@ declare_args() { show_qr_code = true } +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) +} + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false @@ -70,17 +78,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # Enables LCD on supported devices lcd_on = show_qr_code -if (use_rs911x || use_wf200) { +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -89,6 +90,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -117,25 +125,25 @@ efr32_sdk("sdk") { "PW_RPC_ENABLED", ] } - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } - if (use_rs911x || use_wf200) { if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } @@ -171,7 +179,9 @@ efr32_executable("light_switch_app") { "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] - if (!use_rs911x && !use_wf200) { + + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -195,30 +205,33 @@ efr32_executable("light_switch_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs } if (lcd_on) { @@ -285,6 +298,14 @@ efr32_executable("light_switch_app") { ] } + # WiFi Settings + if (chip_enable_wifi) { + ldflags += [ + "-Wl,--defsym", + "-Wl,SILABS_WIFI=1", + ] + } + output_dir = root_out_dir } diff --git a/examples/lighting-app/efr32/BUILD.gn b/examples/lighting-app/efr32/BUILD.gn index 9543da7df39507..3d93d8919e6ef7 100644 --- a/examples/lighting-app/efr32/BUILD.gn +++ b/examples/lighting-app/efr32/BUILD.gn @@ -62,6 +62,14 @@ declare_args() { show_qr_code = true } +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) +} + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false @@ -70,17 +78,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # Enables LCD on supported devices lcd_on = show_qr_code -if (use_rs911x || use_wf200) { +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -89,6 +90,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -117,24 +125,25 @@ efr32_sdk("sdk") { "PW_RPC_ENABLED", ] } - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } - if (use_rs911x || use_wf200) { + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } + if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } @@ -169,7 +178,9 @@ efr32_executable("lighting_app") { "${chip_root}/src/lib", "${chip_root}/src/setup_payload", ] - if (!use_rs911x && !use_wf200) { + + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -193,30 +204,33 @@ efr32_executable("lighting_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs } if (lcd_on) { @@ -287,7 +301,9 @@ efr32_executable("lighting_app") { "-fstack-usage", ] } - if (use_rs911x || use_wf200) { + + # WiFi Settings + if (chip_enable_wifi) { ldflags += [ "-Wl,--defsym", "-Wl,SILABS_WIFI=1", diff --git a/examples/lock-app/efr32/BUILD.gn b/examples/lock-app/efr32/BUILD.gn index 4b28d1732ddcd2..2c4954f2a16899 100644 --- a/examples/lock-app/efr32/BUILD.gn +++ b/examples/lock-app/efr32/BUILD.gn @@ -61,6 +61,14 @@ declare_args() { show_qr_code = true } +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) +} + # BRD4166A --> ThunderBoard Sense 2 (No LCD) if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { show_qr_code = false @@ -69,17 +77,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { # Enables LCD on supported devices lcd_on = show_qr_code -if (use_rs911x || use_wf200) { +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -88,6 +89,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -123,16 +131,24 @@ efr32_sdk("sdk") { include_dirs += wf200_plat_incs } - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } - if (use_rs911x || use_wf200) { + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } + if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } @@ -171,7 +187,9 @@ efr32_executable("lock_app") { "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", "${examples_plat_dir}:efr-matter-shell", ] - if (!use_rs911x && !use_wf200) { + + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -195,30 +213,33 @@ efr32_executable("lock_app") { sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] } - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs } if (lcd_on) { @@ -289,7 +310,9 @@ efr32_executable("lock_app") { "-fstack-usage", ] } - if (use_rs911x || use_wf200) { + + # WiFi Settings + if (chip_enable_wifi) { ldflags += [ "-Wl,--defsym", "-Wl,SILABS_WIFI=1", diff --git a/examples/platform/efr32/ldscripts/efr32mg12.ld b/examples/platform/efr32/ldscripts/efr32mg12.ld index a2a81ed9ccc683..f55f03521bc1e4 100644 --- a/examples/platform/efr32/ldscripts/efr32mg12.ld +++ b/examples/platform/efr32/ldscripts/efr32mg12.ld @@ -284,6 +284,6 @@ SECTIONS /* Check if FLASH usage exceeds FLASH size */ - ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !") + ASSERT( LENGTH(FLASH) >= (__etext), "FLASH memory overflowed !") ASSERT((__etext + SIZEOF(.data)) <= __nvm3Base, "FLASH memory overlapped with NVM section.") } diff --git a/examples/window-app/efr32/BUILD.gn b/examples/window-app/efr32/BUILD.gn index 7d6e4961e71a9b..a8f69ee7228fd8 100644 --- a/examples/window-app/efr32/BUILD.gn +++ b/examples/window-app/efr32/BUILD.gn @@ -55,6 +55,14 @@ declare_args() { show_qr_code = true } +# Sanity check +assert(!(chip_enable_wifi && chip_enable_openthread)) +assert(!(use_rs911x && chip_enable_openthread)) +assert(!(use_wf200 && chip_enable_openthread)) +if (chip_enable_wifi) { + assert(use_rs911x || use_wf200) +} + # Enables LCD on supported devices lcd_on = true @@ -64,17 +72,10 @@ if (efr32_board == "BRD4166A" || efr32_board == "BRD4180A") { lcd_on = false } -if (use_rs911x || use_wf200) { +# WiFi settings +if (chip_enable_wifi) { wifi_sdk_dir = "${chip_root}/third_party/efr32_sdk/repo/matter/wifi" - if (use_rs911x) { - wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" - import("${wifi_sdk_dir}/rs911x/rs911x.gni") - } else { - import("${wifi_sdk_dir}/wf200/wf200.gni") - } -} -efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] -if (use_rs911x || use_wf200) { + efr32_lwip_defs = [ "LWIP_NETIF_API=1" ] efr32_lwip_defs += [ "LWIP_IPV4=1", "LWIP_ARP=1", @@ -83,6 +84,13 @@ if (use_rs911x || use_wf200) { "LWIP_IPV6_ND=1", "LWIP_IGMP=1", ] + + if (use_rs911x) { + wiseconnect_sdk_root = "${chip_root}/third_party/wiseconnect-wifi-bt-sdk" + import("${wifi_sdk_dir}/rs911x/rs911x.gni") + } else { + import("${wifi_sdk_dir}/wf200/wf200.gni") + } } efr32_sdk("sdk") { @@ -103,24 +111,25 @@ efr32_sdk("sdk") { "CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE=${setupPinCode}", "OTA_PERIODIC_TIMEOUT=${OTA_periodic_query_timeout}", ] - if (use_rs911x) { - defines += rs911x_defs - include_dirs += rs911x_plat_incs - } else if (use_wf200) { - defines += wf200_defs - include_dirs += wf200_plat_incs - } - if (use_rs911x_sockets) { - include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] - defines += rs911x_sock_defs - } else { - # Using LWIP instead of the native TCP/IP stack - # Thread also uses LWIP - # - defines += efr32_lwip_defs - } - if (use_rs911x || use_wf200) { + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + defines += rs911x_defs + include_dirs += rs911x_plat_incs + } else if (use_wf200) { + defines += wf200_defs + include_dirs += wf200_plat_incs + } + + if (use_rs911x_sockets) { + include_dirs += [ "${examples_plat_dir}/wifi/rsi-sockets" ] + defines += rs911x_sock_defs + } else { + # Using LWIP instead of the native TCP/IP stack + defines += efr32_lwip_defs + } + if (sl_wfx_config_softap) { defines += [ "SL_WFX_CONFIG_SOFTAP" ] } @@ -149,40 +158,10 @@ efr32_executable("window_app") { "src/main.cpp", ] - if (chip_build_libshell || enable_openthread_cli) { + if (chip_build_libshell || enable_openthread_cli || enable_openthread_cli) { sources += [ "${examples_plat_dir}/uart.cpp" ] } - if (chip_enable_ota_requestor) { - defines += [ "EFR32_OTA_ENABLED" ] - sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] - } - - if (use_rs911x) { - sources += rs911x_src_plat - - # All the stuff from wiseconnect - sources += rs911x_src_sapi - - # Apparently - the rsi library needs this (though we may not use use it) - sources += rs911x_src_sock - include_dirs += rs911x_inc_plat - - if (use_rs911x_sockets) { - # - # Using native sockets inside RS911x - # - include_dirs += rs911x_sock_inc - } else { - # - # We use LWIP - not built-in sockets - # - sources += rs911x_src_lwip - } - } else if (use_wf200) { - sources += wf200_plat_src - include_dirs += wf200_plat_incs - } deps = [ ":sdk", "${chip_root}/examples/window-app/common:window-common", @@ -190,7 +169,8 @@ efr32_executable("window_app") { "${chip_root}/src/setup_payload", ] - if (!use_rs911x && !use_wf200) { + # OpenThread Settings + if (chip_enable_openthread) { deps += [ "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", @@ -209,6 +189,40 @@ efr32_executable("window_app") { } } + if (chip_enable_ota_requestor) { + defines += [ "EFR32_OTA_ENABLED" ] + sources += [ "${examples_plat_dir}/OTAConfig.cpp" ] + } + + # WiFi Settings + if (chip_enable_wifi) { + if (use_rs911x) { + sources += rs911x_src_plat + + # All the stuff from wiseconnect + sources += rs911x_src_sapi + + # Apparently - the rsi library needs this (though we may not use use it) + sources += rs911x_src_sock + include_dirs += rs911x_inc_plat + + if (use_rs911x_sockets) { + # + # Using native sockets inside RS911x + # + include_dirs += rs911x_sock_inc + } else { + # + # We use LWIP - not built-in sockets + # + sources += rs911x_src_lwip + } + } else if (use_wf200) { + sources += wf200_plat_src + include_dirs += wf200_plat_incs + } + } + if (lcd_on) { sources += [ "${examples_plat_dir}/display/lcd.c", @@ -240,7 +254,9 @@ efr32_executable("window_app") { "-fstack-usage", ] } - if (use_rs911x || use_wf200) { + + # WiFi Settings + if (chip_enable_wifi) { ldflags += [ "-Wl,--defsym", "-Wl,SILABS_WIFI=1", From 026e01d3970be4329a764b760845f41cd4439501 Mon Sep 17 00:00:00 2001 From: krypton36 Date: Wed, 23 Mar 2022 22:26:47 -0700 Subject: [PATCH 38/70] Resolve missing attributes darwin (#16595) * Resolve missing attributes in chip-tool-darwin * Generated Code --- .../chip-tool-darwin/templates/commands.zapt | 4 - .../zap-generated/cluster/Commands.h | 381 ++++++++++++++++++ 2 files changed, 381 insertions(+), 4 deletions(-) diff --git a/examples/chip-tool-darwin/templates/commands.zapt b/examples/chip-tool-darwin/templates/commands.zapt index 9355d72c0b6a5c..66b97aebb9bdeb 100644 --- a/examples/chip-tool-darwin/templates/commands.zapt +++ b/examples/chip-tool-darwin/templates/commands.zapt @@ -207,7 +207,6 @@ private: {{/unless}} {{/if}} -{{#unless (isStrEqual chipCallback.name "Unsupported")}} {{#if isReportableAttribute}} class SubscribeAttribute{{asUpperCamelCase parent.name}}{{asUpperCamelCase name}}: public ModelCommand { @@ -254,7 +253,6 @@ private: }; {{/if}} -{{/unless}} {{/chip_server_cluster_attributes}} {{/chip_client_clusters}} @@ -272,7 +270,6 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{/chip_cluster_commands}} {{#chip_server_cluster_attributes}} {{! TODO: Various types (floats, structs) not supported here. }} - {{#unless (isStrEqual chipCallback.name "Unsupported")}} make_unique(), // {{#if isWritableAttribute}} {{! No list support for writing yet. Need to figure out how to @@ -284,7 +281,6 @@ void registerCluster{{asUpperCamelCase name}}(Commands & commands) {{#if isReportableAttribute}} make_unique(), // {{/if}} - {{/unless}} {{/chip_server_cluster_attributes}} }; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index 75df474bd97069..610f0d56a7f960 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -2122,6 +2122,53 @@ class ReadApplicationBasicApplication : public ModelCommand { } }; +class SubscribeAttributeApplicationBasicApplication : public ModelCommand { +public: + SubscribeAttributeApplicationBasicApplication() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "application"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeApplicationBasicApplication() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050D) ReportAttribute (0x00000004) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPApplicationBasic * cluster = [[CHIPApplicationBasic alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster + subscribeAttributeApplicationWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPApplicationBasicClusterApplicationBasicApplication * _Nullable value, + NSError * _Nullable error) { + NSLog(@"ApplicationBasic.Application response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute Status */ @@ -2958,6 +3005,52 @@ class WriteApplicationLauncherCurrentApp : public ModelCommand { private: }; +class SubscribeAttributeApplicationLauncherCurrentApp : public ModelCommand { +public: + SubscribeAttributeApplicationLauncherCurrentApp() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "current-app"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeApplicationLauncherCurrentApp() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050C) ReportAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPApplicationLauncher * cluster = [[CHIPApplicationLauncher alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeCurrentAppWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPApplicationLauncherClusterApplicationEP * _Nullable value, + NSError * _Nullable error) { + NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute GeneratedCommandList */ @@ -10660,6 +10753,50 @@ class ReadChannelLineup : public ModelCommand { } }; +class SubscribeAttributeChannelLineup : public ModelCommand { +public: + SubscribeAttributeChannelLineup() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "lineup"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeChannelLineup() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPChannel * cluster = [[CHIPChannel alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster + subscribeAttributeLineupWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPChannelClusterLineupInfo * _Nullable value, NSError * _Nullable error) { + NSLog(@"Channel.Lineup response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute CurrentChannel */ @@ -10693,6 +10830,50 @@ class ReadChannelCurrentChannel : public ModelCommand { } }; +class SubscribeAttributeChannelCurrentChannel : public ModelCommand { +public: + SubscribeAttributeChannelCurrentChannel() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "current-channel"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeChannelCurrentChannel() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000504) ReportAttribute (0x00000002) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPChannel * cluster = [[CHIPChannel alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeCurrentChannelWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + CHIPChannelClusterChannelInfo * _Nullable value, NSError * _Nullable error) { + NSLog(@"Channel.CurrentChannel response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute GeneratedCommandList */ @@ -25387,6 +25568,55 @@ class ReadGeneralCommissioningBasicCommissioningInfo : public ModelCommand { } }; +class SubscribeAttributeGeneralCommissioningBasicCommissioningInfo : public ModelCommand { +public: + SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "basic-commissioning-info"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeGeneralCommissioningBasicCommissioningInfo() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000030) ReportAttribute (0x00000001) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPGeneralCommissioning * cluster = [[CHIPGeneralCommissioning alloc] initWithDevice:device + endpoint:endpointId + queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster + subscribeAttributeBasicCommissioningInfoWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + CHIPGeneralCommissioningClusterBasicCommissioningInfo * _Nullable value, + NSError * _Nullable error) { + NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", + [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RegulatoryConfig */ @@ -34034,6 +34264,50 @@ class ReadMediaPlaybackSampledPosition : public ModelCommand { } }; +class SubscribeAttributeMediaPlaybackSampledPosition : public ModelCommand { +public: + SubscribeAttributeMediaPlaybackSampledPosition() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "sampled-position"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeMediaPlaybackSampledPosition() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000506) ReportAttribute (0x00000003) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPMediaPlayback * cluster = [[CHIPMediaPlayback alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeSampledPositionWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPMediaPlaybackClusterPlaybackPosition * _Nullable value, + NSError * _Nullable error) { + NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute PlaybackSpeed */ @@ -54237,6 +54511,50 @@ class WriteTestClusterStructAttr : public ModelCommand { private: }; +class SubscribeAttributeTestClusterStructAttr : public ModelCommand { +public: + SubscribeAttributeTestClusterStructAttr() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "struct-attr"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeTestClusterStructAttr() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00000025) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeStructAttrWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPTestClusterClusterSimpleStruct * _Nullable value, + NSError * _Nullable error) { + NSLog(@"TestCluster.StructAttr response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute RangeRestrictedInt8u */ @@ -58401,6 +58719,50 @@ class WriteTestClusterNullableStruct : public ModelCommand { private: }; +class SubscribeAttributeTestClusterNullableStruct : public ModelCommand { +public: + SubscribeAttributeTestClusterNullableStruct() + : ModelCommand("subscribe") + { + AddArgument("attr-name", "nullable-struct"); + AddArgument("min-interval", 0, UINT16_MAX, &mMinInterval); + AddArgument("max-interval", 0, UINT16_MAX, &mMaxInterval); + AddArgument("wait", 0, 1, &mWait); + ModelCommand::AddArguments(); + } + + ~SubscribeAttributeTestClusterNullableStruct() {} + + CHIP_ERROR SendCommand(CHIPDevice * device, chip::EndpointId endpointId) override + { + ChipLogProgress(chipTool, "Sending cluster (0x0000050F) ReportAttribute (0x00008025) on endpoint %" PRIu16, endpointId); + dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); + CHIPTestCluster * cluster = [[CHIPTestCluster alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; + CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; + [cluster subscribeAttributeNullableStructWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^(CHIPTestClusterClusterSimpleStruct * _Nullable value, + NSError * _Nullable error) { + NSLog(@"TestCluster.NullableStruct response %@", [value description]); + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + }]; + + return CHIP_NO_ERROR; + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mWait ? UINT16_MAX : 10); + } + +private: + uint16_t mMinInterval; + uint16_t mMaxInterval; + bool mWait; +}; + /* * Attribute NullableRangeRestrictedInt8u */ @@ -72784,6 +73146,8 @@ void registerClusterApplicationBasic(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -72812,6 +73176,9 @@ void registerClusterApplicationLauncher(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -73088,6 +73455,10 @@ void registerClusterChannel(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -73556,6 +73927,8 @@ void registerClusterGeneralCommissioning(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -73876,6 +74249,8 @@ void registerClusterMediaPlayback(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -74558,6 +74933,9 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // @@ -74670,6 +75048,9 @@ void registerClusterTestCluster(Commands & commands) make_unique(), // make_unique(), // make_unique(), // + make_unique(), // + make_unique(), // + make_unique(), // make_unique(), // make_unique(), // make_unique(), // From dcb6609d354f17d71b20859f1117994685c3693e Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Thu, 24 Mar 2022 16:34:00 +0800 Subject: [PATCH 39/70] Add ScopedNodeId and return it by Session::GetPeer() (#16000) * Add ScopedNodeId and return it by Session::GetPeer() * Move ScopedNodeId to a new file * Add guidance about PeerId class * Update src/lib/core/ScopedNodeId.h Co-authored-by: Jerry Johns * Restyle * Undo Progress/Error delta in logging Co-authored-by: Andrei Litvin Co-authored-by: Jerry Johns --- src/lib/core/PeerId.h | 5 +++ src/lib/core/ScopedNodeId.h | 44 +++++++++++++++++++++ src/transport/GroupSession.h | 4 ++ src/transport/SecureSession.cpp | 5 +++ src/transport/SecureSession.h | 1 + src/transport/Session.h | 3 ++ src/transport/UnauthenticatedSessionTable.h | 2 + 7 files changed, 64 insertions(+) create mode 100644 src/lib/core/ScopedNodeId.h diff --git a/src/lib/core/PeerId.h b/src/lib/core/PeerId.h index 4586ee11cda288..d7f355bb50544b 100644 --- a/src/lib/core/PeerId.h +++ b/src/lib/core/PeerId.h @@ -33,6 +33,11 @@ constexpr bool IsValidFabricId(FabricId aFabricId) return aFabricId != kUndefinedFabricId; } +/* NOTE: PeerId should be only used by mDNS, because it contains a compressed fabric id which is not unique, and the compressed + * fabric id is only used for mDNS announcement. ScopedNodeId which contains a node id and fabirc index, should be used in prefer of + * PeerId. ScopedNodeId is locally unique. + */ +// TODO: remove PeerId usage outside lib/dns, move PeerId into lib/dns /// A peer is identified by a node id within a compressed fabric ID class PeerId { diff --git a/src/lib/core/ScopedNodeId.h b/src/lib/core/ScopedNodeId.h new file mode 100644 index 00000000000000..04512df0c64878 --- /dev/null +++ b/src/lib/core/ScopedNodeId.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 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. + */ + +#pragma once + +#include +#include + +namespace chip { + +/// The ScopedNodeId provides an identifier for an operational node on the network that is only valid for use within the current +/// Matter stack instance. It is not to be exchanged or directly used remotely over the network. +class ScopedNodeId +{ +public: + ScopedNodeId() : mNodeId(kUndefinedNodeId), mFabricIndex(kUndefinedFabricIndex) {} + ScopedNodeId(NodeId nodeId, FabricIndex fabricIndex) : mNodeId(nodeId), mFabricIndex(fabricIndex) {} + + NodeId GetNodeId() const { return mNodeId; } + FabricIndex GetFabricIndex() const { return mFabricIndex; } + + bool IsOperational() const { return mFabricIndex != kUndefinedFabricIndex && IsOperationalNodeId(mNodeId); } + bool operator==(const ScopedNodeId & that) const { return (mNodeId == that.mNodeId) && (mFabricIndex == that.mFabricIndex); } + bool operator!=(const ScopedNodeId & that) const { return !(*this == that); } + +private: + NodeId mNodeId; + FabricIndex mFabricIndex; +}; + +} // namespace chip diff --git a/src/transport/GroupSession.h b/src/transport/GroupSession.h index 88315d0527c97f..4114e77db212d1 100644 --- a/src/transport/GroupSession.h +++ b/src/transport/GroupSession.h @@ -66,6 +66,8 @@ class IncomingGroupSession : public Session const char * GetSessionTypeString() const override { return "incoming group"; }; #endif + ScopedNodeId GetPeer() const override { return ScopedNodeId(mSourceNodeId, GetFabricIndex()); } + Access::SubjectDescriptor GetSubjectDescriptor() const override { Access::SubjectDescriptor subjectDescriptor; @@ -131,6 +133,8 @@ class OutgoingGroupSession : public Session const char * GetSessionTypeString() const override { return "outgoing group"; }; #endif + ScopedNodeId GetPeer() const override { return ScopedNodeId(); } + Access::SubjectDescriptor GetSubjectDescriptor() const override { return Access::SubjectDescriptor(); // no subject exists for outgoing group session. diff --git a/src/transport/SecureSession.cpp b/src/transport/SecureSession.cpp index e2688869bc509a..2a55e03e5bbd9a 100644 --- a/src/transport/SecureSession.cpp +++ b/src/transport/SecureSession.cpp @@ -20,6 +20,11 @@ namespace chip { namespace Transport { +ScopedNodeId SecureSession::GetPeer() const +{ + return ScopedNodeId(mPeerNodeId, GetFabricIndex()); +} + Access::SubjectDescriptor SecureSession::GetSubjectDescriptor() const { Access::SubjectDescriptor subjectDescriptor; diff --git a/src/transport/SecureSession.h b/src/transport/SecureSession.h index e77fab01eb7fbf..8146884cf15373 100644 --- a/src/transport/SecureSession.h +++ b/src/transport/SecureSession.h @@ -83,6 +83,7 @@ class SecureSession : public Session const char * GetSessionTypeString() const override { return "secure"; }; #endif + ScopedNodeId GetPeer() const override; Access::SubjectDescriptor GetSubjectDescriptor() const override; bool RequireMRP() const override { return GetPeerAddress().GetTransportType() == Transport::Type::kUdp; } diff --git a/src/transport/Session.h b/src/transport/Session.h index 91b37de45b94a5..8c1ea3291e9bc9 100644 --- a/src/transport/Session.h +++ b/src/transport/Session.h @@ -18,6 +18,8 @@ #include #include +#include +#include #include #include #include @@ -65,6 +67,7 @@ class Session virtual void Retain() {} virtual void Release() {} + virtual ScopedNodeId GetPeer() const = 0; virtual Access::SubjectDescriptor GetSubjectDescriptor() const = 0; virtual bool RequireMRP() const = 0; virtual const ReliableMessageProtocolConfig & GetMRPConfig() const = 0; diff --git a/src/transport/UnauthenticatedSessionTable.h b/src/transport/UnauthenticatedSessionTable.h index 68c8afc66a72eb..5ac2211fd06d05 100644 --- a/src/transport/UnauthenticatedSessionTable.h +++ b/src/transport/UnauthenticatedSessionTable.h @@ -74,6 +74,8 @@ class UnauthenticatedSession : public Session, public ReferenceCounted::Retain(); } void Release() override { ReferenceCounted::Release(); } + ScopedNodeId GetPeer() const override { return ScopedNodeId(kUndefinedNodeId, GetFabricIndex()); } + Access::SubjectDescriptor GetSubjectDescriptor() const override { return Access::SubjectDescriptor(); // return an empty ISD for unauthenticated session. From 07fc8cd08273f7d15cfbade2ff480c3bcd29d7db Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Thu, 24 Mar 2022 01:41:28 -0700 Subject: [PATCH 40/70] Use AttributePathParams Pool, EventPathParams Pool and DataVersionFilter Pool instead. Roughly there is no logical change. (#16467) --- examples/common/pigweed/rpc_services/Device.h | 3 +- src/app/AttributeAccessInterface.h | 1 - src/app/AttributePathExpandIterator.cpp | 46 ++++---- src/app/AttributePathExpandIterator.h | 39 ++++--- src/app/AttributePathParams.h | 34 ++++-- src/app/ClusterInfo.h | 109 ------------------ src/app/DataVersionFilter.h | 10 +- src/app/EventLoggingTypes.h | 11 +- src/app/EventManagement.cpp | 12 +- src/app/EventManagement.h | 9 +- src/app/EventPathParams.h | 23 ++-- src/app/InteractionModelEngine.cpp | 88 +++++++++++--- src/app/InteractionModelEngine.h | 45 +++++--- src/app/MessageDef/AttributePathIB.h | 1 + src/app/MessageDef/EventPathIB.h | 1 + src/app/ObjectList.h | 31 +++++ src/app/ReadClient.cpp | 1 + src/app/ReadHandler.cpp | 60 +++++----- src/app/ReadHandler.h | 21 ++-- src/app/reporting/Engine.cpp | 57 +++++---- src/app/reporting/Engine.h | 8 +- .../tests/TestAttributePathExpandIterator.cpp | 64 +++++----- src/app/tests/TestClusterInfo.cpp | 66 +++++------ src/app/tests/TestCommissionManager.cpp | 3 +- src/app/tests/TestEventLogging.cpp | 35 +++--- src/app/tests/TestEventOverflow.cpp | 1 - src/app/tests/TestInteractionModelEngine.cpp | 66 ++++++----- src/app/tests/TestReadInteraction.cpp | 24 ++-- src/app/tests/TestReportingEngine.cpp | 8 +- .../suites/certification/Test_TC_IDM_3_2.yaml | 39 +++---- .../util/ember-compatibility-functions.cpp | 5 +- src/app/util/mock/attribute-storage.cpp | 1 - 32 files changed, 472 insertions(+), 450 deletions(-) delete mode 100644 src/app/ClusterInfo.h create mode 100644 src/app/ObjectList.h diff --git a/examples/common/pigweed/rpc_services/Device.h b/examples/common/pigweed/rpc_services/Device.h index fc5605d7dbd538..e0979365529f3f 100644 --- a/examples/common/pigweed/rpc_services/Device.h +++ b/examples/common/pigweed/rpc_services/Device.h @@ -160,8 +160,7 @@ class Device : public pw_rpc::nanopb::Device::Service virtual pw::Status SetPairingInfo(const chip_rpc_PairingInfo & request, pw_protobuf_Empty & response) { if (DeviceLayer::GetCommissionableDataProvider()->SetSetupPasscode(request.code) != CHIP_NO_ERROR || - DeviceLayer::GetCommissionableDataProvider()->SetSetupDiscriminator(request.discriminator) != - CHIP_NO_ERROR) + DeviceLayer::GetCommissionableDataProvider()->SetSetupDiscriminator(request.discriminator) != CHIP_NO_ERROR) { return pw::Status::Unknown(); } diff --git a/src/app/AttributeAccessInterface.h b/src/app/AttributeAccessInterface.h index 7840dac52ebe53..2bb686ba7ca2fd 100644 --- a/src/app/AttributeAccessInterface.h +++ b/src/app/AttributeAccessInterface.h @@ -19,7 +19,6 @@ #pragma once #include -#include #include #include #include diff --git a/src/app/AttributePathExpandIterator.cpp b/src/app/AttributePathExpandIterator.cpp index 235d45185a2dee..3409808ff7c8b5 100644 --- a/src/app/AttributePathExpandIterator.cpp +++ b/src/app/AttributePathExpandIterator.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -52,9 +52,9 @@ extern bool emberAfEndpointIndexIsEnabled(uint16_t index); namespace chip { namespace app { -AttributePathExpandIterator::AttributePathExpandIterator(ClusterInfo * aClusterInfo) +AttributePathExpandIterator::AttributePathExpandIterator(ObjectList * aAttributePath) { - mpClusterInfo = aClusterInfo; + mpAttributePath = aAttributePath; // Reset iterator state mEndpointIndex = UINT16_MAX; @@ -71,42 +71,42 @@ AttributePathExpandIterator::AttributePathExpandIterator(ClusterInfo * aClusterI Next(); } -void AttributePathExpandIterator::PrepareEndpointIndexRange(const ClusterInfo & aClusterInfo) +void AttributePathExpandIterator::PrepareEndpointIndexRange(const AttributePathParams & aAttributePath) { - if (aClusterInfo.HasWildcardEndpointId()) + if (aAttributePath.HasWildcardEndpointId()) { mEndpointIndex = 0; mEndEndpointIndex = emberAfEndpointCount(); } else { - mEndpointIndex = emberAfIndexFromEndpoint(aClusterInfo.mEndpointId); + mEndpointIndex = emberAfIndexFromEndpoint(aAttributePath.mEndpointId); // If the given cluster id does not exist on the given endpoint, it will return uint16(0xFFFF), then endEndpointIndex // will be 0, means we should iterate a null endpoint set (skip it). mEndEndpointIndex = static_cast(mEndpointIndex + 1); } } -void AttributePathExpandIterator::PrepareClusterIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId) +void AttributePathExpandIterator::PrepareClusterIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId) { - if (aClusterInfo.HasWildcardClusterId()) + if (aAttributePath.HasWildcardClusterId()) { mClusterIndex = 0; mEndClusterIndex = emberAfClusterCount(aEndpointId, true /* server */); } else { - mClusterIndex = emberAfClusterIndex(aEndpointId, aClusterInfo.mClusterId, CLUSTER_MASK_SERVER); + mClusterIndex = emberAfClusterIndex(aEndpointId, aAttributePath.mClusterId, CLUSTER_MASK_SERVER); // If the given cluster id does not exist on the given endpoint, it will return uint8(0xFF), then endClusterIndex // will be 0, means we should iterate a null cluster set (skip it). mEndClusterIndex = static_cast(mClusterIndex + 1); } } -void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId, +void AttributePathExpandIterator::PrepareAttributeIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId, ClusterId aClusterId) { - if (aClusterInfo.HasWildcardAttributeId()) + if (aAttributePath.HasWildcardAttributeId()) { mAttributeIndex = 0; mEndAttributeIndex = emberAfGetServerAttributeCount(aEndpointId, aClusterId); @@ -115,7 +115,7 @@ void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & } else { - mAttributeIndex = emberAfGetServerAttributeIndexByAttributeId(aEndpointId, aClusterId, aClusterInfo.mAttributeId); + mAttributeIndex = emberAfGetServerAttributeIndexByAttributeId(aEndpointId, aClusterId, aAttributePath.mAttributeId); // If the given attribute id does not exist on the given endpoint, it will return uint16(0xFFFF), then endAttributeIndex // will be 0, means we should iterate a null attribute set (skip it). mEndAttributeIndex = static_cast(mAttributeIndex + 1); @@ -129,7 +129,7 @@ void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & mGlobalAttributeIndex = UINT8_MAX; for (uint8_t idx = 0; idx < ArraySize(GlobalAttributesNotInMetadata); ++idx) { - if (GlobalAttributesNotInMetadata[idx] == aClusterInfo.mAttributeId) + if (GlobalAttributesNotInMetadata[idx] == aAttributePath.mAttributeId) { mGlobalAttributeIndex = idx; break; @@ -142,25 +142,25 @@ void AttributePathExpandIterator::PrepareAttributeIndexRange(const ClusterInfo & bool AttributePathExpandIterator::Next() { - for (; mpClusterInfo != nullptr; (mpClusterInfo = mpClusterInfo->mpNext, mEndpointIndex = UINT16_MAX)) + for (; mpAttributePath != nullptr; (mpAttributePath = mpAttributePath->mpNext, mEndpointIndex = UINT16_MAX)) { - mOutputPath.mExpanded = mpClusterInfo->HasAttributeWildcard(); + mOutputPath.mExpanded = mpAttributePath->mValue.HasAttributeWildcard(); if (mEndpointIndex == UINT16_MAX) { // Special case: If this is a concrete path, we just return its value as-is. - if (!mpClusterInfo->HasAttributeWildcard()) + if (!mpAttributePath->mValue.HasAttributeWildcard()) { - mOutputPath.mEndpointId = mpClusterInfo->mEndpointId; - mOutputPath.mClusterId = mpClusterInfo->mClusterId; - mOutputPath.mAttributeId = mpClusterInfo->mAttributeId; + mOutputPath.mEndpointId = mpAttributePath->mValue.mEndpointId; + mOutputPath.mClusterId = mpAttributePath->mValue.mClusterId; + mOutputPath.mAttributeId = mpAttributePath->mValue.mAttributeId; // Prepare for next iteration mEndpointIndex = mEndEndpointIndex = 0; return true; } - PrepareEndpointIndexRange(*mpClusterInfo); + PrepareEndpointIndexRange(mpAttributePath->mValue); mClusterIndex = UINT8_MAX; } @@ -177,7 +177,7 @@ bool AttributePathExpandIterator::Next() if (mClusterIndex == UINT8_MAX) { - PrepareClusterIndexRange(*mpClusterInfo, endpointId); + PrepareClusterIndexRange(mpAttributePath->mValue, endpointId); mAttributeIndex = UINT16_MAX; mGlobalAttributeIndex = UINT8_MAX; } @@ -190,7 +190,7 @@ bool AttributePathExpandIterator::Next() ClusterId clusterId = emberAfGetNthClusterId(endpointId, mClusterIndex, true /* server */).Value(); if (mAttributeIndex == UINT16_MAX && mGlobalAttributeIndex == UINT8_MAX) { - PrepareAttributeIndexRange(*mpClusterInfo, endpointId, clusterId); + PrepareAttributeIndexRange(mpAttributePath->mValue, endpointId, clusterId); } if (mAttributeIndex < mEndAttributeIndex) @@ -202,7 +202,7 @@ bool AttributePathExpandIterator::Next() mOutputPath.mEndpointId = endpointId; mAttributeIndex++; // We found a valid attribute path, now return and increase the attribute index for next iteration. - // Return true will skip the increment of mClusterIndex, mEndpointIndex and mpClusterInfo. + // Return true will skip the increment of mClusterIndex, mEndpointIndex and mpAttributePath. return true; } if (mGlobalAttributeIndex < mGlobalAttributeEndIndex) diff --git a/src/app/AttributePathExpandIterator.h b/src/app/AttributePathExpandIterator.h index 75463aeb823ad4..693c20cb024ba9 100644 --- a/src/app/AttributePathExpandIterator.h +++ b/src/app/AttributePathExpandIterator.h @@ -18,13 +18,13 @@ /** * @file - * Defines an iterator for iterating all possible paths from a list of ClusterInfo-s according to spec section 8.9.2.2 (Valid - * Attribute Paths) + * Defines an iterator for iterating all possible paths from a list of AttributePathParams-s according to spec section 8.9.2.2 + * (Valid Attribute Paths) */ #pragma once -#include +#include #include #include #include @@ -42,18 +42,18 @@ namespace chip { namespace app { /** - * AttributePathExpandIterator is used to iterate over a linked list of ClusterInfo-s. + * AttributePathExpandIterator is used to iterate over a linked list of AttributePathParams-s. * The AttributePathExpandIterator is copiable, however, the given cluster info must be valid when calling Next(). * - * AttributePathExpandIterator will expand attribute paths with wildcards, and only emit existing paths for ClusterInfo with - * wildcards. For ClusterInfo with a concrete path (i.e. does not contain wildcards), AttributePathExpandIterator will emit them - * as-is. + * AttributePathExpandIterator will expand attribute paths with wildcards, and only emit existing paths for AttributePathParams with + * wildcards. For AttributePathParams with a concrete path (i.e. does not contain wildcards), AttributePathExpandIterator will emit + * them as-is. * * The typical use of AttributePathExpandIterator may look like: * ConcreteAttributePath path; - * for (AttributePathExpandIterator iterator(clusterInfo); iterator.Get(path); iterator.Next()) {...} + * for (AttributePathExpandIterator iterator(AttributePathParams); iterator.Get(path); iterator.Next()) {...} * - * The iterator does not copy the given ClusterInfo, The given ClusterInfo must be valid when using the iterator. + * The iterator does not copy the given AttributePathParams, The given AttributePathParams must be valid when using the iterator. * If the set of endpoints, clusters, or attributes that are supported changes, AttributePathExpandIterator must be reinitialized. * * A initialized iterator will return the first valid path, no need to call Next() before calling Get() for the first time. @@ -63,17 +63,18 @@ namespace app { * - Chunk full, return * - In a new chunk, Get() * - * TODO: The ClusterInfo may support a group id, the iterator should be able to call group data provider to expand the group id. + * TODO: The AttributePathParams may support a group id, the iterator should be able to call group data provider to expand the group + * id. */ class AttributePathExpandIterator { public: - AttributePathExpandIterator(ClusterInfo * aClusterInfo); + AttributePathExpandIterator(ObjectList * aAttributePath); /** * Proceed the iterator to the next attribute path in the given cluster info. * - * Returns false if AttributePathExpandIterator has exhausted all paths in the given ClusterInfo list. + * Returns false if AttributePathExpandIterator has exhausted all paths in the given AttributePathParams list. */ bool Next(); @@ -90,12 +91,12 @@ class AttributePathExpandIterator /** * Returns if the iterator is valid (not exhausted). An iterator is exhausted if and only if: * - Next() is called after iterating last path. - * - Iterator is initialized with a null ClusterInfo. + * - Iterator is initialized with a null AttributePathParams. */ - inline bool Valid() const { return mpClusterInfo != nullptr; } + inline bool Valid() const { return mpAttributePath != nullptr; } private: - ClusterInfo * mpClusterInfo; + ObjectList * mpAttributePath; uint16_t mEndpointIndex, mEndEndpointIndex; // Note: should use decltype(EmberAfEndpointType::clusterCount) here, but af-types is including app specific generated files. @@ -109,16 +110,16 @@ class AttributePathExpandIterator /** * Prepare*IndexRange will update mBegin*Index and mEnd*Index variables. - * If ClusterInfo contains a wildcard field, it will set mBegin*Index to 0 and mEnd*Index to count. + * If AttributePathParams contains a wildcard field, it will set mBegin*Index to 0 and mEnd*Index to count. * Or it will set mBegin*Index to the index of the Endpoint/Cluster/Attribute, and mEnd*Index to mBegin*Index + 1. * * If the Endpoint/Cluster/Attribute does not exist, mBegin*Index will be UINT*_MAX, and mEnd*Inde will be 0. * * The index can be used with emberAfEndpointFromIndex, emberAfGetNthClusterId and emberAfGetServerAttributeIdByIndex. */ - void PrepareEndpointIndexRange(const ClusterInfo & aClusterInfo); - void PrepareClusterIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId); - void PrepareAttributeIndexRange(const ClusterInfo & aClusterInfo, EndpointId aEndpointId, ClusterId aClusterId); + void PrepareEndpointIndexRange(const AttributePathParams & aAttributePath); + void PrepareClusterIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId); + void PrepareAttributeIndexRange(const AttributePathParams & aAttributePath, EndpointId aEndpointId, ClusterId aClusterId); }; } // namespace app } // namespace chip diff --git a/src/app/AttributePathParams.h b/src/app/AttributePathParams.h index 7c79585a027433..6dd9b135ca9f5d 100644 --- a/src/app/AttributePathParams.h +++ b/src/app/AttributePathParams.h @@ -18,10 +18,9 @@ #pragma once +#include #include -#include - namespace chip { namespace app { struct AttributePathParams @@ -30,8 +29,6 @@ struct AttributePathParams // TODO: (Issue #10596) Need to ensure that we do not encode the NodeId over the wire // if it is either not 'set', or is set to a value that matches accessing fabric // on which the interaction is undertaken. - // - // TODO: (#11420) This class is overlapped with ClusterInfo class, need to do a clean up. AttributePathParams(EndpointId aEndpointId, ClusterId aClusterId) : AttributePathParams(aEndpointId, aClusterId, kInvalidAttributeId, kInvalidListIndex) {} @@ -45,7 +42,7 @@ struct AttributePathParams {} AttributePathParams(EndpointId aEndpointId, ClusterId aClusterId, AttributeId aAttributeId, ListIndex aListIndex) : - mEndpointId(aEndpointId), mClusterId(aClusterId), mAttributeId(aAttributeId), mListIndex(aListIndex) + mClusterId(aClusterId), mAttributeId(aAttributeId), mEndpointId(aEndpointId), mListIndex(aListIndex) {} AttributePathParams() {} @@ -65,10 +62,29 @@ struct AttributePathParams inline bool HasWildcardAttributeId() const { return mAttributeId == kInvalidAttributeId; } inline bool HasWildcardListIndex() const { return mListIndex == kInvalidListIndex; } - EndpointId mEndpointId = kInvalidEndpointId; - ClusterId mClusterId = kInvalidClusterId; - AttributeId mAttributeId = kInvalidAttributeId; - ListIndex mListIndex = kInvalidListIndex; + bool IsAttributePathSupersetOf(const AttributePathParams & other) const + { + VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); + VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); + VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); + VerifyOrReturnError(HasWildcardListIndex() || mListIndex == other.mListIndex, false); + + return true; + } + + bool IsAttributePathSupersetOf(const ConcreteAttributePath & other) const + { + VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); + VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); + VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); + + return true; + } + + ClusterId mClusterId = kInvalidClusterId; // uint32 + AttributeId mAttributeId = kInvalidAttributeId; // uint32 + EndpointId mEndpointId = kInvalidEndpointId; // uint16 + ListIndex mListIndex = kInvalidListIndex; // uint16 }; } // namespace app } // namespace chip diff --git a/src/app/ClusterInfo.h b/src/app/ClusterInfo.h deleted file mode 100644 index 2e3e0ddeab3ab1..00000000000000 --- a/src/app/ClusterInfo.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * - * Copyright (c) 2021 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 -#include -#include - -namespace chip { -namespace app { - -/** - * ClusterInfo is the representation of an attribute path or an event path used by ReadHandler, ReadClient, WriteHandler, - * Report::Engine etc, it uses some invalid values for representing the wildcard values for its fields and contains a mpNext field - * so it can be used as a linked list. - */ -// TODO: The cluster info should be separated into AttributeInfo and EventInfo. -// Note: The user of ClusterInfo today is ReadHandler and ReportEngine, both of them do not accept Null list index (means list -// append operations) -// Note: The change will happen after #11171 with a better linked list. -struct ClusterInfo -{ -public: - bool IsAttributePathSupersetOf(const ClusterInfo & other) const - { - VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); - VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); - VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); - VerifyOrReturnError(HasWildcardListIndex() || mListIndex == other.mListIndex, false); - - return true; - } - - bool IsAttributePathSupersetOf(const ConcreteAttributePath & other) const - { - VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); - VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); - VerifyOrReturnError(HasWildcardAttributeId() || mAttributeId == other.mAttributeId, false); - - return true; - } - - bool IsEventPathSupersetOf(const ConcreteEventPath & other) const - { - VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); - VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); - VerifyOrReturnError(HasWildcardEventId() || mEventId == other.mEventId, false); - - return true; - } - - bool HasAttributeWildcard() const { return HasWildcardEndpointId() || HasWildcardClusterId() || HasWildcardAttributeId(); } - bool HasEventWildcard() const { return HasWildcardEndpointId() || HasWildcardClusterId() || HasWildcardEventId(); } - /** - * Check that the path meets some basic constraints of an attribute path: If list index is not wildcard, then field id must not - * be wildcard. This does not verify that the attribute being targeted is actually of list type when the list index is not - * wildcard. - */ - bool IsValidAttributePath() const { return HasWildcardListIndex() || !HasWildcardAttributeId(); } - - // For event, an event id can only be interpreted if the cluster id is known. - bool IsValidEventPath() const { return !(HasWildcardClusterId() && !HasWildcardEventId()); } - - bool IsValidDataVersionFilter() const { return !HasWildcardEndpointId() && !HasWildcardClusterId() && mDataVersion.HasValue(); } - - inline bool HasWildcardNodeId() const { return mNodeId == kUndefinedNodeId; } - inline bool HasWildcardEndpointId() const { return mEndpointId == kInvalidEndpointId; } - inline bool HasWildcardClusterId() const { return mClusterId == kInvalidClusterId; } - inline bool HasWildcardAttributeId() const { return mAttributeId == kInvalidAttributeId; } - inline bool HasWildcardListIndex() const { return mListIndex == kInvalidListIndex; } - inline bool HasWildcardEventId() const { return mEventId == kInvalidEventId; } - - ClusterInfo() {} - /* - * For better structure alignment - * Below ordering is by bit-size to ensure least amount of memory alignment padding. - * Changing order to something more natural (e.g. endpoint id before cluster id) will result - * in extra memory alignment padding. - */ - NodeId mNodeId = kUndefinedNodeId; // uint64 - ClusterInfo * mpNext = nullptr; // pointer width (32/64 bits) - ClusterId mClusterId = kInvalidClusterId; // uint32 - AttributeId mAttributeId = kInvalidAttributeId; // uint32 - EventId mEventId = kInvalidEventId; // uint32 - ListIndex mListIndex = kInvalidListIndex; // uint16 - EndpointId mEndpointId = kInvalidEndpointId; // uint16 - Optional mDataVersion; // uint32 - bool mIsUrgentEvent = false; // uint8 -}; -} // namespace app -} // namespace chip diff --git a/src/app/DataVersionFilter.h b/src/app/DataVersionFilter.h index 1a6608e04a47eb..2794048170e53f 100644 --- a/src/app/DataVersionFilter.h +++ b/src/app/DataVersionFilter.h @@ -20,14 +20,12 @@ #include -#include - namespace chip { namespace app { struct DataVersionFilter { DataVersionFilter(EndpointId aEndpointId, ClusterId aClusterId, DataVersion aDataVersion) : - mEndpointId(aEndpointId), mClusterId(aClusterId), mDataVersion(aDataVersion) + mClusterId(aClusterId), mDataVersion(aDataVersion), mEndpointId(aEndpointId) {} DataVersionFilter() {} @@ -37,9 +35,9 @@ struct DataVersionFilter return (mEndpointId != kInvalidEndpointId) && (mClusterId != kInvalidClusterId) && (mDataVersion.HasValue()); } - EndpointId mEndpointId = kInvalidEndpointId; - ClusterId mClusterId = kInvalidClusterId; - Optional mDataVersion; + ClusterId mClusterId = kInvalidClusterId; // uint32 + Optional mDataVersion; // uint32 + EndpointId mEndpointId = kInvalidEndpointId; // uint16 }; } // namespace app } // namespace chip diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 28a891af821e5a..a3805a81a89a06 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -18,7 +18,8 @@ #pragma once #include -#include +#include +#include #include #include #include @@ -151,10 +152,10 @@ struct EventLoadOutContext EventNumber mStartingEventNumber = 0; Timestamp mPreviousTime; Timestamp mCurrentTime; - EventNumber mCurrentEventNumber = 0; - size_t mEventCount = 0; - ClusterInfo * mpInterestedEventPaths = nullptr; - bool mFirst = true; + EventNumber mCurrentEventNumber = 0; + size_t mEventCount = 0; + ObjectList * mpInterestedEventPaths = nullptr; + bool mFirst = true; Access::SubjectDescriptor mSubjectDescriptor; }; } // namespace app diff --git a/src/app/EventManagement.cpp b/src/app/EventManagement.cpp index 7de40feb570f12..3ec34237fa4e26 100644 --- a/src/app/EventManagement.cpp +++ b/src/app/EventManagement.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -608,10 +609,10 @@ CHIP_ERROR EventManagement::CheckEventContext(EventLoadOutContext * eventLoadOut for (auto * interestedPath = eventLoadOutContext->mpInterestedEventPaths; interestedPath != nullptr; interestedPath = interestedPath->mpNext) { - if (interestedPath->IsEventPathSupersetOf(path)) + if (interestedPath->mValue.IsEventPathSupersetOf(path)) { ret = CHIP_NO_ERROR; - if (!interestedPath->HasEventWildcard()) + if (!interestedPath->mValue.HasEventWildcard()) { eventReadViaConcretePath = true; break; @@ -732,8 +733,9 @@ CHIP_ERROR EventManagement::CopyEventsSince(const TLVReader & aReader, size_t aD return err; } -CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ClusterInfo * apClusterInfolist, EventNumber & aEventMin, - size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor) +CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ObjectList * apEventPathList, + EventNumber & aEventMin, size_t & aEventCount, + const Access::SubjectDescriptor & aSubjectDescriptor) { // TODO: Add particular set of event Paths in FetchEventsSince so that we can filter the interested paths CHIP_ERROR err = CHIP_NO_ERROR; @@ -747,7 +749,7 @@ CHIP_ERROR EventManagement::FetchEventsSince(TLVWriter & aWriter, ClusterInfo * #endif // !CHIP_SYSTEM_CONFIG_NO_LOCKING context.mSubjectDescriptor = aSubjectDescriptor; - context.mpInterestedEventPaths = apClusterInfolist; + context.mpInterestedEventPaths = apEventPathList; err = GetEventReader(reader, PriorityLevel::Critical, &bufWrapper); SuccessOrExit(err); diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 9d6802105cc237..e4dbe9a6bbc530 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -29,9 +29,9 @@ #include "EventLoggingDelegate.h" #include "EventLoggingTypes.h" #include -#include #include #include +#include #include #include #include @@ -320,7 +320,7 @@ class EventManagement * specified by read/subscribe request. * * @param[in] aWriter The writer to use for event storage - * @param[in] apClusterInfolist the interested cluster info list with event path inside + * @param[in] apEventPathList the interested EventPathParams list * * @param[in,out] aEventMin On input, the Event number is the one we're fetching. On * completion, the event number of the next one we plan to fetch. @@ -340,8 +340,9 @@ class EventManagement * available. * */ - CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, ClusterInfo * apClusterInfolist, EventNumber & aEventMin, - size_t & aEventCount, const Access::SubjectDescriptor & aSubjectDescriptor); + CHIP_ERROR FetchEventsSince(chip::TLV::TLVWriter & aWriter, ObjectList * apEventPathList, + EventNumber & aEventMin, size_t & aEventCount, + const Access::SubjectDescriptor & aSubjectDescriptor); /** * @brief diff --git a/src/app/EventPathParams.h b/src/app/EventPathParams.h index 0516874cf41535..0a8cea3ee1acaa 100644 --- a/src/app/EventPathParams.h +++ b/src/app/EventPathParams.h @@ -18,16 +18,16 @@ #pragma once +#include #include - -#include +#include namespace chip { namespace app { struct EventPathParams { EventPathParams(EndpointId aEndpointId, ClusterId aClusterId, EventId aEventId, bool aUrgentEvent = false) : - mEndpointId(aEndpointId), mClusterId(aClusterId), mEventId(aEventId), mIsUrgentEvent(aUrgentEvent) + mClusterId(aClusterId), mEventId(aEventId), mEndpointId(aEndpointId), mIsUrgentEvent(aUrgentEvent) {} EventPathParams() {} bool IsSamePath(const EventPathParams & other) const @@ -44,10 +44,19 @@ struct EventPathParams inline bool HasWildcardClusterId() const { return mClusterId == kInvalidClusterId; } inline bool HasWildcardEventId() const { return mEventId == kInvalidEventId; } - EndpointId mEndpointId = kInvalidEndpointId; - ClusterId mClusterId = kInvalidClusterId; - EventId mEventId = kInvalidEventId; - bool mIsUrgentEvent = false; + bool IsEventPathSupersetOf(const ConcreteEventPath & other) const + { + VerifyOrReturnError(HasWildcardEndpointId() || mEndpointId == other.mEndpointId, false); + VerifyOrReturnError(HasWildcardClusterId() || mClusterId == other.mClusterId, false); + VerifyOrReturnError(HasWildcardEventId() || mEventId == other.mEventId, false); + + return true; + } + + ClusterId mClusterId = kInvalidClusterId; // uint32 + EventId mEventId = kInvalidEventId; // uint32 + EndpointId mEndpointId = kInvalidEndpointId; // uint16 + bool mIsUrgentEvent = false; // uint8 }; } // namespace app } // namespace chip diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index 12f352e8f2c76c..2a67cc1e8bc20a 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -110,8 +110,9 @@ void InteractionModelEngine::Shutdown() } mReportingEngine.Shutdown(); - mClusterInfoPool.ReleaseAll(); - + mAttributePathPool.ReleaseAll(); + mEventPathPool.ReleaseAll(); + mDataVersionFilterPool.ReleaseAll(); mpExchangeMgr->UnregisterUnsolicitedMessageHandlerForProtocol(Protocols::InteractionModel::Id); } @@ -559,44 +560,93 @@ bool InteractionModelEngine::HasConflictWriteRequests(const WriteHandler * apWri return false; } -void InteractionModelEngine::ReleaseClusterInfoList(ClusterInfo *& aClusterInfo) +void InteractionModelEngine::ReleaseAttributePathList(ObjectList *& aAttributePathList) +{ + ReleasePool(aAttributePathList, mAttributePathPool); +} + +CHIP_ERROR InteractionModelEngine::PushFrontAttributePathList(ObjectList *& aAttributePathList, + AttributePathParams & aAttributePath) +{ + CHIP_ERROR err = PushFront(aAttributePathList, aAttributePath, mAttributePathPool); + if (err == CHIP_ERROR_NO_MEMORY) + { + ChipLogError(InteractionModel, "AttributePath pool full, cannot handle more entries!"); + } + return err; +} + +void InteractionModelEngine::ReleaseEventPathList(ObjectList *& aEventPathList) +{ + ReleasePool(aEventPathList, mEventPathPool); +} + +CHIP_ERROR InteractionModelEngine::PushFrontEventPathParamsList(ObjectList *& aEventPathList, + EventPathParams & aEventPath) +{ + CHIP_ERROR err = PushFront(aEventPathList, aEventPath, mEventPathPool); + if (err == CHIP_ERROR_NO_MEMORY) + { + ChipLogError(InteractionModel, "EventPath pool full, cannot handle more entries!"); + } + return err; +} + +void InteractionModelEngine::ReleaseDataVersionFilterList(ObjectList *& aDataVersionFilterList) +{ + ReleasePool(aDataVersionFilterList, mDataVersionFilterPool); +} + +CHIP_ERROR InteractionModelEngine::PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, + DataVersionFilter & aDataVersionFilter) +{ + CHIP_ERROR err = PushFront(aDataVersionFilterList, aDataVersionFilter, mDataVersionFilterPool); + if (err == CHIP_ERROR_NO_MEMORY) + { + ChipLogError(InteractionModel, "DataVersionFilter pool full, cannot handle more entries, reset this error and continue!"); + err = CHIP_NO_ERROR; + } + return err; +} + +template +void InteractionModelEngine::ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool) { - ClusterInfo * current = aClusterInfo; + ObjectList * current = aObjectList; while (current != nullptr) { - ClusterInfo * next = current->mpNext; - mClusterInfoPool.ReleaseObject(current); + ObjectList * next = current->mpNext; + aObjectPool.ReleaseObject(current); current = next; } - aClusterInfo = nullptr; + aObjectList = nullptr; } -CHIP_ERROR InteractionModelEngine::PushFront(ClusterInfo *& aClusterInfoList, ClusterInfo & aClusterInfo) +template +CHIP_ERROR InteractionModelEngine::PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool) { - ClusterInfo * clusterInfo = mClusterInfoPool.CreateObject(); - if (clusterInfo == nullptr) + ObjectList * object = aObjectPool.CreateObject(); + if (object == nullptr) { - ChipLogError(InteractionModel, "ClusterInfo pool full, cannot handle more entries!"); return CHIP_ERROR_NO_MEMORY; } - *clusterInfo = aClusterInfo; - clusterInfo->mpNext = aClusterInfoList; - aClusterInfoList = clusterInfo; + object->mValue = aData; + object->mpNext = aObjectList; + aObjectList = object; return CHIP_NO_ERROR; } -bool InteractionModelEngine::IsOverlappedAttributePath(ClusterInfo & aAttributePath) +bool InteractionModelEngine::IsOverlappedAttributePath(AttributePathParams & aAttributePath) { return (mReadHandlers.ForEachActiveObject([&aAttributePath](ReadHandler * handler) { if (handler->IsType(ReadHandler::InteractionType::Subscribe) && (handler->IsGeneratingReports() || handler->IsAwaitingReportResponse())) { - for (auto clusterInfo = handler->GetAttributeClusterInfolist(); clusterInfo != nullptr; - clusterInfo = clusterInfo->mpNext) + for (auto object = handler->GetAttributePathList(); object != nullptr; object = object->mpNext) { - if (clusterInfo->IsAttributePathSupersetOf(aAttributePath) || - aAttributePath.IsAttributePathSupersetOf(*clusterInfo)) + if (object->mValue.IsAttributePathSupersetOf(aAttributePath) || + aAttributePath.IsAttributePathSupersetOf(object->mValue)) { return Loop::Break; } diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 572e9cbb35e833..6f1482c63ea769 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -40,12 +40,15 @@ #include #include -#include +#include #include #include #include #include #include +#include +#include +#include #include #include #include @@ -133,9 +136,21 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman reporting::Engine & GetReportingEngine() { return mReportingEngine; } - void ReleaseClusterInfoList(ClusterInfo *& aClusterInfo); - CHIP_ERROR PushFront(ClusterInfo *& aClusterInfoLisst, ClusterInfo & aClusterInfo); - bool IsOverlappedAttributePath(ClusterInfo & aAttributePath); + void ReleaseAttributePathList(ObjectList *& aAttributePathList); + + CHIP_ERROR PushFrontAttributePathList(ObjectList *& aAttributePathList, + AttributePathParams & aAttributePath); + + void ReleaseEventPathList(ObjectList *& aEventPathList); + + CHIP_ERROR PushFrontEventPathParamsList(ObjectList *& aEventPathList, EventPathParams & aEventPath); + + void ReleaseDataVersionFilterList(ObjectList *& aDataVersionFilterList); + + CHIP_ERROR PushFrontDataVersionFilterList(ObjectList *& aDataVersionFilterList, + DataVersionFilter & aDataVersionFilter); + + bool IsOverlappedAttributePath(AttributePathParams & aAttributePath); CHIP_ERROR RegisterCommandHandler(CommandHandlerInterface * handler); CHIP_ERROR UnregisterCommandHandler(CommandHandlerInterface * handler); @@ -291,6 +306,11 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman CHIP_ERROR ShutdownExistingSubscriptionsIfNeeded(Messaging::ExchangeContext * apExchangeContext, System::PacketBufferHandle && aPayload); + template + void ReleasePool(ObjectList *& aObjectList, ObjectPool, N> & aObjectPool); + template + CHIP_ERROR PushFront(ObjectList *& aObjectList, T & aData, ObjectPool, N> & aObjectPool); + Messaging::ExchangeManager * mpExchangeMgr = nullptr; CommandHandlerInterface * mCommandHandlerList = nullptr; @@ -300,8 +320,9 @@ class InteractionModelEngine : public Messaging::ExchangeDelegate, public Comman ObjectPool mReadHandlers; WriteHandler mWriteHandlers[CHIP_IM_MAX_NUM_WRITE_HANDLER]; reporting::Engine mReportingEngine; - ObjectPool mClusterInfoPool; - + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS> mAttributePathPool; + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS> mEventPathPool; + ObjectPool, CHIP_IM_SERVER_MAX_NUM_PATH_GROUPS> mDataVersionFilterPool; ReadClient * mpActiveReadClientList = nullptr; #if CONFIG_IM_BUILD_FOR_UNIT_TEST @@ -328,13 +349,11 @@ Protocols::InteractionModel::Status ServerClusterCommandExists(const ConcreteCom * Fetch attribute value and version info and write to the AttributeReport provided. * The ReadSingleClusterData will do everything required for encoding an attribute, i.e. it will try to put one or more * AttributeReportIB to the AttributeReportIBs::Builder. - * When the endpoint / cluster / attribute / event data specified by aClusterInfo does not exist, corresponding interaction model - * error code will be put into the writer, and CHIP_NO_ERROR will be returned. - * If the data exists on the server, the data (with tag kData) and the data version (with tag kDataVersion) will be put - * into the TLVWriter. TLVWriter error will be returned if any error occurred during encoding - * these values. - * This function is implemented by CHIP as a part of cluster data storage & management. - * The apWriter and apDataExists can be nullptr. + * When the endpoint / cluster / attribute data specified by aPath does not exist, corresponding interaction + * model error code will be put into aAttributeReports, and CHIP_NO_ERROR will be returned. If the data exists on the server, the + * data (with tag kData) and the data version (with tag kDataVersion) will be put into aAttributeReports. TLVWriter error will be + * returned if any error occurred while encoding these values. This function is implemented by CHIP as a part of cluster data + * storage & management. * * @param[in] aSubjectDescriptor The subject descriptor for the read. * @param[in] aPath The concrete path of the data being read. diff --git a/src/app/MessageDef/AttributePathIB.h b/src/app/MessageDef/AttributePathIB.h index a7df656b57d566..24d0bbd03641a4 100644 --- a/src/app/MessageDef/AttributePathIB.h +++ b/src/app/MessageDef/AttributePathIB.h @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/app/MessageDef/EventPathIB.h b/src/app/MessageDef/EventPathIB.h index e1a77532d460e7..d71c141733496d 100644 --- a/src/app/MessageDef/EventPathIB.h +++ b/src/app/MessageDef/EventPathIB.h @@ -22,6 +22,7 @@ #include "ListParser.h" #include +#include #include #include #include diff --git a/src/app/ObjectList.h b/src/app/ObjectList.h new file mode 100644 index 00000000000000..9069848a2f289f --- /dev/null +++ b/src/app/ObjectList.h @@ -0,0 +1,31 @@ +/* + * + * Copyright (c) 2021 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 + +namespace chip { +namespace app { + +template +struct ObjectList +{ + T mValue; + ObjectList * mpNext = nullptr; +}; +} // namespace app +} // namespace chip diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index c30dac9849b06c..397acc7e159505 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/src/app/ReadHandler.cpp b/src/app/ReadHandler.cpp index 09f008f683bb2b..7e15f22b708c9d 100644 --- a/src/app/ReadHandler.cpp +++ b/src/app/ReadHandler.cpp @@ -95,9 +95,9 @@ ReadHandler::~ReadHandler() { InteractionModelEngine::GetInstance()->GetReportingEngine().OnReportConfirm(); } - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(mpAttributeClusterInfoList); - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(mpEventClusterInfoList); - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(mpDataVersionFilterList); + InteractionModelEngine::GetInstance()->ReleaseAttributePathList(mpAttributePathList); + InteractionModelEngine::GetInstance()->ReleaseEventPathList(mpEventPathList); + InteractionModelEngine::GetInstance()->ReleaseDataVersionFilterList(mpDataVersionFilterList); } void ReadHandler::Close() @@ -253,6 +253,7 @@ CHIP_ERROR ReadHandler::SendReportData(System::PacketBufferHandle && aPayload, b if (!aMoreChunks) { ClearDirty(); + InteractionModelEngine::GetInstance()->ReleaseDataVersionFilterList(mpDataVersionFilterList); } return err; } @@ -375,27 +376,27 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrExit(TLV::AnonymousTag() == reader.GetTag(), err = CHIP_ERROR_INVALID_TLV_TAG); - ClusterInfo clusterInfo; + AttributePathParams attribute; AttributePathIB::Parser path; err = path.Init(reader); SuccessOrExit(err); // TODO: MEIs (ClusterId and AttributeId) have a invalid pattern instead of a single invalid value, need to add separate // functions for checking if we have received valid values. // TODO: Wildcard cluster id with non-global attributes or wildcard attribute paths should be rejected. - err = path.GetEndpoint(&(clusterInfo.mEndpointId)); + err = path.GetEndpoint(&(attribute.mEndpointId)); if (err == CHIP_NO_ERROR) { - VerifyOrExit(!clusterInfo.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } else if (err == CHIP_END_OF_TLV) { err = CHIP_NO_ERROR; } SuccessOrExit(err); - err = path.GetCluster(&(clusterInfo.mClusterId)); + err = path.GetCluster(&(attribute.mClusterId)); if (err == CHIP_NO_ERROR) { - VerifyOrExit(!clusterInfo.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } else if (err == CHIP_END_OF_TLV) { @@ -403,21 +404,21 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt } SuccessOrExit(err); - err = path.GetAttribute(&(clusterInfo.mAttributeId)); + err = path.GetAttribute(&(attribute.mAttributeId)); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } else if (err == CHIP_NO_ERROR) { - VerifyOrExit(!clusterInfo.HasWildcardAttributeId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); + VerifyOrExit(!attribute.HasWildcardAttributeId(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } SuccessOrExit(err); - err = path.GetListIndex(&(clusterInfo.mListIndex)); + err = path.GetListIndex(&(attribute.mListIndex)); if (CHIP_NO_ERROR == err) { - VerifyOrExit(!clusterInfo.HasWildcardAttributeId() && !clusterInfo.HasWildcardListIndex(), + VerifyOrExit(!attribute.HasWildcardAttributeId() && !attribute.HasWildcardListIndex(), err = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH); } else if (CHIP_END_OF_TLV == err) @@ -425,13 +426,13 @@ CHIP_ERROR ReadHandler::ProcessAttributePathList(AttributePathIBs::Parser & aAtt err = CHIP_NO_ERROR; } SuccessOrExit(err); - err = InteractionModelEngine::GetInstance()->PushFront(mpAttributeClusterInfoList, clusterInfo); + err = InteractionModelEngine::GetInstance()->PushFrontAttributePathList(mpAttributePathList, attribute); SuccessOrExit(err); } // if we have exhausted this container if (CHIP_END_OF_TLV == err) { - mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributeClusterInfoList); + mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributePathList); err = CHIP_NO_ERROR; } @@ -448,18 +449,19 @@ CHIP_ERROR ReadHandler::ProcessDataVersionFilterList(DataVersionFilterIBs::Parse while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG); - ClusterInfo clusterInfo; + DataVersionFilter versionFilter; ClusterPathIB::Parser path; DataVersionFilterIB::Parser filter; ReturnErrorOnFailure(filter.Init(reader)); DataVersion version = 0; ReturnErrorOnFailure(filter.GetDataVersion(&version)); - clusterInfo.mDataVersion.SetValue(version); + versionFilter.mDataVersion.SetValue(version); ReturnErrorOnFailure(filter.GetPath(&path)); - ReturnErrorOnFailure(path.GetEndpoint(&(clusterInfo.mEndpointId))); - ReturnErrorOnFailure(path.GetCluster(&(clusterInfo.mClusterId))); - VerifyOrReturnError(clusterInfo.IsValidDataVersionFilter(), CHIP_ERROR_IM_MALFORMED_DATA_VERSION_FILTER_IB); - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->PushFront(mpDataVersionFilterList, clusterInfo)); + ReturnErrorOnFailure(path.GetEndpoint(&(versionFilter.mEndpointId))); + ReturnErrorOnFailure(path.GetCluster(&(versionFilter.mClusterId))); + VerifyOrReturnError(versionFilter.IsValidDataVersionFilter(), CHIP_ERROR_IM_MALFORMED_DATA_VERSION_FILTER_IB); + ReturnErrorOnFailure( + InteractionModelEngine::GetInstance()->PushFrontDataVersionFilterList(mpDataVersionFilterList, versionFilter)); } if (CHIP_END_OF_TLV == err) @@ -478,14 +480,14 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars while (CHIP_NO_ERROR == (err = reader.Next())) { VerifyOrReturnError(TLV::AnonymousTag() == reader.GetTag(), CHIP_ERROR_INVALID_TLV_TAG); - ClusterInfo clusterInfo; + EventPathParams event; EventPathIB::Parser path; ReturnErrorOnFailure(path.Init(reader)); - err = path.GetEndpoint(&(clusterInfo.mEndpointId)); + err = path.GetEndpoint(&(event.mEndpointId)); if (err == CHIP_NO_ERROR) { - VerifyOrReturnError(!clusterInfo.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); + VerifyOrReturnError(!event.HasWildcardEndpointId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); } else if (err == CHIP_END_OF_TLV) { @@ -493,10 +495,10 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars } ReturnErrorOnFailure(err); - err = path.GetCluster(&(clusterInfo.mClusterId)); + err = path.GetCluster(&(event.mClusterId)); if (err == CHIP_NO_ERROR) { - VerifyOrReturnError(!clusterInfo.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); + VerifyOrReturnError(!event.HasWildcardClusterId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); } else if (err == CHIP_END_OF_TLV) { @@ -504,25 +506,25 @@ CHIP_ERROR ReadHandler::ProcessEventPaths(EventPathIBs::Parser & aEventPathsPars } ReturnErrorOnFailure(err); - err = path.GetEvent(&(clusterInfo.mEventId)); + err = path.GetEvent(&(event.mEventId)); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } else if (err == CHIP_NO_ERROR) { - VerifyOrReturnError(!clusterInfo.HasWildcardEventId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); + VerifyOrReturnError(!event.HasWildcardEventId(), err = CHIP_ERROR_IM_MALFORMED_EVENT_PATH); } ReturnErrorOnFailure(err); - err = path.GetIsUrgent(&(clusterInfo.mIsUrgentEvent)); + err = path.GetIsUrgent(&(event.mIsUrgentEvent)); if (CHIP_END_OF_TLV == err) { err = CHIP_NO_ERROR; } ReturnErrorOnFailure(err); - ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->PushFront(mpEventClusterInfoList, clusterInfo)); + ReturnErrorOnFailure(InteractionModelEngine::GetInstance()->PushFrontEventPathParamsList(mpEventPathList, event)); } // if we have exhausted this container diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index f2c4bfc390ecb4..8259c455a5a9f5 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -27,10 +27,13 @@ #include #include #include -#include +#include +#include #include +#include #include #include +#include #include #include #include @@ -133,9 +136,9 @@ class ReadHandler : public Messaging::ExchangeDelegate bool IsAwaitingReportResponse() const { return mState == HandlerState::AwaitingReportResponse; } CHIP_ERROR ProcessDataVersionFilterList(DataVersionFilterIBs::Parser & aDataVersionFilterListParser); - ClusterInfo * GetAttributeClusterInfolist() { return mpAttributeClusterInfoList; } - ClusterInfo * GetEventClusterInfolist() { return mpEventClusterInfoList; } - ClusterInfo * GetDataVersionFilterlist() const { return mpDataVersionFilterList; } + ObjectList * GetAttributePathList() { return mpAttributePathList; } + ObjectList * GetEventPathList() { return mpEventPathList; } + ObjectList * GetDataVersionFilterList() const { return mpDataVersionFilterList; } EventNumber & GetEventMin() { return mEventMin; } PriorityLevel GetCurrentPriority() { return mCurrentPriority; } @@ -157,7 +160,7 @@ class ReadHandler : public Messaging::ExchangeDelegate mDirty = true; // If the contents of the global dirty set have changed, we need to reset the iterator since the paths // we've sent up till now are no longer valid and need to be invalidated. - mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributeClusterInfoList); + mAttributePathExpandIterator = AttributePathExpandIterator(mpAttributePathList); mAttributeEncoderState = AttributeValueEncoder::AttributeEncodeState(); } void ClearDirty() { mDirty = false; } @@ -240,10 +243,10 @@ class ReadHandler : public Messaging::ExchangeDelegate bool mSuppressResponse = false; // Current Handler state - HandlerState mState = HandlerState::Idle; - ClusterInfo * mpAttributeClusterInfoList = nullptr; - ClusterInfo * mpEventClusterInfoList = nullptr; - ClusterInfo * mpDataVersionFilterList = nullptr; + HandlerState mState = HandlerState::Idle; + ObjectList * mpAttributePathList = nullptr; + ObjectList * mpEventPathList = nullptr; + ObjectList * mpDataVersionFilterList = nullptr; PriorityLevel mCurrentPriority = PriorityLevel::Invalid; diff --git a/src/app/reporting/Engine.cpp b/src/app/reporting/Engine.cpp index c807783dbb47c3..6dff530476d39e 100644 --- a/src/app/reporting/Engine.cpp +++ b/src/app/reporting/Engine.cpp @@ -50,17 +50,18 @@ void Engine::Shutdown() mGlobalDirtySet.ReleaseAll(); } -bool Engine::IsClusterDataVersionMatch(ClusterInfo * aDataVersionFilterList, const ConcreteReadAttributePath & aPath) +bool Engine::IsClusterDataVersionMatch(ObjectList * aDataVersionFilterList, + const ConcreteReadAttributePath & aPath) { bool existPathMatch = false; bool existVersionMismatch = false; for (auto filter = aDataVersionFilterList; filter != nullptr; filter = filter->mpNext) { - if (aPath.mEndpointId == filter->mEndpointId && aPath.mClusterId == filter->mClusterId) + if (aPath.mEndpointId == filter->mValue.mEndpointId && aPath.mClusterId == filter->mValue.mClusterId) { existPathMatch = true; - if (!IsClusterDataVersionEqual(ConcreteClusterPath(filter->mEndpointId, filter->mClusterId), - filter->mDataVersion.Value())) + if (!IsClusterDataVersionEqual(ConcreteClusterPath(filter->mValue.mEndpointId, filter->mValue.mClusterId), + filter->mValue.mDataVersion.Value())) { existVersionMismatch = true; } @@ -135,7 +136,7 @@ CHIP_ERROR Engine::BuildSingleReportDataAttributeReportIBs(ReportDataMessage::Bu } else { - if (IsClusterDataVersionMatch(apReadHandler->GetDataVersionFilterlist(), readPath)) + if (IsClusterDataVersionMatch(apReadHandler->GetDataVersionFilterList(), readPath)) { continue; } @@ -266,15 +267,15 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder CHIP_ERROR err = CHIP_NO_ERROR; size_t eventCount = 0; TLV::TLVWriter backup; - bool eventClean = true; - ClusterInfo * clusterInfoList = apReadHandler->GetEventClusterInfolist(); - EventNumber & eventMin = apReadHandler->GetEventMin(); - EventManagement & eventManager = EventManagement::GetInstance(); - bool hasMoreChunks = false; + bool eventClean = true; + ObjectList * eventList = apReadHandler->GetEventPathList(); + EventNumber & eventMin = apReadHandler->GetEventMin(); + EventManagement & eventManager = EventManagement::GetInstance(); + bool hasMoreChunks = false; aReportDataBuilder.Checkpoint(backup); - VerifyOrExit(clusterInfoList != nullptr, ); + VerifyOrExit(eventList != nullptr, ); // If the eventManager is not valid or has not been initialized, // skip the rest of processing @@ -291,7 +292,7 @@ CHIP_ERROR Engine::BuildSingleReportDataEventReports(ReportDataMessage::Builder { EventReportIBs::Builder & eventReportIBs = aReportDataBuilder.CreateEventReports(); SuccessOrExit(err = aReportDataBuilder.GetError()); - err = eventManager.FetchEventsSince(*(eventReportIBs.GetWriter()), clusterInfoList, eventMin, eventCount, + err = eventManager.FetchEventsSince(*(eventReportIBs.GetWriter()), eventList, eventMin, eventCount, apReadHandler->GetSubjectDescriptor()); if ((err == CHIP_END_OF_TLV) || (err == CHIP_ERROR_TLV_UNDERRUN) || (err == CHIP_NO_ERROR)) @@ -583,7 +584,7 @@ void Engine::Run() } } -bool Engine::MergeOverlappedAttributePath(ClusterInfo & aAttributePath) +bool Engine::MergeOverlappedAttributePath(AttributePathParams & aAttributePath) { return Loop::Break == mGlobalDirtySet.ForEachActiveObject([&](auto * path) { if (path->IsAttributePathSupersetOf(aAttributePath)) @@ -600,18 +601,18 @@ bool Engine::MergeOverlappedAttributePath(ClusterInfo & aAttributePath) }); } -CHIP_ERROR Engine::SetDirty(ClusterInfo & aClusterInfo) +CHIP_ERROR Engine::SetDirty(AttributePathParams & aAttributePath) { - InteractionModelEngine::GetInstance()->mReadHandlers.ForEachActiveObject([&aClusterInfo](ReadHandler * handler) { + InteractionModelEngine::GetInstance()->mReadHandlers.ForEachActiveObject([&aAttributePath](ReadHandler * handler) { // We call SetDirty for both read interactions and subscribe interactions, since we may sent inconsistent attribute data // between two chunks. SetDirty will be ignored automatically by read handlers which is waiting for response to last message // chunk for read interactions. if (handler->IsGeneratingReports() || handler->IsAwaitingReportResponse()) { - for (auto clusterInfo = handler->GetAttributeClusterInfolist(); clusterInfo != nullptr; - clusterInfo = clusterInfo->mpNext) + for (auto object = handler->GetAttributePathList(); object != nullptr; object = object->mpNext) { - if (aClusterInfo.IsAttributePathSupersetOf(*clusterInfo) || clusterInfo->IsAttributePathSupersetOf(aClusterInfo)) + if (aAttributePath.IsAttributePathSupersetOf(object->mValue) || + object->mValue.IsAttributePathSupersetOf(aAttributePath)) { handler->SetDirty(); break; @@ -622,16 +623,16 @@ CHIP_ERROR Engine::SetDirty(ClusterInfo & aClusterInfo) return Loop::Continue; }); - if (!MergeOverlappedAttributePath(aClusterInfo) && - InteractionModelEngine::GetInstance()->IsOverlappedAttributePath(aClusterInfo)) + if (!MergeOverlappedAttributePath(aAttributePath) && + InteractionModelEngine::GetInstance()->IsOverlappedAttributePath(aAttributePath)) { - ClusterInfo * clusterInfo = mGlobalDirtySet.CreateObject(); - if (clusterInfo == nullptr) + auto object = mGlobalDirtySet.CreateObject(); + if (object == nullptr) { ChipLogError(DataManagement, "mGlobalDirtySet pool full, cannot handle more entries!"); return CHIP_ERROR_NO_MEMORY; } - *clusterInfo = aClusterInfo; + *object = aAttributePath; } // Schedule work to run asynchronously on the CHIP thread. The scheduled @@ -658,10 +659,10 @@ void Engine::UpdateReadHandlerDirty(ReadHandler & aReadHandler) } bool intersected = false; - for (auto clusterInfo = aReadHandler.GetAttributeClusterInfolist(); clusterInfo != nullptr; clusterInfo = clusterInfo->mpNext) + for (auto object = aReadHandler.GetAttributePathList(); object != nullptr; object = object->mpNext) { mGlobalDirtySet.ForEachActiveObject([&](auto * path) { - if (path->IsAttributePathSupersetOf(*clusterInfo) || clusterInfo->IsAttributePathSupersetOf(*path)) + if (path->IsAttributePathSupersetOf(object->mValue) || object->mValue.IsAttributePathSupersetOf(*path)) { intersected = true; return Loop::Break; @@ -744,10 +745,10 @@ CHIP_ERROR Engine::ScheduleEventDelivery(ConcreteEventPath & aPath, uint32_t aBy return Loop::Continue; } - for (auto * interestedPath = handler->GetEventClusterInfolist(); interestedPath != nullptr; + for (auto * interestedPath = handler->GetEventPathList(); interestedPath != nullptr; interestedPath = interestedPath->mpNext) { - if (interestedPath->IsEventPathSupersetOf(aPath) && interestedPath->mIsUrgentEvent) + if (interestedPath->mValue.IsEventPathSupersetOf(aPath) && interestedPath->mValue.mIsUrgentEvent) { isUrgentEvent = true; handler->UnblockUrgentEventDelivery(); @@ -765,8 +766,6 @@ CHIP_ERROR Engine::ScheduleEventDelivery(ConcreteEventPath & aPath, uint32_t aBy } return ScheduleBufferPressureEventDelivery(aBytesWritten); - - return CHIP_NO_ERROR; } void Engine::ScheduleUrgentEventDeliverySync() diff --git a/src/app/reporting/Engine.h b/src/app/reporting/Engine.h index 3ed8512dad8b47..3a26abba3ef040 100644 --- a/src/app/reporting/Engine.h +++ b/src/app/reporting/Engine.h @@ -87,7 +87,7 @@ class Engine /** * Application marks mutated change path and would be sent out in later report. */ - CHIP_ERROR SetDirty(ClusterInfo & aClusterInfo); + CHIP_ERROR SetDirty(AttributePathParams & aAttributePathParams); /** * @brief @@ -144,7 +144,7 @@ class Engine // of those will fail to match. This function should return false if either nothing in the list matches the given // endpoint+cluster in the path or there is an entry in the list that matches the endpoint+cluster in the path but does not // match the current data version of that cluster. - bool IsClusterDataVersionMatch(ClusterInfo * aDataVersionFilterList, const ConcreteReadAttributePath & aPath); + bool IsClusterDataVersionMatch(ObjectList * aDataVersionFilterList, const ConcreteReadAttributePath & aPath); /** * Check all active subscription, if the subscription has no paths that intersect with global dirty set, @@ -173,7 +173,7 @@ class Engine * * Return whether one of our paths is now a superset of the provided path. */ - bool MergeOverlappedAttributePath(ClusterInfo & aAttributePath); + bool MergeOverlappedAttributePath(AttributePathParams & aAttributePath); /** * Boolean to indicate if ScheduleRun is pending. This flag is used to prevent calling ScheduleRun multiple times @@ -203,7 +203,7 @@ class Engine * mGlobalDirtySet is used to track the set of attribute/event paths marked dirty for reporting purposes. * */ - ObjectPool mGlobalDirtySet; + ObjectPool mGlobalDirtySet; #if CONFIG_IM_BUILD_FOR_UNIT_TEST uint32_t mReservedSize = 0; diff --git a/src/app/tests/TestAttributePathExpandIterator.cpp b/src/app/tests/TestAttributePathExpandIterator.cpp index ffa1109020a6ae..fe0d18477614ad 100644 --- a/src/app/tests/TestAttributePathExpandIterator.cpp +++ b/src/app/tests/TestAttributePathExpandIterator.cpp @@ -18,9 +18,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -41,7 +41,7 @@ using P = app::ConcreteAttributePath; void TestAllWildcard(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; + app::ObjectList clusInfo; app::ConcreteAttributePath path; P paths[] = { @@ -117,9 +117,9 @@ void TestAllWildcard(nlTestSuite * apSuite, void * apContext) void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mClusterId = Test::MockClusterId(3); - clusInfo.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo; + clusInfo.mValue.mClusterId = Test::MockClusterId(3); + clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); app::ConcreteAttributePath path; P paths[] = { @@ -140,9 +140,9 @@ void TestWildcardEndpoint(nlTestSuite * apSuite, void * apContext) void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint3; - clusInfo.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; app::ConcreteAttributePath path; P paths[] = { @@ -166,9 +166,9 @@ void TestWildcardCluster(nlTestSuite * apSuite, void * apContext) void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint3; - clusInfo.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo.mValue.mAttributeId = app::Clusters::Globals::Attributes::AttributeList::Id; app::ConcreteAttributePath path; P paths[] = { @@ -192,9 +192,9 @@ void TestWildcardClusterGlobalAttributeNotInMetadata(nlTestSuite * apSuite, void void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint2; - clusInfo.mClusterId = Test::MockClusterId(3); + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo.mValue.mClusterId = Test::MockClusterId(3); app::ConcreteAttributePath path; P paths[] = { @@ -222,10 +222,10 @@ void TestWildcardAttribute(nlTestSuite * apSuite, void * apContext) void TestNoWildcard(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo; - clusInfo.mEndpointId = Test::kMockEndpoint2; - clusInfo.mClusterId = Test::MockClusterId(3); - clusInfo.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo; + clusInfo.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo.mValue.mClusterId = Test::MockClusterId(3); + clusInfo.mValue.mAttributeId = Test::MockAttributeId(3); app::ConcreteAttributePath path; P paths[] = { @@ -247,24 +247,24 @@ void TestNoWildcard(nlTestSuite * apSuite, void * apContext) void TestMultipleClusInfo(nlTestSuite * apSuite, void * apContext) { - app::ClusterInfo clusInfo1; + app::ObjectList clusInfo1; - app::ClusterInfo clusInfo2; - clusInfo2.mClusterId = Test::MockClusterId(3); - clusInfo2.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo2; + clusInfo2.mValue.mClusterId = Test::MockClusterId(3); + clusInfo2.mValue.mAttributeId = Test::MockAttributeId(3); - app::ClusterInfo clusInfo3; - clusInfo3.mEndpointId = Test::kMockEndpoint3; - clusInfo3.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; + app::ObjectList clusInfo3; + clusInfo3.mValue.mEndpointId = Test::kMockEndpoint3; + clusInfo3.mValue.mAttributeId = app::Clusters::Globals::Attributes::ClusterRevision::Id; - app::ClusterInfo clusInfo4; - clusInfo4.mEndpointId = Test::kMockEndpoint2; - clusInfo4.mClusterId = Test::MockClusterId(3); + app::ObjectList clusInfo4; + clusInfo4.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo4.mValue.mClusterId = Test::MockClusterId(3); - app::ClusterInfo clusInfo5; - clusInfo5.mEndpointId = Test::kMockEndpoint2; - clusInfo5.mClusterId = Test::MockClusterId(3); - clusInfo5.mAttributeId = Test::MockAttributeId(3); + app::ObjectList clusInfo5; + clusInfo5.mValue.mEndpointId = Test::kMockEndpoint2; + clusInfo5.mValue.mClusterId = Test::MockClusterId(3); + clusInfo5.mValue.mAttributeId = Test::MockAttributeId(3); clusInfo1.mpNext = &clusInfo2; clusInfo2.mpNext = &clusInfo3; diff --git a/src/app/tests/TestClusterInfo.cpp b/src/app/tests/TestClusterInfo.cpp index 0c007cdf284833..fc7d1cee60a9d7 100644 --- a/src/app/tests/TestClusterInfo.cpp +++ b/src/app/tests/TestClusterInfo.cpp @@ -22,7 +22,9 @@ * */ -#include +#include +#include +#include #include #include #include @@ -31,12 +33,12 @@ using namespace chip::Test; namespace chip { namespace app { -namespace TestClusterInfo { +namespace TestPath { void TestAttributePathIncludedSameFieldId(nlTestSuite * apSuite, void * apContext) { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; - ClusterInfo clusterInfo3; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; + AttributePathParams clusterInfo3; clusterInfo1.mAttributeId = 1; clusterInfo2.mAttributeId = 1; clusterInfo3.mAttributeId = 1; @@ -54,26 +56,26 @@ void TestAttributePathIncludedSameFieldId(nlTestSuite * apSuite, void * apContex void TestAttributePathIncludedDifferentFieldId(nlTestSuite * apSuite, void * apContext) { { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mAttributeId = 1; clusterInfo2.mAttributeId = 2; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); } { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo2.mAttributeId = 2; NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); } { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; NL_TEST_ASSERT(apSuite, clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); } { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mAttributeId = 1; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); @@ -82,8 +84,8 @@ void TestAttributePathIncludedDifferentFieldId(nlTestSuite * apSuite, void * apC void TestAttributePathIncludedDifferentEndpointId(nlTestSuite * apSuite, void * apContext) { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mEndpointId = 1; clusterInfo2.mEndpointId = 2; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); @@ -91,8 +93,8 @@ void TestAttributePathIncludedDifferentEndpointId(nlTestSuite * apSuite, void * void TestAttributePathIncludedDifferentClusterId(nlTestSuite * apSuite, void * apContext) { - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; + AttributePathParams clusterInfo1; + AttributePathParams clusterInfo2; clusterInfo1.mClusterId = 1; clusterInfo2.mClusterId = 2; NL_TEST_ASSERT(apSuite, !clusterInfo1.IsAttributePathSupersetOf(clusterInfo2)); @@ -106,7 +108,7 @@ void TestAttributePathIncludedDifferentClusterId(nlTestSuite * apSuite, void * a {kMockEndpoint1, MockClusterId(1), kInvalidEventId}, {kMockEndpoint1, MockClusterId(1), MockEventId(1)}, */ -chip::app::ClusterInfo validEventpaths[6]; +chip::app::EventPathParams validEventpaths[6]; void InitEventPaths() { validEventpaths[1].mClusterId = MockClusterId(1); @@ -163,33 +165,31 @@ void TestEventPathDifferentEndpointId(nlTestSuite * apSuite, void * apContext) NL_TEST_ASSERT(apSuite, !validEventpaths[5].IsEventPathSupersetOf(testPath)); } -} // namespace TestClusterInfo +} // namespace TestPath } // namespace app } // namespace chip namespace { const nlTest sTests[] = { - NL_TEST_DEF("TestAttributePathIncludedSameFieldId", chip::app::TestClusterInfo::TestAttributePathIncludedSameFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentFieldId", chip::app::TestClusterInfo::TestAttributePathIncludedDifferentFieldId), - NL_TEST_DEF("TestAttributePathIncludedDifferentEndpointId", - chip::app::TestClusterInfo::TestAttributePathIncludedDifferentEndpointId), - NL_TEST_DEF("TestAttributePathIncludedDifferentClusterId", - chip::app::TestClusterInfo::TestAttributePathIncludedDifferentClusterId), - NL_TEST_DEF("TestEventPathSameEventId", chip::app::TestClusterInfo::TestEventPathSameEventId), - NL_TEST_DEF("TestEventPathDifferentEventId", chip::app::TestClusterInfo::TestEventPathDifferentEventId), - NL_TEST_DEF("TestEventPathDifferentClusterId", chip::app::TestClusterInfo::TestEventPathDifferentClusterId), - NL_TEST_DEF("TestEventPathDifferentEndpointId", chip::app::TestClusterInfo::TestEventPathDifferentEndpointId), + NL_TEST_DEF("TestAttributePathIncludedSameFieldId", chip::app::TestPath::TestAttributePathIncludedSameFieldId), + NL_TEST_DEF("TestAttributePathIncludedDifferentFieldId", chip::app::TestPath::TestAttributePathIncludedDifferentFieldId), + NL_TEST_DEF("TestAttributePathIncludedDifferentEndpointId", chip::app::TestPath::TestAttributePathIncludedDifferentEndpointId), + NL_TEST_DEF("TestAttributePathIncludedDifferentClusterId", chip::app::TestPath::TestAttributePathIncludedDifferentClusterId), + NL_TEST_DEF("TestEventPathSameEventId", chip::app::TestPath::TestEventPathSameEventId), + NL_TEST_DEF("TestEventPathDifferentEventId", chip::app::TestPath::TestEventPathDifferentEventId), + NL_TEST_DEF("TestEventPathDifferentClusterId", chip::app::TestPath::TestEventPathDifferentClusterId), + NL_TEST_DEF("TestEventPathDifferentEndpointId", chip::app::TestPath::TestEventPathDifferentEndpointId), NL_TEST_SENTINEL() }; } -int TestClusterInfo() +int TestPath() { - nlTestSuite theSuite = { "ClusterInfo", &sTests[0], nullptr, nullptr }; - chip::app::TestClusterInfo::InitEventPaths(); + nlTestSuite theSuite = { "TestPath", &sTests[0], nullptr, nullptr }; + chip::app::TestPath::InitEventPaths(); nlTestRunner(&theSuite, nullptr); return (nlTestRunnerStats(&theSuite)); } -CHIP_REGISTER_TEST_SUITE(TestClusterInfo) +CHIP_REGISTER_TEST_SUITE(TestPath) diff --git a/src/app/tests/TestCommissionManager.cpp b/src/app/tests/TestCommissionManager.cpp index efcb270eaedddf..6580e543d25abf 100644 --- a/src/app/tests/TestCommissionManager.cpp +++ b/src/app/tests/TestCommissionManager.cpp @@ -143,8 +143,7 @@ void CheckCommissioningWindowManagerEnhancedWindowTask(intptr_t context) nlTestSuite * suite = reinterpret_cast(context); CommissioningWindowManager & commissionMgr = Server::GetInstance().GetCommissioningWindowManager(); uint16_t originDiscriminator; - CHIP_ERROR err = - chip::DeviceLayer::GetCommissionableDataProvider()->GetSetupDiscriminator(originDiscriminator); + CHIP_ERROR err = chip::DeviceLayer::GetCommissionableDataProvider()->GetSetupDiscriminator(originDiscriminator); NL_TEST_ASSERT(suite, err == CHIP_NO_ERROR); uint16_t newDiscriminator = static_cast(originDiscriminator + 1); chip::Spake2pVerifier verifier; diff --git a/src/app/tests/TestEventLogging.cpp b/src/app/tests/TestEventLogging.cpp index db9104bec40b55..da3fbe613149d9 100644 --- a/src/app/tests/TestEventLogging.cpp +++ b/src/app/tests/TestEventLogging.cpp @@ -23,11 +23,11 @@ */ #include -#include #include #include #include #include +#include #include #include #include @@ -46,7 +46,6 @@ namespace { -static const chip::NodeId kTestDeviceNodeId1 = 0x18B4300000000001ULL; static const chip::ClusterId kLivenessClusterId = 0x00000022; static const uint32_t kLivenessChangeEvent = 1; static const chip::EndpointId kTestEndpointId1 = 2; @@ -133,7 +132,7 @@ static void CheckLogState(nlTestSuite * apSuite, chip::app::EventManagement & aL } static void CheckLogReadOut(nlTestSuite * apSuite, chip::app::EventManagement & alogMgmt, chip::EventNumber startingEventNumber, - size_t expectedNumEvents, chip::app::ClusterInfo * clusterInfo) + size_t expectedNumEvents, chip::app::ObjectList * clusterInfo) { CHIP_ERROR err; chip::TLV::TLVReader reader; @@ -224,22 +223,20 @@ static void CheckLogEventWithEvictToNextBuffer(nlTestSuite * apSuite, void * apC NL_TEST_ASSERT(apSuite, (eid4 + 1) == eid5); NL_TEST_ASSERT(apSuite, (eid5 + 1) == eid6); - chip::app::ClusterInfo testClusterInfo1; - testClusterInfo1.mNodeId = kTestDeviceNodeId1; - testClusterInfo1.mEndpointId = kTestEndpointId1; - testClusterInfo1.mClusterId = kLivenessClusterId; - chip::app::ClusterInfo testClusterInfo2; - testClusterInfo2.mNodeId = kTestDeviceNodeId1; - testClusterInfo2.mEndpointId = kTestEndpointId2; - testClusterInfo2.mClusterId = kLivenessClusterId; - testClusterInfo2.mEventId = kLivenessChangeEvent; - - CheckLogReadOut(apSuite, logMgmt, 0, 3, &testClusterInfo1); - CheckLogReadOut(apSuite, logMgmt, 1, 2, &testClusterInfo1); - CheckLogReadOut(apSuite, logMgmt, 2, 1, &testClusterInfo1); - CheckLogReadOut(apSuite, logMgmt, 3, 3, &testClusterInfo2); - CheckLogReadOut(apSuite, logMgmt, 4, 2, &testClusterInfo2); - CheckLogReadOut(apSuite, logMgmt, 5, 1, &testClusterInfo2); + chip::app::ObjectList testEventPathParams1; + testEventPathParams1.mValue.mEndpointId = kTestEndpointId1; + testEventPathParams1.mValue.mClusterId = kLivenessClusterId; + chip::app::ObjectList testEventPathParams2; + testEventPathParams2.mValue.mEndpointId = kTestEndpointId2; + testEventPathParams2.mValue.mClusterId = kLivenessClusterId; + testEventPathParams2.mValue.mEventId = kLivenessChangeEvent; + + CheckLogReadOut(apSuite, logMgmt, 0, 3, &testEventPathParams1); + CheckLogReadOut(apSuite, logMgmt, 1, 2, &testEventPathParams1); + CheckLogReadOut(apSuite, logMgmt, 2, 1, &testEventPathParams1); + CheckLogReadOut(apSuite, logMgmt, 3, 3, &testEventPathParams2); + CheckLogReadOut(apSuite, logMgmt, 4, 2, &testEventPathParams2); + CheckLogReadOut(apSuite, logMgmt, 5, 1, &testEventPathParams2); } static void CheckLogEventWithDiscardLowEvent(nlTestSuite * apSuite, void * apContext) diff --git a/src/app/tests/TestEventOverflow.cpp b/src/app/tests/TestEventOverflow.cpp index 57b203b0b2880e..9178b36718c7fc 100644 --- a/src/app/tests/TestEventOverflow.cpp +++ b/src/app/tests/TestEventOverflow.cpp @@ -22,7 +22,6 @@ * */ -#include #include #include #include diff --git a/src/app/tests/TestInteractionModelEngine.cpp b/src/app/tests/TestInteractionModelEngine.cpp index 2e0407b6cdf917..fe5814d6511df0 100644 --- a/src/app/tests/TestInteractionModelEngine.cpp +++ b/src/app/tests/TestInteractionModelEngine.cpp @@ -43,14 +43,14 @@ namespace app { class TestInteractionModelEngine { public: - static void TestClusterInfoPushRelease(nlTestSuite * apSuite, void * apContext); - static int GetClusterInfoListLength(ClusterInfo * apClusterInfoList); + static void TestAttributePathParamsPushRelease(nlTestSuite * apSuite, void * apContext); + static int GetAttributePathListLength(ObjectList * apattributePathParamsList); }; -int TestInteractionModelEngine::GetClusterInfoListLength(ClusterInfo * apClusterInfoList) +int TestInteractionModelEngine::GetAttributePathListLength(ObjectList * apAttributePathParamsList) { - int length = 0; - ClusterInfo * runner = apClusterInfoList; + int length = 0; + ObjectList * runner = apAttributePathParamsList; while (runner != nullptr) { runner = runner->mpNext; @@ -59,35 +59,41 @@ int TestInteractionModelEngine::GetClusterInfoListLength(ClusterInfo * apCluster return length; } -void TestInteractionModelEngine::TestClusterInfoPushRelease(nlTestSuite * apSuite, void * apContext) +void TestInteractionModelEngine::TestAttributePathParamsPushRelease(nlTestSuite * apSuite, void * apContext) { TestContext & ctx = *static_cast(apContext); CHIP_ERROR err = CHIP_NO_ERROR; err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ClusterInfo * clusterInfoList = nullptr; - ClusterInfo clusterInfo1; - ClusterInfo clusterInfo2; - ClusterInfo clusterInfo3; - - clusterInfo1.mEndpointId = 1; - clusterInfo2.mEndpointId = 2; - clusterInfo3.mEndpointId = 3; - - InteractionModelEngine::GetInstance()->PushFront(clusterInfoList, clusterInfo1); - NL_TEST_ASSERT(apSuite, clusterInfoList != nullptr && clusterInfo1.mEndpointId == clusterInfoList->mEndpointId); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 1); - - InteractionModelEngine::GetInstance()->PushFront(clusterInfoList, clusterInfo2); - NL_TEST_ASSERT(apSuite, clusterInfoList != nullptr && clusterInfo2.mEndpointId == clusterInfoList->mEndpointId); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 2); - - InteractionModelEngine::GetInstance()->PushFront(clusterInfoList, clusterInfo3); - NL_TEST_ASSERT(apSuite, clusterInfoList != nullptr && clusterInfo3.mEndpointId == clusterInfoList->mEndpointId); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 3); - - InteractionModelEngine::GetInstance()->ReleaseClusterInfoList(clusterInfoList); - NL_TEST_ASSERT(apSuite, GetClusterInfoListLength(clusterInfoList) == 0); + ObjectList * attributePathParamsList = nullptr; + AttributePathParams attributePathParams1; + AttributePathParams attributePathParams2; + AttributePathParams attributePathParams3; + + attributePathParams1.mEndpointId = 1; + attributePathParams2.mEndpointId = 2; + attributePathParams3.mEndpointId = 3; + + InteractionModelEngine::GetInstance()->PushFrontAttributePathList(attributePathParamsList, attributePathParams1); + NL_TEST_ASSERT(apSuite, + attributePathParamsList != nullptr && + attributePathParams1.mEndpointId == attributePathParamsList->mValue.mEndpointId); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 1); + + InteractionModelEngine::GetInstance()->PushFrontAttributePathList(attributePathParamsList, attributePathParams2); + NL_TEST_ASSERT(apSuite, + attributePathParamsList != nullptr && + attributePathParams2.mEndpointId == attributePathParamsList->mValue.mEndpointId); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 2); + + InteractionModelEngine::GetInstance()->PushFrontAttributePathList(attributePathParamsList, attributePathParams3); + NL_TEST_ASSERT(apSuite, + attributePathParamsList != nullptr && + attributePathParams3.mEndpointId == attributePathParamsList->mValue.mEndpointId); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 3); + + InteractionModelEngine::GetInstance()->ReleaseAttributePathList(attributePathParamsList); + NL_TEST_ASSERT(apSuite, GetAttributePathListLength(attributePathParamsList) == 0); } } // namespace app } // namespace chip @@ -97,7 +103,7 @@ namespace { // clang-format off const nlTest sTests[] = { - NL_TEST_DEF("TestClusterInfoPushRelease", chip::app::TestInteractionModelEngine::TestClusterInfoPushRelease), + NL_TEST_DEF("TestAttributePathParamsPushRelease", chip::app::TestInteractionModelEngine::TestAttributePathParamsPushRelease), NL_TEST_SENTINEL() }; // clang-format on diff --git a/src/app/tests/TestReadInteraction.cpp b/src/app/tests/TestReadInteraction.cpp index 186fa251843b05..e9ed676ec99b69 100644 --- a/src/app/tests/TestReadInteraction.cpp +++ b/src/app/tests/TestReadInteraction.cpp @@ -1282,7 +1282,7 @@ void TestReadInteraction::TestSetDirtyBetweenChunks(nlTestSuite * apSuite, void { mDidSetDirty = true; - ClusterInfo dirtyPath; + AttributePathParams dirtyPath; dirtyPath.mEndpointId = Test::kMockEndpoint3; dirtyPath.mClusterId = Test::MockClusterId(2); dirtyPath.mAttributeId = Test::MockAttributeId(4); @@ -1524,28 +1524,28 @@ void TestReadInteraction::TestSubscribeRoundtrip(nlTestSuite * apSuite, void * a GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = kTestClusterId; dirtyPath1.mEndpointId = kTestEndpointId; dirtyPath1.mAttributeId = 1; - chip::app::ClusterInfo dirtyPath2; + chip::app::AttributePathParams dirtyPath2; dirtyPath2.mClusterId = kTestClusterId; dirtyPath2.mEndpointId = kTestEndpointId; dirtyPath2.mAttributeId = 2; - chip::app::ClusterInfo dirtyPath3; + chip::app::AttributePathParams dirtyPath3; dirtyPath3.mClusterId = kTestClusterId; dirtyPath3.mEndpointId = kTestEndpointId; dirtyPath3.mAttributeId = 2; dirtyPath3.mListIndex = 1; - chip::app::ClusterInfo dirtyPath4; + chip::app::AttributePathParams dirtyPath4; dirtyPath4.mClusterId = kTestClusterId; dirtyPath4.mEndpointId = kTestEndpointId; dirtyPath4.mAttributeId = 3; - chip::app::ClusterInfo dirtyPath5; + chip::app::AttributePathParams dirtyPath5; dirtyPath5.mClusterId = kTestClusterId; dirtyPath5.mEndpointId = kTestEndpointId; dirtyPath5.mAttributeId = 4; @@ -1774,7 +1774,7 @@ void TestReadInteraction::TestSubscribeWildcard(nlTestSuite * apSuite, void * ap delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - ClusterInfo dirtyPath; + AttributePathParams dirtyPath; dirtyPath.mEndpointId = Test::kMockEndpoint2; dirtyPath.mClusterId = Test::MockClusterId(3); dirtyPath.mAttributeId = Test::MockAttributeId(1); @@ -1795,7 +1795,7 @@ void TestReadInteraction::TestSubscribeWildcard(nlTestSuite * apSuite, void * ap delegate.mGotReport = false; delegate.mNumAttributeResponse = 0; - ClusterInfo dirtyPath; + AttributePathParams dirtyPath; dirtyPath.mEndpointId = Test::kMockEndpoint3; err = engine->GetReportingEngine().SetDirty(dirtyPath); @@ -2084,12 +2084,12 @@ void TestReadInteraction::TestPostSubscribeRoundtripStatusReportTimeout(nlTestSu GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = kTestClusterId; dirtyPath1.mEndpointId = kTestEndpointId; dirtyPath1.mAttributeId = 1; - chip::app::ClusterInfo dirtyPath2; + chip::app::AttributePathParams dirtyPath2; dirtyPath2.mClusterId = kTestClusterId; dirtyPath2.mEndpointId = kTestEndpointId; dirtyPath2.mAttributeId = 2; @@ -2403,7 +2403,7 @@ void TestReadInteraction::TestPostSubscribeRoundtripChunkStatusReportTimeout(nlT GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = Test::MockClusterId(2); dirtyPath1.mEndpointId = Test::kMockEndpoint3; dirtyPath1.mAttributeId = Test::MockAttributeId(4); @@ -2500,7 +2500,7 @@ void TestReadInteraction::TestPostSubscribeRoundtripChunkReportTimeout(nlTestSui GenerateEvents(apSuite, apContext); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mHoldReport == false); NL_TEST_ASSERT(apSuite, delegate.mpReadHandler->mDirty == true); - chip::app::ClusterInfo dirtyPath1; + chip::app::AttributePathParams dirtyPath1; dirtyPath1.mClusterId = Test::MockClusterId(2); dirtyPath1.mEndpointId = Test::kMockEndpoint3; dirtyPath1.mAttributeId = Test::MockAttributeId(4); diff --git a/src/app/tests/TestReportingEngine.cpp b/src/app/tests/TestReportingEngine.cpp index e67ef72759fed1..f4e22fa8a30f79 100644 --- a/src/app/tests/TestReportingEngine.cpp +++ b/src/app/tests/TestReportingEngine.cpp @@ -120,17 +120,17 @@ void TestReportingEngine::TestMergeOverlappedAttributePath(nlTestSuite * apSuite err = InteractionModelEngine::GetInstance()->Init(&ctx.GetExchangeManager()); NL_TEST_ASSERT(apSuite, err == CHIP_NO_ERROR); - ClusterInfo * clusterInfo = InteractionModelEngine::GetInstance()->GetReportingEngine().mGlobalDirtySet.CreateObject(); - clusterInfo->mAttributeId = 1; + AttributePathParams * clusterInfo = InteractionModelEngine::GetInstance()->GetReportingEngine().mGlobalDirtySet.CreateObject(); + clusterInfo->mAttributeId = 1; { - chip::app::ClusterInfo testClusterInfo; + AttributePathParams testClusterInfo; testClusterInfo.mAttributeId = 3; NL_TEST_ASSERT(apSuite, !InteractionModelEngine::GetInstance()->GetReportingEngine().MergeOverlappedAttributePath(testClusterInfo)); } { - chip::app::ClusterInfo testClusterInfo; + AttributePathParams testClusterInfo; testClusterInfo.mAttributeId = 1; testClusterInfo.mListIndex = 2; NL_TEST_ASSERT(apSuite, diff --git a/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml index 992ff201697457..3204ceb5d01f15 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml @@ -27,8 +27,8 @@ tests: Specific Attribute. On receipt of this message, DUT should send a write response action with the modified attribute value to the TH." verification: - "In case of chip tool, here is an example command to use - ./chip-tool levelcontrol write on-level 2 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + levelcontrol write on-level 2 1 1" disabled: true - label: @@ -36,8 +36,8 @@ tests: receipt of this message, DUT should send a Write Response action with the attribute value to the DUT." verification: - "In case of chip tool, here is an example command to use - ./chip-tool any write-by-id 0x0008 0x0010 1 1 0xffff" + "In case of chip tool, here is an example command to use ./chip-tool + any write-by-id 0x0008 0x0010 1 1 0xffff" disabled: true - label: @@ -45,8 +45,8 @@ tests: attribute of data type bool. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool basic write local-config-disabled 1 1 0" + "In case of chip tool, here is an example command to use ./chip-tool + basic write local-config-disabled 1 1 0" disabled: true - label: @@ -54,8 +54,8 @@ tests: attribute of data type string. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool basic write node-label 1 1 0" + "In case of chip tool, here is an example command to use ./chip-tool + basic write node-label 1 1 0" disabled: true - label: @@ -63,8 +63,8 @@ tests: attribute of data type unsigned integer. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool any write-by-id 0x0008 0x0010 1 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + any write-by-id 0x0008 0x0010 1 1 1" disabled: true - label: @@ -108,8 +108,8 @@ tests: attribute of data type enum. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool any write-by-id 0x0204 0 1 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + any write-by-id 0x0204 0 1 1 1" disabled: true - label: @@ -117,8 +117,8 @@ tests: attribute of data type bitmap. DUT responds with the Write Response action with the right attribute value." verification: - "In case of chip tool, here is an example command to use - ./chip-tool colorcontrol write-by-id 0x000f 1 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + colorcontrol write-by-id 0x000f 1 1 1" disabled: true - label: @@ -150,8 +150,8 @@ tests: "TH sends the Write Request Message to the DUT to read an unsupported attribute DUT responds with the Write Response action" verification: - "In case of chip tool, here is an example command to use - ./chip-tool any read-by-id 0x03 -900 1 1" + "In case of chip tool, here is an example command to use ./chip-tool + any read-by-id 0x03 -900 1 1" disabled: true - label: @@ -186,10 +186,9 @@ tests: write response action with the modified attribute value to the TH. Repeat the above steps 3 times." verification: - "In case of chip tool, here is an example command to use - ./chip-tool basic write node-label TE8 1 1 ./chip-tool basic - write node-label TE7 1 1 ./chip-tool basic write node-label TE6 1 - 1" + "In case of chip tool, here is an example command to use ./chip-tool + basic write node-label TE8 1 1 ./chip-tool basic write node-label TE7 + 1 1 ./chip-tool basic write node-label TE6 1 1" disabled: true - label: diff --git a/src/app/util/ember-compatibility-functions.cpp b/src/app/util/ember-compatibility-functions.cpp index e6c46a6b13d076..3f696df7e03674 100644 --- a/src/app/util/ember-compatibility-functions.cpp +++ b/src/app/util/ember-compatibility-functions.cpp @@ -22,7 +22,6 @@ */ #include -#include #include #include #include @@ -990,7 +989,7 @@ void MatterReportingAttributeChangeCallback(EndpointId endpoint, ClusterId clust // applications notifying about changes from their end. assertChipStackLockedByCurrentThread(); - ClusterInfo info; + AttributePathParams info; info.mClusterId = clusterId; info.mAttributeId = attributeId; info.mEndpointId = endpoint; @@ -1010,7 +1009,7 @@ void MatterReportingAttributeChangeCallback(EndpointId endpoint) // applications notifying about changes from their end. assertChipStackLockedByCurrentThread(); - ClusterInfo info; + AttributePathParams info; info.mEndpointId = endpoint; // We are adding or enabling a whole endpoint, in this case, we do not touch the cluster data version. diff --git a/src/app/util/mock/attribute-storage.cpp b/src/app/util/mock/attribute-storage.cpp index 9cb0fa6a172cce..6371b179cdfe8a 100644 --- a/src/app/util/mock/attribute-storage.cpp +++ b/src/app/util/mock/attribute-storage.cpp @@ -37,7 +37,6 @@ #include #include -#include #include #include #include From 2af2c86df7d6f7d7b0981278149a958e2e3e1da0 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Thu, 24 Mar 2022 13:20:54 +0100 Subject: [PATCH 41/70] [asan] heap-buffer-overflow if the txt record does not contains an = and is the len field has the right size (#15917) --- src/lib/dnssd/minimal_mdns/RecordData.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib/dnssd/minimal_mdns/RecordData.cpp b/src/lib/dnssd/minimal_mdns/RecordData.cpp index e252ff3219123c..860773f407491b 100644 --- a/src/lib/dnssd/minimal_mdns/RecordData.cpp +++ b/src/lib/dnssd/minimal_mdns/RecordData.cpp @@ -18,6 +18,7 @@ #include "RecordData.h" #include +#include namespace mdns { namespace Minimal { @@ -36,25 +37,30 @@ bool ParseTxtRecord(const BytesRange & data, TxtRecordDelegate * callback) { return false; } - pos++; // name=value string of size length - const uint8_t * equalPos = pos; - while ((*equalPos != '=') && ((equalPos - pos) < length)) + const uint8_t * equalPos = pos + 1; + while (((equalPos - pos) < length) && (*equalPos != '=')) { equalPos++; } - if (pos + length == equalPos) + if (pos + length == equalPos && *equalPos == '=') { - callback->OnRecord(BytesRange(pos, equalPos), BytesRange()); + // If there is an '=' sign with an empty value, just ignore it and position the end cursor directly onto + // the position of the '=' + callback->OnRecord(BytesRange(pos + 1, equalPos), BytesRange()); + } + else if (pos + length == equalPos && *equalPos != '=') + { + callback->OnRecord(BytesRange(pos + 1, equalPos + 1), BytesRange()); } else { - callback->OnRecord(BytesRange(pos, equalPos), BytesRange(equalPos + 1, pos + length)); + callback->OnRecord(BytesRange(pos + 1, equalPos), BytesRange(equalPos + 1, pos + 1 + length)); } - pos += length; + pos += 1 + length; } return pos == data.End(); From 2eafcfbc5c5eb6efdd87171282dfb5b44032cc93 Mon Sep 17 00:00:00 2001 From: markaj-nordic <98948394+markaj-nordic@users.noreply.github.com> Date: Thu, 24 Mar 2022 13:28:56 +0100 Subject: [PATCH 42/70] [nrfconnect] Optimized external flash power consumption. (#16219) Signed-off-by: markaj-nordic --- .../nrfconnect/main/AppTask.cpp | 6 +-- .../nrfconnect/main/include/AppTask.h | 3 +- .../lighting-app/nrfconnect/main/AppTask.cpp | 9 ++--- examples/lock-app/nrfconnect/main/AppTask.cpp | 9 ++--- .../nrfconnect/util/include/OTAUtil.h | 37 +++++++++++++++++ examples/pump-app/nrfconnect/main/AppTask.cpp | 9 ++--- .../nrfconnect/main/AppTask.cpp | 9 ++--- .../nrfconnect/OTAImageProcessorImpl.cpp | 40 +++++++++++++++++++ .../nrfconnect/OTAImageProcessorImpl.h | 25 +++++++++++- 9 files changed, 121 insertions(+), 26 deletions(-) create mode 100644 examples/platform/nrfconnect/util/include/OTAUtil.h diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index e7590fd6d575b9..60317685df384a 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -147,9 +147,9 @@ CHIP_ERROR AppTask::Init() void AppTask::InitOTARequestor() { #if CONFIG_CHIP_OTA_REQUESTOR - mOTAImageProcessor.SetOTADownloader(&mBDXDownloader); - mBDXDownloader.SetImageProcessorDelegate(&mOTAImageProcessor); - mOTARequestorDriver.Init(&mOTARequestor, &mOTAImageProcessor); + OTAImageProcessorNrf::Get().SetOTADownloader(&mBDXDownloader); + mBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); + mOTARequestorDriver.Init(&mOTARequestor, &OTAImageProcessorNrf::Get()); mOTARequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); mOTARequestor.Init(chip::Server::GetInstance(), mOTARequestorStorage, mOTARequestorDriver, mBDXDownloader); chip::SetRequestorInstance(&mOTARequestor); diff --git a/examples/all-clusters-app/nrfconnect/main/include/AppTask.h b/examples/all-clusters-app/nrfconnect/main/include/AppTask.h index b05a7d30ff3d3d..6f0e00ea247a78 100644 --- a/examples/all-clusters-app/nrfconnect/main/include/AppTask.h +++ b/examples/all-clusters-app/nrfconnect/main/include/AppTask.h @@ -20,11 +20,11 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" #include #include #include #include -#include #endif struct k_timer; @@ -76,7 +76,6 @@ class AppTask #if CONFIG_CHIP_OTA_REQUESTOR chip::DefaultOTARequestorStorage mOTARequestorStorage; chip::DeviceLayer::GenericOTARequestorDriver mOTARequestorDriver; - chip::DeviceLayer::OTAImageProcessorImpl mOTAImageProcessor; chip::BDXDownloader mBDXDownloader; chip::OTARequestor mOTARequestor; #endif diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 8aae4a4487aeb5..c8f1adbebb1859 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -40,11 +40,11 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" #include #include #include #include -#include #endif #include @@ -88,7 +88,6 @@ bool sHaveBLEConnections = false; #if CONFIG_CHIP_OTA_REQUESTOR DefaultOTARequestorStorage sRequestorStorage; GenericOTARequestorDriver sOTARequestorDriver; -OTAImageProcessorImpl sOTAImageProcessor; chip::BDXDownloader sBDXDownloader; chip::OTARequestor sOTARequestor; #endif @@ -202,9 +201,9 @@ CHIP_ERROR AppTask::Init() void AppTask::InitOTARequestor() { #if CONFIG_CHIP_OTA_REQUESTOR - sOTAImageProcessor.SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor); - sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor); + OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); + sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); + sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); chip::SetRequestorInstance(&sOTARequestor); diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 6ca2aa26d525e4..1accdfe81fe6bb 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -36,11 +36,11 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" #include #include #include #include -#include #endif #include @@ -77,7 +77,6 @@ bool sHaveBLEConnections = false; #if CONFIG_CHIP_OTA_REQUESTOR DefaultOTARequestorStorage sRequestorStorage; GenericOTARequestorDriver sOTARequestorDriver; -OTAImageProcessorImpl sOTAImageProcessor; chip::BDXDownloader sBDXDownloader; chip::OTARequestor sOTARequestor; #endif @@ -183,9 +182,9 @@ CHIP_ERROR AppTask::Init() void AppTask::InitOTARequestor() { #if CONFIG_CHIP_OTA_REQUESTOR - sOTAImageProcessor.SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor); - sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor); + OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); + sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); + sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); chip::SetRequestorInstance(&sOTARequestor); diff --git a/examples/platform/nrfconnect/util/include/OTAUtil.h b/examples/platform/nrfconnect/util/include/OTAUtil.h new file mode 100644 index 00000000000000..e8dac963145df7 --- /dev/null +++ b/examples/platform/nrfconnect/util/include/OTAUtil.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2022 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 + +#ifdef CONFIG_CHIP_OTA_REQUESTOR +namespace OTAImageProcessorNrf { +// compile-time factory method +inline chip::DeviceLayer::OTAImageProcessorImpl & Get() +{ +#if CONFIG_PM_DEVICE && CONFIG_NORDIC_QSPI_NOR + static chip::DeviceLayer::ExtFlashHandler sQSPIHandler; + static chip::DeviceLayer::OTAImageProcessorImplPMDevice sOTAImageProcessor{ sQSPIHandler }; +#else + static chip::DeviceLayer::OTAImageProcessorImpl sOTAImageProcessor; +#endif + return sOTAImageProcessor; +} +} // namespace OTAImageProcessorNrf + +#endif diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 4e8b9012b14406..7e62ce1b054fda 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -37,11 +37,11 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" #include #include #include #include -#include #endif #include @@ -80,7 +80,6 @@ bool sHaveBLEConnections = false; #if CONFIG_CHIP_OTA_REQUESTOR DefaultOTARequestorStorage sRequestorStorage; GenericOTARequestorDriver sOTARequestorDriver; -OTAImageProcessorImpl sOTAImageProcessor; chip::BDXDownloader sBDXDownloader; chip::OTARequestor sOTARequestor; #endif @@ -180,9 +179,9 @@ CHIP_ERROR AppTask::Init() void AppTask::InitOTARequestor() { #if CONFIG_CHIP_OTA_REQUESTOR - sOTAImageProcessor.SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor); - sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor); + OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); + sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); + sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); sOTARequestor.Init(chip::Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); chip::SetRequestorInstance(&sOTARequestor); diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index 1c7d92c9c0dd3d..c5e28e1f7c12fe 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -37,11 +37,11 @@ #include #if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" #include #include #include #include -#include #endif #include @@ -77,7 +77,6 @@ bool sHaveBLEConnections = false; #if CONFIG_CHIP_OTA_REQUESTOR DefaultOTARequestorStorage sRequestorStorage; GenericOTARequestorDriver sOTARequestorDriver; -OTAImageProcessorImpl sOTAImageProcessor; chip::BDXDownloader sBDXDownloader; chip::OTARequestor sOTARequestor; #endif @@ -177,9 +176,9 @@ CHIP_ERROR AppTask::Init() void AppTask::InitOTARequestor() { #if CONFIG_CHIP_OTA_REQUESTOR - sOTAImageProcessor.SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&sOTAImageProcessor); - sOTARequestorDriver.Init(&sOTARequestor, &sOTAImageProcessor); + OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); + sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); + sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); sOTARequestor.Init(chip::Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); chip::SetRequestorInstance(&sOTARequestor); diff --git a/src/platform/nrfconnect/OTAImageProcessorImpl.cpp b/src/platform/nrfconnect/OTAImageProcessorImpl.cpp index dd3f4f16040fc7..f7e3e6c8f4190a 100644 --- a/src/platform/nrfconnect/OTAImageProcessorImpl.cpp +++ b/src/platform/nrfconnect/OTAImageProcessorImpl.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include namespace chip { @@ -141,5 +142,44 @@ CHIP_ERROR OTAImageProcessorImpl::ProcessHeader(ByteSpan & block) return CHIP_NO_ERROR; } +// external flash power consumption optimization +void ExtFlashHandler::DoAction(Action action) +{ +#if CONFIG_PM_DEVICE && CONFIG_NORDIC_QSPI_NOR && !CONFIG_SOC_NRF52840 // nRF52 is optimized per default + // utilize the QSPI driver sleep power mode + const auto * qspi_dev = device_get_binding(DT_LABEL(DT_INST(0, nordic_qspi_nor))); + if (qspi_dev) + { + const auto requestedAction = Action::WAKE_UP == action ? PM_DEVICE_ACTION_RESUME : PM_DEVICE_ACTION_SUSPEND; + (void) pm_device_action_run(qspi_dev, requestedAction); // not much can be done in case of a failure + } +#endif +} + +OTAImageProcessorImplPMDevice::OTAImageProcessorImplPMDevice(ExtFlashHandler & aHandler) : mHandler(aHandler) +{ + mHandler.DoAction(ExtFlashHandler::Action::SLEEP); +} + +CHIP_ERROR OTAImageProcessorImplPMDevice::PrepareDownload() +{ + mHandler.DoAction(ExtFlashHandler::Action::WAKE_UP); + return OTAImageProcessorImpl::PrepareDownload(); +} + +CHIP_ERROR OTAImageProcessorImplPMDevice::Abort() +{ + auto status = OTAImageProcessorImpl::Abort(); + mHandler.DoAction(ExtFlashHandler::Action::SLEEP); + return status; +} + +CHIP_ERROR OTAImageProcessorImplPMDevice::Apply() +{ + auto status = OTAImageProcessorImpl::Apply(); + mHandler.DoAction(ExtFlashHandler::Action::SLEEP); + return status; +} + } // namespace DeviceLayer } // namespace chip diff --git a/src/platform/nrfconnect/OTAImageProcessorImpl.h b/src/platform/nrfconnect/OTAImageProcessorImpl.h index 6d3ddd1d454f7f..acdd0c89e0d710 100644 --- a/src/platform/nrfconnect/OTAImageProcessorImpl.h +++ b/src/platform/nrfconnect/OTAImageProcessorImpl.h @@ -1,5 +1,4 @@ /* - * * Copyright (c) 2021 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -53,5 +52,29 @@ class OTAImageProcessorImpl : public OTAImageProcessorInterface uint8_t mBuffer[kBufferSize]; }; +class ExtFlashHandler +{ +public: + enum class Action : uint8_t + { + WAKE_UP, + SLEEP + }; + virtual ~ExtFlashHandler() {} + virtual void DoAction(Action action); +}; + +class OTAImageProcessorImplPMDevice : public OTAImageProcessorImpl +{ +public: + explicit OTAImageProcessorImplPMDevice(ExtFlashHandler & aHandler); + CHIP_ERROR PrepareDownload() override; + CHIP_ERROR Abort() override; + CHIP_ERROR Apply() override; + +private: + ExtFlashHandler & mHandler; +}; + } // namespace DeviceLayer } // namespace chip From 4d6858be2fba5b327574632dd1ccf790ed36d711 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 24 Mar 2022 08:30:14 -0400 Subject: [PATCH 43/70] Remove leftover rendezvous bypass bits. (#16597) We no longer really support this non-spec-compliant mode of operation; remove the bits of it still scattered around the tree. --- .../workflows/examples-linux-standalone.yaml | 3 +- config/ameba/args.gni | 1 - config/mbed/CMakeLists.txt | 1 - examples/all-clusters-app/ameba/README.md | 2 - examples/all-clusters-app/esp32/README.md | 8 +--- .../esp32/main/CHIPDeviceManager.cpp | 6 --- .../esp32/main/Kconfig.projbuild | 3 -- examples/all-clusters-app/mbed/config.in | 1 - examples/bridge-app/esp32/README.md | 8 +--- .../esp32/main/CHIPDeviceManager.cpp | 6 --- .../bridge-app/esp32/main/Kconfig.projbuild | 3 -- examples/lighting-app/ameba/README.md | 2 - examples/lighting-app/cyw30739/src/main.cpp | 10 +--- .../esp32/main/CHIPDeviceManager.cpp | 6 --- .../lighting-app/esp32/main/Kconfig.projbuild | 3 -- examples/lighting-app/mbed/config.in | 1 - .../lighting-app/nrfconnect/main/AppTask.cpp | 5 -- examples/lighting-app/telink/src/AppTask.cpp | 7 --- examples/lock-app/cc13x2x7_26x2x7/args.gni | 1 - examples/lock-app/cyw30739/src/main.cpp | 10 +--- examples/lock-app/esp32/README.md | 8 +--- .../lock-app/esp32/main/CHIPDeviceManager.cpp | 6 --- .../lock-app/esp32/main/Kconfig.projbuild | 3 -- examples/lock-app/mbed/config.in | 1 - examples/lock-app/nrfconnect/main/AppTask.cpp | 5 -- .../esp32/main/CHIPDeviceManager.cpp | 6 --- .../esp32/main/Kconfig.projbuild | 3 -- .../esp32/main/CHIPDeviceManager.cpp | 6 --- .../esp32/main/Kconfig.projbuild | 3 -- examples/ota-requestor-app/mbed/config.in | 1 - .../cc13x2x7_26x2x7/args.gni | 1 - examples/pigweed-app/mbed/config.in | 1 - examples/pump-app/cc13x2x7_26x2x7/args.gni | 1 - examples/pump-app/nrfconnect/main/AppTask.cpp | 5 -- .../cc13x2x7_26x2x7/args.gni | 1 - .../nrfconnect/main/AppTask.cpp | 5 -- examples/shell/mbed/config.in | 1 - .../esp32/README.md | 8 +--- .../esp32/main/CHIPDeviceManager.cpp | 6 --- .../esp32/main/Kconfig.projbuild | 3 -- src/app/server/Server.cpp | 47 +------------------ src/app/server/Server.h | 2 - src/credentials/FabricTable.cpp | 13 ++--- src/credentials/FabricTable.h | 2 - .../GenericConfigurationManagerImpl.ipp | 5 -- src/platform/BUILD.gn | 4 -- .../telink/CHIPDevicePlatformConfig.h | 4 -- 47 files changed, 15 insertions(+), 223 deletions(-) diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index bcfa353c6c5aee..fc6b784a92bfe3 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -90,8 +90,7 @@ jobs: - name: Build example Standalone All Clusters Server timeout-minutes: 5 run: | - scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/all_clusters_debug \ - chip_bypass_rendezvous=true + scripts/examples/gn_build_example.sh examples/all-clusters-app/linux out/all_clusters_debug .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ linux debug all-clusters-app \ out/all_clusters_debug/chip-all-clusters-app \ diff --git a/config/ameba/args.gni b/config/ameba/args.gni index fe49e059010256..57c21e2d02e8c2 100755 --- a/config/ameba/args.gni +++ b/config/ameba/args.gni @@ -29,7 +29,6 @@ chip_build_tests = false chip_inet_config_enable_tcp_endpoint = true chip_inet_config_enable_udp_endpoint = true -chip_bypass_rendezvous = false chip_config_network_layer_ble = true custom_toolchain = "//third_party/connectedhomeip/config/ameba/toolchain:ameba" diff --git a/config/mbed/CMakeLists.txt b/config/mbed/CMakeLists.txt index 7571426a4f78a0..48151240e39202 100644 --- a/config/mbed/CMakeLists.txt +++ b/config/mbed/CMakeLists.txt @@ -275,7 +275,6 @@ chip_gn_arg_bool ("chip_build_tests" CONFIG_CHIP_BUILD_TEST chip_gn_arg_bool ("chip_monolithic_tests" CONFIG_CHIP_BUILD_TESTS) chip_gn_arg_bool ("chip_build_libshell" CONFIG_CHIP_LIB_SHELL) chip_gn_arg_bool ("chip_with_platform_mbedtls" CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS) -chip_gn_arg_bool ("chip_bypass_rendezvous" CONFIG_CHIP_BYPASS_RENDEZVOUS) chip_gn_arg_bool ("chip_build_pw_rpc_lib" CONFIG_CHIP_PW_RPC) chip_gn_arg_bool ("chip_enable_data_model" CONFIG_CHIP_DATA_MODEL) if (CONFIG_CHIP_PW_RPC) diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 5642b9869fce69..8ff6e342433981 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -65,7 +65,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = true` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" @@ -82,7 +81,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = false` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index f6e062ce40982a..a0b79d926d33e8 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -148,18 +148,14 @@ that are currently supported include `ESP32-DevKitC` (default), ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -ByPass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. NOTE: to avoid build error `undefined reference to 'chip::DevelopmentCerts::kDacPublicKey'`, set VID to diff --git a/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp b/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp index 1578b7df5e911a..248bd9cab29d55 100644 --- a/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/all-clusters-app/esp32/main/CHIPDeviceManager.cpp @@ -74,12 +74,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/all-clusters-app/esp32/main/Kconfig.projbuild b/examples/all-clusters-app/esp32/main/Kconfig.projbuild index 5bd4461042836f..b1a935811f318b 100644 --- a/examples/all-clusters-app/esp32/main/Kconfig.projbuild +++ b/examples/all-clusters-app/esp32/main/Kconfig.projbuild @@ -51,8 +51,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_SOFTAP bool "Soft-AP" config RENDEZVOUS_MODE_BLE @@ -87,7 +85,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_SOFTAP default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_ON_NETWORK diff --git a/examples/all-clusters-app/mbed/config.in b/examples/all-clusters-app/mbed/config.in index e1bc59c07a44b0..ecf3bb53b4623b 100644 --- a/examples/all-clusters-app/mbed/config.in +++ b/examples/all-clusters-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_OTA_REQUESTOR=y CONFIG_CHIP_DATA_MODEL=y diff --git a/examples/bridge-app/esp32/README.md b/examples/bridge-app/esp32/README.md index df50e4becfce52..12ca5f4160fead 100644 --- a/examples/bridge-app/esp32/README.md +++ b/examples/bridge-app/esp32/README.md @@ -155,18 +155,14 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -Bypass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. 2. Now flash the device with the same command as before. (Use the right `/dev` device) diff --git a/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp b/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp index f4be7aacd8bf08..add55587dd3eb7 100644 --- a/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/bridge-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/bridge-app/esp32/main/Kconfig.projbuild b/examples/bridge-app/esp32/main/Kconfig.projbuild index 11f2471dad4d2e..5bb496b1599a43 100644 --- a/examples/bridge-app/esp32/main/Kconfig.projbuild +++ b/examples/bridge-app/esp32/main/Kconfig.projbuild @@ -6,8 +6,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -21,7 +19,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/lighting-app/ameba/README.md b/examples/lighting-app/ameba/README.md index 03841064f9424e..19cc15e7a8234c 100644 --- a/examples/lighting-app/ameba/README.md +++ b/examples/lighting-app/ameba/README.md @@ -63,7 +63,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = true` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" @@ -79,7 +78,6 @@ There are two commissioning modes supported by Ameba platform: 1. In "connectedhomeip/config/ameba/args.gni" - - set `chip_bypass_rendezvous = false` - Set `chip_config_network_layer_ble = false` 2. In "connectedhomeip/src/platform/Ameba/CHIPDevicePlatformConfig.h" diff --git a/examples/lighting-app/cyw30739/src/main.cpp b/examples/lighting-app/cyw30739/src/main.cpp index 9ec4cc5c6e3a63..544819f781a876 100644 --- a/examples/lighting-app/cyw30739/src/main.cpp +++ b/examples/lighting-app/cyw30739/src/main.cpp @@ -156,15 +156,7 @@ void EventHandler(const ChipDeviceEvent * event, intptr_t arg) } } -void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) -{ -#if CHIP_BYPASS_RENDEZVOUS - if (event->ThreadStateChange.NetDataChanged && !ConnectivityMgr().IsThreadProvisioned()) - { - ThreadStackMgr().JoinerStart(); - } -#endif /* CHIP_BYPASS_RENDEZVOUS */ -} +void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) {} void LightManagerCallback(LightingManager::Actor_t actor, LightingManager::Action_t action, uint8_t level) { diff --git a/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp b/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp index 5da54e42a021ba..ee7962ed549a72 100644 --- a/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/lighting-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/lighting-app/esp32/main/Kconfig.projbuild b/examples/lighting-app/esp32/main/Kconfig.projbuild index 7aa1ecd9be7ab7..46e6b2dda401ea 100644 --- a/examples/lighting-app/esp32/main/Kconfig.projbuild +++ b/examples/lighting-app/esp32/main/Kconfig.projbuild @@ -85,8 +85,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -100,7 +98,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/lighting-app/mbed/config.in b/examples/lighting-app/mbed/config.in index f55d13d9e9dd68..2456569bfe6fc7 100644 --- a/examples/lighting-app/mbed/config.in +++ b/examples/lighting-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y CONFIG_CHIP_OTA_REQUESTOR=y diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index c8f1adbebb1859..064f8b7738ad64 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -400,11 +400,6 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (chip::Server::GetInstance().AddTestCommissioning() != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - } - if (!chip::DeviceLayer::ConnectivityMgr().IsThreadProvisioned()) { StartDefaultThreadNetwork(); diff --git a/examples/lighting-app/telink/src/AppTask.cpp b/examples/lighting-app/telink/src/AppTask.cpp index 5602acc36ca53d..92e1dde232983d 100644 --- a/examples/lighting-app/telink/src/AppTask.cpp +++ b/examples/lighting-app/telink/src/AppTask.cpp @@ -105,13 +105,6 @@ CHIP_ERROR AppTask::Init() ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); - ret = chip::Server::GetInstance().AddTestCommissioning(); - if (ret != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - return ret; - } - return CHIP_NO_ERROR; } diff --git a/examples/lock-app/cc13x2x7_26x2x7/args.gni b/examples/lock-app/cc13x2x7_26x2x7/args.gni index 21aca9d359af72..2b1db21d690d61 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/args.gni +++ b/examples/lock-app/cc13x2x7_26x2x7/args.gni @@ -34,7 +34,6 @@ chip_enable_ota_requestor = true # BLE options chip_config_network_layer_ble = true -chip_bypass_rendezvous = false # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/lock-app/cyw30739/src/main.cpp b/examples/lock-app/cyw30739/src/main.cpp index ccd12f86dfb329..00c0f91f52648b 100644 --- a/examples/lock-app/cyw30739/src/main.cpp +++ b/examples/lock-app/cyw30739/src/main.cpp @@ -170,15 +170,7 @@ void EventHandler(const ChipDeviceEvent * event, intptr_t arg) } } -void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) -{ -#if CHIP_BYPASS_RENDEZVOUS - if (event->ThreadStateChange.NetDataChanged && !ConnectivityMgr().IsThreadProvisioned()) - { - ThreadStackMgr().JoinerStart(); - } -#endif /* CHIP_BYPASS_RENDEZVOUS */ -} +void HandleThreadStateChangeEvent(const ChipDeviceEvent * event) {} void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor) { diff --git a/examples/lock-app/esp32/README.md b/examples/lock-app/esp32/README.md index 8cc35eaf597e8f..d810491160ef7b 100644 --- a/examples/lock-app/esp32/README.md +++ b/examples/lock-app/esp32/README.md @@ -97,18 +97,14 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -Bypass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. 2. Now flash the device with the same command as before. (Use the right `/dev` device) diff --git a/examples/lock-app/esp32/main/CHIPDeviceManager.cpp b/examples/lock-app/esp32/main/CHIPDeviceManager.cpp index 579e68ada9c8d9..b6d0db29573370 100644 --- a/examples/lock-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/lock-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/lock-app/esp32/main/Kconfig.projbuild b/examples/lock-app/esp32/main/Kconfig.projbuild index 36dc37930eda26..e2ec051d774fe1 100644 --- a/examples/lock-app/esp32/main/Kconfig.projbuild +++ b/examples/lock-app/esp32/main/Kconfig.projbuild @@ -26,8 +26,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -55,7 +53,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/lock-app/mbed/config.in b/examples/lock-app/mbed/config.in index 87619681f691c0..4725fbcd62a77e 100644 --- a/examples/lock-app/mbed/config.in +++ b/examples/lock-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y CONFIG_CHIP_OTA_REQUESTOR=n diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index 1accdfe81fe6bb..fb7cdfc7e3f671 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -376,11 +376,6 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (chip::Server::GetInstance().AddTestCommissioning() != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - } - if (!ConnectivityMgr().IsThreadProvisioned()) { StartDefaultThreadNetwork(); diff --git a/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp b/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp index f4be7aacd8bf08..add55587dd3eb7 100644 --- a/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/ota-provider-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/ota-provider-app/esp32/main/Kconfig.projbuild b/examples/ota-provider-app/esp32/main/Kconfig.projbuild index b5a506f24a24fc..483b7585dc68c6 100644 --- a/examples/ota-provider-app/esp32/main/Kconfig.projbuild +++ b/examples/ota-provider-app/esp32/main/Kconfig.projbuild @@ -26,8 +26,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -41,7 +39,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/ota-requestor-app/esp32/main/CHIPDeviceManager.cpp b/examples/ota-requestor-app/esp32/main/CHIPDeviceManager.cpp index f4be7aacd8bf08..add55587dd3eb7 100644 --- a/examples/ota-requestor-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/ota-requestor-app/esp32/main/CHIPDeviceManager.cpp @@ -69,12 +69,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/ota-requestor-app/esp32/main/Kconfig.projbuild b/examples/ota-requestor-app/esp32/main/Kconfig.projbuild index 96a7f14d5c69ec..a563d7b2ae46ce 100644 --- a/examples/ota-requestor-app/esp32/main/Kconfig.projbuild +++ b/examples/ota-requestor-app/esp32/main/Kconfig.projbuild @@ -26,8 +26,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -41,7 +39,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/examples/ota-requestor-app/mbed/config.in b/examples/ota-requestor-app/mbed/config.in index 93cc98cf544af1..9faec62faac967 100644 --- a/examples/ota-requestor-app/mbed/config.in +++ b/examples/ota-requestor-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_OTA_REQUESTOR=y CONFIG_CHIP_DATA_MODEL=y \ No newline at end of file diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/args.gni b/examples/persistent-storage/cc13x2x7_26x2x7/args.gni index 96bab211852345..86ad077d6f40f3 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/args.gni +++ b/examples/persistent-storage/cc13x2x7_26x2x7/args.gni @@ -26,4 +26,3 @@ ti_simplelink_board = "LP_CC2652R7" # BLE options chip_config_network_layer_ble = true -chip_bypass_rendezvous = false diff --git a/examples/pigweed-app/mbed/config.in b/examples/pigweed-app/mbed/config.in index 89a6a784e8a438..40d50f04657d32 100644 --- a/examples/pigweed-app/mbed/config.in +++ b/examples/pigweed-app/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_PW_RPC=y CONFIG_CHIP_OTA_REQUESTOR=n diff --git a/examples/pump-app/cc13x2x7_26x2x7/args.gni b/examples/pump-app/cc13x2x7_26x2x7/args.gni index 21aca9d359af72..2b1db21d690d61 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/args.gni +++ b/examples/pump-app/cc13x2x7_26x2x7/args.gni @@ -34,7 +34,6 @@ chip_enable_ota_requestor = true # BLE options chip_config_network_layer_ble = true -chip_bypass_rendezvous = false # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index 7e62ce1b054fda..c448c5aeaa3de1 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -371,11 +371,6 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (chip::Server::GetInstance().AddTestCommissioning() != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - } - if (!ConnectivityMgr().IsThreadProvisioned()) { StartDefaultThreadNetwork(); diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni b/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni index 21aca9d359af72..2b1db21d690d61 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/args.gni @@ -34,7 +34,6 @@ chip_enable_ota_requestor = true # BLE options chip_config_network_layer_ble = true -chip_bypass_rendezvous = false # Disable lock tracking, since our FreeRTOS configuration does not set # INCLUDE_xSemaphoreGetMutexHolder diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index c5e28e1f7c12fe..aea8dca3512337 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -368,11 +368,6 @@ void AppTask::StartThreadHandler(AppEvent * aEvent) if (aEvent->ButtonEvent.PinNo != THREAD_START_BUTTON) return; - if (chip::Server::GetInstance().AddTestCommissioning() != CHIP_NO_ERROR) - { - LOG_ERR("Failed to add test pairing"); - } - if (!ConnectivityMgr().IsThreadProvisioned()) { StartDefaultThreadNetwork(); diff --git a/examples/shell/mbed/config.in b/examples/shell/mbed/config.in index 700185f2f5ceca..768471bfdf866e 100644 --- a/examples/shell/mbed/config.in +++ b/examples/shell/mbed/config.in @@ -1,7 +1,6 @@ CONFIG_CHIP_BUILD_TESTS=n CONFIG_CHIP_WITH_EXTERNAL_MBEDTLS=y CONFIG_CHIP_PROJECT_CONFIG=main/include/CHIPProjectConfig.h -CONFIG_CHIP_BYPASS_RENDEZVOUS=n CONFIG_CHIP_LIB_SHELL=y CONFIG_MBED_BSD_SOCKET_TRACE=n CONFIG_CHIP_OTA_REQUESTOR=y diff --git a/examples/temperature-measurement-app/esp32/README.md b/examples/temperature-measurement-app/esp32/README.md index 5603eec78054ed..c72660fe2f34e9 100644 --- a/examples/temperature-measurement-app/esp32/README.md +++ b/examples/temperature-measurement-app/esp32/README.md @@ -97,18 +97,14 @@ make sure the IDF_PATH has been exported(See the manual setup steps above). ## Commissioning and cluster control -Commissioning can be carried out using WiFi, BLE or Bypass. +Commissioning can be carried out using WiFi or BLE. 1. Set the `Rendezvous Mode` for commissioning using menuconfig; the default Rendezvous mode is BLE. $ idf.py menuconfig -Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. If Rendezvous Mode is -Bypass then set the credentials of the WiFi Network (i.e. SSID and Password from -menuconfig). - -`idf.py menuconfig -> Component config -> CHIP Device Layer -> WiFi Station Options` +Select the Rendezvous Mode via `Demo -> Rendezvous Mode`. 2. Now flash the device with the same command as before. (Use the right `/dev` device) diff --git a/examples/temperature-measurement-app/esp32/main/CHIPDeviceManager.cpp b/examples/temperature-measurement-app/esp32/main/CHIPDeviceManager.cpp index ae50dddbcb8670..665bb9f6b5133e 100644 --- a/examples/temperature-measurement-app/esp32/main/CHIPDeviceManager.cpp +++ b/examples/temperature-measurement-app/esp32/main/CHIPDeviceManager.cpp @@ -72,12 +72,6 @@ CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb) ConnectivityMgr().SetBLEAdvertisingEnabled(false); ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); } - else - { - // If rendezvous is bypassed, enable SoftAP so that the device can still - // be communicated with via its SoftAP as needed. - ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled); - } // Register a function to receive events from the CHIP device layer. Note that calls to // this function will happen on the CHIP event loop thread, not the app_main thread. diff --git a/examples/temperature-measurement-app/esp32/main/Kconfig.projbuild b/examples/temperature-measurement-app/esp32/main/Kconfig.projbuild index 36dc37930eda26..e2ec051d774fe1 100644 --- a/examples/temperature-measurement-app/esp32/main/Kconfig.projbuild +++ b/examples/temperature-measurement-app/esp32/main/Kconfig.projbuild @@ -26,8 +26,6 @@ menu "Demo" help Specifies the Rendezvous mode of the peripheral. - config RENDEZVOUS_MODE_BYPASS - bool "Bypass" config RENDEZVOUS_MODE_WIFI bool "Wi-Fi" config RENDEZVOUS_MODE_BLE @@ -55,7 +53,6 @@ menu "Demo" config RENDEZVOUS_MODE int range 0 8 - default 0 if RENDEZVOUS_MODE_BYPASS default 1 if RENDEZVOUS_MODE_WIFI default 2 if RENDEZVOUS_MODE_BLE default 4 if RENDEZVOUS_MODE_THREAD diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 949affe999294d..63af6a1a07d555 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -57,17 +57,6 @@ using chip::Transport::UdpListenParameters; namespace { -constexpr bool isRendezvousBypassed() -{ -#if defined(CHIP_BYPASS_RENDEZVOUS) && CHIP_BYPASS_RENDEZVOUS - return true; -#elif defined(CONFIG_RENDEZVOUS_MODE) - return static_cast(CONFIG_RENDEZVOUS_MODE) == RendezvousInformationFlag::kNone; -#else - return false; -#endif -} - void StopEventLoop(intptr_t arg) { CHIP_ERROR err = chip::DeviceLayer::PlatformMgr().StopEventLoopTask(); @@ -222,12 +211,7 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint SuccessOrExit(err); #endif - if (isRendezvousBypassed()) - { - ChipLogProgress(AppServer, "Rendezvous and secure pairing skipped"); - SuccessOrExit(err = AddTestCommissioning()); - } - else if (GetFabricTable().FabricCount() != 0) + if (GetFabricTable().FabricCount() != 0) { // The device is already commissioned, proactively disable BLE advertisement. ChipLogProgress(AppServer, "Fabric already commissioned. Disabling BLE advertisement"); @@ -392,33 +376,4 @@ CHIP_ERROR Server::SendUserDirectedCommissioningRequest(chip::Transport::PeerAdd } #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT -CHIP_ERROR Server::AddTestCommissioning() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - PASESession * testSession = nullptr; - PASESessionSerializable serializedTestSession; - SessionHolder session; - - mTestPairing.ToSerializable(serializedTestSession); - - testSession = chip::Platform::New(); - testSession->FromSerializable(serializedTestSession); - SuccessOrExit(err = mSessions.NewPairing(session, Optional{ PeerAddress::Uninitialized() }, - chip::kTestControllerNodeId, testSession, CryptoContext::SessionRole::kResponder, - kMinValidFabricIndex)); - -exit: - if (testSession) - { - testSession->Clear(); - chip::Platform::Delete(testSession); - } - - if (err != CHIP_NO_ERROR) - { - mFabrics.ReleaseFabricIndex(kMinValidFabricIndex); - } - return err; -} - } // namespace chip diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 0b717ce7cca056..e05c4ae54b4cb2 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -67,8 +67,6 @@ class Server CHIP_ERROR SendUserDirectedCommissioningRequest(chip::Transport::PeerAddress commissioner); #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT - CHIP_ERROR AddTestCommissioning(); - /** * @brief Call this function to rejoin existing groups found in the GroupDataProvider */ diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index e5b1fc37f95bdc..a729ecd7f23346 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -509,15 +509,6 @@ FabricTable::~FabricTable() } } -void FabricTable::ReleaseFabricIndex(FabricIndex fabricIndex) -{ - FabricInfo * fabric = FindFabricWithIndex(fabricIndex); - if (fabric != nullptr) - { - fabric->Reset(); - } -} - FabricInfo * FabricTable::FindFabric(P256PublicKeySpan rootPubKey, FabricId fabricId) { static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); @@ -750,7 +741,9 @@ CHIP_ERROR FabricTable::Delete(FabricIndex index) } ReturnErrorOnFailure(err); - ReleaseFabricIndex(index); + // Since fabricIsInitialized was true, fabric is not null. + fabric->Reset(); + if (mDelegate != nullptr) { if (mFabricCount == 0) diff --git a/src/credentials/FabricTable.h b/src/credentials/FabricTable.h index adcfbd680b05a3..5d8bdd15710a7b 100644 --- a/src/credentials/FabricTable.h +++ b/src/credentials/FabricTable.h @@ -393,8 +393,6 @@ class DLL_EXPORT FabricTable */ CHIP_ERROR AddNewFabric(FabricInfo & fabric, FabricIndex * assignedIndex); - void ReleaseFabricIndex(FabricIndex fabricIndex); - FabricInfo * FindFabric(Credentials::P256PublicKeySpan rootPubKey, FabricId fabricId); FabricInfo * FindFabricWithIndex(FabricIndex fabricIndex); FabricInfo * FindFabricWithCompressedId(CompressedFabricId fabricId); diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp index 969a1b484b9c14..146c967eb6a3a8 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp @@ -723,10 +723,6 @@ exit: template bool GenericConfigurationManagerImpl::IsFullyProvisioned() { -#if CHIP_BYPASS_RENDEZVOUS - return true; -#else // CHIP_BYPASS_RENDEZVOUS - return #if CHIP_DEVICE_CONFIG_ENABLE_WIFI_STATION ConnectivityMgr().IsWiFiStationProvisioned() && @@ -735,7 +731,6 @@ bool GenericConfigurationManagerImpl::IsFullyProvisioned() ConnectivityMgr().IsThreadProvisioned() && #endif true; -#endif // CHIP_BYPASS_RENDEZVOUS } template diff --git a/src/platform/BUILD.gn b/src/platform/BUILD.gn index f3d466068053ea..1ac8f1bba7f764 100644 --- a/src/platform/BUILD.gn +++ b/src/platform/BUILD.gn @@ -50,9 +50,6 @@ if (chip_device_platform != "none") { # Use OpenThread ftd or mtd library chip_device_config_thread_ftd = chip_openthread_ftd - # By pass provision and secure session - chip_bypass_rendezvous = false - # Enable including the additional data in the advertisement packets chip_enable_additional_data_advertising = false @@ -107,7 +104,6 @@ if (chip_device_platform != "none") { "CHIP_DEVICE_CONFIG_THREAD_FTD=${chip_device_config_thread_ftd}", "CHIP_WITH_GIO=${chip_with_gio}", "OPENTHREAD_CONFIG_ENABLE_TOBLE=false", - "CHIP_BYPASS_RENDEZVOUS=${chip_bypass_rendezvous}", "CHIP_STACK_LOCK_TRACKING_ENABLED=${chip_stack_lock_tracking_log}", "CHIP_STACK_LOCK_TRACKING_ERROR_FATAL=${chip_stack_lock_tracking_fatal}", "CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING=${chip_enable_additional_data_advertising}", diff --git a/src/platform/telink/CHIPDevicePlatformConfig.h b/src/platform/telink/CHIPDevicePlatformConfig.h index d80369615ca696..c927a95fc001a8 100644 --- a/src/platform/telink/CHIPDevicePlatformConfig.h +++ b/src/platform/telink/CHIPDevicePlatformConfig.h @@ -70,7 +70,3 @@ #else #define CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART #endif // CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART - -#ifdef CONFIG_CHIP_ENABLE_RENDEZVOUS_BYPASS -#define CHIP_BYPASS_RENDEZVOUS CONFIG_CHIP_ENABLE_RENDEZVOUS_BYPASS -#endif // CONFIG_CHIP_ENABLE_RENDEZVOUS_BYPASS From dad637561b0bee01982b71ab82d70874734e60d8 Mon Sep 17 00:00:00 2001 From: rgoliver Date: Thu, 24 Mar 2022 08:31:19 -0400 Subject: [PATCH 44/70] trace: Add tracing for prepared secure messages (#16565) - Add new traces for the prepared messages for send and receive. - Add handlers to pack the data into json. Note: This is only enabled when CHIP_CONFIG_TRANSPORT_TRACE is enabled, otherwise this is a no-op. --- examples/common/tracing/TraceHandlers.cpp | 72 +++++++++++++++++------ src/transport/SessionManager.cpp | 2 + src/transport/TraceMessage.h | 44 ++++++++++++-- 3 files changed, 96 insertions(+), 22 deletions(-) diff --git a/examples/common/tracing/TraceHandlers.cpp b/examples/common/tracing/TraceHandlers.cpp index fb131dd6d46fab..d0c54d07c7c7a1 100644 --- a/examples/common/tracing/TraceHandlers.cpp +++ b/examples/common/tracing/TraceHandlers.cpp @@ -214,9 +214,27 @@ std::string PayloadHeaderToJson(const PayloadHeader * payloadHeader) return jsonBody; } -bool SecureMessageSentHandler(const TraceEventFields & eventFields, TraceHandlerContext * context) +std::string PreparedSecureMessageDataToJson(const TracePreparedSecureMessageData * data, const std::string & peerAddressKey) { - if (eventFields.dataSize != sizeof(TraceSecureMessageSentData)) + const System::PacketBuffer * packetBuffer = data->packetBuffer->operator->(); + std::string jsonBody = "{"; + jsonBody += AsFirstJsonKey(peerAddressKey, AsJsonString(data->peerAddress)); + jsonBody += ", "; + jsonBody += AsFirstJsonKey("payload_size", std::to_string(packetBuffer->DataLength())); + jsonBody += ", "; + jsonBody += AsFirstJsonKey("payload_hex", AsJsonHexString(packetBuffer->Start(), packetBuffer->DataLength())); + jsonBody += ", "; + jsonBody += AsFirstJsonKey("buffer_ptr", std::to_string(reinterpret_cast(packetBuffer))); + jsonBody += "}"; + + return jsonBody; +} + +bool SecureMessageSentHandler(const TraceEventFields & eventFields, void * context) +{ + TraceHandlerContext * ourContext = reinterpret_cast(context); + if ((std::string{ eventFields.dataFormat } != kTraceMessageSentDataFormat) || + (eventFields.dataSize != sizeof(TraceSecureMessageSentData))) { return false; } @@ -232,7 +250,7 @@ bool SecureMessageSentHandler(const TraceEventFields & eventFields, TraceHandler jsonBody += AsFirstJsonKey("payload_hex", AsJsonHexString(eventData->packetPayload, eventData->packetSize)); jsonBody += "}"; - TraceOutput * sink = context->sink; + TraceOutput * sink = ourContext->sink; sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTraceMessageSentDataFormat); sink->AddField("json", jsonBody); sink->FinishEvent(); @@ -240,9 +258,11 @@ bool SecureMessageSentHandler(const TraceEventFields & eventFields, TraceHandler return true; } -bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, TraceHandlerContext * context) +bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, void * context) { - if (eventFields.dataSize != sizeof(TraceSecureMessageReceivedData)) + TraceHandlerContext * ourContext = reinterpret_cast(context); + if ((std::string{ eventFields.dataFormat } != kTraceMessageReceivedDataFormat) || + (eventFields.dataSize != sizeof(TraceSecureMessageReceivedData))) { return false; } @@ -261,7 +281,7 @@ bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, TraceHan jsonBody += AsFirstJsonKey("payload_hex", AsJsonHexString(eventData->packetPayload, eventData->packetSize)); jsonBody += "}"; - TraceOutput * sink = context->sink; + TraceOutput * sink = ourContext->sink; sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTraceMessageReceivedDataFormat); sink->AddField("json", jsonBody); sink->FinishEvent(); @@ -271,25 +291,40 @@ bool SecureMessageReceivedHandler(const TraceEventFields & eventFields, TraceHan return true; } -// TODO: Framework this into a registry of handlers for different message types. -bool TraceDefaultHandler(const TraceEventFields & eventFields, void * context) +bool PreparedMessageSentHandler(const TraceEventFields & eventFields, void * context) { TraceHandlerContext * ourContext = reinterpret_cast(context); - if (ourContext == nullptr) + if ((std::string{ eventFields.dataFormat } != kTracePreparedMessageSentDataFormat) || + (eventFields.dataSize != sizeof(TracePreparedSecureMessageData))) { return false; } - if (std::string{ eventFields.dataFormat } == kTraceMessageSentDataFormat) - { - return SecureMessageSentHandler(eventFields, ourContext); - } - else if (std::string{ eventFields.dataFormat } == kTraceMessageReceivedDataFormat) + const auto * eventData = reinterpret_cast(eventFields.dataBuffer); + TraceOutput * sink = ourContext->sink; + sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTracePreparedMessageSentDataFormat); + sink->AddField("json", PreparedSecureMessageDataToJson(eventData, "destination")); + sink->FinishEvent(); + + return true; +} + +bool PreparedMessageReceivedHandler(const TraceEventFields & eventFields, void * context) +{ + TraceHandlerContext * ourContext = reinterpret_cast(context); + if ((std::string{ eventFields.dataFormat } != kTracePreparedMessageReceivedDataFormat) || + (eventFields.dataSize != sizeof(TracePreparedSecureMessageData))) { - return SecureMessageReceivedHandler(eventFields, ourContext); + return false; } - return false; + const auto * eventData = reinterpret_cast(eventFields.dataBuffer); + TraceOutput * sink = ourContext->sink; + sink->StartEvent(std::string{ kTraceMessageEvent } + "." + kTracePreparedMessageReceivedDataFormat); + sink->AddField("json", PreparedSecureMessageDataToJson(eventData, "source")); + sink->FinishEvent(); + + return true; } } // namespace @@ -302,7 +337,10 @@ void SetTraceStream(TraceStream * stream) void InitTrace() { void * context = &gTraceHandlerContext; - RegisterTraceHandler(TraceDefaultHandler, context); + RegisterTraceHandler(SecureMessageSentHandler, context); + RegisterTraceHandler(SecureMessageReceivedHandler, context); + RegisterTraceHandler(PreparedMessageSentHandler, context); + RegisterTraceHandler(PreparedMessageReceivedHandler, context); } void DeInitTrace() diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 6dcbbdb5275613..db83898ca00ffb 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -318,6 +318,7 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand if (mTransportMgr != nullptr) { + CHIP_TRACE_PREPARED_MESSAGE_SENT(destination, &msgBuf); return mTransportMgr->SendMessage(*destination, std::move(msgBuf)); } @@ -414,6 +415,7 @@ void SessionManager::CancelExpiryTimer() void SessionManager::OnMessageReceived(const PeerAddress & peerAddress, System::PacketBufferHandle && msg) { + CHIP_TRACE_PREPARED_MESSAGE_RECEIVED(&peerAddress, &msg); PacketHeader packetHeader; ReturnOnFailure(packetHeader.DecodeAndConsume(msg)); diff --git a/src/transport/TraceMessage.h b/src/transport/TraceMessage.h index 0863bf0cc9cec8..93cdfa6dd77927 100644 --- a/src/transport/TraceMessage.h +++ b/src/transport/TraceMessage.h @@ -19,6 +19,7 @@ #pragma once #include +#include #include #include #include @@ -30,7 +31,7 @@ do \ { \ const ::chip::trace::TraceSecureMessageSentData _trace_data{ &payloadHeader, &packetHeader, data, dataLen }; \ - PW_TRACE_INSTANT_DATA("SecureMsg", ::chip::trace::kTraceMessageSentDataFormat, \ + PW_TRACE_INSTANT_DATA(::chip::trace::kTraceMessageEvent, ::chip::trace::kTraceMessageSentDataFormat, \ reinterpret_cast(&_trace_data), sizeof(_trace_data)); \ } while (0) @@ -39,7 +40,23 @@ { \ const ::chip::trace::TraceSecureMessageReceivedData _trace_data{ &payloadHeader, &packetHeader, session, \ &peerAddress, data, dataLen }; \ - PW_TRACE_INSTANT_DATA("SecureMsg", ::chip::trace::kTraceMessageReceivedDataFormat, \ + PW_TRACE_INSTANT_DATA(::chip::trace::kTraceMessageEvent, ::chip::trace::kTraceMessageReceivedDataFormat, \ + reinterpret_cast(&_trace_data), sizeof(_trace_data)); \ + } while (0) + +#define CHIP_TRACE_PREPARED_MESSAGE_SENT(destination, packetBuffer) \ + do \ + { \ + const ::chip::trace::TracePreparedSecureMessageData _trace_data{ destination, packetBuffer }; \ + PW_TRACE_INSTANT_DATA(::chip::trace::kTraceMessageEvent, ::chip::trace::kTracePreparedMessageSentDataFormat, \ + reinterpret_cast(&_trace_data), sizeof(_trace_data)); \ + } while (0) + +#define CHIP_TRACE_PREPARED_MESSAGE_RECEIVED(source, packetBuffer) \ + do \ + { \ + const ::chip::trace::TracePreparedSecureMessageData _trace_data{ source, packetBuffer }; \ + PW_TRACE_INSTANT_DATA(::chip::trace::kTraceMessageEvent, ::chip::trace::kTracePreparedMessageReceivedDataFormat, \ reinterpret_cast(&_trace_data), sizeof(_trace_data)); \ } while (0) @@ -54,14 +71,25 @@ { \ } while (0) +#define CHIP_TRACE_PREPARED_MESSAGE_SENT(destination, packetBuffer) \ + do \ + { \ + } while (0) + +#define CHIP_TRACE_PREPARED_MESSAGE_RECEIVED(source, packetBuffer) \ + do \ + { \ + } while (0) #endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED namespace chip { namespace trace { -constexpr const char * kTraceMessageEvent = "SecureMsg"; -constexpr const char * kTraceMessageSentDataFormat = "SecMsgSent"; -constexpr const char * kTraceMessageReceivedDataFormat = "SecMsgReceived"; +constexpr const char * kTraceMessageEvent = "SecureMsg"; +constexpr const char * kTraceMessageSentDataFormat = "SecMsgSent"; +constexpr const char * kTraceMessageReceivedDataFormat = "SecMsgReceived"; +constexpr const char * kTracePreparedMessageSentDataFormat = "PreparedMsgSent"; +constexpr const char * kTracePreparedMessageReceivedDataFormat = "PreparedMsgReceived"; struct TraceSecureMessageSentData { @@ -81,5 +109,11 @@ struct TraceSecureMessageReceivedData size_t packetSize; }; +struct TracePreparedSecureMessageData +{ + const Transport::PeerAddress * peerAddress; + const System::PacketBufferHandle * packetBuffer; +}; + } // namespace trace } // namespace chip From be4abbe1af49e14837f782f005ca7fa25d1053cb Mon Sep 17 00:00:00 2001 From: Jiacheng Guo Date: Thu, 24 Mar 2022 20:31:34 +0800 Subject: [PATCH 45/70] [binding] Fix missing callback when notifying a connecting device (#16553) --- src/app/clusters/bindings/BindingManager.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/app/clusters/bindings/BindingManager.cpp b/src/app/clusters/bindings/BindingManager.cpp index dfd931e17e291d..a87fe777c7533b 100644 --- a/src/app/clusters/bindings/BindingManager.cpp +++ b/src/app/clusters/bindings/BindingManager.cpp @@ -188,6 +188,7 @@ void BindingManager::FabricRemoved(CompressedFabricId compressedFabricId, Fabric CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, ClusterId cluster, void * context) { VerifyOrReturnError(mInitParams.mFabricTable != nullptr, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mBoundDeviceChangedHandler, CHIP_NO_ERROR); for (auto iter = BindingTable::GetInstance().begin(); iter != BindingTable::GetInstance().end(); ++iter) { @@ -199,7 +200,7 @@ CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, Cluste VerifyOrReturnError(fabricInfo != nullptr, CHIP_ERROR_NOT_FOUND); PeerId peer = fabricInfo->GetPeerIdForNode(iter->nodeId); OperationalDeviceProxy * peerDevice = mInitParams.mCASESessionManager->FindExistingSession(peer); - if (peerDevice != nullptr && peerDevice->IsConnected() && mBoundDeviceChangedHandler) + if (peerDevice != nullptr && peerDevice->IsConnected()) { // We already have an active connection mBoundDeviceChangedHandler(*iter, peerDevice, context); @@ -207,10 +208,7 @@ CHIP_ERROR BindingManager::NotifyBoundClusterChanged(EndpointId endpoint, Cluste else { mPendingNotificationMap.AddPendingNotification(iter.GetIndex(), context); - if (peerDevice == nullptr || !peerDevice->IsConnecting()) - { - ReturnErrorOnFailure(EstablishConnection(iter->fabricIndex, iter->nodeId)); - } + ReturnErrorOnFailure(EstablishConnection(iter->fabricIndex, iter->nodeId)); } } else if (iter->type == EMBER_MULTICAST_BINDING) From 7a90bda188c11a6ced8f692d993ad3b741df8e87 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 24 Mar 2022 13:45:26 +0100 Subject: [PATCH 46/70] [chiptest] Network-independent RPC server shutdown (#15954) Terminating app-register RPC server with the usage RPC call itself might cause troubles in case when the network connection is not reliable (e.g. no route to the server). This commit simplifies the shutdown process by using dedicated shutdown method. --- scripts/tests/chiptest/accessories.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/scripts/tests/chiptest/accessories.py b/scripts/tests/chiptest/accessories.py index b91a38f50c525b..44ae550b2f9b91 100644 --- a/scripts/tests/chiptest/accessories.py +++ b/scripts/tests/chiptest/accessories.py @@ -15,7 +15,6 @@ import sys import threading -from xmlrpc.client import ServerProxy from xmlrpc.server import SimpleXMLRPCServer IP = '127.0.0.1' @@ -98,9 +97,6 @@ def waitForOperationalAdvertisement(self, name): return accessory.waitForOperationalAdvertisement() return False - def ping(self): - return True - def __startXMLRPCServer(self): self.server = SimpleXMLRPCServer((IP, PORT)) @@ -114,20 +110,9 @@ def __startXMLRPCServer(self): self.server.register_function( self.waitForOperationalAdvertisement, 'waitForOperationalAdvertisement') - self.server.register_function(self.ping, 'ping') - self.server_thread = threading.Thread(target=self.__handle_request) + self.server_thread = threading.Thread(target=self.server.serve_forever) self.server_thread.start() - def __handle_request(self): - self.__should_handle_requests = True - while self.__should_handle_requests: - self.server.handle_request() - def __stopXMLRPCServer(self): - self.__should_handle_requests = False - # handle_request will wait until it receives a message, - # so let's send a ping to the server - client = ServerProxy('http://' + IP + ':' + - str(PORT) + '/', allow_none=True) - client.ping() + self.server.shutdown() From d6921c85768d9203c0c207e260a7f23bc3db1471 Mon Sep 17 00:00:00 2001 From: "Hui.Li-TCL" Date: Thu, 24 Mar 2022 20:45:58 +0800 Subject: [PATCH 47/70] add IPAddresses for DiagnosticDataProviderImpl on android (#16557) * add IPAddresses for DiagnosticDataProviderImpl on android * fix restyled-io and ci errors * add ip adder size check * fix restyled-io and ci errors --- .../android/DiagnosticDataProviderImpl.cpp | 36 +++++++++++++++++++ .../platform/DiagnosticDataProviderImpl.java | 19 ++++++++++ .../java/chip/platform/NetworkInterface.java | 2 ++ 3 files changed, 57 insertions(+) diff --git a/src/platform/android/DiagnosticDataProviderImpl.cpp b/src/platform/android/DiagnosticDataProviderImpl.cpp index 09a580062d71e0..4af6611657b009 100644 --- a/src/platform/android/DiagnosticDataProviderImpl.cpp +++ b/src/platform/android/DiagnosticDataProviderImpl.cpp @@ -170,6 +170,42 @@ CHIP_ERROR DiagnosticDataProviderImpl::GetNetworkInterfaces(NetworkInterface ** jfieldID getTypeField = env->GetFieldID(nifClass, "type", "I"); ifp->type = static_cast(env->GetIntField(nifObject, getTypeField)); + jfieldID ipv4AddressField = env->GetFieldID(nifClass, "ipv4Address", "[B"); + jbyteArray jIpv4AddressObj = static_cast(env->GetObjectField(nifObject, ipv4AddressField)); + if (jIpv4AddressObj != nullptr) + { + JniByteArray Ipv4ByteArray(env, jIpv4AddressObj); + + if (Ipv4ByteArray.size() == kMaxIPv4AddrSize) + { + memcpy(ifp->Ipv4AddressesBuffer[0], reinterpret_cast(Ipv4ByteArray.data()), kMaxIPv4AddrSize); + ifp->Ipv4AddressSpans[0] = ByteSpan(ifp->Ipv4AddressesBuffer[0], kMaxIPv4AddrSize); + ifp->IPv4Addresses = chip::app::DataModel::List(ifp->Ipv4AddressSpans, 1); + } + else + { + ChipLogError(DeviceLayer, "ipv4Address size (%d) not equal to kMaxIPv4AddrSize", Ipv4ByteArray.size()); + } + } + + jfieldID ipv6AddressField = env->GetFieldID(nifClass, "ipv6Address", "[B"); + jbyteArray jIpv6AddressObj = static_cast(env->GetObjectField(nifObject, ipv6AddressField)); + if (jIpv6AddressObj != nullptr) + { + JniByteArray Ipv6ByteArray(env, jIpv6AddressObj); + + if (Ipv6ByteArray.size() == kMaxIPv6AddrSize) + { + memcpy(ifp->Ipv6AddressesBuffer[0], reinterpret_cast(Ipv6ByteArray.data()), kMaxIPv6AddrSize); + ifp->Ipv6AddressSpans[0] = ByteSpan(ifp->Ipv6AddressesBuffer[0], kMaxIPv6AddrSize); + ifp->IPv6Addresses = chip::app::DataModel::List(ifp->Ipv6AddressSpans, 1); + } + else + { + ChipLogError(DeviceLayer, "ipv6Address size (%d) not equal to kMaxIPv6AddrSize", Ipv6ByteArray.size()); + } + } + ifp->Next = head; head = ifp; } diff --git a/src/platform/android/java/chip/platform/DiagnosticDataProviderImpl.java b/src/platform/android/java/chip/platform/DiagnosticDataProviderImpl.java index 769b9070679c27..4a90a48848aaba 100644 --- a/src/platform/android/java/chip/platform/DiagnosticDataProviderImpl.java +++ b/src/platform/android/java/chip/platform/DiagnosticDataProviderImpl.java @@ -19,9 +19,12 @@ import android.content.Context; import android.util.Log; +import java.net.Inet4Address; +import java.net.InetAddress; import java.net.SocketException; import java.util.ArrayList; import java.util.Collections; +import java.util.Enumeration; import java.util.List; public class DiagnosticDataProviderImpl implements DiagnosticDataProvider { @@ -64,6 +67,22 @@ public NetworkInterface[] getNetworkInterfaces() { name.startsWith("wlan") ? NetworkInterface.INTERFACE_TYPE_WI_FI : NetworkInterface.INTERFACE_TYPE_ETHERNET; + + Enumeration inetAddress = nif.getInetAddresses(); + while (inetAddress.hasMoreElements()) { + InetAddress ip = inetAddress.nextElement(); + + if (ip instanceof Inet4Address) { + if (anInterface.ipv4Address == null) { + anInterface.ipv4Address = ip.getAddress(); + } + } else if (ip instanceof InetAddress) { + if (anInterface.ipv6Address == null) { + anInterface.ipv6Address = ip.getAddress(); + } + } + } + destInterfaces.add(anInterface); } } diff --git a/src/platform/android/java/chip/platform/NetworkInterface.java b/src/platform/android/java/chip/platform/NetworkInterface.java index faa33cf9a91143..6898d091e39135 100644 --- a/src/platform/android/java/chip/platform/NetworkInterface.java +++ b/src/platform/android/java/chip/platform/NetworkInterface.java @@ -33,5 +33,7 @@ public class NetworkInterface { @Nullable public Boolean offPremiseServicesReachableIPv4; @Nullable public Boolean offPremiseServicesReachableIPv6; public byte[] hardwareAddress; + public byte[] ipv4Address; + public byte[] ipv6Address; public int type; } From e6141d416142712eb1fe70fa7b01077d2539f78c Mon Sep 17 00:00:00 2001 From: wendythewan <99999710+wendythewan@users.noreply.github.com> Date: Thu, 24 Mar 2022 05:47:29 -0700 Subject: [PATCH 48/70] Wrap usages of src/ble/... with CONFIG_NETWORK_LAYER_BLE (#16414) * Wrap usages of src/ble/BleLayer with CONFIG_NETWORK_LAYER_BLE * Restyle Server.cpp * Restyle CHIPDeviceControllerFactory * Restyle CASEServer.cpp * Update Server.cpp * Restyle change * Restyle change * Restyle * Restyle * Restyle * Remove whitespace --- src/app/server/Server.cpp | 9 ++++++++- src/controller/CHIPDeviceControllerFactory.cpp | 8 ++++++-- src/include/platform/CHIPDeviceLayer.h | 1 - src/include/platform/internal/BLEManager.h | 2 ++ src/protocols/secure_channel/CASEServer.cpp | 10 +++++++--- src/protocols/secure_channel/CASEServer.h | 11 +++++++++-- .../secure_channel/tests/TestCASESession.cpp | 5 ++++- 7 files changed, 36 insertions(+), 10 deletions(-) diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 63af6a1a07d555..9967491c6dae24 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -25,7 +25,9 @@ #include #include +#if CONFIG_NETWORK_LAYER_BLE #include +#endif #include #include #include @@ -51,7 +53,9 @@ using chip::kMinValidFabricIndex; using chip::RendezvousInformationFlag; using chip::DeviceLayer::PersistedStorage::KeyValueStoreMgr; using chip::Inet::IPAddressType; +#if CONFIG_NETWORK_LAYER_BLE using chip::Transport::BleListenParameters; +#endif using chip::Transport::PeerAddress; using chip::Transport::UdpListenParameters; @@ -239,7 +243,10 @@ CHIP_ERROR Server::Init(AppDelegate * delegate, uint16_t secureServicePort, uint app::DnssdServer::Instance().StartServer(); #endif - err = mCASEServer.ListenForSessionEstablishment(&mExchangeMgr, &mTransports, chip::DeviceLayer::ConnectivityMgr().GetBleLayer(), + err = mCASEServer.ListenForSessionEstablishment(&mExchangeMgr, &mTransports, +#if CONFIG_NETWORK_LAYER_BLE + chip::DeviceLayer::ConnectivityMgr().GetBleLayer(), +#endif &mSessions, &mFabrics); SuccessOrExit(err); diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index d04f56e83123a4..92668b255a0d5a 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -178,8 +178,12 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) // We pass in a nullptr for the BLELayer since we're not permitting usage of BLE in this server modality for the controller, // especially since it will interrupt other potential usages of BLE by the controller acting in a commissioning capacity. // - ReturnErrorOnFailure(stateParams.caseServer->ListenForSessionEstablishment( - stateParams.exchangeMgr, stateParams.transportMgr, nullptr, stateParams.sessionMgr, stateParams.fabricTable)); + ReturnErrorOnFailure( + stateParams.caseServer->ListenForSessionEstablishment(stateParams.exchangeMgr, stateParams.transportMgr, +#if CONFIG_NETWORK_LAYER_BLE + nullptr, +#endif + stateParams.sessionMgr, stateParams.fabricTable)); // // We need to advertise the port that we're listening to for unsolicited messages over UDP. However, we have both a IPv4 diff --git a/src/include/platform/CHIPDeviceLayer.h b/src/include/platform/CHIPDeviceLayer.h index 8d6fab3f7248c7..9e317b3d7ccb96 100644 --- a/src/include/platform/CHIPDeviceLayer.h +++ b/src/include/platform/CHIPDeviceLayer.h @@ -22,7 +22,6 @@ #if !CHIP_DEVICE_LAYER_NONE -#include #include #include #include diff --git a/src/include/platform/internal/BLEManager.h b/src/include/platform/internal/BLEManager.h index 3910822f1952ae..2bb3cd66ae872c 100644 --- a/src/include/platform/internal/BLEManager.h +++ b/src/include/platform/internal/BLEManager.h @@ -119,7 +119,9 @@ inline CHIP_ERROR BLEManager::Init() inline CHIP_ERROR BLEManager::Shutdown() { +#if CONFIG_NETWORK_LAYER_BLE ReturnErrorOnFailure(GetBleLayer()->Shutdown()); +#endif return static_cast(this)->_Shutdown(); } diff --git a/src/protocols/secure_channel/CASEServer.cpp b/src/protocols/secure_channel/CASEServer.cpp index e54362a100a19b..139e0079fcee86 100644 --- a/src/protocols/secure_channel/CASEServer.cpp +++ b/src/protocols/secure_channel/CASEServer.cpp @@ -30,15 +30,19 @@ using namespace ::chip::Credentials; namespace chip { CHIP_ERROR CASEServer::ListenForSessionEstablishment(Messaging::ExchangeManager * exchangeManager, TransportMgrBase * transportMgr, - Ble::BleLayer * bleLayer, SessionManager * sessionManager, - FabricTable * fabrics) +#if CONFIG_NETWORK_LAYER_BLE + Ble::BleLayer * bleLayer, +#endif + SessionManager * sessionManager, FabricTable * fabrics) { VerifyOrReturnError(transportMgr != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(exchangeManager != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(sessionManager != nullptr, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(fabrics != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - mBleLayer = bleLayer; +#if CONFIG_NETWORK_LAYER_BLE + mBleLayer = bleLayer; +#endif mSessionManager = sessionManager; mFabrics = fabrics; mExchangeManager = exchangeManager; diff --git a/src/protocols/secure_channel/CASEServer.h b/src/protocols/secure_channel/CASEServer.h index 81597fbb3e5f59..0bb6e85f000cd1 100644 --- a/src/protocols/secure_channel/CASEServer.h +++ b/src/protocols/secure_channel/CASEServer.h @@ -17,7 +17,9 @@ #pragma once +#if CONFIG_NETWORK_LAYER_BLE #include +#endif #include #include #include @@ -38,7 +40,10 @@ class CASEServer : public SessionEstablishmentDelegate, public Messaging::Exchan } CHIP_ERROR ListenForSessionEstablishment(Messaging::ExchangeManager * exchangeManager, TransportMgrBase * transportMgr, - Ble::BleLayer * bleLayer, SessionManager * sessionManager, FabricTable * fabrics); +#if CONFIG_NETWORK_LAYER_BLE + Ble::BleLayer * bleLayer, +#endif + SessionManager * sessionManager, FabricTable * fabrics); //////////// SessionEstablishmentDelegate Implementation /////////////// void OnSessionEstablishmentError(CHIP_ERROR error) override; @@ -58,7 +63,9 @@ class CASEServer : public SessionEstablishmentDelegate, public Messaging::Exchan CASESession mPairingSession; uint16_t mSessionKeyId = 0; SessionManager * mSessionManager = nullptr; - Ble::BleLayer * mBleLayer = nullptr; +#if CONFIG_NETWORK_LAYER_BLE + Ble::BleLayer * mBleLayer = nullptr; +#endif FabricTable * mFabrics = nullptr; SessionIDAllocator mSessionIDAllocator; diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 1c75010df24062..66f52f1e862678 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -374,7 +374,10 @@ void CASE_SecurePairingHandshakeServerTest(nlTestSuite * inSuite, void * inConte gLoopback.mSentMessageCount = 0; NL_TEST_ASSERT(inSuite, - gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetTransportMgr(), nullptr, + gPairingServer.ListenForSessionEstablishment(&ctx.GetExchangeManager(), &ctx.GetTransportMgr(), +#if CONFIG_NETWORK_LAYER_BLE + nullptr, +#endif &ctx.GetSecureSessionManager(), &gDeviceFabrics) == CHIP_NO_ERROR); ExchangeContext * contextCommissioner = ctx.NewUnauthenticatedExchangeToBob(pairingCommissioner); From 011efcf02bbd1e9ca3fd2c50f9084d3755ba13e5 Mon Sep 17 00:00:00 2001 From: Sergei Lissianoi <54454955+selissia@users.noreply.github.com> Date: Thu, 24 Mar 2022 09:15:58 -0400 Subject: [PATCH 49/70] EFR32: Use correct FLASH addresses in the EFR32MG24 linker file (#16563) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Test added march 8 (#15957) * Added new manual scripts * Added Auto generated File * [OTA] Fix OTARequestorDriverImpl inclusion (#15981) * Regen to fix CI failures (#15990) * [ota] Store Default OTA Providers in flash (#15970) * [ota] Store Default OTA Providers in flash Store Default OTA Providers in flash each time the attribute is modified and load it back on the application startup. * Restyled by clang-format * Fix build and reduce flash usage Co-authored-by: Restyled.io * Use correct FLASH addresses in the EFR32MG24 linker file * Remove merge artifacts Co-authored-by: kowsisoundhar12 <57476670+kowsisoundhar12@users.noreply.github.com> Co-authored-by: Carol Yang Co-authored-by: Boris Zbarsky Co-authored-by: Damian Królik <66667989+Damian-Nordic@users.noreply.github.com> Co-authored-by: Restyled.io --- examples/platform/efr32/ldscripts/efr32mg24.ld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/platform/efr32/ldscripts/efr32mg24.ld b/examples/platform/efr32/ldscripts/efr32mg24.ld index 8778f772235876..8a7835f6cf2fd0 100644 --- a/examples/platform/efr32/ldscripts/efr32mg24.ld +++ b/examples/platform/efr32/ldscripts/efr32mg24.ld @@ -47,7 +47,7 @@ MEMORY { - FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 0x17e000 + FLASH (rx) : ORIGIN = 0x8006000, LENGTH = 0x178000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x40000 } From 03818695dbd5b45c2cf41958790580cc891b5d14 Mon Sep 17 00:00:00 2001 From: Sharad Binjola <31142146+sharadb-amazon@users.noreply.github.com> Date: Thu, 24 Mar 2022 09:07:10 -0700 Subject: [PATCH 50/70] Adding deps: CHIPController.jar to tv-casting-app/android (#16586) --- examples/tv-casting-app/android/BUILD.gn | 1 + scripts/build/builders/android.py | 4 +++- scripts/build/testdata/build_all_except_host.txt | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/tv-casting-app/android/BUILD.gn b/examples/tv-casting-app/android/BUILD.gn index b3159bc3337420..2cd7aaa4d06dda 100644 --- a/examples/tv-casting-app/android/BUILD.gn +++ b/examples/tv-casting-app/android/BUILD.gn @@ -75,6 +75,7 @@ group("default") { ":java", ":jni", "${chip_root}/src/app/server/java", + "${chip_root}/src/controller/java", "${chip_root}/src/platform/android:java", ] } diff --git a/scripts/build/builders/android.py b/scripts/build/builders/android.py index d9cc9f156c53a4..72ae967dd89617 100644 --- a/scripts/build/builders/android.py +++ b/scripts/build/builders/android.py @@ -183,7 +183,8 @@ def copyToExampleAndroid(self): title='Prepare Native libs ' + self.identifier) if self.app.ExampleName() == 'tv-casting-app': - libs = ['libc++_shared.so', 'libTvCastingApp.so'] + libs = ['libCHIPController.so', + 'libc++_shared.so', 'libTvCastingApp.so'] else: libs = ['libSetupPayloadParser.so', 'libc++_shared.so', 'libTvApp.so'] @@ -195,6 +196,7 @@ def copyToExampleAndroid(self): jars = { 'AndroidPlatform.jar': 'third_party/connectedhomeip/src/platform/android/AndroidPlatform.jar', 'CHIPAppServer.jar': 'third_party/connectedhomeip/src/app/server/java/CHIPAppServer.jar', + 'CHIPController.jar': 'third_party/connectedhomeip/src/controller/java/CHIPController.jar', 'TvCastingApp.jar': 'TvCastingApp.jar', } else: diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index 114bc8ac4ab4f2..f93c1edebfa831 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -943,6 +943,8 @@ ninja -C {out}/android-arm-chip-tv-casting-app # Prepare Native libs android-arm-chip-tv-casting-app mkdir -p {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/armeabi-v7a +cp {out}/android-arm-chip-tv-casting-app/lib/jni/armeabi-v7a/libCHIPController.so {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/armeabi-v7a/libCHIPController.so + cp {out}/android-arm-chip-tv-casting-app/lib/jni/armeabi-v7a/libc++_shared.so {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/armeabi-v7a/libc++_shared.so cp {out}/android-arm-chip-tv-casting-app/lib/jni/armeabi-v7a/libTvCastingApp.so {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/armeabi-v7a/libTvCastingApp.so @@ -951,6 +953,8 @@ cp {out}/android-arm-chip-tv-casting-app/lib/third_party/connectedhomeip/src/pla cp {out}/android-arm-chip-tv-casting-app/lib/third_party/connectedhomeip/src/app/server/java/CHIPAppServer.jar {root}/examples/tv-casting-app/android/App/app/libs/CHIPAppServer.jar +cp {out}/android-arm-chip-tv-casting-app/lib/third_party/connectedhomeip/src/controller/java/CHIPController.jar {root}/examples/tv-casting-app/android/App/app/libs/CHIPController.jar + cp {out}/android-arm-chip-tv-casting-app/lib/TvCastingApp.jar {root}/examples/tv-casting-app/android/App/app/libs/TvCastingApp.jar # Building Example android-arm-chip-tv-casting-app @@ -1027,6 +1031,8 @@ ninja -C {out}/android-arm64-chip-tv-casting-app # Prepare Native libs android-arm64-chip-tv-casting-app mkdir -p {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/arm64-v8a +cp {out}/android-arm64-chip-tv-casting-app/lib/jni/arm64-v8a/libCHIPController.so {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/arm64-v8a/libCHIPController.so + cp {out}/android-arm64-chip-tv-casting-app/lib/jni/arm64-v8a/libc++_shared.so {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/arm64-v8a/libc++_shared.so cp {out}/android-arm64-chip-tv-casting-app/lib/jni/arm64-v8a/libTvCastingApp.so {root}/examples/tv-casting-app/android/App/app/libs/jniLibs/arm64-v8a/libTvCastingApp.so @@ -1035,6 +1041,8 @@ cp {out}/android-arm64-chip-tv-casting-app/lib/third_party/connectedhomeip/src/p cp {out}/android-arm64-chip-tv-casting-app/lib/third_party/connectedhomeip/src/app/server/java/CHIPAppServer.jar {root}/examples/tv-casting-app/android/App/app/libs/CHIPAppServer.jar +cp {out}/android-arm64-chip-tv-casting-app/lib/third_party/connectedhomeip/src/controller/java/CHIPController.jar {root}/examples/tv-casting-app/android/App/app/libs/CHIPController.jar + cp {out}/android-arm64-chip-tv-casting-app/lib/TvCastingApp.jar {root}/examples/tv-casting-app/android/App/app/libs/TvCastingApp.jar # Building Example android-arm64-chip-tv-casting-app From 6d00c5980b31b05124c458aa83f5a255b916c8aa Mon Sep 17 00:00:00 2001 From: ManjunathRA Date: Thu, 24 Mar 2022 21:54:36 +0530 Subject: [PATCH 51/70] Test modified Mar 17 (#16367) * Modified scripts TC-CC-2.1 TC-CC-9.1 * Added auto generated files * Modified script after rebase * Auto generated files after rebase --- .../suites/certification/Test_TC_CC_2_1.yaml | 164 ++++++--- .../suites/certification/Test_TC_CC_9_2.yaml | 18 +- .../suites/certification/Test_TC_MC_9_1.yaml | 3 +- .../Framework/CHIPTests/CHIPClustersTests.m | 316 +++++++++++------ .../zap-generated/test/Commands.h | 318 ++++++++++-------- .../chip-tool/zap-generated/test/Commands.h | 231 +++++++------ 6 files changed, 650 insertions(+), 400 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_CC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_CC_2_1.yaml index 27cef7c45f7665..8ae7aeb41dac1f 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_2_1.yaml @@ -49,7 +49,10 @@ tests: command: "readAttribute" attribute: "current hue" response: - value: 0 + constraints: + type: uint8 + minValue: 0 + maxValue: 254 - label: "Validate constraints of attribute: CurrentSaturation" command: "readAttribute" @@ -72,7 +75,10 @@ tests: command: "readAttribute" attribute: "current saturation" response: - value: 0 + constraints: + type: uint8 + minValue: 0 + maxValue: 254 - label: "Validate constraints of attribute: CurrentX" command: "readAttribute" @@ -95,7 +101,10 @@ tests: command: "readAttribute" attribute: "current x" response: - value: 24939 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Validate constraints of attribute: CurrentY" command: "readAttribute" @@ -118,7 +127,10 @@ tests: command: "readAttribute" attribute: "current y" response: - value: 24701 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Validate constraints of attribute: ColorTemperatureMireds" command: "readAttribute" @@ -145,7 +157,10 @@ tests: command: "readAttribute" attribute: "color temperature" response: - value: 250 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Validate constraints of attribute: ColorMode" command: "readAttribute" @@ -170,7 +185,10 @@ tests: command: "readAttribute" attribute: "color mode" response: - value: 1 + constraints: + type: enum8 + minValue: 0 + maxValue: 2 - label: "Validate constraints of attribute: Options" command: "readAttribute" @@ -211,7 +229,8 @@ tests: command: "readAttribute" attribute: "enhanced current hue" response: - value: 0 + constraints: + type: uint16 - label: "Validate constraints of attribute: EnhancedColorMode" command: "readAttribute" @@ -235,7 +254,8 @@ tests: command: "readAttribute" attribute: "enhanced color mode" response: - value: 1 + constraints: + type: enum8 - label: "Validate constraints of attribute: ColorLoopActive" command: "readAttribute" @@ -256,7 +276,8 @@ tests: command: "readAttribute" attribute: "color loop active" response: - value: 0 + constraints: + type: uint8 - label: "Validate constraints of attribute: ColorLoopDirection" command: "readAttribute" @@ -278,7 +299,8 @@ tests: command: "readAttribute" attribute: "color loop direction" response: - value: 0 + constraints: + type: uint8 - label: "Validate constraints of attribute: ColorLoopTime" command: "readAttribute" @@ -299,7 +321,8 @@ tests: command: "readAttribute" attribute: "color loop time" response: - value: 25 + constraints: + type: uint16 - label: "Validate constraints of attribute: ColorLoopStartEnhancedHue" command: "readAttribute" @@ -322,7 +345,8 @@ tests: command: "readAttribute" attribute: "color loop start enhanced hue" response: - value: 8960 + constraints: + type: uint16 - label: "Validate constraints of attribute: ColorLoopStoredEnhancedHue" command: "readAttribute" @@ -345,7 +369,8 @@ tests: command: "readAttribute" attribute: "color loop stored enhanced hue" response: - value: 0 + constraints: + type: uint16 - label: "Validate constraints of attribute: ColorCapabilities" command: "readAttribute" @@ -369,7 +394,10 @@ tests: command: "readAttribute" attribute: "color capabilities" response: - value: 0 + constraints: + type: map16 + minValue: 0 + maxValue: 31 - label: "Validate constraints of attribute: ColorTempPhysicalMinMireds" command: "readAttribute" @@ -394,7 +422,10 @@ tests: command: "readAttribute" attribute: "color temp physical min" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Validate constraints of attribute: ColorTempPhysicalMaxMireds" command: "readAttribute" @@ -419,7 +450,10 @@ tests: command: "readAttribute" attribute: "color temp physical max" response: - value: 65279 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the optional attribute: CoupleColorTempToLevelMinMireds" optional: true @@ -445,7 +479,8 @@ tests: command: "readAttribute" attribute: "couple color temp to level min-mireds" response: - value: 0 + constraints: + type: uint16 - label: "Read the optional attribute: StartUpColorTemperatureMireds" optional: true @@ -495,7 +530,8 @@ tests: command: "readAttribute" attribute: "remaining time" response: - value: 0 + constraints: + type: uint16 - label: "Read the optional attribute: DriftCompensation" optional: true @@ -521,7 +557,10 @@ tests: command: "readAttribute" attribute: "drift compensation" response: - value: 0 + constraints: + type: enum8 + minValue: 0 + maxValue: 4 - label: "Read the optional attribute: CompensationText" optional: true @@ -546,7 +585,9 @@ tests: command: "readAttribute" attribute: "compensation text" response: - value: "" + constraints: + type: string + maxLength: 254 #Defined Primaries Information Attribute Set @@ -571,7 +612,10 @@ tests: command: "readAttribute" attribute: "number of primaries" response: - value: 0 + constraints: + type: uint8 + minValue: 0 + maxValue: 6 - label: "Read the mandatory attribute: Primary1X" command: "readAttribute" @@ -594,7 +638,10 @@ tests: command: "readAttribute" attribute: "primary 1 x" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary1Y" command: "readAttribute" @@ -617,7 +664,10 @@ tests: command: "readAttribute" attribute: "primary 1 y" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary1Intensity" command: "readAttribute" @@ -640,7 +690,8 @@ tests: command: "readAttribute" attribute: "primary 1 intensity" response: - value: 0 + constraints: + type: uint8 - label: "Read the mandatory attribute: Primary2X" command: "readAttribute" @@ -663,7 +714,10 @@ tests: command: "readAttribute" attribute: "primary 2 x" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary2Y" command: "readAttribute" @@ -686,7 +740,10 @@ tests: command: "readAttribute" attribute: "primary 2 y" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Validate constraints of attribute: Primary2Intensity" command: "readAttribute" @@ -709,7 +766,8 @@ tests: command: "readAttribute" attribute: "primary 2 intensity" response: - value: 0 + constraints: + type: uint8 - label: "Read the mandatory attribute: Primary3X" command: "readAttribute" @@ -732,7 +790,10 @@ tests: command: "readAttribute" attribute: "primary 3 x" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary3Y" command: "readAttribute" @@ -755,7 +816,10 @@ tests: command: "readAttribute" attribute: "primary 3 y" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary3Intensity" command: "readAttribute" @@ -778,7 +842,8 @@ tests: command: "readAttribute" attribute: "primary 3 intensity" response: - value: 0 + constraints: + type: uint8 #Additional Defined Primaries Information Attribute Set - label: "Read the mandatory attribute: Primary4X" @@ -802,7 +867,10 @@ tests: command: "readAttribute" attribute: "primary 4 x" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary4Y" command: "readAttribute" @@ -825,7 +893,10 @@ tests: command: "readAttribute" attribute: "primary 4 y" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary4Intensity" command: "readAttribute" @@ -848,7 +919,8 @@ tests: command: "readAttribute" attribute: "primary 4 intensity" response: - value: 0 + constraints: + type: uint8 - label: "Read the mandatory attribute: Primary5X" command: "readAttribute" @@ -871,7 +943,10 @@ tests: command: "readAttribute" attribute: "primary 5 x" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary5Y" command: "readAttribute" @@ -894,7 +969,10 @@ tests: command: "readAttribute" attribute: "primary 5 y" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary5Intensity" command: "readAttribute" @@ -917,7 +995,8 @@ tests: command: "readAttribute" attribute: "primary 5 intensity" response: - value: 0 + constraints: + type: uint8 - label: "Read the mandatory attribute: Primary6X" command: "readAttribute" @@ -940,7 +1019,10 @@ tests: command: "readAttribute" attribute: "primary 6 x" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary6Y" command: "readAttribute" @@ -963,7 +1045,10 @@ tests: command: "readAttribute" attribute: "primary 6 y" response: - value: 0 + constraints: + type: uint16 + minValue: 0 + maxValue: 65279 - label: "Read the mandatory attribute: Primary6Intensity" command: "readAttribute" @@ -986,7 +1071,8 @@ tests: command: "readAttribute" attribute: "primary 6 intensity" response: - value: 0 + constraints: + type: uint8 #Defined Color Points Settings Attribute Set - label: "Read the optional attribute: WhitePointX" diff --git a/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml b/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml index 3fb80d1b146c4d..6f7a92c62f4030 100644 --- a/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_CC_9_2.yaml @@ -89,6 +89,15 @@ tests: response: value: 160 + - label: "Read EnhancedCurrentHue attribute from DUT." + command: "readAttribute" + attribute: "enhanced current hue" + PICS: A_ENHANCEDCURRENTHUE + response: + saveAs: EnhancedCurrentHueValue + constraints: + type: uint16 + - label: "Color Loop Set Command - Set all Attributes" command: "ColorLoopSet" PICS: CR_COLORLOOPSET @@ -116,15 +125,6 @@ tests: response: value: 1 - - label: "Read EnhancedCurrentHue attribute from DUT." - command: "readAttribute" - attribute: "enhanced current hue" - PICS: A_ENHANCEDCURRENTHUE - response: - saveAs: EnhancedCurrentHueValue - constraints: - type: uint16 - - label: "Read ColorLoopStoredEnhancedHue attribute from DUT." command: "readAttribute" attribute: "color loop stored enhanced hue" diff --git a/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml b/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml index 2eb32092e047c1..e6cb59e61aada3 100644 --- a/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_MC_9_1.yaml @@ -44,13 +44,12 @@ tests: response: constraints: type: string - maxLenght: 32 + maxLength: 32 - label: "Reads the VendorID attribute" command: "readAttribute" attribute: "VendorID" response: - value: 0 constraints: type: vendor-id saveAs: vendorID diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index acc67d4f028669..d01a4df9ede1f3 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -2361,7 +2361,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000003_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 254); + } } [expectation fulfill]; @@ -2440,7 +2448,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000006_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 254); + } } [expectation fulfill]; @@ -2517,7 +2533,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000009_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 24939U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -2595,7 +2619,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000012_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 24701U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -2790,11 +2822,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000020_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - [expectation fulfill]; }]; @@ -2875,11 +2902,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000024_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - [expectation fulfill]; }]; @@ -2942,11 +2964,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000027_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - [expectation fulfill]; }]; @@ -3008,11 +3025,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000030_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 25U); - } - [expectation fulfill]; }]; @@ -3078,11 +3090,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000033_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 8960U); - } - [expectation fulfill]; }]; @@ -3148,11 +3155,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000036_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - [expectation fulfill]; }]; @@ -3229,7 +3231,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000039_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 31U); + } } [expectation fulfill]; @@ -3313,7 +3323,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000042_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -3397,7 +3415,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000045_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 65279U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -3483,11 +3509,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000048_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - [expectation fulfill]; }]; @@ -3666,11 +3687,6 @@ - (void)testSendClusterTest_TC_CC_2_1_000054_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - [expectation fulfill]; }]; @@ -3763,7 +3779,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000057_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 4); + } } [expectation fulfill]; @@ -3850,7 +3874,7 @@ - (void)testSendClusterTest_TC_CC_2_1_000060_ReadAttribute { id actualValue = value; - XCTAssertTrue([actualValue isEqualToString:@""]); + XCTAssertLessThanOrEqual([actualValue length], 254); } [expectation fulfill]; @@ -3928,7 +3952,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000063_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 6); + } } [expectation fulfill]; @@ -4005,7 +4037,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000066_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4082,7 +4122,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000069_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4178,7 +4226,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000073_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4255,7 +4311,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000076_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4351,7 +4415,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000080_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4428,7 +4500,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000083_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4524,7 +4604,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000087_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4601,7 +4689,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000090_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4697,7 +4793,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000094_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4774,7 +4878,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000097_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4870,7 +4982,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000101_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -4947,7 +5067,15 @@ - (void)testSendClusterTest_TC_CC_2_1_000104_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 65279U); + } } [expectation fulfill]; @@ -10745,7 +10873,32 @@ - (void)testSendClusterTest_TC_CC_9_2_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000008_ColorLoopSet +NSNumber * _Nonnull EnhancedCurrentHueValue; +- (void)testSendClusterTest_TC_CC_9_2_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT."]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + EnhancedCurrentHueValue = actualValue; + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_CC_9_2_000009_ColorLoopSet { XCTestExpectation * expectation = [self expectationWithDescription:@"Color Loop Set Command - Set all Attributes"]; @@ -10773,7 +10926,7 @@ - (void)testSendClusterTest_TC_CC_9_2_000008_ColorLoopSet [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_CC_9_2_000009_ReadAttribute +- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopActive attribute from DUT."]; @@ -10797,31 +10950,6 @@ - (void)testSendClusterTest_TC_CC_9_2_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -NSNumber * _Nonnull EnhancedCurrentHueValue; -- (void)testSendClusterTest_TC_CC_9_2_000010_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read EnhancedCurrentHue attribute from DUT."]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - EnhancedCurrentHueValue = actualValue; - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - (void)testSendClusterTest_TC_CC_9_2_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read ColorLoopStoredEnhancedHue attribute from DUT."]; @@ -16437,6 +16565,11 @@ - (void)testSendClusterTest_TC_MC_9_1_000002_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertLessThanOrEqual([actualValue length], 32); + } + [expectation fulfill]; }]; @@ -16456,11 +16589,6 @@ - (void)testSendClusterTest_TC_MC_9_1_000003_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - [expectation fulfill]; }]; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index 44fcafab7368ef..b5a321a5a7673f 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -3594,9 +3594,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current hue", actualValue, 0)); + VerifyOrReturn(CheckConstraintType("currentHue", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentHue", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("currentHue", [value unsignedCharValue], 254)); } NextTest(); @@ -3661,9 +3664,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current saturation", actualValue, 0)); + VerifyOrReturn(CheckConstraintType("currentSaturation", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentSaturation", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("currentSaturation", [value unsignedCharValue], 254)); } NextTest(); @@ -3727,9 +3733,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current x", actualValue, 24939U)); + VerifyOrReturn(CheckConstraintType("currentX", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentX", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("currentX", [value unsignedShortValue], 65279U)); } NextTest(); @@ -3793,9 +3802,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current y", actualValue, 24701U)); + VerifyOrReturn(CheckConstraintType("currentY", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("currentY", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("currentY", [value unsignedShortValue], 65279U)); } NextTest(); @@ -3963,11 +3975,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("enhanced current hue", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); NextTest(); }]; @@ -4040,11 +4048,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color loop active", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("colorLoopActive", "", "uint8")); NextTest(); }]; @@ -4100,11 +4104,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color loop direction", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("colorLoopDirection", "", "uint8")); NextTest(); }]; @@ -4159,11 +4159,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color loop time", actualValue, 25U)); - } - + VerifyOrReturn(CheckConstraintType("colorLoopTime", "", "uint16")); NextTest(); }]; @@ -4222,11 +4218,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color loop start enhanced hue", actualValue, 8960U)); - } - + VerifyOrReturn(CheckConstraintType("colorLoopStartEnhancedHue", "", "uint16")); NextTest(); }]; @@ -4285,11 +4277,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color loop stored enhanced hue", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); NextTest(); }]; @@ -4352,9 +4340,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color capabilities", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("colorCapabilities", "", "map16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("colorCapabilities", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("colorCapabilities", [value unsignedShortValue], 31U)); } NextTest(); @@ -4420,9 +4411,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color temp physical min", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("colorTempPhysicalMin", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMin", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMin", [value unsignedShortValue], 65279U)); } NextTest(); @@ -4488,9 +4482,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("color temp physical max", actualValue, 65279U)); + VerifyOrReturn(CheckConstraintType("colorTempPhysicalMax", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMax", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMax", [value unsignedShortValue], 65279U)); } NextTest(); @@ -4567,11 +4564,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("couple color temp to level min-mireds", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("coupleColorTempToLevelMinMireds", "", "uint16")); NextTest(); }]; @@ -4728,11 +4721,7 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("remaining time", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); NextTest(); }]; @@ -4810,9 +4799,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("drift compensation", actualValue, 0)); + VerifyOrReturn(CheckConstraintType("driftCompensation", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("driftCompensation", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("driftCompensation", [value unsignedCharValue], 4)); } NextTest(); @@ -4886,11 +4878,8 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValueAsString("compensation text", actualValue, @"")); - } - + VerifyOrReturn(CheckConstraintType("compensationText", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("compensationText", [value length], 254)); NextTest(); }]; @@ -4952,9 +4941,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("number of primaries", actualValue, 0)); + VerifyOrReturn(CheckConstraintType("numberOfPrimaries", "", "uint8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("numberOfPrimaries", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("numberOfPrimaries", [value unsignedCharValue], 6)); } NextTest(); @@ -5018,9 +5010,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 1 x", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary1X", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary1X", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary1X", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5084,9 +5079,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 1 y", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary1Y", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary1Y", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary1Y", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5168,9 +5166,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 2 x", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary2X", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary2X", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary2X", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5234,9 +5235,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 2 y", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary2Y", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary2Y", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary2Y", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5318,9 +5322,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 3 x", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary3X", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary3X", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary3X", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5384,9 +5391,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 3 y", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary3Y", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary3Y", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary3Y", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5468,9 +5478,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 4 x", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary4X", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary4X", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary4X", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5534,9 +5547,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 4 y", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary4Y", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary4Y", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary4Y", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5618,9 +5634,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 5 x", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary5X", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary5X", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary5X", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5684,9 +5703,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 5 y", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary5Y", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary5Y", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary5Y", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5768,9 +5790,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 6 x", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary6X", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary6X", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary6X", [value unsignedShortValue], 65279U)); } NextTest(); @@ -5834,9 +5859,12 @@ class Test_TC_CC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("primary 6 y", actualValue, 0U)); + VerifyOrReturn(CheckConstraintType("primary6Y", "", "uint16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("primary6Y", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("primary6Y", [value unsignedShortValue], 65279U)); } NextTest(); @@ -13126,28 +13154,28 @@ class Test_TC_CC_9_2 : public TestCommandBridge { err = TestReadColorLoopStartEnhancedHueAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Color Loop Set Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) { + ChipLogProgress(chipTool, " ***** Test Step 8 : Read EnhancedCurrentHue attribute from DUT.\n"); + if (ShouldSkip("A_ENHANCEDCURRENTHUE")) { NextTest(); return; } - err = TestColorLoopSetCommandSetAllAttributes_8(); + err = TestReadEnhancedCurrentHueAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read ColorLoopActive attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) { + ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Set all Attributes\n"); + if (ShouldSkip("CR_COLORLOOPSET")) { NextTest(); return; } - err = TestReadColorLoopActiveAttributeFromDut_9(); + err = TestColorLoopSetCommandSetAllAttributes_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read EnhancedCurrentHue attribute from DUT.\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) { + ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopActive attribute from DUT.\n"); + if (ShouldSkip("A_COLORLOOPACTIVE")) { NextTest(); return; } - err = TestReadEnhancedCurrentHueAttributeFromDut_10(); + err = TestReadColorLoopActiveAttributeFromDut_10(); break; case 11: ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); @@ -13394,8 +13422,31 @@ class Test_TC_CC_9_2 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull EnhancedCurrentHueValue; - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_8() + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); + { + EnhancedCurrentHueValue = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -13421,7 +13472,7 @@ class Test_TC_CC_9_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_9() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -13442,29 +13493,6 @@ class Test_TC_CC_9_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - NSNumber * _Nonnull EnhancedCurrentHueValue; - - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_10() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestColorControl * cluster = [[CHIPTestColorControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeEnhancedCurrentHueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read EnhancedCurrentHue attribute from DUT. Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - { - EnhancedCurrentHueValue = value; - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } CHIP_ERROR TestReadColorLoopStoredEnhancedHueAttributeFromDut_11() { @@ -21384,6 +21412,7 @@ class Test_TC_MC_9_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", [value length], 32)); NextTest(); }]; @@ -21403,11 +21432,6 @@ class Test_TC_MC_9_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("VendorID", actualValue, 0U)); - } - VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); NextTest(); }]; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 767cce84c1d7fc..2ae2ddd5dc6181 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -5818,8 +5818,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_3(uint8_t currentHue) { - VerifyOrReturn(CheckValue("currentHue", currentHue, 0)); - + VerifyOrReturn(CheckConstraintType("currentHue", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("currentHue", currentHue, 0)); + VerifyOrReturn(CheckConstraintMaxValue("currentHue", currentHue, 254)); NextTest(); } @@ -5890,8 +5891,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_6(uint8_t currentSaturation) { - VerifyOrReturn(CheckValue("currentSaturation", currentSaturation, 0)); - + VerifyOrReturn(CheckConstraintType("currentSaturation", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("currentSaturation", currentSaturation, 0)); + VerifyOrReturn(CheckConstraintMaxValue("currentSaturation", currentSaturation, 254)); NextTest(); } @@ -5962,8 +5964,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_9(uint16_t currentX) { - VerifyOrReturn(CheckValue("currentX", currentX, 24939U)); - + VerifyOrReturn(CheckConstraintType("currentX", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("currentX", currentX, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentX", currentX, 65279U)); NextTest(); } @@ -6034,8 +6037,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_12(uint16_t currentY) { - VerifyOrReturn(CheckValue("currentY", currentY, 24701U)); - + VerifyOrReturn(CheckConstraintType("currentY", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("currentY", currentY, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentY", currentY, 65279U)); NextTest(); } @@ -6223,8 +6227,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_20(uint16_t enhancedCurrentHue) { - VerifyOrReturn(CheckValue("enhancedCurrentHue", enhancedCurrentHue, 0U)); - + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); NextTest(); } @@ -6316,8 +6319,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_24(uint8_t colorLoopActive) { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 0)); - + VerifyOrReturn(CheckConstraintType("colorLoopActive", "", "uint8")); NextTest(); } @@ -6386,8 +6388,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_27(uint8_t colorLoopDirection) { - VerifyOrReturn(CheckValue("colorLoopDirection", colorLoopDirection, 0)); - + VerifyOrReturn(CheckConstraintType("colorLoopDirection", "", "uint8")); NextTest(); } @@ -6456,8 +6457,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_30(uint16_t colorLoopTime) { - VerifyOrReturn(CheckValue("colorLoopTime", colorLoopTime, 25U)); - + VerifyOrReturn(CheckConstraintType("colorLoopTime", "", "uint16")); NextTest(); } @@ -6529,8 +6529,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_33(uint16_t colorLoopStartEnhancedHue) { - VerifyOrReturn(CheckValue("colorLoopStartEnhancedHue", colorLoopStartEnhancedHue, 8960U)); - + VerifyOrReturn(CheckConstraintType("colorLoopStartEnhancedHue", "", "uint16")); NextTest(); } @@ -6602,8 +6601,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_36(uint16_t colorLoopStoredEnhancedHue) { - VerifyOrReturn(CheckValue("colorLoopStoredEnhancedHue", colorLoopStoredEnhancedHue, 0U)); - + VerifyOrReturn(CheckConstraintType("colorLoopStoredEnhancedHue", "", "uint16")); NextTest(); } @@ -6674,8 +6672,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_39(uint16_t colorCapabilities) { - VerifyOrReturn(CheckValue("colorCapabilities", colorCapabilities, 0U)); - + VerifyOrReturn(CheckConstraintType("colorCapabilities", "", "map16")); + VerifyOrReturn(CheckConstraintMinValue("colorCapabilities", colorCapabilities, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("colorCapabilities", colorCapabilities, 31U)); NextTest(); } @@ -6746,8 +6745,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_42(uint16_t colorTempPhysicalMin) { - VerifyOrReturn(CheckValue("colorTempPhysicalMin", colorTempPhysicalMin, 0U)); - + VerifyOrReturn(CheckConstraintType("colorTempPhysicalMin", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMin", colorTempPhysicalMin, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMin", colorTempPhysicalMin, 65279U)); NextTest(); } @@ -6818,8 +6818,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_45(uint16_t colorTempPhysicalMax) { - VerifyOrReturn(CheckValue("colorTempPhysicalMax", colorTempPhysicalMax, 65279U)); - + VerifyOrReturn(CheckConstraintType("colorTempPhysicalMax", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("colorTempPhysicalMax", colorTempPhysicalMax, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("colorTempPhysicalMax", colorTempPhysicalMax, 65279U)); NextTest(); } @@ -6898,8 +6899,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_48(uint16_t coupleColorTempToLevelMinMireds) { - VerifyOrReturn(CheckValue("coupleColorTempToLevelMinMireds", coupleColorTempToLevelMinMireds, 0U)); - + VerifyOrReturn(CheckConstraintType("coupleColorTempToLevelMinMireds", "", "uint16")); NextTest(); } @@ -7049,8 +7049,7 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_54(uint16_t remainingTime) { - VerifyOrReturn(CheckValue("remainingTime", remainingTime, 0U)); - + VerifyOrReturn(CheckConstraintType("remainingTime", "", "uint16")); NextTest(); } @@ -7128,8 +7127,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_57(uint8_t driftCompensation) { - VerifyOrReturn(CheckValue("driftCompensation", driftCompensation, 0)); - + VerifyOrReturn(CheckConstraintType("driftCompensation", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("driftCompensation", driftCompensation, 0)); + VerifyOrReturn(CheckConstraintMaxValue("driftCompensation", driftCompensation, 4)); NextTest(); } @@ -7206,8 +7206,8 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_60(chip::CharSpan compensationText) { - VerifyOrReturn(CheckValueAsString("compensationText", compensationText, chip::CharSpan("", 0))); - + VerifyOrReturn(CheckConstraintType("compensationText", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("compensationText", compensationText.size(), 254)); NextTest(); } @@ -7278,8 +7278,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_63(uint8_t numberOfPrimaries) { - VerifyOrReturn(CheckValue("numberOfPrimaries", numberOfPrimaries, 0)); - + VerifyOrReturn(CheckConstraintType("numberOfPrimaries", "", "uint8")); + VerifyOrReturn(CheckConstraintMinValue("numberOfPrimaries", numberOfPrimaries, 0)); + VerifyOrReturn(CheckConstraintMaxValue("numberOfPrimaries", numberOfPrimaries, 6)); NextTest(); } @@ -7350,8 +7351,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_66(uint16_t primary1X) { - VerifyOrReturn(CheckValue("primary1X", primary1X, 0U)); - + VerifyOrReturn(CheckConstraintType("primary1X", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary1X", primary1X, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary1X", primary1X, 65279U)); NextTest(); } @@ -7422,8 +7424,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_69(uint16_t primary1Y) { - VerifyOrReturn(CheckValue("primary1Y", primary1Y, 0U)); - + VerifyOrReturn(CheckConstraintType("primary1Y", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary1Y", primary1Y, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary1Y", primary1Y, 65279U)); NextTest(); } @@ -7517,8 +7520,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_73(uint16_t primary2X) { - VerifyOrReturn(CheckValue("primary2X", primary2X, 0U)); - + VerifyOrReturn(CheckConstraintType("primary2X", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary2X", primary2X, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary2X", primary2X, 65279U)); NextTest(); } @@ -7589,8 +7593,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_76(uint16_t primary2Y) { - VerifyOrReturn(CheckValue("primary2Y", primary2Y, 0U)); - + VerifyOrReturn(CheckConstraintType("primary2Y", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary2Y", primary2Y, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary2Y", primary2Y, 65279U)); NextTest(); } @@ -7684,8 +7689,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_80(uint16_t primary3X) { - VerifyOrReturn(CheckValue("primary3X", primary3X, 0U)); - + VerifyOrReturn(CheckConstraintType("primary3X", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary3X", primary3X, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary3X", primary3X, 65279U)); NextTest(); } @@ -7756,8 +7762,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_83(uint16_t primary3Y) { - VerifyOrReturn(CheckValue("primary3Y", primary3Y, 0U)); - + VerifyOrReturn(CheckConstraintType("primary3Y", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary3Y", primary3Y, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary3Y", primary3Y, 65279U)); NextTest(); } @@ -7851,8 +7858,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_87(uint16_t primary4X) { - VerifyOrReturn(CheckValue("primary4X", primary4X, 0U)); - + VerifyOrReturn(CheckConstraintType("primary4X", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary4X", primary4X, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary4X", primary4X, 65279U)); NextTest(); } @@ -7923,8 +7931,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_90(uint16_t primary4Y) { - VerifyOrReturn(CheckValue("primary4Y", primary4Y, 0U)); - + VerifyOrReturn(CheckConstraintType("primary4Y", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary4Y", primary4Y, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary4Y", primary4Y, 65279U)); NextTest(); } @@ -8018,8 +8027,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_94(uint16_t primary5X) { - VerifyOrReturn(CheckValue("primary5X", primary5X, 0U)); - + VerifyOrReturn(CheckConstraintType("primary5X", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary5X", primary5X, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary5X", primary5X, 65279U)); NextTest(); } @@ -8090,8 +8100,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_97(uint16_t primary5Y) { - VerifyOrReturn(CheckValue("primary5Y", primary5Y, 0U)); - + VerifyOrReturn(CheckConstraintType("primary5Y", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary5Y", primary5Y, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary5Y", primary5Y, 65279U)); NextTest(); } @@ -8185,8 +8196,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_101(uint16_t primary6X) { - VerifyOrReturn(CheckValue("primary6X", primary6X, 0U)); - + VerifyOrReturn(CheckConstraintType("primary6X", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary6X", primary6X, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary6X", primary6X, 65279U)); NextTest(); } @@ -8257,8 +8269,9 @@ class Test_TC_CC_2_1Suite : public TestCommand void OnSuccessResponse_104(uint16_t primary6Y) { - VerifyOrReturn(CheckValue("primary6Y", primary6Y, 0U)); - + VerifyOrReturn(CheckConstraintType("primary6Y", "", "uint16")); + VerifyOrReturn(CheckConstraintMinValue("primary6Y", primary6Y, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("primary6Y", primary6Y, 65279U)); NextTest(); } @@ -17669,31 +17682,31 @@ class Test_TC_CC_9_2Suite : public TestCommand err = TestReadColorLoopStartEnhancedHueAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Color Loop Set Command - Set all Attributes\n"); - if (ShouldSkip("CR_COLORLOOPSET")) + ChipLogProgress(chipTool, " ***** Test Step 8 : Read EnhancedCurrentHue attribute from DUT.\n"); + if (ShouldSkip("A_ENHANCEDCURRENTHUE")) { NextTest(); return; } - err = TestColorLoopSetCommandSetAllAttributes_8(); + err = TestReadEnhancedCurrentHueAttributeFromDut_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read ColorLoopActive attribute from DUT.\n"); - if (ShouldSkip("A_COLORLOOPACTIVE")) + ChipLogProgress(chipTool, " ***** Test Step 9 : Color Loop Set Command - Set all Attributes\n"); + if (ShouldSkip("CR_COLORLOOPSET")) { NextTest(); return; } - err = TestReadColorLoopActiveAttributeFromDut_9(); + err = TestColorLoopSetCommandSetAllAttributes_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Read EnhancedCurrentHue attribute from DUT.\n"); - if (ShouldSkip("A_ENHANCEDCURRENTHUE")) + ChipLogProgress(chipTool, " ***** Test Step 10 : Read ColorLoopActive attribute from DUT.\n"); + if (ShouldSkip("A_COLORLOOPACTIVE")) { NextTest(); return; } - err = TestReadEnhancedCurrentHueAttributeFromDut_10(); + err = TestReadColorLoopActiveAttributeFromDut_10(); break; case 11: ChipLogProgress(chipTool, " ***** Test Step 11 : Read ColorLoopStoredEnhancedHue attribute from DUT.\n"); @@ -17850,14 +17863,14 @@ class Test_TC_CC_9_2Suite : public TestCommand (static_cast(context))->OnSuccessResponse_7(colorLoopStartEnhancedHue); } - static void OnFailureCallback_9(void * context, CHIP_ERROR error) + static void OnFailureCallback_8(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_9(error); + (static_cast(context))->OnFailureResponse_8(error); } - static void OnSuccessCallback_9(void * context, uint8_t colorLoopActive) + static void OnSuccessCallback_8(void * context, uint16_t enhancedCurrentHue) { - (static_cast(context))->OnSuccessResponse_9(colorLoopActive); + (static_cast(context))->OnSuccessResponse_8(enhancedCurrentHue); } static void OnFailureCallback_10(void * context, CHIP_ERROR error) @@ -17865,9 +17878,9 @@ class Test_TC_CC_9_2Suite : public TestCommand (static_cast(context))->OnFailureResponse_10(error); } - static void OnSuccessCallback_10(void * context, uint16_t enhancedCurrentHue) + static void OnSuccessCallback_10(void * context, uint8_t colorLoopActive) { - (static_cast(context))->OnSuccessResponse_10(enhancedCurrentHue); + (static_cast(context))->OnSuccessResponse_10(colorLoopActive); } static void OnFailureCallback_11(void * context, CHIP_ERROR error) @@ -18122,7 +18135,31 @@ class Test_TC_CC_9_2Suite : public TestCommand NextTest(); } - CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_8() + CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ColorControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8(uint16_t enhancedCurrentHue) + { + VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); + EnhancedCurrentHueValue = enhancedCurrentHue; + NextTest(); + } + + CHIP_ERROR TestColorLoopSetCommandSetAllAttributes_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::ColorControl::Commands::ColorLoopSet::Type; @@ -18137,56 +18174,32 @@ class Test_TC_CC_9_2Suite : public TestCommand request.optionsOverride = 0; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_8(); + (static_cast(context))->OnSuccessResponse_9(); }; auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_8(error); + (static_cast(context))->OnFailureResponse_9(error); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ColorControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - void OnFailureResponse_9(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t colorLoopActive) - { - VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); - - NextTest(); - } + void OnSuccessResponse_9() { NextTest(); } - CHIP_ERROR TestReadEnhancedCurrentHueAttributeFromDut_10() + CHIP_ERROR TestReadColorLoopActiveAttributeFromDut_10() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ColorControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_10, OnFailureCallback_10, true)); return CHIP_NO_ERROR; } @@ -18197,10 +18210,10 @@ class Test_TC_CC_9_2Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_10(uint16_t enhancedCurrentHue) + void OnSuccessResponse_10(uint8_t colorLoopActive) { - VerifyOrReturn(CheckConstraintType("enhancedCurrentHue", "", "uint16")); - EnhancedCurrentHueValue = enhancedCurrentHue; + VerifyOrReturn(CheckValue("colorLoopActive", colorLoopActive, 1)); + NextTest(); } @@ -31101,6 +31114,7 @@ class Test_TC_MC_9_1Suite : public TestCommand void OnSuccessResponse_2(chip::CharSpan vendorName) { VerifyOrReturn(CheckConstraintType("vendorName", "", "string")); + VerifyOrReturn(CheckConstraintMaxLength("vendorName", vendorName.size(), 32)); NextTest(); } @@ -31123,7 +31137,6 @@ class Test_TC_MC_9_1Suite : public TestCommand void OnSuccessResponse_3(uint16_t vendorID) { - VerifyOrReturn(CheckValue("vendorID", vendorID, 0U)); VerifyOrReturn(CheckConstraintType("vendorID", "", "vendor-id")); NextTest(); } From 6c3f648d019c280c351e13dc50b457aa2a815f06 Mon Sep 17 00:00:00 2001 From: ManjunathRA Date: Thu, 24 Mar 2022 21:56:14 +0530 Subject: [PATCH 52/70] Test modified Mar 21 (#16492) * Updated Scripts : Test_TC_BOOL_1_1.yaml Test_TC_BOOL_2_1.yaml Test_TC_BRAC_1_1.yaml Test_TC_ILL_1_1.yaml Test_TC_LVL_1_1.yaml Test_TC_LVL_3_1.yaml Test_TC_LVL_4_1.yaml Test_TC_LVL_5_1.yaml Test_TC_LVL_6_1.yaml Test_TC_MC_3_11.yaml Test_TC_MC_3_7.yaml Test_TC_OCC_2_1.yaml Test_TC_OCC_2_2.yaml Test_TC_OO_2_1.yaml Test_TC_PCC_1_1.yaml Test_TC_PCC_2_1.yaml Test_TC_PRS_2_1.yaml Test_TC_PS_1_1.yaml Test_TC_RH_1_1.yaml Test_TC_RH_2_1.yaml Test_TC_RH_2_2.yaml Test_TC_TM_1_1.yaml Test_TC_TM_2_2.yaml Test_TC_TSTAT_1_1.yaml Test_TC_TSTAT_2_1.yaml Test_TC_TSUIC_1_1.yaml Test_TC_TSUIC_2_1.yaml Test_TC_TSUIC_2_2.yaml Test_TC_WIFIDIAG_1_1.yaml * Auto generated files * Modified scripts rebase * Auto generated files after rebase * Modified scripts after rebase * Auto generated files after rebase * modified after Rebased * auto generated rebaesed --- .../certification/Test_TC_BOOL_1_1.yaml | 27 - .../certification/Test_TC_BOOL_2_1.yaml | 15 - .../certification/Test_TC_BRAC_1_1.yaml | 30 + .../suites/certification/Test_TC_ILL_1_1.yaml | 30 +- .../suites/certification/Test_TC_LVL_1_1.yaml | 7 +- .../suites/certification/Test_TC_LVL_3_1.yaml | 32 +- .../suites/certification/Test_TC_LVL_4_1.yaml | 68 +- .../suites/certification/Test_TC_LVL_5_1.yaml | 33 +- .../suites/certification/Test_TC_LVL_6_1.yaml | 4 +- .../suites/certification/Test_TC_MC_3_11.yaml | 14 +- .../suites/certification/Test_TC_MC_3_7.yaml | 12 +- .../suites/certification/Test_TC_OCC_2_1.yaml | 208 + .../suites/certification/Test_TC_OCC_2_2.yaml | 22 +- .../suites/certification/Test_TC_PCC_1_1.yaml | 9 +- .../suites/certification/Test_TC_PCC_2_1.yaml | 82 +- .../suites/certification/Test_TC_PS_1_1.yaml | 34 - .../suites/certification/Test_TC_RH_1_1.yaml | 52 +- .../suites/certification/Test_TC_RH_2_1.yaml | 36 +- .../suites/certification/Test_TC_RH_2_2.yaml | 33 +- .../suites/certification/Test_TC_TM_1_1.yaml | 25 - .../suites/certification/Test_TC_TM_2_1.yaml | 2 - .../suites/certification/Test_TC_TM_2_2.yaml | 30 +- .../certification/Test_TC_TSTAT_1_1.yaml | 41 - .../certification/Test_TC_TSTAT_2_1.yaml | 1202 +---- .../certification/Test_TC_TSTAT_2_2.yaml | 23 + .../certification/Test_TC_TSUIC_1_1.yaml | 50 - .../certification/Test_TC_TSUIC_2_1.yaml | 63 +- .../certification/Test_TC_TSUIC_2_2.yaml | 3 - .../certification/Test_TC_WIFIDIAG_1_1.yaml | 7 +- .../Framework/CHIPTests/CHIPClustersTests.m | 3116 +++++------ .../zap-generated/test/Commands.h | 3552 +++++-------- .../chip-tool/zap-generated/test/Commands.h | 4689 ++++++----------- 32 files changed, 4814 insertions(+), 8737 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml index 57ac79db0cb867..22d0f995647186 100644 --- a/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_BOOL_1_1.yaml @@ -41,22 +41,6 @@ tests: constraints: type: uint16 - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 1 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -74,7 +58,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -82,18 +65,8 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: constraints: type: list - - #Disabled due to issue #13442 - - label: "Read the optional global attribute : FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_BOOL_2_1.yaml b/src/app/tests/suites/certification/Test_TC_BOOL_2_1.yaml index cb3b6eb42adb51..e997fae45f22b5 100644 --- a/src/app/tests/suites/certification/Test_TC_BOOL_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_BOOL_2_1.yaml @@ -40,18 +40,3 @@ tests: response: constraints: type: bool - - - label: - "Write the default value to mandatory non-global attribute: StateValue" - command: "writeAttribute" - attribute: "StateValue" - arguments: - value: 1 - response: - error: UNSUPPORTED_WRITE - - - label: "Reads back the mandatory non-global attribute: StateValue" - command: "readAttribute" - attribute: "StateValue" - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml index eea942c4607424..547bf39db86803 100644 --- a/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_BRAC_1_1.yaml @@ -40,3 +40,33 @@ tests: response: constraints: type: uint16 + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + + #issue #11053 disabled steps below Global attributes missing from YAML framework + - label: "Read the global attribute: EventList" + disabled: true + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml index 41cd89aa9e641c..50544be9e7a145 100644 --- a/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_ILL_1_1.yaml @@ -28,11 +28,13 @@ tests: - name: "nodeId" value: nodeId + #issue #12190 as per spec default value is 3 but expecting 2 - label: "read the global attribute: ClusterRevision" + disabled: true command: "readAttribute" attribute: "ClusterRevision" response: - value: 2 + value: 3 - label: "Read the global attribute constraints: ClusterRevision" command: "readAttribute" @@ -41,22 +43,6 @@ tests: constraints: type: uint16 - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 1 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 2 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -74,7 +60,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -82,17 +67,8 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: constraints: type: list - - - label: "Read the optional global attribute : FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml index 4147475a71ef2e..5a12491b2ef7fb 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_1_1.yaml @@ -74,7 +74,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -82,7 +81,6 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: @@ -90,7 +88,6 @@ tests: type: list - label: "read the optional global attribute: FeatureMap" - disabled: true command: "readAttribute" attribute: "FeatureMap" response: @@ -112,8 +109,8 @@ tests: error: UNSUPPORTED_WRITE - label: "reads back optional global attribute: FeatureMap" - disabled: true command: "readAttribute" attribute: "FeatureMap" response: - value: 3 + constraints: + type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml index 608e9376446732..0416617a970345 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_3_1.yaml @@ -32,19 +32,22 @@ tests: command: "readAttribute" attribute: "current level" response: - value: 254 + constraints: + type: uint8 - label: "Reads the MinLevel attribute" command: "readAttribute" attribute: "min level" response: - value: 0 + constraints: + type: uint8 - label: "Reads the MaxLevel attribute" command: "readAttribute" attribute: "max level" response: - value: 254 + constraints: + type: uint8 - label: "sends a Move to level command" command: "MoveToLevel" @@ -53,7 +56,7 @@ tests: - name: "level" value: 64 - name: "transitionTime" - value: 0 + value: 65535 - name: "optionMask" value: 1 - name: "optionOverride" @@ -78,40 +81,41 @@ tests: arguments: values: - name: "level" - value: 128 + value: 100 - name: "transitionTime" - value: 1 + value: 100 - name: "optionMask" value: 1 - name: "optionOverride" value: 1 - - label: "Wait a second" + - label: "Wait 11000 second" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 1000 + value: 11000 - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 128 + value: 100 - label: "reads On Off Transition Time attribute from DUT" command: "readAttribute" attribute: "On Off Transition Time" response: - value: 0 + constraints: + type: uint16 - label: "sends a Move to level command" command: "MoveToLevel" arguments: values: - name: "level" - value: 254 + value: 128 - name: "transitionTime" value: 65535 - name: "optionMask" @@ -119,19 +123,19 @@ tests: - name: "optionOverride" value: 1 - - label: "Wait 10ms" + - label: "Wait 1000ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 100 + value: 1000 - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 254 + value: 128 - label: "Reset level to 254" command: "MoveToLevel" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml index 212efdde6f2e4f..6a3abbc3e0962d 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_4_1.yaml @@ -28,17 +28,13 @@ tests: - name: "nodeId" value: nodeId - - label: "reads CurrentLevel attribute from DUT" - command: "readAttribute" - attribute: "current level" - response: - value: 254 - - label: "reads max level attribute from DUT" command: "readAttribute" attribute: "max level" response: - value: 254 + saveAs: MaxlevelValue + constraints: + type: uint8 - label: "sends a Move up command" command: "Move" @@ -47,12 +43,23 @@ tests: - name: "moveMode" value: 0 - name: "rate" - value: 200 + value: 32 - name: "optionMask" value: 1 - name: "optionOverride" value: 1 + - label: "user prompt message" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Physically verify that the DUT moves at a rate of 32 units + per second or as close as possible to this rate and + completes moving to its maximum level" + - label: "Wait 3000ms" cluster: "DelayCommands" command: "WaitForMs" @@ -65,13 +72,15 @@ tests: command: "readAttribute" attribute: "current level" response: - value: 254 + value: MaxlevelValue - label: "reads min level attribute from DUT" command: "readAttribute" attribute: "min level" response: - value: 0 + saveAs: MinlevelValue + constraints: + type: uint8 - label: "sends a Move down command" command: "Move" @@ -80,40 +89,48 @@ tests: - name: "moveMode" value: 1 - name: "rate" - value: 250 + value: 64 - name: "optionMask" value: 1 - name: "optionOverride" value: 1 - - label: "Wait 3000ms" + - label: "user prompt message" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Physically verify that the DUT moves at a rate of 64 units + per second or as close as possible to this rate and complete + moving to its minimum level" + + - label: "Wait 5000ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 3000 + value: 5000 # For lighting Device type current level minimal value is 1 - label: "reads CurrentLevel attribute from DUT" command: "readAttribute" attribute: "current level" response: + value: 1 constraints: minValue: 0 maxValue: 1 - - label: "Write default move rate attribute from DUT" - command: "writeAttribute" - attribute: "default move rate" - arguments: - value: 20 - - label: "reads default move rate attribute from DUT" command: "readAttribute" attribute: "default move rate" response: - value: 20 + saveAs: DefaultMoveRateValue + constraints: + type: uint8 - label: "sends a Move up command at default move rate" command: "Move" @@ -143,6 +160,17 @@ tests: constraints: notValue: 255 + - label: "user prompt message" + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: + "Physically verify that the device moves at the rate + recorded in step 3a and completes moving to its maximum + level." + - label: "Reset level to 254" command: "MoveToLevel" arguments: diff --git a/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml index 66099613d60683..4fd1359b7d0719 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_5_1.yaml @@ -32,14 +32,14 @@ tests: cluster: "On/Off" command: "on" - - label: "Precondition: DUT level is set to 0x80" + - label: "Precondition: DUT level is set to its lowest point" command: "Step" arguments: values: - name: "stepMode" value: 1 - name: "stepSize" - value: 126 + value: 100 - name: "transitionTime" value: 20 - name: "optionMask" @@ -47,59 +47,62 @@ tests: - name: "optionOverride" value: 0 - - label: "Wait 4000ms" + - label: "Wait 3000ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 4000 + value: 3000 - label: "Reads current level attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 128 + saveAs: CurrentlevelValue + constraints: + type: uint8 - - label: "Sends step down command to DUT" + - label: "Sends step up command to DUT" command: "Step" arguments: values: - name: "stepMode" - value: 1 + value: 0 - name: "stepSize" value: 64 - name: "transitionTime" - value: 20 + value: 2 - name: "optionMask" value: 0 - name: "optionOverride" value: 0 - - label: "Wait 4000ms" + - label: "Wait 5000ms" cluster: "DelayCommands" command: "WaitForMs" arguments: values: - name: "ms" - value: 4000 + value: 5000 - label: "Reads current level attribute from DUT" command: "readAttribute" attribute: "current level" response: - value: 64 + constraints: + notValue: CurrentlevelValue - - label: "Sends a Step up command" + - label: "Sends a Step down command" command: "Step" arguments: values: - name: "stepMode" - value: 0 + value: 1 - name: "stepSize" value: 64 - name: "transitionTime" - value: 20 + value: 2 - name: "optionMask" value: 0 - name: "optionOverride" @@ -117,7 +120,7 @@ tests: command: "readAttribute" attribute: "current level" response: - value: 128 + value: CurrentlevelValue - label: "Reset level to 254" command: "MoveToLevel" diff --git a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml index bc9644b72ec7e0..f0c31c8184c2af 100644 --- a/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LVL_6_1.yaml @@ -58,6 +58,7 @@ tests: command: "readAttribute" attribute: "current level" response: + saveAs: CurrentLevelValue constraints: minValue: 0 maxValue: 1 @@ -97,8 +98,7 @@ tests: attribute: "current level" response: constraints: - minValue: 2 - maxValue: 3 + notValue: CurrentLevelValue - label: "Reset level to 254" command: "MoveToLevel" diff --git a/src/app/tests/suites/certification/Test_TC_MC_3_11.yaml b/src/app/tests/suites/certification/Test_TC_MC_3_11.yaml index cb7b4a56da2abb..601235bf6e92ca 100644 --- a/src/app/tests/suites/certification/Test_TC_MC_3_11.yaml +++ b/src/app/tests/suites/certification/Test_TC_MC_3_11.yaml @@ -29,6 +29,16 @@ tests: value: nodeId # Remove disable flag when SDK supports command. + - label: "Read attribute media input list" + disabled: true + command: "readAttribute" + attribute: "InputList" + response: + constraints: + type: list + saveAs: InputListValues + + # Remove disable flag when SDK supports command. #13029 - label: "Rename Input Command" disabled: true command: "RenameInput" @@ -38,7 +48,7 @@ tests: value: 1 - name: "name" value: "A1" - # Remove disable flag when SDK supports command. + # Remove disable flag when SDK supports command. #13029 - label: "Rename Input Command" disabled: true command: "RenameInput" @@ -48,7 +58,7 @@ tests: value: 1 - name: "name" value: "A2" - # Remove disable flag when SDK supports command. + # Remove disable flag when SDK supports command. #13029 - label: "Read attribute media input list" disabled: true command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_MC_3_7.yaml b/src/app/tests/suites/certification/Test_TC_MC_3_7.yaml index c4127c210766f2..90c0fe395074df 100644 --- a/src/app/tests/suites/certification/Test_TC_MC_3_7.yaml +++ b/src/app/tests/suites/certification/Test_TC_MC_3_7.yaml @@ -41,6 +41,14 @@ tests: - name: "applicationId" value: "HelloWorldApp" + - label: "Reads the Status attribute" + disabled: true + cluster: "Application Basic" + command: "readAttribute" + attribute: "Status" + response: + value: 1 + # TODO: Update the corresponding values when feature is supported - label: "Stop an app with the provided application ID" disabled: true @@ -63,7 +71,7 @@ tests: - name: "applicationId" value: "NonAvailableApp" response: - error: UNSUPPORTED_WRITE + error: APP_NOT_AVAILABLE # TODO: Update the corresponding values when feature is supported - label: "Launch an app with the provided a application ID" @@ -91,4 +99,4 @@ tests: - name: "applicationId" value: "HelloWorldApp2" response: - error: INVALID_COMMAND + error: SYSTEM_BUSY diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml index 01f38f84cad857..4296b71a5b3e11 100644 --- a/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_1.yaml @@ -122,3 +122,211 @@ tests: attribute: "occupancy sensor type bitmap" response: value: 1 + + #disabled due to issue #15377 + - label: "Reads optional attribute: PIROccupiedToUnoccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PIROccupiedToUnoccupiedDelay" + response: + value: 0 + + - label: "Reads optional attribute constrains: PIROccupiedToUnoccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PIROccupiedToUnoccupiedDelay" + response: + constraints: + type: uint16 + + - label: + "Writes the respective default value to optional attribute: + PIROccupiedToUnoccupiedDelay" + disabled: true + command: "writeAttribute" + attribute: "PIROccupiedToUnoccupiedDelay" + arguments: + value: 0 + + - label: "Reads back optional attribute: PIROccupiedToUnoccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PIROccupiedToUnoccupiedDelay" + response: + value: 0 + + - label: "Reads optional attribute: PIRUnoccupiedToOccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PIRUnoccupiedToOccupiedDelay" + response: + value: 0 + + - label: "Reads optional attribute constrains: PIRUnoccupiedToOccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PIRUnoccupiedToOccupiedDelay" + response: + constraints: + type: uint16 + + - label: + "Writes the respective default value to optional attribute: + PIRUnoccupiedToOccupiedDelay" + disabled: true + command: "writeAttribute" + attribute: "PIRUnoccupiedToOccupiedDelay" + arguments: + value: 0 + + - label: "Reads back optional attribute: PIRUnoccupiedToOccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PIRUnoccupiedToOccupiedDelay" + response: + value: 0 + + - label: "Reads optional attribute: PIRUnoccupiedToOccupiedThreshold" + disabled: true + command: "readAttribute" + attribute: "PIRUnoccupiedToOccupiedThreshold" + response: + value: 1 + + - label: + "Reads optional attribute constrains: PIRUnoccupiedToOccupiedThreshold" + disabled: true + command: "readAttribute" + attribute: "PIRUnoccupiedToOccupiedThreshold" + response: + constraints: + type: uint8 + minValue: 1 + maxValue: 254 + + - label: + "Writes the respective default value to optional attribute: + PIRUnoccupiedToOccupiedThreshold" + disabled: true + command: "writeAttribute" + attribute: "PIRUnoccupiedToOccupiedThreshold" + arguments: + value: 1 + + - label: "Reads back optional attribute: PIRUnoccupiedToOccupiedThreshold" + disabled: true + command: "readAttribute" + attribute: "PIRUnoccupiedToOccupiedThreshold" + response: + value: 1 + + - label: + "Reads optional attribute: PhysicalContactOccupiedToUnoccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactOccupiedToUnoccupiedDelay" + response: + value: 0 + + - label: + "Reads optional attribute constrains: + PhysicalContactOccupiedToUnoccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactOccupiedToUnoccupiedDelay" + response: + constraints: + type: uint16 + + - label: + "Writes the respective default value to optional attribute: + PhysicalContactOccupiedToUnoccupiedDelay" + disabled: true + command: "writeAttribute" + attribute: "PhysicalContactOccupiedToUnoccupiedDelay" + arguments: + value: 0 + + - label: + "Reads back optional attribute: + PhysicalContactOccupiedToUnoccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactOccupiedToUnoccupiedDelay" + response: + value: 0 + + - label: + "Reads optional attribute: PhysicalContactUnoccupiedToOccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedDelay" + response: + value: 0 + + - label: + "Reads optional attribute constrains: + PhysicalContactUnoccupiedToOccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedDelay" + response: + constraints: + type: uint16 + + - label: + "Writes the respective default value to optional attribute: + PhysicalContactUnoccupiedToOccupiedDelay" + disabled: true + command: "writeAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedDelay" + arguments: + value: 0 + + - label: + "Reads back optional attribute: + PhysicalContactUnoccupiedToOccupiedDelay" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedDelay" + response: + value: 0 + + - label: + "Reads optional attribute: + PhysicalContactUnoccupiedToOccupiedThreshold" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedThreshold" + response: + value: 1 + + - label: + "Reads optional attribute constrains: + PhysicalContactUnoccupiedToOccupiedThreshold" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedThreshold" + response: + constraints: + type: uint8 + minValue: 1 + maxValue: 254 + + - label: + "Writes the respective default value to optional attribute: + PhysicalContactUnoccupiedToOccupiedThreshold" + disabled: true + command: "writeAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedThreshold" + arguments: + value: 1 + + - label: + "Reads back optional attribute: + PhysicalContactUnoccupiedToOccupiedThreshold" + disabled: true + command: "readAttribute" + attribute: "PhysicalContactUnoccupiedToOccupiedThreshold" + response: + value: 1 diff --git a/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml b/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml index 5a86edb7c3af87..eb6e00abccf6a8 100644 --- a/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_OCC_2_2.yaml @@ -28,41 +28,23 @@ tests: - name: "nodeId" value: nodeId - #Issue #10816 Disabled as values needs to be stored for comparison - label: "Reads Occupancy attribute from DUT" - disabled: true command: "readAttribute" attribute: "occupancy" PICS: A_OCCUPANCY response: value: 0 - - - label: "Reads Occupancy attribute from DUT" - command: "readAttribute" - attribute: "occupancy" - PICS: A_OCCUPANCY - response: - constraints: - type: map8 + saveAs: OccupancyValue #Issue #10815 Disabled as UI prompts required for user action - label: "Operate on DUT to change the occupancy status" disabled: true PICS: MANUAL_OCCUPANCY_CHANGE - #Issue #10816 Disabled as values needs to be compared with the value read in step 2 - label: "Reads back Occupancy attribute from DUT after few seconds" - disabled: true - command: "readAttribute" - attribute: "occupancy" - PICS: A_OCCUPANCY - response: - value: 0 - - - label: "Reads Occupancy attribute from DUT" command: "readAttribute" attribute: "occupancy" PICS: A_OCCUPANCY response: constraints: - type: map8 + notvalue: OccupancyValue diff --git a/src/app/tests/suites/certification/Test_TC_PCC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PCC_1_1.yaml index 6c246db193b3f9..6bca9268c35e8c 100644 --- a/src/app/tests/suites/certification/Test_TC_PCC_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_PCC_1_1.yaml @@ -58,7 +58,7 @@ tests: command: "readAttribute" attribute: "ClusterRevision" response: - value: 1 + value: 3 - label: "Read the global attribute: AttributeList" command: "readAttribute" @@ -77,7 +77,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -85,7 +84,6 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: @@ -93,7 +91,6 @@ tests: type: list - label: "read the optional global attribute: FeatureMap" - disabled: true command: "readAttribute" attribute: "FeatureMap" response: @@ -107,7 +104,6 @@ tests: type: map32 - label: "write the default values to optional global attribute: FeatureMap" - disabled: true command: "writeAttribute" attribute: "FeatureMap" arguments: @@ -116,8 +112,9 @@ tests: error: UNSUPPORTED_WRITE - label: "reads back optional global attribute: FeatureMap" - disabled: true command: "readAttribute" attribute: "FeatureMap" response: value: 0 + constraints: + type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_PCC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_PCC_2_1.yaml index 850e789712fbec..05250e107b249a 100644 --- a/src/app/tests/suites/certification/Test_TC_PCC_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_PCC_2_1.yaml @@ -28,13 +28,6 @@ tests: - name: "nodeId" value: nodeId - - label: "read the mandatory attribute: MaxPressure" - disabled: true - command: "readAttribute" - attribute: "MaxPressure" - response: - value: null - - label: "read the mandatory attribute: MaxPressure" command: "readAttribute" attribute: "MaxPressure" @@ -42,13 +35,6 @@ tests: constraints: type: int16 - - label: "read the mandatory attribute: MaxSpeed" - disabled: true - command: "readAttribute" - attribute: "MaxSpeed" - response: - value: null - - label: "read the mandatory attribute: MaxSpeed" command: "readAttribute" attribute: "MaxSpeed" @@ -56,13 +42,6 @@ tests: constraints: type: uint16 - - label: "read the mandatory attribute: MaxFlow" - disabled: true - command: "readAttribute" - attribute: "MaxFlow" - response: - value: null - - label: "read the mandatory attribute: MaxFlow" command: "readAttribute" attribute: "MaxFlow" @@ -70,13 +49,6 @@ tests: constraints: type: uint16 - - label: "read the mandatory attribute: EffectiveOperationMode" - disabled: true - command: "readAttribute" - attribute: "EffectiveOperationMode" - response: - value: desc - - label: "read the mandatory attribute: EffectiveOperationMode" command: "readAttribute" attribute: "EffectiveOperationMode" @@ -84,13 +56,6 @@ tests: constraints: type: enum8 - - label: "read the mandatory attribute: EffectiveControlMode" - disabled: true - command: "readAttribute" - attribute: "EffectiveControlMode" - response: - value: desc - - label: "read the mandatory attribute: EffectiveControlMode" command: "readAttribute" attribute: "EffectiveControlMode" @@ -98,13 +63,6 @@ tests: constraints: type: enum8 - - label: "read the mandatory attribute: Capacity" - disabled: true - command: "readAttribute" - attribute: "Capacity" - response: - value: null - - label: "read the mandatory attribute: Capacity" command: "readAttribute" attribute: "Capacity" @@ -253,7 +211,6 @@ tests: #issue #11670 Null check is not implemented in YAML framework. - label: "read the optional attribute: MinConstPressure" disabled: true - optional: true command: "readAttribute" attribute: "MinConstPressure" response: @@ -269,7 +226,6 @@ tests: - label: "read the optional attribute: MaxConstPressure" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstPressure" response: @@ -285,7 +241,6 @@ tests: - label: "read the optional attribute: MinCompPressure" disabled: true - optional: true command: "readAttribute" attribute: "MinCompPressure" response: @@ -301,7 +256,6 @@ tests: - label: "read the optional attribute: MaxCompPressure" disabled: true - optional: true command: "readAttribute" attribute: "MaxCompPressure" response: @@ -317,7 +271,6 @@ tests: - label: "read the optional attribute: MinConstSpeed" disabled: true - optional: true command: "readAttribute" attribute: "MinConstSpeed" response: @@ -333,7 +286,6 @@ tests: - label: "read the optional attribute: MaxConstSpeed" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstSpeed" response: @@ -349,7 +301,6 @@ tests: - label: "read the optional attribute: MinConstFlow" disabled: true - optional: true command: "readAttribute" attribute: "MinConstFlow" response: @@ -365,7 +316,6 @@ tests: - label: "read the optional attribute: MaxConstFlow" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstFlow" response: @@ -381,7 +331,6 @@ tests: - label: "read the optional attribute: MinConstTemp" disabled: true - optional: true command: "readAttribute" attribute: "MinConstTemp" response: @@ -398,7 +347,6 @@ tests: - label: "read the optional attribute: MaxConstTemp" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstTemp" response: @@ -430,7 +378,6 @@ tests: - label: "read the optional attribute: Speed" disabled: true - optional: true command: "readAttribute" attribute: "Speed" response: @@ -461,7 +408,6 @@ tests: - label: "read the optional attribute: Power" disabled: true - optional: true command: "readAttribute" attribute: "Power" response: @@ -492,7 +438,6 @@ tests: - label: "write to the optional attribute: MinConstPressure" disabled: true - optional: true command: "writeAttribute" attribute: "MinConstPressure" arguments: @@ -502,7 +447,6 @@ tests: - label: "write to the optional attribute: MaxConstPressure" disabled: true - optional: true command: "writeAttribute" attribute: "MaxConstPressure" arguments: @@ -512,7 +456,6 @@ tests: - label: "write to the optional attribute: MinCompPressure" disabled: true - optional: true command: "writeAttribute" attribute: "MinCompPressure" arguments: @@ -522,7 +465,6 @@ tests: - label: "write to the optional attribute: MaxCompPressure" disabled: true - optional: true command: "writeAttribute" attribute: "MaxCompPressure" arguments: @@ -532,7 +474,6 @@ tests: - label: "write to the optional attribute: MinConstSpeed" disabled: true - optional: true command: "writeAttribute" attribute: "MinConstSpeed" arguments: @@ -542,7 +483,6 @@ tests: - label: "write to the optional attribute: MaxConstSpeed" disabled: true - optional: true command: "writeAttribute" attribute: "MaxConstSpeed" arguments: @@ -552,7 +492,6 @@ tests: - label: "write to the optional attribute: MinConstFlow" disabled: true - optional: true command: "writeAttribute" attribute: "MinConstFlow" arguments: @@ -562,7 +501,6 @@ tests: - label: "write to the optional attribute: MaxConstFlow" disabled: true - optional: true command: "writeAttribute" attribute: "MaxConstFlow" arguments: @@ -572,7 +510,6 @@ tests: - label: "write to the optional attribute: MinConstTemp" disabled: true - optional: true command: "writeAttribute" attribute: "MinConstTemp" arguments: @@ -582,7 +519,6 @@ tests: - label: "write to the optional attribute: MaxConstTemp" disabled: true - optional: true command: "writeAttribute" attribute: "MaxConstTemp" arguments: @@ -592,7 +528,6 @@ tests: - label: "write to the optional attribute: PumpStatus" disabled: true - optional: true command: "writeAttribute" attribute: "PumpStatus" arguments: @@ -602,7 +537,6 @@ tests: - label: "write to the optional attribute: Speed" disabled: true - optional: true command: "writeAttribute" attribute: "Speed" arguments: @@ -612,7 +546,6 @@ tests: - label: "write to the optional attribute: LifetimeRunningHours" disabled: true - optional: true command: "writeAttribute" attribute: "LifetimeRunningHours" arguments: @@ -620,7 +553,6 @@ tests: - label: "write to the optional attribute: Power" disabled: true - optional: true command: "writeAttribute" attribute: "Power" arguments: @@ -637,7 +569,6 @@ tests: - label: "read the optional attribute: MinConstPressure" disabled: true - optional: true command: "readAttribute" attribute: "MinConstPressure" response: @@ -653,7 +584,6 @@ tests: - label: "read the optional attribute: MaxConstPressure" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstPressure" response: @@ -669,7 +599,6 @@ tests: - label: "read the optional attribute: MinCompPressure" disabled: true - optional: true command: "readAttribute" attribute: "MinCompPressure" response: @@ -685,7 +614,6 @@ tests: - label: "read the optional attribute: MaxCompPressure" disabled: true - optional: true command: "readAttribute" attribute: "MaxCompPressure" response: @@ -701,7 +629,6 @@ tests: - label: "read the optional attribute: MinConstSpeed" disabled: true - optional: true command: "readAttribute" attribute: "MinConstSpeed" response: @@ -717,7 +644,6 @@ tests: - label: "read the optional attribute: MaxConstSpeed" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstSpeed" response: @@ -733,7 +659,6 @@ tests: - label: "read the optional attribute: MinConstFlow" disabled: true - optional: true command: "readAttribute" attribute: "MinConstFlow" response: @@ -749,7 +674,6 @@ tests: - label: "read the optional attribute: MaxConstFlow" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstFlow" response: @@ -765,7 +689,6 @@ tests: - label: "read the optional attribute: MinConstTemp" disabled: true - optional: true command: "readAttribute" attribute: "MinConstTemp" response: @@ -779,10 +702,10 @@ tests: constraints: type: int16 minValue: -27315 + maxValue: 32767 - label: "read the optional attribute: MaxConstTemp" disabled: true - optional: true command: "readAttribute" attribute: "MaxConstTemp" response: @@ -796,6 +719,7 @@ tests: constraints: type: int16 minValue: -27315 + maxValue: 32767 - label: "read the optional attribute: PumpStatus" optional: true @@ -814,7 +738,6 @@ tests: - label: "read the optional attribute: Speed" disabled: true - optional: true command: "readAttribute" attribute: "Speed" response: @@ -844,7 +767,6 @@ tests: - label: "read the optional attribute: Power" disabled: true - optional: true command: "readAttribute" attribute: "Power" response: diff --git a/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml b/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml index d260d9dbddcfe4..bcb6f0990f6b8e 100644 --- a/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_PS_1_1.yaml @@ -34,29 +34,6 @@ tests: response: value: 1 - - label: "Read the global attribute constraints: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - constraints: - type: uint16 - - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 1 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -74,7 +51,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -82,18 +58,8 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: constraints: type: list - - #disabled due to issue #13442 - - label: "Read the optional global attribute : FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml b/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml index 8fc39d682d643d..539203a2829f1b 100644 --- a/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_RH_1_1.yaml @@ -35,7 +35,7 @@ tests: command: "readAttribute" attribute: "ClusterRevision" response: - value: 1 + value: 3 - label: "Read the global attribute constraints: ClusterRevision" command: "readAttribute" @@ -44,23 +44,6 @@ tests: constraints: type: uint16 - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 1 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - disabled: true - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -78,7 +61,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -86,40 +68,8 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: constraints: type: list - - - label: "read the optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - - - label: "Read the optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: map32 - - - label: "write the default values to optional global attribute: FeatureMap" - disabled: true - command: "writeAttribute" - attribute: "FeatureMap" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml b/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml index 9c610309583d93..475f27782fb633 100644 --- a/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_RH_2_1.yaml @@ -28,60 +28,34 @@ tests: - name: "nodeId" value: nodeId - - label: "Reads the mandatory attribute: MeasuredValue" - disabled: true - command: "readAttribute" - attribute: "measured value" - response: - value: 65535 - - label: "Reads constraints of attribute: MeasuredValue" command: "readAttribute" attribute: "measured value" response: constraints: - type: uint16 - - - label: "Reads the mandatory attribute: MinMeasuredValue" - disabled: true - command: "readAttribute" - attribute: "min measured value" - response: - value: 65535 + type: int16 + minValue: 0 + maxValue: 10000 - label: "Reads constraints of attribute: MinMeasuredValue" command: "readAttribute" attribute: "min measured value" response: constraints: - type: uint16 + type: int16 minValue: 0 maxValue: 9999 - - label: "Reads the mandatory attribute: MaxMeasuredValue" - disabled: true - command: "readAttribute" - attribute: "max measured value" - response: - value: 65535 - - label: "Reads constraints of attribute: MaxMeasuredValue" disabled: true command: "readAttribute" attribute: "max measured value" response: constraints: - type: uint16 + type: int16 minValue: 1 maxValue: 10000 - - label: "Reads the optional attribute: Tolerance" - optional: true - command: "readAttribute" - attribute: "tolerance" - response: - value: 0 - - label: "Reads constraints of attribute: Tolerance" optional: true command: "readAttribute" diff --git a/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml b/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml index 977acd69776aa0..bae47dc7d5e16f 100644 --- a/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_RH_2_2.yaml @@ -28,14 +28,24 @@ tests: - name: "nodeId" value: nodeId - #Disabled as values needs to be stored for comparison - - label: "Reads MeasuredValue attribute from DUT" + - label: "Reads constraints of attribute: MinMeasuredValue" + command: "readAttribute" + attribute: "min measured value" + response: + constraints: + type: int16 + minValue: 0 + maxValue: 9999 + + - label: "Reads constraints of attribute: MaxMeasuredValue" disabled: true command: "readAttribute" - attribute: "measured value" - PICS: A_RELATIVEHUMIDITY + attribute: "max measured value" response: - value: 0 + constraints: + type: int16 + minValue: 1 + maxValue: 10000 - label: "Reads MeasuredValue attribute from DUT" command: "readAttribute" @@ -43,22 +53,15 @@ tests: PICS: A_RELATIVEHUMIDITY response: constraints: - type: uint16 + type: int16 + minValue: 0 + maxValue: 10000 #Disabled as UI prompts required for user action - label: "Operate on device to change the relative humidity significantly" disabled: true PICS: MANUAL_RELATIVEHUMIDITY_CHANGE - #Disabled as values needs to be compared with the value read in step 2 - - label: "Reads back MeasuredValue attribute from DUT after few seconds" - disabled: true - command: "readAttribute" - attribute: "measured value" - PICS: A_RELATIVEHUMIDITY - response: - value: 0 - - label: "Read the mandatory attribute: MeasuredValue" command: "readAttribute" attribute: "measured value" diff --git a/src/app/tests/suites/certification/Test_TC_TM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TM_1_1.yaml index 49c54803abc0d9..cacf105243a499 100644 --- a/src/app/tests/suites/certification/Test_TC_TM_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TM_1_1.yaml @@ -43,23 +43,6 @@ tests: constraints: type: uint16 - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 4 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - disabled: true - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 4 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -91,11 +74,3 @@ tests: response: constraints: type: list - - - label: "Read the optional global attribute : FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: map32 diff --git a/src/app/tests/suites/certification/Test_TC_TM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TM_2_1.yaml index 77dad07826ef45..0505319f0e37ff 100644 --- a/src/app/tests/suites/certification/Test_TC_TM_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TM_2_1.yaml @@ -36,7 +36,6 @@ tests: type: int16 - label: "read the mandatory attribute: MinMeasuredValue" - disabled: true command: "readAttribute" attribute: "MinMeasuredValue" response: @@ -46,7 +45,6 @@ tests: maxValue: 32766 - label: "read the mandatory attribute: MaxMeasuredValue" - disabled: true command: "readAttribute" attribute: "MaxMeasuredValue" response: diff --git a/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml b/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml index 56f45e811f1c8e..d19221203d01cc 100644 --- a/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_TM_2_2.yaml @@ -28,14 +28,23 @@ tests: - name: "nodeId" value: nodeId - #Disabled as values needs to be stored for comparison - - label: "Reads MeasuredValue attribute from DUT" - disabled: true + - label: "read the mandatory attribute: MinMeasuredValue" command: "readAttribute" - attribute: "MeasuredValue" - PICS: A_TEMPERATURE + attribute: "MinMeasuredValue" response: - value: 0 + constraints: + type: int16 + minValue: -27315 + maxValue: 32766 + + - label: "read the mandatory attribute: MaxMeasuredValue" + command: "readAttribute" + attribute: "MaxMeasuredValue" + response: + constraints: + type: int16 + minValue: -27314 + maxValue: 32767 - label: "Reads MeasuredValue attribute from DUT" command: "readAttribute" @@ -50,15 +59,6 @@ tests: disabled: true PICS: MANUAL_TEMPERATURE_CHANGE - #Disabled as values needs to be compared with the value read in step 2 - - label: "Reads back MeasuredValue attribute from DUT after few seconds" - disabled: true - command: "readAttribute" - attribute: "MeasuredValue" - PICS: A_TEMPERATURE - response: - value: 0 - - label: "Read the mandatory attribute: MeasuredValue" command: "readAttribute" attribute: "MeasuredValue" diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml index 38e3d38f21dfc5..40e88cd7e71e33 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_1_1.yaml @@ -43,23 +43,6 @@ tests: constraints: type: uint16 - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 5 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - disabled: true - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -92,33 +75,9 @@ tests: constraints: type: list - #issue #12089 Value mismatch for FeatureMap attribute expecting 11 - - label: "read the optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - - label: "Read the optional global attribute constraints: FeatureMap" command: "readAttribute" attribute: "FeatureMap" response: constraints: type: map32 - - - label: "write the default values to optional global attribute: FeatureMap" - disabled: true - command: "writeAttribute" - attribute: "FeatureMap" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml index 6b6dee6c8cc57a..206b584cda5ad5 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml @@ -28,13 +28,7 @@ tests: - name: "nodeId" value: nodeId - #issue #11524 disabled steps are for attributes not supported in YAML framework - - label: "Reads mandatory attributes from DUT: LocalTemperature" - disabled: true - command: "readAttribute" - attribute: "local temperature" - response: - value: null + #issue #11524 below disabled steps are for attributes not supported in YAML framework - label: "Reads constraints of mandatory attributes from DUT: LocalTemperature" @@ -44,30 +38,6 @@ tests: constraints: type: int16 - - label: - "Writes the respective default value to mandatory attributes to DUT: - LocalTemperature" - disabled: true - command: "writeAttribute" - attribute: "local temperature" - arguments: - value: null - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: LocalTemperature" - disabled: true - command: "readAttribute" - attribute: "local temperature" - response: - value: null - - - label: "Reads mandatory attributes from DUT: AbsMinHeatSetpointLimit" - command: "readAttribute" - attribute: "abs min heat setpoint limit" - response: - value: 700 - - label: "Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit" @@ -79,28 +49,6 @@ tests: minValue: 700 maxValue: 3000 - - label: - "Writes the respective default value to mandatory attributes to DUT: - AbsMinHeatSetpointLimit" - command: "writeAttribute" - attribute: "abs min heat setpoint limit" - arguments: - value: 700 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: AbsMinHeatSetpointLimit" - command: "readAttribute" - attribute: "abs min heat setpoint limit" - response: - value: 700 - - - label: "Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit" - command: "readAttribute" - attribute: "abs max heat setpoint limit" - response: - value: 3000 - - label: "Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit" @@ -113,30 +61,9 @@ tests: maxValue: 3000 - label: - "Writes the respective default value to mandatory attributes to DUT: - AbsMaxHeatSetpointLimit" - command: "writeAttribute" - attribute: "abs max heat setpoint limit" - arguments: - value: 3000 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: AbsMaxHeatSetpointLimit" - command: "readAttribute" - attribute: "abs max heat setpoint limit" - response: - value: 3000 - - - label: "Reads mandatory attributes from DUT: AbsMinCoolSetpointLimit" - command: "readAttribute" - attribute: "abs min cool setpoint limit" - response: - value: 1600 - - - label: - "Reads constraints of mandatory attributes from DUT: + "Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit" + optional: true command: "readAttribute" attribute: "abs min cool setpoint limit" response: @@ -146,30 +73,9 @@ tests: maxValue: 3200 - label: - "Writes the respective default value to mandatory attributes to DUT: - AbsMinCoolSetpointLimit" - command: "writeAttribute" - attribute: "abs min cool setpoint limit" - arguments: - value: 1600 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: AbsMinCoolSetpointLimit" - command: "readAttribute" - attribute: "abs min cool setpoint limit" - response: - value: 1600 - - - label: "Reads mandatory attributes from DUT: AbsMaxCoolSetpointLimit" - command: "readAttribute" - attribute: "abs max cool setpoint limit" - response: - value: 3200 - - - label: - "Reads constraints of mandatory attributes from DUT: + "Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit" + optional: true command: "readAttribute" attribute: "abs max cool setpoint limit" response: @@ -178,22 +84,6 @@ tests: minValue: 1600 maxValue: 3200 - - label: - "Writes the respective default value to mandatory attributes to DUT: - AbsMaxCoolSetpointLimit" - command: "writeAttribute" - attribute: "abs max cool setpoint limit" - arguments: - value: 3200 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: AbsMaxCoolSetpointLimit" - command: "readAttribute" - attribute: "abs max cool setpoint limit" - response: - value: 3200 - - label: "Reads constraints of mandatory attributes from DUT: PICoolingDemand" disabled: true @@ -205,24 +95,6 @@ tests: minValue: 0 maxValue: 100 - - label: - "Writes the respective default value to mandatory attributes to DUT: - PICoolingDemand" - disabled: true - command: "writeAttribute" - attribute: "PICoolingDemand" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: PICoolingDemand" - disabled: true - command: "readAttribute" - attribute: "PICoolingDemand" - response: - value: 0 - - label: "Reads constraints of mandatory attributes from DUT: PIHeatingDemand" disabled: true @@ -235,32 +107,9 @@ tests: maxValue: 100 - label: - "Writes the respective default value to mandatory attributes to DUT: - PIHeatingDemand" - disabled: true - command: "writeAttribute" - attribute: "PIHeatingDemand" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back mandatory attributes from DUT: PIHeatingDemand" - disabled: true - command: "readAttribute" - attribute: "PIHeatingDemand" - response: - value: 0 - - - label: "Reads mandatory attributes from DUT: OccupiedCoolingSetpoint" - command: "readAttribute" - attribute: "occupied cooling setpoint" - response: - value: 2600 - - - label: - "Reads constraints of mandatory attributes from DUT: + "Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint" + optional: true command: "readAttribute" attribute: "occupied cooling setpoint" response: @@ -269,26 +118,6 @@ tests: minValue: 1600 maxValue: 2600 - - label: - "Writes the respective default value to mandatory attributes to DUT: - OccupiedCoolingSetpoint" - command: "writeAttribute" - attribute: "occupied cooling setpoint" - arguments: - value: 2600 - - - label: "Read back mandatory attributes from DUT: OccupiedCoolingSetpoint" - command: "readAttribute" - attribute: "occupied cooling setpoint" - response: - value: 2600 - - - label: "Reads mandatory attributes from DUT: OccupiedHeatingSetpoint" - command: "readAttribute" - attribute: "occupied heating setpoint" - response: - value: 2000 - - label: "Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint" @@ -300,27 +129,6 @@ tests: minValue: 700 maxValue: 2600 - - label: - "Writes the respective default value to mandatory attributes to DUT: - OccupiedHeatingSetpoint" - command: "writeAttribute" - attribute: "occupied heating setpoint" - arguments: - value: 2000 - - - label: "Read back mandatory attributes from DUT: OccupiedHeatingSetpoint" - command: "readAttribute" - attribute: "occupied heating setpoint" - response: - value: 2000 - - - label: "Reads mandatory attributes from DUT: UnoccupiedCoolingSetpoint" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedCoolingSetpoint" - response: - value: 2600 - - label: "Reads constraints of mandatory attributes from DUT: UnoccupiedCoolingSetpoint" @@ -333,30 +141,6 @@ tests: minValue: 1600 maxValue: 2600 - - label: - "Writes the respective default value to mandatory attributes to DUT: - UnoccupiedCoolingSetpoint" - disabled: true - command: "writeAttribute" - attribute: "UnoccupiedCoolingSetpoint" - arguments: - value: 2600 - - - label: - "Read back mandatory attributes from DUT: UnoccupiedCoolingSetpoint" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedCoolingSetpoint" - response: - value: 2600 - - - label: "Reads mandatory attributes from DUT: UnoccupiedHeatingSetpoint" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedHeatingSetpoint" - response: - value: 2000 - - label: "Reads constraints of mandatory attributes from DUT: UnoccupiedHeatingSetpoint" @@ -369,29 +153,6 @@ tests: minValue: 700 maxValue: 2000 - - label: - "Writes the respective default value to mandatory attributes to DUT: - UnoccupiedHeatingSetpoint" - disabled: true - command: "writeAttribute" - attribute: "UnoccupiedHeatingSetpoint" - arguments: - value: 2000 - - - label: - "Read back mandatory attributes from DUT: UnoccupiedHeatingSetpoint" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedHeatingSetpoint" - response: - value: 2000 - - - label: "Reads mandatory attributes from DUT: MinHeatSetpointLimit" - command: "readAttribute" - attribute: "min heat setpoint limit" - response: - value: 700 - - label: "Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit" @@ -403,26 +164,6 @@ tests: minValue: 700 maxValue: 3000 - - label: - "Writes the respective default value to mandatory attributes to DUT: - MinHeatSetpointLimit" - command: "writeAttribute" - attribute: "min heat setpoint limit" - arguments: - value: 700 - - - label: "Read back mandatory attributes from DUT: MinHeatSetpointLimit" - command: "readAttribute" - attribute: "min heat setpoint limit" - response: - value: 700 - - - label: "Reads mandatory attributes from DUT: MaxHeatSetpointLimit" - command: "readAttribute" - attribute: "max heat setpoint limit" - response: - value: 3000 - - label: "Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit" @@ -435,28 +176,9 @@ tests: maxValue: 3000 - label: - "Writes the respective default value to mandatory attributes to DUT: - MaxHeatSetpointLimit" - command: "writeAttribute" - attribute: "max heat setpoint limit" - arguments: - value: 3000 - - - label: "Read back mandatory attributes from DUT: MaxHeatSetpointLimit" - command: "readAttribute" - attribute: "max heat setpoint limit" - response: - value: 3000 - - - label: "Reads mandatory attributes from DUT: MinCoolSetpointLimit" - command: "readAttribute" - attribute: "min cool setpoint limit" - response: - value: 1600 - - - label: - "Reads constraints of mandatory attributes from DUT: + "Reads constraints of optional attributes from DUT: MinCoolSetpointLimit" + optional: true command: "readAttribute" attribute: "min cool setpoint limit" response: @@ -466,28 +188,9 @@ tests: maxValue: 3200 - label: - "Writes the respective default value to mandatory attributes to DUT: - MinCoolSetpointLimit" - command: "writeAttribute" - attribute: "min cool setpoint limit" - arguments: - value: 1600 - - - label: "Read back mandatory attributes from DUT: MinCoolSetpointLimit" - command: "readAttribute" - attribute: "min cool setpoint limit" - response: - value: 1600 - - - label: "Reads mandatory attributes from DUT: MaxCoolSetpointLimit" - command: "readAttribute" - attribute: "max cool setpoint limit" - response: - value: 3200 - - - label: - "Reads constraints of mandatory attributes from DUT: + "Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit" + optional: true command: "readAttribute" attribute: "max cool setpoint limit" response: @@ -496,26 +199,6 @@ tests: minValue: 1600 maxValue: 3200 - - label: - "Writes the respective default value to mandatory attributes to DUT: - MaxCoolSetpointLimit" - command: "writeAttribute" - attribute: "max cool setpoint limit" - arguments: - value: 3200 - - - label: "Read back mandatory attributes from DUT: MaxCoolSetpointLimit" - command: "readAttribute" - attribute: "max cool setpoint limit" - response: - value: 3200 - - - label: "Reads mandatory attributes from DUT: ControlSequenceOfOperation" - command: "readAttribute" - attribute: "control sequence of operation" - response: - value: 4 - - label: "Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation" @@ -527,27 +210,6 @@ tests: minValue: 0 maxValue: 5 - - label: - "Writes the respective default value to mandatory attributes to DUT: - ControlSequenceOfOperation" - command: "writeAttribute" - attribute: "control sequence of operation" - arguments: - value: 4 - - - label: - "Read back mandatory attributes from DUT: ControlSequenceOfOperation" - command: "readAttribute" - attribute: "control sequence of operation" - response: - value: 4 - - - label: "Reads mandatory attributes from DUT: SystemMode" - command: "readAttribute" - attribute: "system mode" - response: - value: 1 - - label: "Reads constraints of mandatory attributes from DUT: SystemMode" command: "readAttribute" attribute: "system mode" @@ -557,27 +219,6 @@ tests: minValue: 0 maxValue: 9 - - label: - "Writes the respective default value to mandatory attributes to DUT: - SystemMode" - command: "writeAttribute" - attribute: "system mode" - arguments: - value: 1 - - - label: "Read back mandatory attributes from DUT: SystemMode" - command: "readAttribute" - attribute: "system mode" - response: - value: 1 - - - label: "Reads optional attributes from DUT: OutdoorTemperature" - disabled: true - command: "readAttribute" - attribute: "OutdoorTemperature" - response: - value: null - - label: "Reads constraints of optional attributes from DUT: OutdoorTemperature" disabled: true @@ -587,29 +228,6 @@ tests: constraints: type: int16 - - label: - "Writes the respective default value to optional attributes to DUT: - OutdoorTemperature" - disabled: true - command: "writeAttribute" - attribute: "OutdoorTemperature" - arguments: - value: null - - - label: "Read back optional attributes from DUT: OutdoorTemperature" - disabled: true - command: "readAttribute" - attribute: "OutdoorTemperature" - response: - value: null - - - label: "Reads optional attributes from DUT: Occupancy" - disabled: true - command: "readAttribute" - attribute: "Occupancy" - response: - value: 1 - - label: "Reads constraints of optional attributes from DUT: Occupancy" disabled: true command: "readAttribute" @@ -620,29 +238,6 @@ tests: minValue: 0 maxValue: 1 - - label: - "Writes the respective default value to optional attributes to DUT: - Occupancy" - disabled: true - command: "writeAttribute" - attribute: "Occupancy" - arguments: - value: 1 - - - label: "Read back optional attributes from DUT: Occupancy" - disabled: true - command: "readAttribute" - attribute: "Occupancy" - response: - value: 1 - - - label: "Reads optionl attributes from DUT: HVACSystemTypeConfiguration" - disabled: true - command: "readAttribute" - attribute: "HVACSystemTypeConfiguration" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: HVACSystemTypeConfiguration" @@ -653,31 +248,7 @@ tests: constraints: type: map8 minValue: 0 - maxValue: 5 - - - label: - "Writes the respective default value to optional attributes to DUT: - HVACSystemTypeConfiguration" - disabled: true - command: "writeAttribute" - attribute: "HVACSystemTypeConfiguration" - arguments: - value: 0 - - - label: - "Read back optional attributes from DUT: HVACSystemTypeConfiguration" - disabled: true - command: "readAttribute" - attribute: "HVACSystemTypeConfiguration" - response: - value: 0 - - - label: "Reads optional attributes from DUT: LocalTemperatureCalibration" - disabled: true - command: "readAttribute" - attribute: "LocalTemperatureCalibration" - response: - value: 0 + maxValue: 63 - label: "Reads constraints of optional attributes from DUT: @@ -691,30 +262,6 @@ tests: minValue: -25 maxValue: 25 - - label: - "Writes the respective default value to optional attributes to DUT: - LocalTemperatureCalibration" - disabled: true - command: "writeAttribute" - attribute: "LocalTemperatureCalibration" - arguments: - value: 0 - - - label: - "Read back optional attributes from DUT: LocalTemperatureCalibration" - disabled: true - command: "readAttribute" - attribute: "LocalTemperatureCalibration" - response: - value: 0 - - - label: "Reads optional attributes from DUT: MinSetpointDeadBand" - optional: true - command: "readAttribute" - attribute: "min setpoint dead band" - response: - value: 25 - - label: "Reads constraints of optional attributes from DUT: MinSetpointDeadBand" @@ -727,29 +274,6 @@ tests: minValue: 0 maxValue: 25 - - label: - "Writes the respective default value to optional attributes to DUT: - MinSetpointDeadBand" - optional: true - command: "writeAttribute" - attribute: "min setpoint dead band" - arguments: - value: 25 - - - label: "Read back optional attributes from DUT: MinSetpointDeadBand" - optional: true - command: "readAttribute" - attribute: "min setpoint dead band" - response: - value: 25 - - - label: "Reads optional attributes from DUT: RemoteSensing" - disabled: true - command: "readAttribute" - attribute: "RemoteSensing" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: RemoteSensing" disabled: true command: "readAttribute" @@ -757,29 +281,8 @@ tests: response: constraints: type: map8 - - - label: - "Writes the respective default value to optional attributes to DUT: - RemoteSensing" - disabled: true - command: "writeAttribute" - attribute: "RemoteSensing" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: RemoteSensing" - disabled: true - command: "readAttribute" - attribute: "RemoteSensing" - response: - value: 0 - - - label: "Reads optional attributes from DUT: AlarmMask" - disabled: true - command: "readAttribute" - attribute: "AlarmMask" - response: - value: 0 + minValue: 0 + maxValue: 7 - label: "Reads constraints of optional attributes from DUT: AlarmMask" disabled: true @@ -791,31 +294,6 @@ tests: minValue: 0 maxValue: 2 - - label: - "Writes the respective default value to optional attributes to DUT: - AlarmMask" - disabled: true - command: "writeAttribute" - attribute: "AlarmMask" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: AlarmMask" - disabled: true - command: "readAttribute" - attribute: "AlarmMask" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ThermostatRunningMode" - disabled: true - command: "readAttribute" - attribute: "ThermostatRunningMode" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ThermostatRunningMode" @@ -828,24 +306,6 @@ tests: minValue: 0 maxValue: 9 - - label: - "Writes the respective default value to optional attributes to DUT: - ThermostatRunningMode" - disabled: true - command: "writeAttribute" - attribute: "ThermostatRunningMode" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: ThermostatRunningMode" - disabled: true - command: "readAttribute" - attribute: "ThermostatRunningMode" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: StartOfWeek" optional: true command: "readAttribute" @@ -856,32 +316,6 @@ tests: minValue: 0 maxValue: 6 - - label: - "Writes the respective default value to optional attributes to DUT: - StartOfWeek" - optional: true - command: "writeAttribute" - attribute: "start of week" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: StartOfWeek" - optional: true - command: "readAttribute" - attribute: "start of week" - response: - value: 0 - - #issue #11625 default value is 0 as per spec but expecting 7 - - label: "Reads optional attributes from DUT: NumberOfWeeklyTransitions" - disabled: true - command: "readAttribute" - attribute: "number of weekly transitions" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions" @@ -892,32 +326,6 @@ tests: constraints: type: uint8 - - label: - "Writes the respective default value to optional attributes to DUT: - NumberOfWeeklyTransitions" - optional: true - command: "writeAttribute" - attribute: "number of weekly transitions" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: NumberOfWeeklyTransitions" - disabled: true - command: "readAttribute" - attribute: "number of weekly transitions" - response: - value: 0 - - #issue #11625 default value is 0 as per spec but expecting 4 - - label: "Reads optional attributes from DUT: NumberOfDailyTransitions" - disabled: true - command: "readAttribute" - attribute: "number of daily transitions" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: NumberOfDailyTransitions" @@ -928,31 +336,6 @@ tests: constraints: type: uint8 - - label: - "Writes the respective default value to optional attributes to DUT: - NumberOfDailyTransitions" - optional: true - command: "writeAttribute" - attribute: "number of daily transitions" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: NumberOfDailyTransitions" - disabled: true - command: "readAttribute" - attribute: "number of daily transitions" - response: - value: 0 - - - label: "Reads optional attributes from DUT: TemperatureSetpointHold" - disabled: true - command: "readAttribute" - attribute: "TemperatureSetpointHold" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: TemperatureSetpointHold" @@ -965,30 +348,6 @@ tests: minValue: 0 maxValue: 1 - - label: - "Writes the respective default value to optional attributes to DUT: - TemperatureSetpointHold" - disabled: true - command: "writeAttribute" - attribute: "TemperatureSetpointHold" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: TemperatureSetpointHold" - disabled: true - command: "readAttribute" - attribute: "TemperatureSetpointHold" - response: - value: 0 - - - label: - "Reads optional attributes from DUT: TemperatureSetpointHoldDuration" - disabled: true - command: "readAttribute" - attribute: "TemperatureSetpointHoldDuration" - response: - value: null - - label: "Reads constraints of optional attributes from DUT: TemperatureSetpointHoldDuration" @@ -1001,33 +360,6 @@ tests: minValue: 0 maxValue: 1440 - - label: - "Writes the respective default value to optional attributes to DUT: - TemperatureSetpointHoldDuration" - disabled: true - command: "writeAttribute" - attribute: "TemperatureSetpointHoldDuration" - arguments: - value: null - - - label: - "Read back optional attributes from DUT: - TemperatureSetpointHoldDuration" - disabled: true - command: "readAttribute" - attribute: "TemperatureSetpointHoldDuration" - response: - value: null - - - label: - "Reads optional attributes from DUT: - ThermostatProgrammingOperationMode" - disabled: true - command: "readAttribute" - attribute: "ThermostatProgrammingOperationMode" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ThermostatProgrammingOperationMode" @@ -1040,24 +372,6 @@ tests: minValue: 0 maxValue: 2 - - label: - "Writes the respective default value to optional attributes to DUT: - ThermostatProgrammingOperationMode" - disabled: true - command: "writeAttribute" - attribute: "ThermostatProgrammingOperationMode" - arguments: - value: 0 - - - label: - "Read back optional attributes from DUT: - ThermostatProgrammingOperationMode" - disabled: true - command: "readAttribute" - attribute: "ThermostatProgrammingOperationMode" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ThermostatRunningState" @@ -1068,182 +382,45 @@ tests: constraints: type: map16 minValue: 0 - maxValue: 6 - - - label: - "Writes the respective default value to optional attributes to DUT: - ThermostatRunningState" - disabled: true - command: "writeAttribute" - attribute: "ThermostatRunningState" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: ThermostatRunningState" - disabled: true - command: "readAttribute" - attribute: "ThermostatRunningState" - response: - value: 0 - - - label: "Reads optional attributes from DUT: SetpointChangeSource" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeSource" - response: - value: 0 - - - label: - "Reads constraints of optional attributes from DUT: - SetpointChangeSource" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeSource" - response: - constraints: - type: enum8 - minValue: 0 - maxValue: 2 - - - label: - "Writes the respective default value to optional attributes to DUT: - SetpointChangeSource" - disabled: true - command: "writeAttribute" - attribute: "SetpointChangeSource" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: SetpointChangeSource" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeSource" - response: - value: 0 - - - label: "Reads optional attributes from DUT: SetpointChangeAmount" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeAmount" - response: - value: null - - - label: - "Reads constraints of optional attributes from DUT: - SetpointChangeAmount" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeAmount" - response: - constraints: - type: int16 - - - label: - "Writes the respective default value to optional attributes to DUT: - SetpointChangeAmount" - disabled: true - command: "writeAttribute" - attribute: "SetpointChangeAmount" - arguments: - value: null - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: SetpointChangeAmount" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeAmount" - response: - value: null - - - label: "Reads optional attributes from DUT: SetpointChangeSourceTimestamp" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeSourceTimestamp" - response: - value: 0 - - - label: - "Reads constraints of optional attributes from DUT: - SetpointChangeSourceTimestamp" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeSourceTimestamp" - response: - constraints: - type: utc - - - label: - "Writes the respective default value to optional attributes to DUT: - SetpointChangeSourceTimestamp" - disabled: true - command: "writeAttribute" - attribute: "SetpointChangeSourceTimestamp" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: - "Read back optional attributes from DUT: SetpointChangeSourceTimestamp" - disabled: true - command: "readAttribute" - attribute: "SetpointChangeSourceTimestamp" - response: - value: 0 - - - label: "Reads optional attributes from DUT: OccupiedSetback" - disabled: true - command: "readAttribute" - attribute: "OccupiedSetback" - response: - value: null + maxValue: 6 - label: - "Reads constraints of optional attributes from DUT: OccupiedSetback" + "Reads constraints of optional attributes from DUT: + SetpointChangeSource" disabled: true command: "readAttribute" - attribute: "OccupiedSetback" + attribute: "SetpointChangeSource" response: constraints: - type: uint8 + type: enum8 minValue: 0 - maxValue: 254 + maxValue: 2 - label: - "Writes the respective default value to optional attributes to DUT: - OccupiedSetback" - disabled: true - command: "writeAttribute" - attribute: "OccupiedSetback" - arguments: - value: null - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: OccupiedSetback" + "Reads constraints of optional attributes from DUT: + SetpointChangeAmount" disabled: true command: "readAttribute" - attribute: "OccupiedSetback" + attribute: "SetpointChangeAmount" response: - value: null + constraints: + type: int16 - - label: "Reads optional attributes from DUT: OccupiedSetbackMin" + - label: + "Reads constraints of optional attributes from DUT: + SetpointChangeSourceTimestamp" disabled: true command: "readAttribute" - attribute: "OccupiedSetbackMin" + attribute: "SetpointChangeSourceTimestamp" response: - value: null + constraints: + type: utc - label: - "Reads constraints of optional attributes from DUT: OccupiedSetbackMin" + "Reads constraints of optional attributes from DUT: OccupiedSetback" disabled: true command: "readAttribute" - attribute: "OccupiedSetbackMin" + attribute: "OccupiedSetback" response: constraints: type: uint8 @@ -1251,27 +428,15 @@ tests: maxValue: 254 - label: - "Writes the respective default value to optional attributes to DUT: - OccupiedSetbackMin" - disabled: true - command: "writeAttribute" - attribute: "OccupiedSetbackMin" - arguments: - value: null - - - label: "Read back optional attributes from DUT: OccupiedSetbackMin" + "Reads constraints of optional attributes from DUT: OccupiedSetbackMin" disabled: true command: "readAttribute" attribute: "OccupiedSetbackMin" response: - value: null - - - label: "Reads optional attributes from DUT: OccupiedSetbackMax" - disabled: true - command: "readAttribute" - attribute: "OccupiedSetbackMax" - response: - value: null + constraints: + type: uint8 + minValue: 0 + maxValue: 254 - label: "Reads constraints of optional attributes from DUT: OccupiedSetbackMax" @@ -1284,29 +449,6 @@ tests: minValue: 0 maxValue: 254 - - label: - "Writes the respective default value to optional attributes to DUT: - OccupiedSetbackMax" - disabled: true - command: "writeAttribute" - attribute: "OccupiedSetbackMax" - arguments: - value: null - - - label: "Read back optional attributes from DUT: OccupiedSetbackMax" - disabled: true - command: "readAttribute" - attribute: "OccupiedSetbackMax" - response: - value: null - - - label: "Reads optional attributes from DUT: UnoccupiedSetback" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedSetback" - response: - value: null - - label: "Reads constraints of optional attributes from DUT: UnoccupiedSetback" disabled: true @@ -1318,31 +460,6 @@ tests: minValue: 0 maxValue: 254 - - label: - "Writes the respective default value to optional attributes to DUT: - UnoccupiedSetback" - disabled: true - command: "writeAttribute" - attribute: "UnoccupiedSetback" - arguments: - value: null - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: UnoccupiedSetback" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedSetback" - response: - value: null - - - label: "Reads optional attributes from DUT: UnoccupiedSetbackMin" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedSetbackMin" - response: - value: null - - label: "Reads constraints of optional attributes from DUT: UnoccupiedSetbackMin" @@ -1355,29 +472,6 @@ tests: minValue: 0 maxValue: 254 - - label: - "Writes the respective default value to optional attributes to DUT: - UnoccupiedSetbackMin" - disabled: true - command: "writeAttribute" - attribute: "UnoccupiedSetbackMin" - arguments: - value: null - - - label: "Read back optional attributes from DUT: UnoccupiedSetbackMin" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedSetbackMin" - response: - value: null - - - label: "Reads optional attributes from DUT: UnoccupiedSetbackMax" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedSetbackMax" - response: - value: null - - label: "Reads constraints of optional attributes from DUT: UnoccupiedSetbackMax" @@ -1390,29 +484,6 @@ tests: minValue: 0 maxValue: 254 - - label: - "Writes the respective default value to optional attributes to DUT: - UnoccupiedSetbackMax" - disabled: true - command: "writeAttribute" - attribute: "UnoccupiedSetbackMax" - arguments: - value: null - - - label: "Read back optional attributes from DUT: UnoccupiedSetbackMax" - disabled: true - command: "readAttribute" - attribute: "UnoccupiedSetbackMax" - response: - value: null - - - label: "Reads optional attributes from DUT: EmergencyHeatDelta" - disabled: true - command: "readAttribute" - attribute: "EmergencyHeatDelta" - response: - value: 255OccupiedSetbackMin - - label: "Reads constraints of optional attributes from DUT: EmergencyHeatDelta" disabled: true @@ -1422,29 +493,6 @@ tests: constraints: type: uint8 - - label: - "Writes the respective default value to optional attributes to DUT: - EmergencyHeatDelta" - disabled: true - command: "writeAttribute" - attribute: "EmergencyHeatDelta" - arguments: - value: 255 - - - label: "Read back optional attributes from DUT: EmergencyHeatDelta" - disabled: true - command: "readAttribute" - attribute: "EmergencyHeatDelta" - response: - value: 255 - - - label: "Reads optional attributes from DUT: ACType" - disabled: true - command: "readAttribute" - attribute: "ACType" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ACType" disabled: true command: "readAttribute" @@ -1455,29 +503,6 @@ tests: minValue: 0 maxValue: 4 - - label: - "Writes the respective default value to optional attributes to DUT: - ACType" - disabled: true - command: "writeAttribute" - attribute: "ACType" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACType" - disabled: true - command: "readAttribute" - attribute: "ACType" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ACCapacity" - disabled: true - command: "readAttribute" - attribute: "ACCapacity" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ACCapacity" disabled: true command: "readAttribute" @@ -1486,29 +511,6 @@ tests: constraints: type: uint16 - - label: - "Writes the respective default value to optional attributes to DUT: - ACCapacity" - disabled: true - command: "writeAttribute" - attribute: "ACCapacity" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACCapacity" - disabled: true - command: "readAttribute" - attribute: "ACCapacity" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ACRefrigerantType" - disabled: true - command: "readAttribute" - attribute: "ACRefrigerantType" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ACRefrigerantType" disabled: true @@ -1520,29 +522,6 @@ tests: minValue: 0 maxValue: 3 - - label: - "Writes the respective default value to optional attributes to DUT: - ACRefrigerantType" - disabled: true - command: "writeAttribute" - attribute: "ACRefrigerantType" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACRefrigerantType" - disabled: true - command: "readAttribute" - attribute: "ACRefrigerantType" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ACCompressorType" - disabled: true - command: "readAttribute" - attribute: "ACCompressorType" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ACCompressorType" disabled: true @@ -1554,29 +533,6 @@ tests: minValue: 0 maxValue: 3 - - label: - "Writes the respective default value to optional attributes to DUT: - ACCompressorType" - disabled: true - command: "writeAttribute" - attribute: "ACCompressorType" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACCompressorType" - disabled: true - command: "readAttribute" - attribute: "ACCompressorType" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ACErrorCode" - disabled: true - command: "readAttribute" - attribute: "ACErrorCode" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ACErrorCode" disabled: true command: "readAttribute" @@ -1585,29 +541,6 @@ tests: constraints: type: map32 - - label: - "Writes the respective default value to optional attributes to DUT: - ACErrorCode" - disabled: true - command: "writeAttribute" - attribute: "ACErrorCode" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACErrorCode" - disabled: true - command: "readAttribute" - attribute: "ACErrorCode" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ACLouverPosition" - disabled: true - command: "readAttribute" - attribute: "ACLouverPosition" - response: - value: 0 - - label: "Reads constraints of optional attributes from DUT: ACLouverPosition" disabled: true @@ -1616,32 +549,9 @@ tests: response: constraints: type: enum8 - minValue: 0 + minValue: 1 maxValue: 5 - - label: - "Writes the respective default value to optional attributes to DUT: - ACLouverPosition" - disabled: true - command: "writeAttribute" - attribute: "ACLouverPosition" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACLouverPosition" - disabled: true - command: "readAttribute" - attribute: "ACLouverPosition" - response: - value: 0 - - - label: "Reads optional attributes from DUT: ACCoilTemperature" - disabled: true - command: "readAttribute" - attribute: "ACCoilTemperature" - response: - value: null - - label: "Reads constraints of optional attributes from DUT: ACCoilTemperature" disabled: true @@ -1651,24 +561,6 @@ tests: constraints: type: int16 - - label: - "Writes the respective default value to optional attributes to DUT: - ACCoilTemperature" - disabled: true - command: "writeAttribute" - attribute: "ACCoilTemperature" - arguments: - value: null - response: - error: UNSUPPORTED_WRITE - - - label: "Read back optional attributes from DUT: ACCoilTemperature" - disabled: true - command: "readAttribute" - attribute: "ACCoilTemperature" - response: - value: null - - label: "Reads optional attributes from DUT: ACCapacityFormat" disabled: true command: "readAttribute" @@ -1684,19 +576,3 @@ tests: response: constraints: type: enum8 - - - label: - "Writes the respective default value to optional attributes to DUT: - ACCapacityFormat" - disabled: true - command: "writeAttribute" - attribute: "ACCapacityFormat" - arguments: - value: 0 - - - label: "Read back optional attributes from DUT: ACCapacityFormat" - disabled: true - command: "readAttribute" - attribute: "ACCapacityFormat" - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_TSTAT_2_2.yaml b/src/app/tests/suites/certification/Test_TC_TSTAT_2_2.yaml index 24ddb1676891b2..3f1e178ccacf5a 100644 --- a/src/app/tests/suites/certification/Test_TC_TSTAT_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSTAT_2_2.yaml @@ -31,6 +31,7 @@ tests: - label: "Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range" + optional: true command: "readAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -44,6 +45,7 @@ tests: - label: "Writes a value back that is different but valid for OccupiedCoolingSetpoint attribute" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -53,6 +55,7 @@ tests: - label: "Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute" + optional: true command: "readAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -84,6 +87,7 @@ tests: - label: "Writes the limit of MinCoolSetpointLimit to OccupiedCoolingSetpoint attribute" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -93,6 +97,7 @@ tests: - label: "Writes the limit of MaxCoolSetpointLimit to OccupiedCoolingSetpoint attribute" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -315,6 +320,7 @@ tests: - label: "Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range" + optional: true command: "readAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -328,6 +334,7 @@ tests: - label: "Writes a value back that is different but valid for MinCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -337,6 +344,7 @@ tests: - label: "Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute" + optional: true command: "readAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -367,6 +375,7 @@ tests: - label: "Writes the limit of AbsMinCoolSetpointLimit to MinCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -376,6 +385,7 @@ tests: - label: "Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -385,6 +395,7 @@ tests: - label: "Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range" + optional: true command: "readAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -398,6 +409,7 @@ tests: - label: "Writes a value back that is different but valid for MaxCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -407,6 +419,7 @@ tests: - label: "Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute" + optional: true command: "readAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -437,6 +450,7 @@ tests: - label: "Writes the limit of AbsMinCoolSetpointLimit to MaxCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -446,6 +460,7 @@ tests: - label: "Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -491,6 +506,7 @@ tests: - label: "Writes (sets back) the limit of MinCoolSetpointLimit to MinCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -500,6 +516,7 @@ tests: - label: "Writes (sets back) the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "min cool setpoint limit" PICS: A_MINCOOLSETPOINTLIMIT @@ -509,6 +526,7 @@ tests: - label: "Writes (sets back) the limit of MinCoolSetpointLimit to MaxCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -518,6 +536,7 @@ tests: - label: "Writes (sets back) the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute" + optional: true command: "writeAttribute" attribute: "max cool setpoint limit" PICS: A_MAXCOOLSETPOINTLIMIT @@ -612,6 +631,7 @@ tests: value: 30 - label: "Sets OccupiedCoolingSetpoint to default value" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -641,6 +661,7 @@ tests: value: -30 - label: "Sets OccupiedCoolingSetpoint to default value" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -670,6 +691,7 @@ tests: value: 30 - label: "Sets OccupiedCoolingSetpoint to default value" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT @@ -716,6 +738,7 @@ tests: value: -30 - label: "Sets OccupiedCoolingSetpoint to default value" + optional: true command: "writeAttribute" attribute: "occupied cooling setpoint" PICS: A_OCCUPIEDCOOLINGSETPOINT diff --git a/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml index a92c744e997e5f..fee98f83989075 100644 --- a/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSUIC_1_1.yaml @@ -43,23 +43,6 @@ tests: constraints: type: uint16 - - label: - "write the default values to mandatory global attribute: - ClusterRevision" - command: "writeAttribute" - attribute: "ClusterRevision" - arguments: - value: 2 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back global attribute: ClusterRevision" - disabled: true - command: "readAttribute" - attribute: "ClusterRevision" - response: - value: 1 - - label: "Read the global attribute: AttributeList" command: "readAttribute" attribute: "AttributeList" @@ -77,7 +60,6 @@ tests: type: list - label: "Read the global attribute: AcceptedCommandList" - disabled: true command: "readAttribute" attribute: "AcceptedCommandList" response: @@ -85,40 +67,8 @@ tests: type: list - label: "Read the global attribute: GeneratedCommandList" - disabled: true command: "readAttribute" attribute: "GeneratedCommandList" response: constraints: type: list - - - label: "read the optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 - - - label: "Read the optional global attribute constraints: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - constraints: - type: map32 - - - label: "write the default values to optional global attribute: FeatureMap" - disabled: true - command: "writeAttribute" - attribute: "FeatureMap" - arguments: - value: 0 - response: - error: UNSUPPORTED_WRITE - - - label: "reads back optional global attribute: FeatureMap" - disabled: true - command: "readAttribute" - attribute: "FeatureMap" - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_TSUIC_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TSUIC_2_1.yaml index ae682b0400e4f2..8d94d644347dc4 100644 --- a/src/app/tests/suites/certification/Test_TC_TSUIC_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSUIC_2_1.yaml @@ -40,25 +40,8 @@ tests: response: constraints: type: enum8 - - - label: "write to the mandatory attribute: TemperatureDisplayMode" - command: "writeAttribute" - attribute: "temperature display mode" - arguments: - value: 0 - - - label: "read the mandatory attribute: TemperatureDisplayMode" - command: "readAttribute" - attribute: "temperature display mode" - response: - value: 0 - - - label: "read the mandatory attribute: TemperatureDisplayMode" - command: "readAttribute" - attribute: "temperature display mode" - response: - constraints: - type: enum8 + minValue: 0 + maxValue: 1 - label: "read the mandatory attribute: KeypadLockout" command: "readAttribute" @@ -72,44 +55,8 @@ tests: response: constraints: type: enum8 - - - label: "write to the mandatory attribute: KeypadLockout" - command: "writeAttribute" - attribute: "keypad lockout" - arguments: - value: 0 - - - label: "read the mandatory attribute: KeypadLockout" - command: "readAttribute" - attribute: "keypad lockout" - response: - value: 0 - - - label: "read the mandatory attribute: KeypadLockout" - command: "readAttribute" - attribute: "keypad lockout" - response: - constraints: - type: enum8 - - - label: "read the optional attribute: ScheduleProgrammingVisibility" - command: "readAttribute" - attribute: "schedule programming visibility" - response: - value: 0 - - - label: "read the optional attribute: ScheduleProgrammingVisibility" - command: "readAttribute" - attribute: "schedule programming visibility" - response: - constraints: - type: enum8 - - - label: "write to the mandatory attribute: ScheduleProgrammingVisibility" - command: "writeAttribute" - attribute: "schedule programming visibility" - arguments: - value: 0 + minValue: 0 + maxValue: 5 - label: "read the optional attribute: ScheduleProgrammingVisibility" command: "readAttribute" @@ -123,3 +70,5 @@ tests: response: constraints: type: enum8 + minValue: 0 + maxValue: 1 diff --git a/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml b/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml index ba5652d7f841ae..9147321abaf224 100644 --- a/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_TSUIC_2_2.yaml @@ -54,7 +54,6 @@ tests: - label: "Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT" - disabled: true command: "writeAttribute" attribute: "temperature display mode" PICS: A_TEMPERATURE_DISPLAY_MODE @@ -132,7 +131,6 @@ tests: #Disabled as write was successful - label: "Writes a value of greater than 5 to KeypadLockout attribute of DUT" - disabled: true command: "writeAttribute" attribute: "keypad lockout" PICS: A_KEYPAD_LOCKOUT @@ -173,7 +171,6 @@ tests: - label: "Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT" - disabled: true command: "writeAttribute" attribute: "schedule programming visibility" PICS: A_SCHEDULE_PROGRAMMING_VISIBILITY diff --git a/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml b/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml index 282e7f63a22d03..70dd41a50da8e8 100644 --- a/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_WIFIDIAG_1_1.yaml @@ -36,6 +36,7 @@ tests: constraints: type: list + # issue: 16654 and 13645 # Various tests disabled for now until # https://github.com/project-chip/connectedhomeip/pull/14755 is # fixed and the SDK has the right types. @@ -47,7 +48,6 @@ tests: value: null - label: "Reads SecurityType attribute constraints" - disabled: true command: "readAttribute" attribute: "SecurityType" response: @@ -62,7 +62,6 @@ tests: value: null - label: "Reads WiFiVersion attribute constraints" - disabled: true command: "readAttribute" attribute: "WiFiVersion" response: @@ -77,7 +76,6 @@ tests: value: null - label: "Reads ChannelNumber attribute constraints" - disabled: true command: "readAttribute" attribute: "ChannelNumber" response: @@ -92,7 +90,6 @@ tests: value: null - label: "Reads RSSI attribute constraints" - disabled: true command: "readAttribute" attribute: "RSSI" response: @@ -194,7 +191,6 @@ tests: # Disabled because this fails on Linux because we have no Wi-Fi interface. - label: "Reads CurrentMaxRate attribute from DUT" disabled: true - optional: true command: "readAttribute" attribute: "CurrentMaxRate" response: @@ -203,7 +199,6 @@ tests: # Disabled because this fails on Linux because we have no Wi-Fi interface. - label: "Reads CurrentMaxRate attribute constraints" disabled: true - optional: true command: "readAttribute" attribute: "CurrentMaxRate" response: diff --git a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m index d01a4df9ede1f3..f169fd959ae3e9 100644 --- a/src/darwin/Framework/CHIPTests/CHIPClustersTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPClustersTests.m @@ -1994,48 +1994,39 @@ - (void)testSendClusterTest_TC_BOOL_1_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_BOOL_1_1_000003_WriteAttribute +- (void)testSendClusterTest_TC_BOOL_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_BOOL_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - [expectation fulfill]; }]; @@ -2043,15 +2034,15 @@ - (void)testSendClusterTest_TC_BOOL_1_1_000004_ReadAttribute } - (void)testSendClusterTest_TC_BOOL_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -2113,46 +2104,32 @@ - (void)testSendClusterTest_TC_BOOL_2_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_BOOL_2_1_000003_WriteAttribute + +- (void)testSendClusterTest_TC_BRAC_1_1_000000_WaitForCommissionee { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Write the default value to mandatory non-global attribute: StateValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id stateValueArgument; - stateValueArgument = [NSNumber numberWithBool:1]; - [cluster writeAttributeStateValueWithValue:stateValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default value to mandatory non-global attribute: StateValue Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - + WaitForCommissionee(expectation, queue, 305414945); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_BOOL_2_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_BRAC_1_1_000001_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads back the mandatory non-global attribute: StateValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: ClusterRevision"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:queue]; + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStateValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back the mandatory non-global attribute: StateValue Error: %@", err); + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue boolValue], 0); + XCTAssertEqual([actualValue unsignedShortValue], 1U); } [expectation fulfill]; @@ -2160,50 +2137,74 @@ - (void)testSendClusterTest_TC_BOOL_2_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_BRAC_1_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_BRAC_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_BRAC_1_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_BRAC_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_BRAC_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_BRAC_1_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_BRAC_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -13008,7 +13009,7 @@ - (void)testSendClusterTest_TC_ILL_1_1_000000_WaitForCommissionee } - (void)testSendClusterTest_TC_ILL_1_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13018,15 +13019,10 @@ - (void)testSendClusterTest_TC_ILL_1_1_000001_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 2U); - } - [expectation fulfill]; }]; @@ -13034,7 +13030,7 @@ - (void)testSendClusterTest_TC_ILL_1_1_000001_ReadAttribute } - (void)testSendClusterTest_TC_ILL_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13043,8 +13039,8 @@ - (void)testSendClusterTest_TC_ILL_1_1_000002_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -13053,34 +13049,9 @@ - (void)testSendClusterTest_TC_ILL_1_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_ILL_1_1_000003_WriteAttribute +- (void)testSendClusterTest_TC_ILL_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_ILL_1_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13089,24 +13060,19 @@ - (void)testSendClusterTest_TC_ILL_1_1_000004_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 2U); - } - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_ILL_1_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_ILL_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -13115,8 +13081,8 @@ - (void)testSendClusterTest_TC_ILL_1_1_000005_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -13244,6 +13210,68 @@ - (void)testSendClusterTest_TC_LVL_1_1_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_1_1_000006_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_1_1_000007_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_1_1_000008_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedIntValue], 3UL); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_1_1_000009_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional global attribute : FeatureMap"]; @@ -13262,7 +13290,7 @@ - (void)testSendClusterTest_TC_LVL_1_1_000006_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_1_1_000007_WriteAttribute +- (void)testSendClusterTest_TC_LVL_1_1_000010_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; @@ -13284,6 +13312,25 @@ - (void)testSendClusterTest_TC_LVL_1_1_000007_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_LVL_1_1_000011_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_LVL_2_1_000000_WaitForCommissionee { @@ -13997,11 +14044,6 @@ - (void)testSendClusterTest_TC_LVL_3_1_000001_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - [expectation fulfill]; }]; @@ -14021,11 +14063,6 @@ - (void)testSendClusterTest_TC_LVL_3_1_000002_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - [expectation fulfill]; }]; @@ -14045,11 +14082,6 @@ - (void)testSendClusterTest_TC_LVL_3_1_000003_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - [expectation fulfill]; }]; @@ -14066,7 +14098,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000004_MoveToLevel __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; params.level = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveToLevelWithParams:params @@ -14122,8 +14154,8 @@ - (void)testSendClusterTest_TC_LVL_3_1_000007_MoveToLevel XCTAssertNotNil(cluster); __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:128]; - params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; + params.level = [NSNumber numberWithUnsignedChar:100]; + params.transitionTime = [NSNumber numberWithUnsignedShort:100U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveToLevelWithParams:params @@ -14139,11 +14171,11 @@ - (void)testSendClusterTest_TC_LVL_3_1_000007_MoveToLevel } - (void)testSendClusterTest_TC_LVL_3_1_000008_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait a second"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 11000 second"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 1000); - [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; + WaitForMs(expectation, queue, 11000); + [self waitForExpectationsWithTimeout:(11000 / 1000) + kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute { @@ -14161,7 +14193,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000009_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); + XCTAssertEqual([actualValue unsignedCharValue], 100); } [expectation fulfill]; @@ -14183,11 +14215,6 @@ - (void)testSendClusterTest_TC_LVL_3_1_000010_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); - } - [expectation fulfill]; }]; @@ -14203,7 +14230,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000011_MoveToLevel XCTAssertNotNil(cluster); __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; + params.level = [NSNumber numberWithUnsignedChar:128]; params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; @@ -14220,11 +14247,11 @@ - (void)testSendClusterTest_TC_LVL_3_1_000011_MoveToLevel } - (void)testSendClusterTest_TC_LVL_3_1_000012_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 10ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 1000ms"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 100); - [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; + WaitForMs(expectation, queue, 1000); + [self waitForExpectationsWithTimeout:(1000 / 1000) + kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute { @@ -14242,7 +14269,7 @@ - (void)testSendClusterTest_TC_LVL_3_1_000013_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); + XCTAssertEqual([actualValue unsignedCharValue], 128); } [expectation fulfill]; @@ -14292,31 +14319,8 @@ - (void)testSendClusterTest_TC_LVL_4_1_000000_WaitForCommissionee WaitForCommissionee(expectation, queue, 305414945); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +NSNumber * _Nonnull MaxlevelValue; - (void)testSendClusterTest_TC_LVL_4_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_LVL_4_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads max level attribute from DUT"]; @@ -14332,7 +14336,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000002_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); + MaxlevelValue = actualValue; } [expectation fulfill]; @@ -14340,7 +14344,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000003_Move +- (void)testSendClusterTest_TC_LVL_4_1_000002_Move { XCTestExpectation * expectation = [self expectationWithDescription:@"sends a Move up command"]; @@ -14351,7 +14355,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000003_Move __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:200]; + params.rate = [NSNumber numberWithUnsignedChar:32]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveWithParams:params @@ -14365,6 +14369,16 @@ - (void)testSendClusterTest_TC_LVL_4_1_000003_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_LVL_4_1_000003_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"user prompt message"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, + @"Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to this rate and completes " + @"moving to its maximum level"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_LVL_4_1_000004_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; @@ -14389,7 +14403,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 254); + XCTAssertEqualObjects(actualValue, MaxlevelValue); } [expectation fulfill]; @@ -14397,6 +14411,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +NSNumber * _Nonnull MinlevelValue; - (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads min level attribute from DUT"]; @@ -14413,7 +14428,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000006_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + MinlevelValue = actualValue; } [expectation fulfill]; @@ -14432,7 +14447,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000007_Move __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:250]; + params.rate = [NSNumber numberWithUnsignedChar:64]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveWithParams:params @@ -14446,15 +14461,25 @@ - (void)testSendClusterTest_TC_LVL_4_1_000007_Move [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000008_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000008_UserPrompt { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"user prompt message"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 3000); - [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; + UserPrompt(expectation, queue, + @"Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to this rate and complete " + @"moving to its minimum level"); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_LVL_4_1_000009_WaitForMs +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 5000ms"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForMs(expectation, queue, 5000); + [self waitForExpectationsWithTimeout:(5000 / 1000) + kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000010_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads CurrentLevel attribute from DUT"]; @@ -14468,6 +14493,10 @@ - (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 1); + } { id actualValue = value; if (actualValue != nil) { @@ -14486,28 +14515,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000010_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Write default move rate attribute from DUT"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id defaultMoveRateArgument; - defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:20]; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write default move rate attribute from DUT Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} +NSNumber * _Nullable DefaultMoveRateValue; - (void)testSendClusterTest_TC_LVL_4_1_000011_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"reads default move rate attribute from DUT"]; @@ -14524,8 +14532,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000011_ReadAttribute { id actualValue = value; - XCTAssertFalse(actualValue == nil); - XCTAssertEqual([actualValue unsignedCharValue], 20); + DefaultMoveRateValue = actualValue; } [expectation fulfill]; @@ -14592,7 +14599,16 @@ - (void)testSendClusterTest_TC_LVL_4_1_000014_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000015_MoveToLevel +- (void)testSendClusterTest_TC_LVL_4_1_000015_UserPrompt +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"user prompt message"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + UserPrompt(expectation, queue, + @"Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_LVL_4_1_000016_MoveToLevel { XCTestExpectation * expectation = [self expectationWithDescription:@"Reset level to 254"]; @@ -14617,7 +14633,7 @@ - (void)testSendClusterTest_TC_LVL_4_1_000015_MoveToLevel [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_LVL_4_1_000016_WaitForMs +- (void)testSendClusterTest_TC_LVL_4_1_000017_WaitForMs { XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 100ms"]; @@ -14655,7 +14671,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000001_On } - (void)testSendClusterTest_TC_LVL_5_1_000002_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to 0x80"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Precondition: DUT level is set to its lowest point"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -14664,13 +14680,13 @@ - (void)testSendClusterTest_TC_LVL_5_1_000002_Step __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:126]; + params.stepSize = [NSNumber numberWithUnsignedChar:100]; params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; params.optionMask = [NSNumber numberWithUnsignedChar:0]; params.optionOverride = [NSNumber numberWithUnsignedChar:0]; [cluster stepWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + NSLog(@"Precondition: DUT level is set to its lowest point Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -14681,12 +14697,13 @@ - (void)testSendClusterTest_TC_LVL_5_1_000002_Step } - (void)testSendClusterTest_TC_LVL_5_1_000003_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 4000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 3000ms"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 4000); - [self waitForExpectationsWithTimeout:(4000 / 1000) + kTimeoutInSeconds handler:nil]; + WaitForMs(expectation, queue, 3000); + [self waitForExpectationsWithTimeout:(3000 / 1000) + kTimeoutInSeconds handler:nil]; } +NSNumber * _Nonnull CurrentlevelValue; - (void)testSendClusterTest_TC_LVL_5_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads current level attribute from DUT"]; @@ -14703,7 +14720,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000004_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); + CurrentlevelValue = actualValue; } [expectation fulfill]; @@ -14713,7 +14730,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000004_ReadAttribute } - (void)testSendClusterTest_TC_LVL_5_1_000005_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step down command to DUT"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends step up command to DUT"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -14721,14 +14738,14 @@ - (void)testSendClusterTest_TC_LVL_5_1_000005_Step XCTAssertNotNil(cluster); __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; + params.stepMode = [NSNumber numberWithUnsignedChar:0]; params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; params.optionMask = [NSNumber numberWithUnsignedChar:0]; params.optionOverride = [NSNumber numberWithUnsignedChar:0]; [cluster stepWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends step down command to DUT Error: %@", err); + NSLog(@"Sends step up command to DUT Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -14739,11 +14756,11 @@ - (void)testSendClusterTest_TC_LVL_5_1_000005_Step } - (void)testSendClusterTest_TC_LVL_5_1_000006_WaitForMs { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 4000ms"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait 5000ms"]; dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForMs(expectation, queue, 4000); - [self waitForExpectationsWithTimeout:(4000 / 1000) + kTimeoutInSeconds handler:nil]; + WaitForMs(expectation, queue, 5000); + [self waitForExpectationsWithTimeout:(5000 / 1000) + kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_LVL_5_1_000007_ReadAttribute { @@ -14761,7 +14778,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000007_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 64); + XCTAssertNotEqualObjects(actualValue, CurrentlevelValue); } [expectation fulfill]; @@ -14771,7 +14788,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000007_ReadAttribute } - (void)testSendClusterTest_TC_LVL_5_1_000008_Step { - XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step up command"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Sends a Step down command"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -14779,14 +14796,14 @@ - (void)testSendClusterTest_TC_LVL_5_1_000008_Step XCTAssertNotNil(cluster); __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; + params.stepMode = [NSNumber numberWithUnsignedChar:1]; params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; params.optionMask = [NSNumber numberWithUnsignedChar:0]; params.optionOverride = [NSNumber numberWithUnsignedChar:0]; [cluster stepWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends a Step up command Error: %@", err); + NSLog(@"Sends a Step down command Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -14819,7 +14836,7 @@ - (void)testSendClusterTest_TC_LVL_5_1_000010_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 128); + XCTAssertEqualObjects(actualValue, CurrentlevelValue); } [expectation fulfill]; @@ -14940,6 +14957,7 @@ - (void)testSendClusterTest_TC_LVL_6_1_000003_WaitForMs WaitForMs(expectation, queue, 100); [self waitForExpectationsWithTimeout:(100 / 1000) + kTimeoutInSeconds handler:nil]; } +NSNumber * _Nonnull CurrentLevelValue; - (void)testSendClusterTest_TC_LVL_6_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads CurrentLevel attribute from DUT"]; @@ -14966,6 +14984,10 @@ - (void)testSendClusterTest_TC_LVL_6_1_000004_ReadAttribute XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 1); } } + { + id actualValue = value; + CurrentLevelValue = actualValue; + } [expectation fulfill]; }]; @@ -15044,15 +15066,7 @@ - (void)testSendClusterTest_TC_LVL_6_1_000008_ReadAttribute { id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 2); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 3); - } + XCTAssertNotEqualObjects(actualValue, CurrentLevelValue); } [expectation fulfill]; @@ -17016,6 +17030,7 @@ - (void)testSendClusterTest_TC_OCC_2_2_000000_WaitForCommissionee WaitForCommissionee(expectation, queue, 305414945); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +NSNumber * _Nonnull OccupancyValue; - (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; @@ -17030,6 +17045,15 @@ - (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } + { + id actualValue = value; + OccupancyValue = actualValue; + } + [expectation fulfill]; }]; @@ -17037,7 +17061,8 @@ - (void)testSendClusterTest_TC_OCC_2_2_000001_ReadAttribute } - (void)testSendClusterTest_TC_OCC_2_2_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads Occupancy attribute from DUT"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads back Occupancy attribute from DUT after few seconds"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -17045,7 +17070,7 @@ - (void)testSendClusterTest_TC_OCC_2_2_000002_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + NSLog(@"Reads back Occupancy attribute from DUT after few seconds Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -18802,15 +18827,15 @@ - (void)testSendClusterTest_TC_PS_1_1_000001_ReadAttribute } - (void)testSendClusterTest_TC_PS_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute constraints: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -18819,64 +18844,36 @@ - (void)testSendClusterTest_TC_PS_1_1_000002_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_PS_1_1_000003_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PS_1_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_PS_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"reads back global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 1U); - } - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_PS_1_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_PS_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -19483,7 +19480,7 @@ - (void)testSendClusterTest_TC_PCC_1_1_000003_ReadAttribute } - (void)testSendClusterTest_TC_PCC_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -19492,8 +19489,8 @@ - (void)testSendClusterTest_TC_PCC_1_1_000004_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -19502,18 +19499,9 @@ - (void)testSendClusterTest_TC_PCC_1_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_PCC_2_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_PCC_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_PCC_1_1_000005_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxPressure"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -19522,8 +19510,8 @@ - (void)testSendClusterTest_TC_PCC_2_1_000001_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -19532,9 +19520,9 @@ - (void)testSendClusterTest_TC_PCC_2_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_PCC_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_PCC_1_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxSpeed"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -19543,19 +19531,24 @@ - (void)testSendClusterTest_TC_PCC_2_1_000002_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedIntValue], 0UL); + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_PCC_2_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_PCC_1_1_000007_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxFlow"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional global attribute: FeatureMap"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -19564,8 +19557,8 @@ - (void)testSendClusterTest_TC_PCC_2_1_000003_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -19574,9 +19567,10 @@ - (void)testSendClusterTest_TC_PCC_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_PCC_2_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_PCC_1_1_000008_WriteAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveOperationMode"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"write the default values to optional global attribute: FeatureMap"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -19585,19 +19579,21 @@ - (void)testSendClusterTest_TC_PCC_2_1_000004_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + id featureMapArgument; + featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_PCC_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_PCC_1_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveControlMode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"reads back optional global attribute: FeatureMap"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -19606,8 +19602,127 @@ - (void)testSendClusterTest_TC_PCC_2_1_000005_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedIntValue], 0UL); + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} + +- (void)testSendClusterTest_TC_PCC_2_1_000000_WaitForCommissionee +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PCC_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxPressure"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxPressureWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxPressure Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PCC_2_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxSpeed"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxSpeedWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxSpeed Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PCC_2_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxFlow"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxFlowWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxFlow Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PCC_2_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveOperationMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeEffectiveOperationModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: EffectiveOperationMode Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_PCC_2_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: EffectiveControlMode"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeEffectiveControlModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: EffectiveControlMode Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -20527,6 +20642,12 @@ - (void)testSendClusterTest_TC_PCC_2_1_000040_ReadAttribute XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); } } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 32767); + } + } [expectation fulfill]; }]; @@ -20560,6 +20681,12 @@ - (void)testSendClusterTest_TC_PCC_2_1_000041_ReadAttribute XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); } } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 32767); + } + } [expectation fulfill]; }]; @@ -21417,10 +21544,9 @@ - (void)testSendClusterTest_TC_RH_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_RH_1_1_000002_WriteAttribute +- (void)testSendClusterTest_TC_RH_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -21429,22 +21555,19 @@ - (void)testSendClusterTest_TC_RH_1_1_000002_WriteAttribute queue:queue]; XCTAssertNotNil(cluster); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_RH_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -21453,8 +21576,29 @@ - (void)testSendClusterTest_TC_RH_1_1_000003_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_RH_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -21488,6 +21632,19 @@ - (void)testSendClusterTest_TC_RH_2_1_000001_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 10000U); + } + } + [expectation fulfill]; }]; @@ -21529,7 +21686,7 @@ - (void)testSendClusterTest_TC_RH_2_1_000002_ReadAttribute } - (void)testSendClusterTest_TC_RH_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads the optional attribute: Tolerance"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of attribute: Tolerance"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -21539,7 +21696,7 @@ - (void)testSendClusterTest_TC_RH_2_1_000003_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the optional attribute: Tolerance Error: %@", err); + NSLog(@"Reads constraints of attribute: Tolerance Error: %@", err); if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { [expectation fulfill]; @@ -21550,7 +21707,15 @@ - (void)testSendClusterTest_TC_RH_2_1_000003_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedShortValue], 0U); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 2048U); + } } [expectation fulfill]; @@ -21558,9 +21723,18 @@ - (void)testSendClusterTest_TC_RH_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_RH_2_1_000004_ReadAttribute + +- (void)testSendClusterTest_TC_RH_2_2_000000_WaitForCommissionee { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of attribute: Tolerance"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_RH_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of attribute: MinMeasuredValue"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -21569,13 +21743,8 @@ - (void)testSendClusterTest_TC_RH_2_1_000004_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of attribute: Tolerance Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of attribute: MinMeasuredValue Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -21588,7 +21757,7 @@ - (void)testSendClusterTest_TC_RH_2_1_000004_ReadAttribute { id actualValue = value; if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 2048U); + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 9999U); } } @@ -21597,16 +21766,7 @@ - (void)testSendClusterTest_TC_RH_2_1_000004_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_RH_2_2_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_RH_2_2_000001_ReadAttribute +- (void)testSendClusterTest_TC_RH_2_2_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads MeasuredValue attribute from DUT"]; @@ -21622,12 +21782,25 @@ - (void)testSendClusterTest_TC_RH_2_2_000001_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedShortValue], 0U); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedShortValue], 10000U); + } + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_RH_2_2_000002_ReadAttribute +- (void)testSendClusterTest_TC_RH_2_2_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: MeasuredValue"]; @@ -22175,10 +22348,9 @@ - (void)testSendClusterTest_TC_TM_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000002_WriteAttribute +- (void)testSendClusterTest_TC_TM_1_1_000002_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -22187,22 +22359,28 @@ - (void)testSendClusterTest_TC_TM_1_1_000002_WriteAttribute queue:queue]; XCTAssertNotNil(cluster); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:4U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_1_1_000003_ReadAttribute + +- (void)testSendClusterTest_TC_TM_2_1_000000_WaitForCommissionee { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + + dispatch_queue_t queue = dispatch_get_main_queue(); + WaitForCommissionee(expectation, queue, 305414945); + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_2_1_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -22211,8 +22389,8 @@ - (void)testSendClusterTest_TC_TM_1_1_000003_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -22221,18 +22399,43 @@ - (void)testSendClusterTest_TC_TM_1_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_TM_2_1_000000_WaitForCommissionee +- (void)testSendClusterTest_TC_TM_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 32766); + } + } + + [expectation fulfill]; + }]; + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_2_1_000001_ReadAttribute +- (void)testSendClusterTest_TC_TM_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MeasuredValue"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -22241,17 +22444,30 @@ - (void)testSendClusterTest_TC_TM_2_1_000001_ReadAttribute queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: MeasuredValue Error: %@", err); + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], -27314); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 32767); + } + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_2_1_000002_ReadAttribute +- (void)testSendClusterTest_TC_TM_2_1_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: Tolerance"]; @@ -22300,6 +22516,74 @@ - (void)testSendClusterTest_TC_TM_2_2_000000_WaitForCommissionee [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_TM_2_2_000001_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MinMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], -27315); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 32766); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_2_2_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: MaxMeasuredValue"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], -27314); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 32767); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TM_2_2_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads MeasuredValue attribute from DUT"]; @@ -22320,7 +22604,7 @@ - (void)testSendClusterTest_TC_TM_2_2_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TM_2_2_000002_ReadAttribute +- (void)testSendClusterTest_TC_TM_2_2_000004_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the mandatory attribute: MeasuredValue"]; @@ -22369,30 +22653,7 @@ - (void)testSendClusterTest_TC_TSTAT_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_1_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:5U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_1_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; @@ -22411,7 +22672,7 @@ - (void)testSendClusterTest_TC_TSTAT_1_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_1_1_000004_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_1_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the optional global attribute constraints: FeatureMap"]; @@ -22461,31 +22722,6 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_TSTAT_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: AbsMinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 700); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000003_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit"]; @@ -22518,74 +22754,32 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000004_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: AbsMinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id absMinHeatSetpointLimitArgument; - absMinHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeAbsMinHeatSetpointLimitWithValue:absMinHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMinHeatSetpointLimit Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000003_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: AbsMinHeatSetpointLimit"]; + [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); + [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue shortValue], 700); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); + } } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000006_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3000); + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 3000); + } } [expectation fulfill]; @@ -22593,31 +22787,36 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000006_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000007_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000004_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit"]; + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); + [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); + + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); + XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); } } { id actualValue = value; if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); + XCTAssertLessThanOrEqual([actualValue shortValue], 3200); } } @@ -22626,1022 +22825,37 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000007_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000008_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: AbsMaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id absMaxHeatSetpointLimitArgument; - absMaxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeAbsMaxHeatSetpointLimitWithValue:absMaxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMaxHeatSetpointLimit Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000009_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: AbsMaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000010_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: AbsMinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 1600); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000011_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000012_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: AbsMinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id absMinCoolSetpointLimitArgument; - absMinCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeAbsMinCoolSetpointLimitWithValue:absMinCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMinCoolSetpointLimit Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000013_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: AbsMinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 1600); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000014_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: AbsMaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000015_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: AbsMaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000016_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: AbsMaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id absMaxCoolSetpointLimitArgument; - absMaxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeAbsMaxCoolSetpointLimitWithValue:absMaxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMaxCoolSetpointLimit Error: %@", - err); - - XCTAssertEqual( - [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000017_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: AbsMaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000018_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: OccupiedCoolingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2600); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000019_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: OccupiedCoolingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 2600); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000020_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: OccupiedCoolingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"OccupiedCoolingSetpoint Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000021_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: OccupiedCoolingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2600); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000022_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: OccupiedHeatingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000023_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 2600); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000024_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: OccupiedHeatingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"OccupiedHeatingSetpoint Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000025_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: OccupiedHeatingSetpoint"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 2000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000026_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: MinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 700); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000027_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000028_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: MinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MinHeatSetpointLimit Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000029_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: MinHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 700); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000030_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: MaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000031_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3000); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000032_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: MaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MaxHeatSetpointLimit Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000033_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: MaxHeatSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3000); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000034_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: MinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 1600); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000035_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000036_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: MinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MinCoolSetpointLimit Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000037_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: MinCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 1600); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000038_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: MaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000039_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue shortValue], 3200); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000040_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: MaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MaxCoolSetpointLimit Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000041_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: MaxCoolSetpointLimit"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue shortValue], 3200); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000042_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads mandatory attributes from DUT: ControlSequenceOfOperation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 4); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000043_ReadAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); - } - } - { - id actualValue = value; - if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 5); - } - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000044_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription: - @"Writes the respective default value to mandatory attributes to DUT: ControlSequenceOfOperation"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id controlSequenceOfOperationArgument; - controlSequenceOfOperationArgument = [NSNumber numberWithUnsignedChar:4]; - [cluster writeAttributeControlSequenceOfOperationWithValue:controlSequenceOfOperationArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"ControlSequenceOfOperation Error: %@", - err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000045_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000005_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back mandatory attributes from DUT: ControlSequenceOfOperation"]; + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); + [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); + + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 4); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 3200); + } } [expectation fulfill]; @@ -23649,23 +22863,37 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000045_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000046_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000006_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads mandatory attributes from DUT: SystemMode"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: SystemMode Error: %@", err); + [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); + + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 2600); + } } [expectation fulfill]; @@ -23673,31 +22901,31 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000046_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000047_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000007_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: SystemMode"]; + [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode Error: %@", err); + [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); } } { id actualValue = value; if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 9); + XCTAssertLessThanOrEqual([actualValue shortValue], 2600); } } @@ -23706,47 +22934,65 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000047_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000048_WriteAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000008_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to mandatory attributes to DUT: SystemMode"]; + [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - id systemModeArgument; - systemModeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster - writeAttributeSystemModeWithValue:systemModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: SystemMode Error: %@", err); + [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - [expectation fulfill]; - }]; + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 3000); + } + } + + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000049_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000009_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back mandatory attributes from DUT: SystemMode"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: SystemMode Error: %@", err); + [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 1); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], 700); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 3000); + } } [expectation fulfill]; @@ -23754,17 +23000,18 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000049_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000050_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000010_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"Reads optional attributes from DUT: MinSetpointDeadBand"]; + XCTestExpectation * expectation = + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads optional attributes from DUT: MinSetpointDeadBand Error: %@", err); + [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit Error: %@", err); if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { [expectation fulfill]; @@ -23775,7 +23022,15 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000050_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue charValue], 25); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue shortValue], 3200); + } } [expectation fulfill]; @@ -23783,18 +23038,18 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000050_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000051_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000011_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand"]; + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); + [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit Error: %@", err); if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { [expectation fulfill]; @@ -23806,13 +23061,13 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000051_ReadAttribute { id actualValue = value; if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue charValue], 0); + XCTAssertGreaterThanOrEqual([actualValue shortValue], 1600); } } { id actualValue = value; if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue charValue], 25); + XCTAssertLessThanOrEqual([actualValue shortValue], 3200); } } @@ -23821,60 +23076,65 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000051_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000052_WriteAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000012_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to optional attributes to DUT: MinSetpointDeadBand"]; + [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - id minSetpointDeadBandArgument; - minSetpointDeadBandArgument = [NSNumber numberWithChar:25]; - [cluster writeAttributeMinSetpointDeadBandWithValue:minSetpointDeadBandArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: " - @"MinSetpointDeadBand Error: %@", - err); + [cluster readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 5); + } + } - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000053_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000013_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Read back optional attributes from DUT: MinSetpointDeadBand"]; + [self expectationWithDescription:@"Reads constraints of mandatory attributes from DUT: SystemMode"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back optional attributes from DUT: MinSetpointDeadBand Error: %@", err); - - if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } + [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { id actualValue = value; - XCTAssertEqual([actualValue charValue], 25); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 9); + } } [expectation fulfill]; @@ -23882,18 +23142,18 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000053_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000054_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000014_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: StartOfWeek"]; + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); + [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { [expectation fulfill]; @@ -23905,13 +23165,13 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000054_ReadAttribute { id actualValue = value; if (actualValue != nil) { - XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + XCTAssertGreaterThanOrEqual([actualValue charValue], 0); } } { id actualValue = value; if (actualValue != nil) { - XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 6); + XCTAssertLessThanOrEqual([actualValue charValue], 25); } } @@ -23920,38 +23180,10 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000054_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000055_WriteAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000015_ReadAttribute { XCTestExpectation * expectation = - [self expectationWithDescription:@"Writes the respective default value to optional attributes to DUT: StartOfWeek"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id startOfWeekArgument; - startOfWeekArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeStartOfWeekWithValue:startOfWeekArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: StartOfWeek Error: %@", - err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000056_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Read back optional attributes from DUT: StartOfWeek"]; + [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: StartOfWeek"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -23959,7 +23191,7 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000056_ReadAttribute XCTAssertNotNil(cluster); [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back optional attributes from DUT: StartOfWeek Error: %@", err); + NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { [expectation fulfill]; @@ -23970,7 +23202,15 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000056_ReadAttribute { id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 6); + } } [expectation fulfill]; @@ -23978,7 +23218,7 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000056_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000057_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000016_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions"]; @@ -24003,38 +23243,7 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000057_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000058_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to optional attributes to DUT: NumberOfWeeklyTransitions"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id numberOfWeeklyTransitionsArgument; - numberOfWeeklyTransitionsArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNumberOfWeeklyTransitionsWithValue:numberOfWeeklyTransitionsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: " - @"NumberOfWeeklyTransitions Error: %@", - err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSTAT_2_1_000059_ReadAttribute +- (void)testSendClusterTest_TC_TSTAT_2_1_000017_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Reads constraints of optional attributes from DUT: NumberOfDailyTransitions"]; @@ -24059,37 +23268,6 @@ - (void)testSendClusterTest_TC_TSTAT_2_1_000059_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSTAT_2_1_000060_WriteAttribute -{ - XCTestExpectation * expectation = [self - expectationWithDescription:@"Writes the respective default value to optional attributes to DUT: NumberOfDailyTransitions"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id numberOfDailyTransitionsArgument; - numberOfDailyTransitionsArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNumberOfDailyTransitionsWithValue:numberOfDailyTransitionsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: " - @"NumberOfDailyTransitions Error: %@", - err); - - if (err.domain == MatterInteractionErrorDomain - && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - [expectation fulfill]; - return; - } - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], - EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} - (void)testSendClusterTest_TC_TSTAT_2_2_000000_WaitForCommissionee { @@ -24114,6 +23292,11 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000001_ReadAttribute NSLog( @"Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range Error: %@", err); + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { @@ -24156,6 +23339,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000002_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24176,6 +23365,11 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000003_ReadAttribute [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { @@ -24206,6 +23400,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000004_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24231,6 +23431,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000005_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24667,6 +23873,11 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000021_ReadAttribute [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { @@ -24709,6 +23920,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000022_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24729,6 +23946,11 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000023_ReadAttribute [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { @@ -24759,6 +23981,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000024_WriteAttribute @"Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24784,6 +24012,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000025_WriteAttribute NSLog(@"Writes the limit of MaxCoolSetpointLimit to MinCoolSetpointLimit attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24805,6 +24039,11 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000026_ReadAttribute [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { @@ -24847,6 +24086,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000027_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24867,6 +24112,11 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000028_ReadAttribute [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); { @@ -24897,6 +24147,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000029_WriteAttribute @"Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -24922,6 +24178,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000030_WriteAttribute NSLog(@"Writes the limit of MaxCoolSetpointLimit to MaxCoolSetpointLimit attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25047,6 +24309,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000035_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25072,6 +24340,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000036_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25097,6 +24371,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000037_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25122,6 +24402,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000038_WriteAttribute @"attribute Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25274,6 +24560,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000044_WriteAttribute completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25296,6 +24588,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000045_WriteAttribute completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25318,6 +24616,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000046_WriteAttribute completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25362,6 +24666,12 @@ - (void)testSendClusterTest_TC_TSTAT_2_2_000048_WriteAttribute completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.domain == MatterInteractionErrorDomain + && err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + [expectation fulfill]; + return; + } + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); [expectation fulfill]; @@ -25420,31 +24730,7 @@ - (void)testSendClusterTest_TC_TSUIC_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_1_1_000002_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write the default values to mandatory global attribute: ClusterRevision"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:2U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_UNSUPPORTED_WRITE); - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_1_1_000003_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_1_1_000002_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AttributeList"]; @@ -25464,111 +24750,9 @@ - (void)testSendClusterTest_TC_TSUIC_1_1_000003_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - -- (void)testSendClusterTest_TC_TSUIC_2_1_000000_WaitForCommissionee -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - - dispatch_queue_t queue = dispatch_get_main_queue(); - WaitForCommissionee(expectation, queue, 305414945); - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000001_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000002_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000003_WriteAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"write to the mandatory attribute: TemperatureDisplayMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id temperatureDisplayModeArgument; - temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_1_1_000003_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: AcceptedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -25576,8 +24760,8 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -25586,9 +24770,9 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_1_1_000004_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Read the global attribute: GeneratedCommandList"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -25596,67 +24780,28 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } - [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000007_ReadAttribute -{ - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000008_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000000_WaitForCommissionee { - XCTestExpectation * expectation = [self expectationWithDescription:@"write to the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"Wait for the commissioned device to be retrieved"]; - CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); - - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the mandatory attribute: KeypadLockout Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - + WaitForCommissionee(expectation, queue, 305414945); [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000009_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000001_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -25664,8 +24809,8 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000009_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); @@ -25679,9 +24824,9 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000009_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000010_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000002_ReadAttribute { - XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: TemperatureDisplayMode"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -25689,20 +24834,32 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000010_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 1); + } + } + [expectation fulfill]; }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000011_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000003_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -25710,26 +24867,24 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000011_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); + [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - { - id actualValue = value; - XCTAssertEqual([actualValue unsignedCharValue], 0); - } + { + id actualValue = value; + XCTAssertEqual([actualValue unsignedCharValue], 0); + } - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000012_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000004_ReadAttribute { - XCTestExpectation * expectation = - [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; + XCTestExpectation * expectation = [self expectationWithDescription:@"read the mandatory attribute: KeypadLockout"]; CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); @@ -25737,44 +24892,30 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000012_ReadAttribute [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; XCTAssertNotNil(cluster); - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - - [expectation fulfill]; - }]; - - [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; -} -- (void)testSendClusterTest_TC_TSUIC_2_1_000013_WriteAttribute -{ - XCTestExpectation * expectation = - [self expectationWithDescription:@"write to the mandatory attribute: ScheduleProgrammingVisibility"]; - - CHIPDevice * device = GetConnectedDevice(); - dispatch_queue_t queue = dispatch_get_main_queue(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; - XCTAssertNotNil(cluster); + [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - id scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the mandatory attribute: ScheduleProgrammingVisibility Error: %@", - err); + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); - XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 5); + } + } - [expectation fulfill]; - }]; + [expectation fulfill]; + }]; [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000014_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000005_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; @@ -25801,7 +24942,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000014_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_1_000015_ReadAttribute +- (void)testSendClusterTest_TC_TSUIC_2_1_000006_ReadAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"read the optional attribute: ScheduleProgrammingVisibility"]; @@ -25818,6 +24959,19 @@ - (void)testSendClusterTest_TC_TSUIC_2_1_000015_ReadAttribute XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue unsignedCharValue], 0); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue unsignedCharValue], 1); + } + } + [expectation fulfill]; }]; @@ -25883,6 +25037,32 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000002_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } - (void)testSendClusterTest_TC_TSUIC_2_2_000003_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id temperatureDisplayModeArgument; + temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT " + @"Error: %@", + err); + + XCTAssertEqual( + [CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_2_000004_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 0 to KeypadLockout attribute of DUT"]; @@ -25905,7 +25085,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000003_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000004_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000005_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 1 to KeypadLockout attribute of DUT"]; @@ -25928,7 +25108,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000004_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000005_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000006_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 2 to KeypadLockout attribute of DUT"]; @@ -25951,7 +25131,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000005_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000006_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000007_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 3 to KeypadLockout attribute of DUT"]; @@ -25974,7 +25154,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000006_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000007_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000008_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 4 to KeypadLockout attribute of DUT"]; @@ -25997,7 +25177,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000007_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000008_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000009_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 5 to KeypadLockout attribute of DUT"]; @@ -26020,7 +25200,30 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000008_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000009_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000010_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes a value of greater than 5 to KeypadLockout attribute of DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:6]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 5 to KeypadLockout attribute of DUT Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_TSUIC_2_2_000011_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT"]; @@ -26046,7 +25249,7 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000009_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } -- (void)testSendClusterTest_TC_TSUIC_2_2_000010_WriteAttribute +- (void)testSendClusterTest_TC_TSUIC_2_2_000012_WriteAttribute { XCTestExpectation * expectation = [self expectationWithDescription:@"Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT"]; @@ -26072,6 +25275,32 @@ - (void)testSendClusterTest_TC_TSUIC_2_2_000010_WriteAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_TSUIC_2_2_000013_WriteAttribute +{ + XCTestExpectation * expectation = + [self expectationWithDescription:@"Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:queue]; + XCTAssertNotNil(cluster); + + id scheduleProgrammingVisibilityArgument; + scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 1 to ScheduleProgrammingVisibility " + @"attribute of DUT Error: %@", + err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], + EMBER_ZCL_STATUS_CONSTRAINT_ERROR); + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_DIAG_TH_NW_1_1_000000_WaitForCommissionee { @@ -28544,6 +27773,103 @@ - (void)testSendClusterTest_TC_WIFIDIAG_1_1_000001_ReadAttribute [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; } +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000002_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads SecurityType attribute constraints"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeSecurityTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads SecurityType attribute constraints Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000003_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads WiFiVersion attribute constraints"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeWiFiVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads WiFiVersion attribute constraints Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000004_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads ChannelNumber attribute constraints"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeChannelNumberWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads ChannelNumber attribute constraints Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} +- (void)testSendClusterTest_TC_WIFIDIAG_1_1_000005_ReadAttribute +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Reads RSSI attribute constraints"]; + + CHIPDevice * device = GetConnectedDevice(); + dispatch_queue_t queue = dispatch_get_main_queue(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:queue]; + XCTAssertNotNil(cluster); + + [cluster readAttributeRssiWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads RSSI attribute constraints Error: %@", err); + + XCTAssertEqual([CHIPErrorTestUtils errorToZCLErrorCode:err], 0); + + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertGreaterThanOrEqual([actualValue charValue], -120); + } + } + { + id actualValue = value; + if (actualValue != nil) { + XCTAssertLessThanOrEqual([actualValue charValue], 0); + } + } + + [expectation fulfill]; + }]; + + [self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil]; +} - (void)testSendClusterTest_TC_WIFIDIAG_3_1_000000_WaitForCommissionee { diff --git a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h index b5a321a5a7673f..7360214a6abd09 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/test/Commands.h @@ -2346,17 +2346,16 @@ class Test_TC_BOOL_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); break; } @@ -2426,61 +2425,54 @@ class Test_TC_BOOL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } - + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -2536,15 +2528,6 @@ class Test_TC_BOOL_2_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 2 : Read mandatory non-global attribute constraints: StateValue\n"); err = TestReadMandatoryNonGlobalAttributeConstraintsStateValue_2(); break; - case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : Write the default value to mandatory non-global attribute: StateValue\n"); - err = TestWriteTheDefaultValueToMandatoryNonGlobalAttributeStateValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads back the mandatory non-global attribute: StateValue\n"); - err = TestReadsBackTheMandatoryNonGlobalAttributeStateValue_4(); - break; } if (CHIP_NO_ERROR != err) { @@ -2560,7 +2543,7 @@ class Test_TC_BOOL_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -2612,47 +2595,6 @@ class Test_TC_BOOL_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - - CHIP_ERROR TestWriteTheDefaultValueToMandatoryNonGlobalAttributeStateValue_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id stateValueArgument; - stateValueArgument = [NSNumber numberWithBool:1]; - [cluster writeAttributeStateValueWithValue:stateValueArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write the default value to mandatory non-global attribute: StateValue Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributeStateValue_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestBooleanState * cluster = [[CHIPTestBooleanState alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeStateValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads back the mandatory non-global attribute: StateValue Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("StateValue", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; class Test_TC_BRAC_1_1 : public TestCommandBridge { @@ -2703,6 +2645,18 @@ class Test_TC_BRAC_1_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); + break; } if (CHIP_NO_ERROR != err) { @@ -2718,7 +2672,7 @@ class Test_TC_BRAC_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -2770,6 +2724,60 @@ class Test_TC_BRAC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestBridgedActions * cluster = [[CHIPTestBridgedActions alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class Test_TC_CC_1_1 : public TestCommandBridge { @@ -16448,25 +16456,20 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -16483,7 +16486,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -16496,7 +16499,7 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device @@ -16505,22 +16508,18 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the global attribute: ClusterRevision Error: %@", err); + NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 2U)); - } - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device @@ -16528,42 +16527,19 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device @@ -16571,23 +16547,19 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 2U)); - } - + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestIlluminanceMeasurement * cluster = [[CHIPTestIlluminanceMeasurement alloc] initWithDevice:device @@ -16595,12 +16567,12 @@ class Test_TC_ILL_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -16670,12 +16642,28 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeAttributeList_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the optional global attribute : FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional global attribute : FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_11(); break; } @@ -16692,7 +16680,7 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 12; chip::Optional mNodeId; chip::Optional mCluster; @@ -16806,57 +16794,133 @@ class Test_TC_LVL_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the optional global attribute : FeatureMap Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_7() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id featureMapArgument; - featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; - [cluster writeAttributeFeatureMapWithValue:featureMapArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } -}; -class Test_TC_LVL_2_1 : public TestCommandBridge { -public: - Test_TC_LVL_2_1() - : TestCommandBridge("Test_TC_LVL_2_1") - , mTestIndex(0) + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_8() { - AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); - AddArgument("cluster", &mCluster); - AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); - AddArgument("timeout", 0, UINT16_MAX, &mTimeout); - } + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - ~Test_TC_LVL_2_1() {} + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 3UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional global attribute : FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id featureMapArgument; + featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_11() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_LVL_2_1 : public TestCommandBridge { +public: + Test_TC_LVL_2_1() + : TestCommandBridge("Test_TC_LVL_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); + } + + ~Test_TC_LVL_2_1() {} /////////// TestCommand Interface ///////// void NextTest() override @@ -17804,8 +17868,8 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { err = TestSendsAMoveToLevelCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait a second\n"); - err = TestWaitASecond_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 11000 second\n"); + err = TestWait11000Second_8(); break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); @@ -17820,8 +17884,8 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { err = TestSendsAMoveToLevelCommand_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 10ms\n"); - err = TestWait10ms_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); + err = TestWait1000ms_12(); break; case 13: ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); @@ -17874,11 +17938,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 254)); - } - + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); NextTest(); }]; @@ -17896,11 +17956,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("min level", actualValue, 0)); - } - + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); NextTest(); }]; @@ -17918,11 +17974,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("max level", actualValue, 254)); - } - + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); NextTest(); }]; @@ -17937,7 +17989,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; params.level = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:0U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveToLevelWithParams:params @@ -17987,8 +18039,8 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:128]; - params.transitionTime = [NSNumber numberWithUnsignedShort:1U]; + params.level = [NSNumber numberWithUnsignedChar:100]; + params.transitionTime = [NSNumber numberWithUnsignedShort:100U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveToLevelWithParams:params @@ -18003,9 +18055,9 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWaitASecond_8() + CHIP_ERROR TestWait11000Second_8() { - WaitForMs(1000); + WaitForMs(11000); return CHIP_NO_ERROR; } @@ -18022,7 +18074,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 128)); + VerifyOrReturn(CheckValue("current level", actualValue, 100)); } NextTest(); @@ -18042,11 +18094,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("on off transition time", actualValue, 0U)); - } - + VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); NextTest(); }]; @@ -18060,7 +18108,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[CHIPLevelControlClusterMoveToLevelParams alloc] init]; - params.level = [NSNumber numberWithUnsignedChar:254]; + params.level = [NSNumber numberWithUnsignedChar:128]; params.transitionTime = [NSNumber numberWithUnsignedShort:65535U]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; @@ -18076,9 +18124,9 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait10ms_12() + CHIP_ERROR TestWait1000ms_12() { - WaitForMs(100); + WaitForMs(1000); return CHIP_NO_ERROR; } @@ -18095,7 +18143,7 @@ class Test_TC_LVL_3_1 : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 254)); + VerifyOrReturn(CheckValue("current level", actualValue, 128)); } NextTest(); @@ -18175,16 +18223,16 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); + err = TestReadsMaxLevelAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); + err = TestSendsAMoveUpCommand_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : user prompt message\n"); + err = TestUserPromptMessage_3(); break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); @@ -18203,16 +18251,16 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { err = TestSendsAMoveDownCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); - err = TestWait3000ms_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : user prompt message\n"); + err = TestUserPromptMessage_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); + err = TestWait5000ms_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Write default move rate attribute from DUT\n"); - err = TestWriteDefaultMoveRateAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); break; case 11: ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); @@ -18231,12 +18279,16 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { err = TestReadsCurrentLevelAttributeFromDut_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reset level to 254\n"); - err = TestResetLevelTo254_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : user prompt message\n"); + err = TestUserPromptMessage_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Wait 100ms\n"); - err = TestWait100ms_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : Reset level to 254\n"); + err = TestResetLevelTo254_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Wait 100ms\n"); + err = TestWait100ms_17(); break; } @@ -18253,7 +18305,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 17; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; @@ -18265,30 +18317,9 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + NSNumber * _Nonnull MaxlevelValue; - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeCurrentLevelWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads CurrentLevel attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 254)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_2() + CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -18299,9 +18330,9 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); { - id actualValue = value; - VerifyOrReturn(CheckValue("max level", actualValue, 254)); + MaxlevelValue = value; } NextTest(); @@ -18310,7 +18341,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAMoveUpCommand_3() + CHIP_ERROR TestSendsAMoveUpCommand_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -18318,7 +18349,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; params.moveMode = [NSNumber numberWithUnsignedChar:0]; - params.rate = [NSNumber numberWithUnsignedChar:200]; + params.rate = [NSNumber numberWithUnsignedChar:32]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveWithParams:params @@ -18333,6 +18364,13 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + CHIP_ERROR TestUserPromptMessage_3() + { + UserPrompt(@"Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to this rate " + @"and completes moving to its maximum level"); + return CHIP_NO_ERROR; + } + CHIP_ERROR TestWait3000ms_4() { WaitForMs(3000); @@ -18352,7 +18390,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 254)); + VerifyOrReturn(CheckValue("current level", actualValue, MaxlevelValue)); } NextTest(); @@ -18360,6 +18398,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + NSNumber * _Nonnull MinlevelValue; CHIP_ERROR TestReadsMinLevelAttributeFromDut_6() { @@ -18372,9 +18411,9 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); { - id actualValue = value; - VerifyOrReturn(CheckValue("min level", actualValue, 0)); + MinlevelValue = value; } NextTest(); @@ -18391,7 +18430,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { __auto_type * params = [[CHIPLevelControlClusterMoveParams alloc] init]; params.moveMode = [NSNumber numberWithUnsignedChar:1]; - params.rate = [NSNumber numberWithUnsignedChar:250]; + params.rate = [NSNumber numberWithUnsignedChar:64]; params.optionMask = [NSNumber numberWithUnsignedChar:1]; params.optionOverride = [NSNumber numberWithUnsignedChar:1]; [cluster moveWithParams:params @@ -18406,13 +18445,20 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait3000ms_8() + CHIP_ERROR TestUserPromptMessage_8() { - WaitForMs(3000); + UserPrompt(@"Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to this rate " + @"and complete moving to its minimum level"); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + CHIP_ERROR TestWait5000ms_9() + { + WaitForMs(5000); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -18423,6 +18469,11 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); + { + id actualValue = value; + VerifyOrReturn(CheckValue("current level", actualValue, 1)); + } + if (value != nil) { VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 0)); } @@ -18435,26 +18486,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - - CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_10() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id defaultMoveRateArgument; - defaultMoveRateArgument = [NSNumber numberWithUnsignedChar:20]; - [cluster writeAttributeDefaultMoveRateWithValue:defaultMoveRateArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Write default move rate attribute from DUT Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } + NSNumber * _Nullable DefaultMoveRateValue; CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() { @@ -18467,10 +18499,9 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); { - id actualValue = value; - VerifyOrReturn(CheckValueNonNull("default move rate", actualValue)); - VerifyOrReturn(CheckValue("default move rate", actualValue, 20)); + DefaultMoveRateValue = value; } NextTest(); @@ -18529,7 +18560,14 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestResetLevelTo254_15() + CHIP_ERROR TestUserPromptMessage_15() + { + UserPrompt( + @"Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestResetLevelTo254_16() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -18552,7 +18590,7 @@ class Test_TC_LVL_4_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait100ms_16() + CHIP_ERROR TestWait100ms_17() { WaitForMs(100); return CHIP_NO_ERROR; @@ -18604,32 +18642,32 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { err = TestSendingOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to its lowest point\n"); + err = TestPreconditionDutLevelIsSetToItsLowestPoint_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 4000ms\n"); - err = TestWait4000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); + err = TestWait3000ms_3(); break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step down command to DUT\n"); - err = TestSendsStepDownCommandToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step up command to DUT\n"); + err = TestSendsStepUpCommandToDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 4000ms\n"); - err = TestWait4000ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 5000ms\n"); + err = TestWait5000ms_6(); break; case 7: ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step up command\n"); - err = TestSendsAStepUpCommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step down command\n"); + err = TestSendsAStepDownCommand_8(); break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 4000ms\n"); @@ -18696,7 +18734,7 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_2() + CHIP_ERROR TestPreconditionDutLevelIsSetToItsLowestPoint_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -18704,13 +18742,13 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; params.stepMode = [NSNumber numberWithUnsignedChar:1]; - params.stepSize = [NSNumber numberWithUnsignedChar:126]; + params.stepSize = [NSNumber numberWithUnsignedChar:100]; params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; params.optionMask = [NSNumber numberWithUnsignedChar:0]; params.optionOverride = [NSNumber numberWithUnsignedChar:0]; [cluster stepWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Precondition: DUT level is set to 0x80 Error: %@", err); + NSLog(@"Precondition: DUT level is set to its lowest point Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); @@ -18720,11 +18758,12 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait4000ms_3() + CHIP_ERROR TestWait3000ms_3() { - WaitForMs(4000); + WaitForMs(3000); return CHIP_NO_ERROR; } + NSNumber * _Nonnull CurrentlevelValue; CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() { @@ -18737,9 +18776,9 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); { - id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 128)); + CurrentlevelValue = value; } NextTest(); @@ -18748,21 +18787,21 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsStepDownCommandToDut_5() + CHIP_ERROR TestSendsStepUpCommandToDut_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:1]; + params.stepMode = [NSNumber numberWithUnsignedChar:0]; params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; params.optionMask = [NSNumber numberWithUnsignedChar:0]; params.optionOverride = [NSNumber numberWithUnsignedChar:0]; [cluster stepWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends step down command to DUT Error: %@", err); + NSLog(@"Sends step up command to DUT Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); @@ -18772,9 +18811,9 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWait4000ms_6() + CHIP_ERROR TestWait5000ms_6() { - WaitForMs(4000); + WaitForMs(5000); return CHIP_NO_ERROR; } @@ -18789,9 +18828,8 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 64)); + if (value != nil) { + VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, CurrentlevelValue)); } NextTest(); @@ -18800,21 +18838,21 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestSendsAStepUpCommand_8() + CHIP_ERROR TestSendsAStepDownCommand_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestLevelControl * cluster = [[CHIPTestLevelControl alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); __auto_type * params = [[CHIPLevelControlClusterStepParams alloc] init]; - params.stepMode = [NSNumber numberWithUnsignedChar:0]; + params.stepMode = [NSNumber numberWithUnsignedChar:1]; params.stepSize = [NSNumber numberWithUnsignedChar:64]; - params.transitionTime = [NSNumber numberWithUnsignedShort:20U]; + params.transitionTime = [NSNumber numberWithUnsignedShort:2U]; params.optionMask = [NSNumber numberWithUnsignedChar:0]; params.optionOverride = [NSNumber numberWithUnsignedChar:0]; [cluster stepWithParams:params completionHandler:^(NSError * _Nullable err) { - NSLog(@"Sends a Step up command Error: %@", err); + NSLog(@"Sends a Step down command Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); @@ -18843,7 +18881,7 @@ class Test_TC_LVL_5_1 : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("current level", actualValue, 128)); + VerifyOrReturn(CheckValue("current level", actualValue, CurrentlevelValue)); } NextTest(); @@ -19056,6 +19094,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { WaitForMs(100); return CHIP_NO_ERROR; } + NSNumber * _Nonnull CurrentLevelValue; CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() { @@ -19074,6 +19113,9 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 1)); } + { + CurrentLevelValue = value; + } NextTest(); }]; @@ -19143,10 +19185,7 @@ class Test_TC_LVL_6_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("currentLevel", [value unsignedCharValue], 2)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", [value unsignedCharValue], 3)); + VerifyOrReturn(CheckConstraintNotValue("currentLevel", value, CurrentLevelValue)); } NextTest(); @@ -22050,12 +22089,12 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { err = TestReadsOccupancyAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads Occupancy attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back Occupancy attribute from DUT after few seconds\n"); if (ShouldSkip("A_OCCUPANCY")) { NextTest(); return; } - err = TestReadsOccupancyAttributeFromDut_2(); + err = TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2(); break; } @@ -22084,6 +22123,7 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } + NSNumber * _Nonnull OccupancyValue; CHIP_ERROR TestReadsOccupancyAttributeFromDut_1() { @@ -22098,14 +22138,21 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("occupancy", actualValue, 0)); + } + { + OccupancyValue = value; + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOccupancyAttributeFromDut_2() + CHIP_ERROR TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestOccupancySensing * cluster = [[CHIPTestOccupancySensing alloc] initWithDevice:device @@ -22114,11 +22161,10 @@ class Test_TC_OCC_2_2 : public TestCommandBridge { VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeOccupancyWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads Occupancy attribute from DUT Error: %@", err); + NSLog(@"Reads back Occupancy attribute from DUT after few seconds Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); NextTest(); }]; @@ -24462,21 +24508,16 @@ class Test_TC_PS_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress( - chipTool, " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -24493,7 +24534,7 @@ class Test_TC_PS_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -24528,79 +24569,54 @@ class Test_TC_PS_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute constraints: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeClusterRevisionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"reads back global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); - } + VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestPowerSource * cluster = [[CHIPTestPowerSource alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -25112,8 +25128,28 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); break; } @@ -25130,7 +25166,7 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 10; chip::Optional mNodeId; chip::Optional mCluster; @@ -25206,7 +25242,71 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_4() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device @@ -25225,6 +25325,52 @@ class Test_TC_PCC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id featureMapArgument; + featureMapArgument = [NSNumber numberWithUnsignedInt:0UL]; + [cluster writeAttributeFeatureMapWithValue:featureMapArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"write the default values to optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestPumpConfigurationAndControl * cluster = [[CHIPTestPumpConfigurationAndControl alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"reads back optional global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class Test_TC_PCC_2_1 : public TestCommandBridge { @@ -26452,6 +26598,9 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintMinValue("minConstTemp", [value shortValue], -27315)); } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minConstTemp", [value shortValue], 32767)); + } NextTest(); }]; @@ -26481,6 +26630,9 @@ class Test_TC_PCC_2_1 : public TestCommandBridge { if (value != nil) { VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", [value shortValue], -27315)); } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxConstTemp", [value shortValue], 32767)); + } NextTest(); }]; @@ -27245,13 +27397,16 @@ class Test_TC_RH_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -27268,7 +27423,7 @@ class Test_TC_RH_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -27301,7 +27456,7 @@ class Test_TC_RH_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device @@ -27309,22 +27464,19 @@ class Test_TC_RH_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:1U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device @@ -27332,12 +27484,32 @@ class Test_TC_RH_1_1 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -27394,12 +27566,8 @@ class Test_TC_RH_2_1 : public TestCommandBridge { err = TestReadsConstraintsOfAttributeMinMeasuredValue_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the optional attribute: Tolerance\n"); - err = TestReadsTheOptionalAttributeTolerance_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads constraints of attribute: Tolerance\n"); - err = TestReadsConstraintsOfAttributeTolerance_4(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads constraints of attribute: Tolerance\n"); + err = TestReadsConstraintsOfAttributeTolerance_3(); break; } @@ -27416,7 +27584,7 @@ class Test_TC_RH_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -27442,7 +27610,14 @@ class Test_TC_RH_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); + } + NextTest(); }]; @@ -27462,7 +27637,7 @@ class Test_TC_RH_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); if (value != nil) { VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); } @@ -27476,36 +27651,7 @@ class Test_TC_RH_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsTheOptionalAttributeTolerance_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeToleranceWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads the optional attribute: Tolerance Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("tolerance", actualValue, 0U)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_4() + CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device @@ -27579,20 +27725,24 @@ class Test_TC_RH_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads MeasuredValue attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads MeasuredValue attribute from DUT\n"); if (ShouldSkip("A_RELATIVEHUMIDITY")) { NextTest(); return; } - err = TestReadsMeasuredValueAttributeFromDut_1(); + err = TestReadsMeasuredValueAttributeFromDut_2(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the mandatory attribute: MeasuredValue\n"); + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the mandatory attribute: MeasuredValue\n"); if (ShouldSkip("A_RELATIVEHUMIDITY")) { NextTest(); return; } - err = TestReadTheMandatoryAttributeMeasuredValue_2(); + err = TestReadTheMandatoryAttributeMeasuredValue_3(); break; } @@ -27609,7 +27759,7 @@ class Test_TC_RH_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -27622,7 +27772,7 @@ class Test_TC_RH_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_1() + CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device @@ -27630,19 +27780,53 @@ class Test_TC_RH_2_2 : public TestCommandBridge { queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of attribute: MinMeasuredValue Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_2() + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value unsignedShortValue], 9999U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads MeasuredValue attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("measuredValue", [value unsignedShortValue], 0U)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", [value unsignedShortValue], 10000U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestRelativeHumidityMeasurement * cluster = [[CHIPTestRelativeHumidityMeasurement alloc] initWithDevice:device @@ -28404,13 +28588,8 @@ class Test_TC_TM_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; } @@ -28427,7 +28606,7 @@ class Test_TC_TM_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -28460,30 +28639,7 @@ class Test_TC_TM_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device - endpoint:1 - queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:4U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device @@ -28549,8 +28705,16 @@ class Test_TC_TM_2_1 : public TestCommandBridge { err = TestReadTheMandatoryAttributeMeasuredValue_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional attribute: Tolerance\n"); + err = TestReadTheOptionalAttributeTolerance_4(); break; } @@ -28567,7 +28731,7 @@ class Test_TC_TM_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -28600,7 +28764,61 @@ class Test_TC_TM_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeTolerance_2() + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeTolerance_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device @@ -28674,20 +28892,28 @@ class Test_TC_TM_2_2 : public TestCommandBridge { err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads MeasuredValue attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads MeasuredValue attribute from DUT\n"); if (ShouldSkip("A_TEMPERATURE")) { NextTest(); return; } - err = TestReadsMeasuredValueAttributeFromDut_1(); + err = TestReadsMeasuredValueAttributeFromDut_3(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the mandatory attribute: MeasuredValue\n"); + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute: MeasuredValue\n"); if (ShouldSkip("A_TEMPERATURE")) { NextTest(); return; } - err = TestReadTheMandatoryAttributeMeasuredValue_2(); + err = TestReadTheMandatoryAttributeMeasuredValue_4(); break; } @@ -28704,7 +28930,7 @@ class Test_TC_TM_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -28717,7 +28943,61 @@ class Test_TC_TM_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_1() + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MinMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", [value shortValue], -27315)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", [value shortValue], 32766)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device + endpoint:1 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaxMeasuredValueWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: MaxMeasuredValue Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", [value shortValue], -27314)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", [value shortValue], 32767)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device @@ -28737,7 +29017,7 @@ class Test_TC_TM_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_2() + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestTemperatureMeasurement * cluster = [[CHIPTestTemperatureMeasurement alloc] initWithDevice:device @@ -28803,17 +29083,12 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the optional global attribute constraints: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_4(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the optional global attribute constraints: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3(); break; } @@ -28830,7 +29105,7 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -28861,28 +29136,7 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:5U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -28900,7 +29154,7 @@ class Test_TC_TSTAT_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_4() + CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -28965,280 +29219,82 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { err = TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); + ChipLogProgress( + chipTool, " ***** Test Step 2 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); break; case 3: ChipLogProgress( - chipTool, " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_3(); + chipTool, " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3(); break; case 4: - ChipLogProgress(chipTool, - " ***** Test Step 4 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMinHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinHeatSetpointLimit_4(); + ChipLogProgress( + chipTool, " ***** Test Step 4 : Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read back mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMinHeatSetpointLimit_5(); + ChipLogProgress( + chipTool, " ***** Test Step 5 : Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_6(); + ChipLogProgress( + chipTool, " ***** Test Step 6 : Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6(); break; case 7: ChipLogProgress( - chipTool, " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_7(); + chipTool, " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7(); break; case 8: - ChipLogProgress(chipTool, - " ***** Test Step 8 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMaxHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxHeatSetpointLimit_8(); + ChipLogProgress( + chipTool, " ***** Test Step 8 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read back mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_9(); + ChipLogProgress( + chipTool, " ***** Test Step 9 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads mandatory attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMinCoolSetpointLimit_10(); + ChipLogProgress( + chipTool, " ***** Test Step 10 : Reads constraints of optional attributes from DUT: MinCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10(); break; case 11: ChipLogProgress( - chipTool, " ***** Test Step 11 : Reads constraints of mandatory attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinCoolSetpointLimit_11(); + chipTool, " ***** Test Step 11 : Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11(); break; case 12: - ChipLogProgress(chipTool, - " ***** Test Step 12 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMinCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinCoolSetpointLimit_12(); + ChipLogProgress( + chipTool, " ***** Test Step 12 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read back mandatory attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMinCoolSetpointLimit_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads mandatory attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_14(); + ChipLogProgress( + chipTool, " ***** Test Step 14 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14(); break; case 15: - ChipLogProgress( - chipTool, " ***** Test Step 15 : Reads constraints of mandatory attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15(); break; case 16: - ChipLogProgress(chipTool, - " ***** Test Step 16 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMaxCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxCoolSetpointLimit_16(); - break; - case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read back mandatory attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Reads mandatory attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadsMandatoryAttributesFromDutOccupiedCoolingSetpoint_18(); - break; - case 19: ChipLogProgress( - chipTool, " ***** Test Step 19 : Reads constraints of mandatory attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedCoolingSetpoint_19(); + chipTool, " ***** Test Step 16 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16(); break; - case 20: - ChipLogProgress(chipTool, - " ***** Test Step 20 : Writes the respective default value to mandatory attributes to DUT: " - "OccupiedCoolingSetpoint\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedCoolingSetpoint_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Read back mandatory attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadBackMandatoryAttributesFromDutOccupiedCoolingSetpoint_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Reads mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadsMandatoryAttributesFromDutOccupiedHeatingSetpoint_22(); - break; - case 23: + case 17: ChipLogProgress( - chipTool, " ***** Test Step 23 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : Writes the respective default value to mandatory attributes to DUT: " - "OccupiedHeatingSetpoint\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedHeatingSetpoint_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Read back mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadBackMandatoryAttributesFromDutOccupiedHeatingSetpoint_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Reads mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMinHeatSetpointLimit_26(); - break; - case 27: - ChipLogProgress( - chipTool, " ***** Test Step 27 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_27(); - break; - case 28: - ChipLogProgress(chipTool, - " ***** Test Step 28 : Writes the respective default value to mandatory attributes to DUT: MinHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinHeatSetpointLimit_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Read back mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMinHeatSetpointLimit_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Reads mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMaxHeatSetpointLimit_30(); - break; - case 31: - ChipLogProgress( - chipTool, " ***** Test Step 31 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_31(); - break; - case 32: - ChipLogProgress(chipTool, - " ***** Test Step 32 : Writes the respective default value to mandatory attributes to DUT: MaxHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxHeatSetpointLimit_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read back mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMaxHeatSetpointLimit_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Reads mandatory attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMinCoolSetpointLimit_34(); - break; - case 35: - ChipLogProgress( - chipTool, " ***** Test Step 35 : Reads constraints of mandatory attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMinCoolSetpointLimit_35(); - break; - case 36: - ChipLogProgress(chipTool, - " ***** Test Step 36 : Writes the respective default value to mandatory attributes to DUT: MinCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinCoolSetpointLimit_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Read back mandatory attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMinCoolSetpointLimit_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Reads mandatory attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMaxCoolSetpointLimit_38(); - break; - case 39: - ChipLogProgress( - chipTool, " ***** Test Step 39 : Reads constraints of mandatory attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxCoolSetpointLimit_39(); - break; - case 40: - ChipLogProgress(chipTool, - " ***** Test Step 40 : Writes the respective default value to mandatory attributes to DUT: MaxCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxCoolSetpointLimit_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read back mandatory attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMaxCoolSetpointLimit_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Reads mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadsMandatoryAttributesFromDutControlSequenceOfOperation_42(); - break; - case 43: - ChipLogProgress( - chipTool, " ***** Test Step 43 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_43(); - break; - case 44: - ChipLogProgress(chipTool, - " ***** Test Step 44 : Writes the respective default value to mandatory attributes to DUT: " - "ControlSequenceOfOperation\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutControlSequenceOfOperation_44(); - break; - case 45: - ChipLogProgress( - chipTool, " ***** Test Step 45 : Read back mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadBackMandatoryAttributesFromDutControlSequenceOfOperation_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Reads mandatory attributes from DUT: SystemMode\n"); - err = TestReadsMandatoryAttributesFromDutSystemMode_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_47(); - break; - case 48: - ChipLogProgress( - chipTool, " ***** Test Step 48 : Writes the respective default value to mandatory attributes to DUT: SystemMode\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutSystemMode_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Read back mandatory attributes from DUT: SystemMode\n"); - err = TestReadBackMandatoryAttributesFromDutSystemMode_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Reads optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadsOptionalAttributesFromDutMinSetpointDeadBand_50(); - break; - case 51: - ChipLogProgress( - chipTool, " ***** Test Step 51 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_51(); - break; - case 52: - ChipLogProgress(chipTool, - " ***** Test Step 52 : Writes the respective default value to optional attributes to DUT: MinSetpointDeadBand\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutMinSetpointDeadBand_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Read back optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadBackOptionalAttributesFromDutMinSetpointDeadBand_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_54(); - break; - case 55: - ChipLogProgress( - chipTool, " ***** Test Step 55 : Writes the respective default value to optional attributes to DUT: StartOfWeek\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutStartOfWeek_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Read back optional attributes from DUT: StartOfWeek\n"); - err = TestReadBackOptionalAttributesFromDutStartOfWeek_56(); - break; - case 57: - ChipLogProgress( - chipTool, " ***** Test Step 57 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_57(); - break; - case 58: - ChipLogProgress(chipTool, - " ***** Test Step 58 : Writes the respective default value to optional attributes to DUT: " - "NumberOfWeeklyTransitions\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfWeeklyTransitions_58(); - break; - case 59: - ChipLogProgress( - chipTool, " ***** Test Step 59 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_59(); - break; - case 60: - ChipLogProgress(chipTool, - " ***** Test Step 60 : Writes the respective default value to optional attributes to DUT: " - "NumberOfDailyTransitions\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfDailyTransitions_60(); + chipTool, " ***** Test Step 17 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17(); break; } @@ -29255,7 +29311,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 61; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; @@ -29286,29 +29342,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs min heat setpoint limit", actualValue, 700)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_3() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -29333,72 +29367,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinHeatSetpointLimit_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id absMinHeatSetpointLimitArgument; - absMinHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeAbsMinHeatSetpointLimitWithValue:absMinHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMinHeatSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMinHeatSetpointLimit_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs min heat setpoint limit", actualValue, 700)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_6() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs max heat setpoint limit", actualValue, 3000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_7() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -29423,883 +29392,88 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxHeatSetpointLimit_8() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id absMaxHeatSetpointLimitArgument; - absMaxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeAbsMaxHeatSetpointLimitWithValue:absMaxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMaxHeatSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_9() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs max heat setpoint limit", actualValue, 3000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMinCoolSetpointLimit_10() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs min cool setpoint limit", actualValue, 1600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinCoolSetpointLimit_11() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", [value shortValue], 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinCoolSetpointLimit_12() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id absMinCoolSetpointLimitArgument; - absMinCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeAbsMinCoolSetpointLimitWithValue:absMinCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMinCoolSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMinCoolSetpointLimit_13() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeAbsMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs min cool setpoint limit", actualValue, 1600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_14() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs max cool setpoint limit", actualValue, 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_15() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", [value shortValue], 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxCoolSetpointLimit_16() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id absMaxCoolSetpointLimitArgument; - absMaxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeAbsMaxCoolSetpointLimitWithValue:absMaxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"AbsMaxCoolSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_17() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("abs max cool setpoint limit", actualValue, 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutOccupiedCoolingSetpoint_18() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupied cooling setpoint", actualValue, 2600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedCoolingSetpoint_19() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", [value shortValue], 2600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedCoolingSetpoint_20() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = [NSNumber numberWithShort:2600]; - [cluster writeAttributeOccupiedCoolingSetpointWithValue:occupiedCoolingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"OccupiedCoolingSetpoint Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutOccupiedCoolingSetpoint_21() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupied cooling setpoint", actualValue, 2600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutOccupiedHeatingSetpoint_22() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupied heating setpoint", actualValue, 2000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_23() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", [value shortValue], 2600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedHeatingSetpoint_24() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = [NSNumber numberWithShort:2000]; - [cluster writeAttributeOccupiedHeatingSetpointWithValue:occupiedHeatingSetpointArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"OccupiedHeatingSetpoint Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutOccupiedHeatingSetpoint_25() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("occupied heating setpoint", actualValue, 2000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutMinHeatSetpointLimit_26() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("min heat setpoint limit", actualValue, 700)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_27() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", [value shortValue], 3000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinHeatSetpointLimit_28() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = [NSNumber numberWithShort:700]; - [cluster writeAttributeMinHeatSetpointLimitWithValue:minHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MinHeatSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMinHeatSetpointLimit_29() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("min heat setpoint limit", actualValue, 700)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutMaxHeatSetpointLimit_30() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("max heat setpoint limit", actualValue, 3000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_31() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", [value shortValue], 700)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", [value shortValue], 3000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxHeatSetpointLimit_32() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = [NSNumber numberWithShort:3000]; - [cluster writeAttributeMaxHeatSetpointLimitWithValue:maxHeatSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MaxHeatSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMaxHeatSetpointLimit_33() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("max heat setpoint limit", actualValue, 3000)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutMinCoolSetpointLimit_34() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("min cool setpoint limit", actualValue, 1600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinCoolSetpointLimit_35() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", [value shortValue], 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinCoolSetpointLimit_36() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = [NSNumber numberWithShort:1600]; - [cluster writeAttributeMinCoolSetpointLimitWithValue:minCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MinCoolSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMinCoolSetpointLimit_37() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MinCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("min cool setpoint limit", actualValue, 1600)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutMaxCoolSetpointLimit_38() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("max cool setpoint limit", actualValue, 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxCoolSetpointLimit_39() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", [value shortValue], 1600)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", [value shortValue], 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxCoolSetpointLimit_40() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = [NSNumber numberWithShort:3200]; - [cluster writeAttributeMaxCoolSetpointLimitWithValue:maxCoolSetpointLimitArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"MaxCoolSetpointLimit Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMaxCoolSetpointLimit_41() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: MaxCoolSetpointLimit Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("max cool setpoint limit", actualValue, 3200)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutControlSequenceOfOperation_42() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("control sequence of operation", actualValue, 4)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_43() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); - if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", [value unsignedCharValue], 0)); - } - if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", [value unsignedCharValue], 5)); - } + NSLog(@"Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutControlSequenceOfOperation_44() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + return; + } - id controlSequenceOfOperationArgument; - controlSequenceOfOperationArgument = [NSNumber numberWithUnsignedChar:4]; - [cluster writeAttributeControlSequenceOfOperationWithValue:controlSequenceOfOperationArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: " - @"ControlSequenceOfOperation Error: %@", - err); + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", [value shortValue], 3200)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadBackMandatoryAttributesFromDutControlSequenceOfOperation_45() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster - readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); + [cluster readAttributeAbsMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } - { - id actualValue = value; - VerifyOrReturn(CheckValue("control sequence of operation", actualValue, 4)); - } + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", [value shortValue], 3200)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsMandatoryAttributesFromDutSystemMode_46() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads mandatory attributes from DUT: SystemMode Error: %@", err); + [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint Error: %@", err); + + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("system mode", actualValue, 1)); + VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", [value shortValue], 2600)); } NextTest(); @@ -30308,23 +29482,23 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_47() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode Error: %@", err); + [cluster readAttributeOccupiedHeatingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); + VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("systemMode", [value unsignedCharValue], 0)); + VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", [value shortValue], 700)); } if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("systemMode", [value unsignedCharValue], 9)); + VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", [value shortValue], 2600)); } NextTest(); @@ -30333,42 +29507,48 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutSystemMode_48() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id systemModeArgument; - systemModeArgument = [NSNumber numberWithUnsignedChar:1]; - [cluster - writeAttributeSystemModeWithValue:systemModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to mandatory attributes to DUT: SystemMode Error: %@", - err); + [cluster readAttributeMinHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", [value shortValue], 3000)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadBackMandatoryAttributesFromDutSystemMode_49() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back mandatory attributes from DUT: SystemMode Error: %@", err); + [cluster readAttributeMaxHeatSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("system mode", actualValue, 1)); + VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", [value shortValue], 700)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", [value shortValue], 3000)); } NextTest(); @@ -30377,14 +29557,14 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsOptionalAttributesFromDutMinSetpointDeadBand_50() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads optional attributes from DUT: MinSetpointDeadBand Error: %@", err); + [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MinCoolSetpointLimit Error: %@", err); if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { NextTest(); @@ -30393,9 +29573,12 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("min setpoint dead band", actualValue, 25)); + VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", [value shortValue], 1600)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", [value shortValue], 3200)); } NextTest(); @@ -30404,14 +29587,14 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_51() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); + [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit Error: %@", err); if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { NextTest(); @@ -30420,12 +29603,12 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("minSetpointDeadBand", "", "int8")); + VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("minSetpointDeadBand", [value charValue], 0)); + VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", [value shortValue], 1600)); } if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("minSetpointDeadBand", [value charValue], 25)); + VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", [value shortValue], 3200)); } NextTest(); @@ -30434,52 +29617,49 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutMinSetpointDeadBand_52() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id minSetpointDeadBandArgument; - minSetpointDeadBandArgument = [NSNumber numberWithChar:25]; - [cluster writeAttributeMinSetpointDeadBandWithValue:minSetpointDeadBandArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: " - @"MinSetpointDeadBand Error: %@", - err); + [cluster + readAttributeControlSequenceOfOperationWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation Error: %@", err); - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", [value unsignedCharValue], 5)); + } - NextTest(); - }]; + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadBackOptionalAttributesFromDutMinSetpointDeadBand_53() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back optional attributes from DUT: MinSetpointDeadBand Error: %@", err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } + [cluster readAttributeSystemModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of mandatory attributes from DUT: SystemMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("min setpoint dead band", actualValue, 25)); + VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("systemMode", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("systemMode", [value unsignedCharValue], 9)); } NextTest(); @@ -30488,14 +29668,14 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_54() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); + [cluster readAttributeMinSetpointDeadBandWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads constraints of optional attributes from DUT: MinSetpointDeadBand Error: %@", err); if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { NextTest(); @@ -30504,12 +29684,12 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("startOfWeek", "", "enum8")); + VerifyOrReturn(CheckConstraintType("minSetpointDeadBand", "", "int8")); if (value != nil) { - VerifyOrReturn(CheckConstraintMinValue("startOfWeek", [value unsignedCharValue], 0)); + VerifyOrReturn(CheckConstraintMinValue("minSetpointDeadBand", [value charValue], 0)); } if (value != nil) { - VerifyOrReturn(CheckConstraintMaxValue("startOfWeek", [value unsignedCharValue], 6)); + VerifyOrReturn(CheckConstraintMaxValue("minSetpointDeadBand", [value charValue], 25)); } NextTest(); @@ -30518,40 +29698,14 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutStartOfWeek_55() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id startOfWeekArgument; - startOfWeekArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeStartOfWeekWithValue:startOfWeekArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: StartOfWeek Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadBackOptionalAttributesFromDutStartOfWeek_56() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); [cluster readAttributeStartOfWeekWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read back optional attributes from DUT: StartOfWeek Error: %@", err); + NSLog(@"Reads constraints of optional attributes from DUT: StartOfWeek Error: %@", err); if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { NextTest(); @@ -30560,9 +29714,12 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); - { - id actualValue = value; - VerifyOrReturn(CheckValue("start of week", actualValue, 0)); + VerifyOrReturn(CheckConstraintType("startOfWeek", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("startOfWeek", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("startOfWeek", [value unsignedCharValue], 6)); } NextTest(); @@ -30571,7 +29728,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_57() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -30595,33 +29752,7 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfWeeklyTransitions_58() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id numberOfWeeklyTransitionsArgument; - numberOfWeeklyTransitionsArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNumberOfWeeklyTransitionsWithValue:numberOfWeeklyTransitionsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: " - @"NumberOfWeeklyTransitions Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_59() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; @@ -30643,32 +29774,6 @@ class Test_TC_TSTAT_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfDailyTransitions_60() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostat * cluster = [[CHIPTestThermostat alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id numberOfDailyTransitionsArgument; - numberOfDailyTransitionsArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeNumberOfDailyTransitionsWithValue:numberOfDailyTransitionsArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"Writes the respective default value to optional attributes to DUT: " - @"NumberOfDailyTransitions Error: %@", - err); - - if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { - NextTest(); - return; - } - - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; class Test_TC_TSTAT_2_2 : public TestCommandBridge { @@ -31187,6 +30292,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { NSLog(@"Reads OccupiedCoolingSetpoint attribute from Server DUT and verifies that the value is within range Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); { @@ -31222,6 +30332,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"OccupiedCoolingSetpoint attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31239,6 +30354,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { [cluster readAttributeOccupiedCoolingSetpointWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads it back again to confirm the successful write of OccupiedCoolingSetpoint attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); { @@ -31266,6 +30386,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31288,6 +30413,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31663,6 +30793,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { NSLog( @"Reads MinCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); { @@ -31698,6 +30833,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31715,6 +30855,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { [cluster readAttributeMinCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads it back again to confirm the successful write of MinCoolSetpointLimit attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); { @@ -31742,6 +30887,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31764,6 +30914,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31782,6 +30937,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { NSLog( @"Reads MaxCoolSetpointLimit attribute from Server DUT and verifies that the value is within range Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); { @@ -31817,6 +30977,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31834,6 +30999,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { [cluster readAttributeMaxCoolSetpointLimitWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { NSLog(@"Reads it back again to confirm the successful write of MaxCoolSetpointLimit attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); { @@ -31861,6 +31031,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31883,6 +31058,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -31993,6 +31173,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"MinCoolSetpointLimit attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32015,6 +31200,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"MinCoolSetpointLimit attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32037,6 +31227,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"MaxCoolSetpointLimit attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32059,6 +31254,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { @"MaxCoolSetpointLimit attribute Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32195,6 +31395,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32215,6 +31420,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32235,6 +31445,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32275,6 +31490,11 @@ class Test_TC_TSTAT_2_2 : public TestCommandBridge { completionHandler:^(NSError * _Nullable err) { NSLog(@"Sets OccupiedCoolingSetpoint to default value Error: %@", err); + if (err.code == MatterInteractionErrorCodeUnsupportedAttribute) { + NextTest(); + return; + } + VerifyOrReturn(CheckValue("status", err, 0)); NextTest(); @@ -32349,13 +31569,16 @@ class Test_TC_TSUIC_1_1 : public TestCommandBridge { err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress( - chipTool, " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -32372,7 +31595,7 @@ class Test_TC_TSUIC_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -32404,41 +31627,57 @@ class Test_TC_TSUIC_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id clusterRevisionArgument; - clusterRevisionArgument = [NSNumber numberWithUnsignedShort:2U]; - [cluster - writeAttributeClusterRevisionWithValue:clusterRevisionArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write the default values to mandatory global attribute: ClusterRevision Error: %@", err); + [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); - VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - }]; + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeAttributeListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { - NSLog(@"Read the global attribute: AttributeList Error: %@", err); + [cluster readAttributeAcceptedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletionHandler:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); }]; @@ -32495,56 +31734,20 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { err = TestReadTheMandatoryAttributeTemperatureDisplayMode_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : write to the mandatory attribute: TemperatureDisplayMode\n"); - err = TestWriteToTheMandatoryAttributeTemperatureDisplayMode_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write to the mandatory attribute: KeypadLockout\n"); - err = TestWriteToTheMandatoryAttributeKeypadLockout_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : write to the mandatory attribute: ScheduleProgrammingVisibility\n"); - err = TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_15(); + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_6(); break; } @@ -32561,188 +31764,69 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; + const uint16_t mTestCount = 7; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; - chip::Optional mTimeout; - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("temperature display mode", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_2() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWriteToTheMandatoryAttributeTemperatureDisplayMode_3() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id temperatureDisplayModeArgument; - temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_4() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("temperature display mode", actualValue, 0)); - } - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_5() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_6() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("keypad lockout", actualValue, 0)); - } - - NextTest(); - }]; + chip::Optional mTimeout; + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_7() + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_1() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - [cluster readAttributeKeypadLockoutWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); VerifyOrReturn(CheckValue("status", err, 0)); - VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); + { + id actualValue = value; + VerifyOrReturn(CheckValue("temperature display mode", actualValue, 0)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestWriteToTheMandatoryAttributeKeypadLockout_8() + CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_2() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - id keypadLockoutArgument; - keypadLockoutArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument - completionHandler:^(NSError * _Nullable err) { - NSLog(@"write to the mandatory attribute: KeypadLockout Error: %@", err); + [cluster readAttributeTemperatureDisplayModeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"read the mandatory attribute: TemperatureDisplayMode Error: %@", err); - VerifyOrReturn(CheckValue("status", err, 0)); + VerifyOrReturn(CheckValue("status", err, 0)); - NextTest(); - }]; + VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("temperatureDisplayMode", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("temperatureDisplayMode", [value unsignedCharValue], 1)); + } + + NextTest(); + }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_9() + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_3() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -32765,7 +31849,7 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_10() + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -32778,13 +31862,20 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("keypadLockout", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("keypadLockout", [value unsignedCharValue], 5)); + } + NextTest(); }]; return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_11() + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -32808,7 +31899,7 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_12() + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -32822,52 +31913,11 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { VerifyOrReturn(CheckValue("status", err, 0)); VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_13() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - id scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:0]; - [cluster - writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument - completionHandler:^(NSError * _Nullable err) { - NSLog( - @"write to the mandatory attribute: ScheduleProgrammingVisibility Error: %@", - err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - NextTest(); - }]; - - return CHIP_NO_ERROR; - } - - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_14() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - { - id actualValue = value; - VerifyOrReturn(CheckValue("schedule programming visibility", actualValue, 0)); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("scheduleProgrammingVisibility", [value unsignedCharValue], 0)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("scheduleProgrammingVisibility", [value unsignedCharValue], 1)); } NextTest(); @@ -32875,26 +31925,6 @@ class Test_TC_TSUIC_2_1 : public TestCommandBridge { return CHIP_NO_ERROR; } - - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_15() - { - CHIPDevice * device = GetConnectedDevice(); - CHIPTestThermostatUserInterfaceConfiguration * cluster = - [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; - VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); - - [cluster - readAttributeScheduleProgrammingVisibilityWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { - NSLog(@"read the optional attribute: ScheduleProgrammingVisibility Error: %@", err); - - VerifyOrReturn(CheckValue("status", err, 0)); - - VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - NextTest(); - }]; - - return CHIP_NO_ERROR; - } }; class Test_TC_TSUIC_2_2 : public TestCommandBridge { @@ -32954,70 +31984,96 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { err = TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + ChipLogProgress( + chipTool, " ***** Test Step 3 : Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT\n"); + if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { NextTest(); return; } - err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_3(); + err = TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_4(); + err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_5(); + err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_6(); + err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_7(); + err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_8(); + err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8(); break; case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Writes a value of greater than 5 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) { + NextTest(); + return; + } + err = TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10(); + break; + case 11: ChipLogProgress( - chipTool, " ***** Test Step 9 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); + chipTool, " ***** Test Step 11 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { NextTest(); return; } - err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_9(); + err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11(); break; - case 10: + case 12: ChipLogProgress( - chipTool, " ***** Test Step 10 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + chipTool, " ***** Test Step 12 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { + NextTest(); + return; + } + err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12(); + break; + case 13: + ChipLogProgress(chipTool, + " ***** Test Step 13 : Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT\n"); if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { NextTest(); return; } - err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_10(); + err = TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13(); break; } @@ -33034,7 +32090,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 14; chip::Optional mNodeId; chip::Optional mCluster; @@ -33091,7 +32147,29 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_3() + CHIP_ERROR TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id temperatureDisplayModeArgument; + temperatureDisplayModeArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster writeAttributeTemperatureDisplayModeWithValue:temperatureDisplayModeArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 1 to TemperatureDisplayMode attribute of " + @"DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33112,7 +32190,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_4() + CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33133,7 +32211,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_5() + CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33154,7 +32232,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_6() + CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33175,7 +32253,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_7() + CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33196,7 +32274,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_8() + CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33217,7 +32295,27 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_9() + CHIP_ERROR TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id keypadLockoutArgument; + keypadLockoutArgument = [NSNumber numberWithUnsignedChar:6]; + [cluster writeAttributeKeypadLockoutWithValue:keypadLockoutArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 5 to KeypadLockout attribute of DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33240,7 +32338,7 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } - CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_10() + CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12() { CHIPDevice * device = GetConnectedDevice(); CHIPTestThermostatUserInterfaceConfiguration * cluster = @@ -33262,6 +32360,29 @@ class Test_TC_TSUIC_2_2 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestThermostatUserInterfaceConfiguration * cluster = + [[CHIPTestThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:1 queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id scheduleProgrammingVisibilityArgument; + scheduleProgrammingVisibilityArgument = [NSNumber numberWithUnsignedChar:2]; + [cluster + writeAttributeScheduleProgrammingVisibilityWithValue:scheduleProgrammingVisibilityArgument + completionHandler:^(NSError * _Nullable err) { + NSLog(@"Writes a value of greater than 1 to ScheduleProgrammingVisibility " + @"attribute of DUT Error: %@", + err); + + VerifyOrReturn(CheckValue("status", err, EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class Test_TC_DIAG_TH_NW_1_1 : public TestCommandBridge { @@ -33428,6 +32549,22 @@ class Test_TC_WIFIDIAG_1_1 : public TestCommandBridge { ChipLogProgress(chipTool, " ***** Test Step 1 : Reads NetworkInterface structure attribute from DUT\n"); err = TestReadsNetworkInterfaceStructureAttributeFromDut_1(); break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads SecurityType attribute constraints\n"); + err = TestReadsSecurityTypeAttributeConstraints_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads WiFiVersion attribute constraints\n"); + err = TestReadsWiFiVersionAttributeConstraints_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads ChannelNumber attribute constraints\n"); + err = TestReadsChannelNumberAttributeConstraints_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads RSSI attribute constraints\n"); + err = TestReadsRssiAttributeConstraints_5(); + break; } if (CHIP_NO_ERROR != err) { @@ -33443,7 +32580,7 @@ class Test_TC_WIFIDIAG_1_1 : public TestCommandBridge { private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -33475,6 +32612,93 @@ class Test_TC_WIFIDIAG_1_1 : public TestCommandBridge { return CHIP_NO_ERROR; } + + CHIP_ERROR TestReadsSecurityTypeAttributeConstraints_2() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSecurityTypeWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads SecurityType attribute constraints Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("securityType", "", "enum")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsWiFiVersionAttributeConstraints_3() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeWiFiVersionWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads WiFiVersion attribute constraints Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("wiFiVersion", "", "enum")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsChannelNumberAttributeConstraints_4() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChannelNumberWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads ChannelNumber attribute constraints Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("channelNumber", "", "uint16")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadsRssiAttributeConstraints_5() + { + CHIPDevice * device = GetConnectedDevice(); + CHIPTestWiFiNetworkDiagnostics * cluster = [[CHIPTestWiFiNetworkDiagnostics alloc] initWithDevice:device + endpoint:0 + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRssiWithCompletionHandler:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Reads RSSI attribute constraints Error: %@", err); + + VerifyOrReturn(CheckValue("status", err, 0)); + + VerifyOrReturn(CheckConstraintType("rssi", "", "int8")); + if (value != nil) { + VerifyOrReturn(CheckConstraintMinValue("rssi", [value charValue], -120)); + } + if (value != nil) { + VerifyOrReturn(CheckConstraintMaxValue("rssi", [value charValue], 0)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } }; class Test_TC_WIFIDIAG_3_1 : public TestCommandBridge { diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 2ae2ddd5dc6181..22f68a840de67a 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -3050,17 +3050,16 @@ class Test_TC_BOOL_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); break; } @@ -3118,16 +3117,20 @@ class Test_TC_BOOL_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) + { + (static_cast(context))->OnSuccessResponse_3(attributeList); + } static void OnFailureCallback_4(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); + (static_cast(context))->OnSuccessResponse_4(acceptedCommandList); } static void OnFailureCallback_5(void * context, CHIP_ERROR error) @@ -3135,9 +3138,10 @@ class Test_TC_BOOL_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_5(error); } - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_5(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) { - (static_cast(context))->OnSuccessResponse_5(attributeList); + (static_cast(context))->OnSuccessResponse_5(generatedCommandList); } // @@ -3197,36 +3201,36 @@ class Test_TC_BOOL_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::BooleanStateClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ThrowFailureResponse(); } - void OnSuccessResponse_3() { ThrowSuccessResponse(); } + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) + { + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::BooleanStateClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } @@ -3237,20 +3241,19 @@ class Test_TC_BOOL_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t clusterRevision) + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & acceptedCommandList) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::BooleanStateClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_5, OnFailureCallback_5, true)); return CHIP_NO_ERROR; } @@ -3261,9 +3264,9 @@ class Test_TC_BOOL_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & generatedCommandList) { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); } }; @@ -3319,15 +3322,6 @@ class Test_TC_BOOL_2_1Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 2 : Read mandatory non-global attribute constraints: StateValue\n"); err = TestReadMandatoryNonGlobalAttributeConstraintsStateValue_2(); break; - case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : Write the default value to mandatory non-global attribute: StateValue\n"); - err = TestWriteTheDefaultValueToMandatoryNonGlobalAttributeStateValue_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads back the mandatory non-global attribute: StateValue\n"); - err = TestReadsBackTheMandatoryNonGlobalAttributeStateValue_4(); - break; } if (CHIP_NO_ERROR != err) @@ -3344,7 +3338,7 @@ class Test_TC_BOOL_2_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -3379,23 +3373,6 @@ class Test_TC_BOOL_2_1Suite : public TestCommand (static_cast(context))->OnSuccessResponse_2(stateValue); } - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, bool stateValue) - { - (static_cast(context))->OnSuccessResponse_4(stateValue); - } - // // Tests methods // @@ -3452,53 +3429,6 @@ class Test_TC_BOOL_2_1Suite : public TestCommand VerifyOrReturn(CheckConstraintType("stateValue", "", "bool")); NextTest(); } - - CHIP_ERROR TestWriteTheDefaultValueToMandatoryNonGlobalAttributeStateValue_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - bool stateValueArgument; - stateValueArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - stateValueArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackTheMandatoryNonGlobalAttributeStateValue_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::BooleanStateClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_4(bool stateValue) - { - VerifyOrReturn(CheckValue("stateValue", stateValue, 0)); - - NextTest(); - } }; class Test_TC_BRAC_1_1Suite : public TestCommand @@ -3552,6 +3482,18 @@ class Test_TC_BRAC_1_1Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); + break; } if (CHIP_NO_ERROR != err) @@ -3568,7 +3510,7 @@ class Test_TC_BRAC_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -3603,6 +3545,38 @@ class Test_TC_BRAC_1_1Suite : public TestCommand (static_cast(context))->OnSuccessResponse_2(clusterRevision); } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) + { + (static_cast(context))->OnSuccessResponse_3(attributeList); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) + { + (static_cast(context))->OnSuccessResponse_4(acceptedCommandList); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) + { + (static_cast(context))->OnSuccessResponse_5(generatedCommandList); + } + // // Tests methods // @@ -3659,6 +3633,75 @@ class Test_TC_BRAC_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::BridgedActionsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) + { + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::BridgedActionsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & acceptedCommandList) + { + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::BridgedActionsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + } }; class Test_TC_CC_1_1Suite : public TestCommand @@ -22368,25 +22411,20 @@ class Test_TC_ILL_1_1Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : read the global attribute: ClusterRevision\n"); - err = TestReadTheGlobalAttributeClusterRevision_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute constraints: ClusterRevision\n"); + err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -22404,7 +22442,7 @@ class Test_TC_ILL_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -22434,9 +22472,9 @@ class Test_TC_ILL_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnSuccessResponse_2(attributeList); } static void OnFailureCallback_3(void * context, CHIP_ERROR error) @@ -22444,26 +22482,21 @@ class Test_TC_ILL_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); + (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); + (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) { - (static_cast(context))->OnSuccessResponse_5(attributeList); + (static_cast(context))->OnSuccessResponse_4(generatedCommandList); } // @@ -22476,7 +22509,7 @@ class Test_TC_ILL_1_1Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::IlluminanceMeasurementClusterTest cluster; @@ -22496,19 +22529,18 @@ class Test_TC_ILL_1_1Suite : public TestCommand void OnSuccessResponse_1(uint16_t clusterRevision) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); - + VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::IlluminanceMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( + cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } @@ -22519,82 +22551,57 @@ class Test_TC_ILL_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t clusterRevision) + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::IlluminanceMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; - ReturnErrorOnFailure( - cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::IlluminanceMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t clusterRevision) + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 2U)); - + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::IlluminanceMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); } }; @@ -22664,12 +22671,28 @@ class Test_TC_LVL_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeAttributeList_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Read the optional global attribute : FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : write the default values to optional global attribute: FeatureMap\n"); - err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_7(); + ChipLogProgress(chipTool, " ***** Test Step 7 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional global attribute : FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_11(); break; } @@ -22687,7 +22710,7 @@ class Test_TC_LVL_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 8; + const uint16_t mTestCount = 12; chip::Optional mNodeId; chip::Optional mCluster; @@ -22754,9 +22777,10 @@ class Test_TC_LVL_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_6(error); } - static void OnSuccessCallback_6(void * context, uint32_t featureMap) + static void OnSuccessCallback_6(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) { - (static_cast(context))->OnSuccessResponse_6(featureMap); + (static_cast(context))->OnSuccessResponse_6(acceptedCommandList); } static void OnFailureCallback_7(void * context, CHIP_ERROR error) @@ -22764,7 +22788,48 @@ class Test_TC_LVL_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_7(error); } - static void OnSuccessCallback_7(void * context) { (static_cast(context))->OnSuccessResponse_7(); } + static void OnSuccessCallback_7(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) + { + (static_cast(context))->OnSuccessResponse_7(generatedCommandList); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_8(featureMap); + } + + static void OnFailureCallback_9(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_9(error); + } + + static void OnSuccessCallback_9(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_9(featureMap); + } + + static void OnFailureCallback_10(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_10(error); + } + + static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } + + static void OnFailureCallback_11(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_11(error); + } + + static void OnSuccessCallback_11(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_11(featureMap); + } // // Tests methods @@ -22893,13 +22958,13 @@ class Test_TC_LVL_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_6, OnFailureCallback_6, true)); return CHIP_NO_ERROR; } @@ -22910,13 +22975,83 @@ class Test_TC_LVL_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_6(uint32_t featureMap) + void OnSuccessResponse_6(const chip::app::DataModel::DecodableList & acceptedCommandList) + { + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_8(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 3UL)); + + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_9(uint32_t featureMap) { VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_7() + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_10() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; @@ -22926,18 +23061,41 @@ class Test_TC_LVL_1_1Suite : public TestCommand featureMapArgument = 0UL; ReturnErrorOnFailure(cluster.WriteAttribute( - featureMapArgument, this, OnSuccessCallback_7, OnFailureCallback_7)); + featureMapArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); return CHIP_NO_ERROR; } - void OnFailureResponse_7(CHIP_ERROR error) + void OnFailureResponse_10(CHIP_ERROR error) { chip::app::StatusIB status(error); VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); NextTest(); } - void OnSuccessResponse_7() { ThrowSuccessResponse(); } + void OnSuccessResponse_10() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_11() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::LevelControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_11, OnFailureCallback_11, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_11(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_11(uint32_t featureMap) + { + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + NextTest(); + } }; class Test_TC_LVL_2_1Suite : public TestCommand @@ -24262,8 +24420,8 @@ class Test_TC_LVL_3_1Suite : public TestCommand err = TestSendsAMoveToLevelCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait a second\n"); - err = TestWaitASecond_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 11000 second\n"); + err = TestWait11000Second_8(); break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); @@ -24278,8 +24436,8 @@ class Test_TC_LVL_3_1Suite : public TestCommand err = TestSendsAMoveToLevelCommand_11(); break; case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 10ms\n"); - err = TestWait10ms_12(); + ChipLogProgress(chipTool, " ***** Test Step 12 : Wait 1000ms\n"); + err = TestWait1000ms_12(); break; case 13: ChipLogProgress(chipTool, " ***** Test Step 13 : reads CurrentLevel attribute from DUT\n"); @@ -24423,8 +24581,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_1(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); - + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); NextTest(); } @@ -24447,8 +24604,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_2(uint8_t minLevel) { - VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); - + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); NextTest(); } @@ -24471,8 +24627,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_3(uint8_t maxLevel) { - VerifyOrReturn(CheckValue("maxLevel", maxLevel, 254)); - + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); NextTest(); } @@ -24483,7 +24638,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand RequestType request; request.level = 64; - request.transitionTime = 0U; + request.transitionTime = 65535U; request.optionMask = 1; request.optionOverride = 1; @@ -24543,8 +24698,8 @@ class Test_TC_LVL_3_1Suite : public TestCommand using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; - request.level = 128; - request.transitionTime = 1U; + request.level = 100; + request.transitionTime = 100U; request.optionMask = 1; request.optionOverride = 1; @@ -24568,10 +24723,10 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestWaitASecond_8() + CHIP_ERROR TestWait11000Second_8() { SetIdentity(kIdentityAlpha); - return WaitForMs(1000); + return WaitForMs(11000); } CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() @@ -24593,7 +24748,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_9(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 100)); NextTest(); } @@ -24617,8 +24772,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_10(uint16_t onOffTransitionTime) { - VerifyOrReturn(CheckValue("onOffTransitionTime", onOffTransitionTime, 0U)); - + VerifyOrReturn(CheckConstraintType("onOffTransitionTime", "", "uint16")); NextTest(); } @@ -24628,7 +24782,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; RequestType request; - request.level = 254; + request.level = 128; request.transitionTime = 65535U; request.optionMask = 1; request.optionOverride = 1; @@ -24653,10 +24807,10 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestWait10ms_12() + CHIP_ERROR TestWait1000ms_12() { SetIdentity(kIdentityAlpha); - return WaitForMs(100); + return WaitForMs(1000); } CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_13() @@ -24678,7 +24832,7 @@ class Test_TC_LVL_3_1Suite : public TestCommand void OnSuccessResponse_13(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); NextTest(); } @@ -24765,16 +24919,16 @@ class Test_TC_LVL_4_1Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_1(); + ChipLogProgress(chipTool, " ***** Test Step 1 : reads max level attribute from DUT\n"); + err = TestReadsMaxLevelAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : reads max level attribute from DUT\n"); - err = TestReadsMaxLevelAttributeFromDut_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : sends a Move up command\n"); + err = TestSendsAMoveUpCommand_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : sends a Move up command\n"); - err = TestSendsAMoveUpCommand_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : user prompt message\n"); + err = TestUserPromptMessage_3(); break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Wait 3000ms\n"); @@ -24793,16 +24947,16 @@ class Test_TC_LVL_4_1Suite : public TestCommand err = TestSendsAMoveDownCommand_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Wait 3000ms\n"); - err = TestWait3000ms_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : user prompt message\n"); + err = TestUserPromptMessage_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : reads CurrentLevel attribute from DUT\n"); - err = TestReadsCurrentLevelAttributeFromDut_9(); + ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 5000ms\n"); + err = TestWait5000ms_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Write default move rate attribute from DUT\n"); - err = TestWriteDefaultMoveRateAttributeFromDut_10(); + ChipLogProgress(chipTool, " ***** Test Step 10 : reads CurrentLevel attribute from DUT\n"); + err = TestReadsCurrentLevelAttributeFromDut_10(); break; case 11: ChipLogProgress(chipTool, " ***** Test Step 11 : reads default move rate attribute from DUT\n"); @@ -24821,12 +24975,16 @@ class Test_TC_LVL_4_1Suite : public TestCommand err = TestReadsCurrentLevelAttributeFromDut_14(); break; case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : Reset level to 254\n"); - err = TestResetLevelTo254_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : user prompt message\n"); + err = TestUserPromptMessage_15(); break; case 16: - ChipLogProgress(chipTool, " ***** Test Step 16 : Wait 100ms\n"); - err = TestWait100ms_16(); + ChipLogProgress(chipTool, " ***** Test Step 16 : Reset level to 254\n"); + err = TestResetLevelTo254_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Wait 100ms\n"); + err = TestWait100ms_17(); break; } @@ -24844,13 +25002,17 @@ class Test_TC_LVL_4_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 17; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; chip::Optional mEndpoint; chip::Optional mTimeout; + uint8_t MaxlevelValue; + uint8_t MinlevelValue; + chip::app::DataModel::Nullable DefaultMoveRateValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override { bool isExpectedDnssdResult = false; @@ -24864,19 +25026,9 @@ class Test_TC_LVL_4_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_1(error); } - static void OnSuccessCallback_1(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_1(currentLevel); - } - - static void OnFailureCallback_2(void * context, CHIP_ERROR error) + static void OnSuccessCallback_1(void * context, uint8_t maxLevel) { - (static_cast(context))->OnFailureResponse_2(error); - } - - static void OnSuccessCallback_2(void * context, uint8_t maxLevel) - { - (static_cast(context))->OnSuccessResponse_2(maxLevel); + (static_cast(context))->OnSuccessResponse_1(maxLevel); } static void OnFailureCallback_5(void * context, CHIP_ERROR error) @@ -24899,22 +25051,15 @@ class Test_TC_LVL_4_1Suite : public TestCommand (static_cast(context))->OnSuccessResponse_6(minLevel); } - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t currentLevel) - { - (static_cast(context))->OnSuccessResponse_9(currentLevel); - } - static void OnFailureCallback_10(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_10(error); } - static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } + static void OnSuccessCallback_10(void * context, uint8_t currentLevel) + { + (static_cast(context))->OnSuccessResponse_10(currentLevel); + } static void OnFailureCallback_11(void * context, CHIP_ERROR error) { @@ -24946,13 +25091,13 @@ class Test_TC_LVL_4_1Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_1() + CHIP_ERROR TestReadsMaxLevelAttributeFromDut_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } @@ -24963,67 +25108,50 @@ class Test_TC_LVL_4_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_1(uint8_t currentLevel) - { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); - - NextTest(); - } - - CHIP_ERROR TestReadsMaxLevelAttributeFromDut_2() + void OnSuccessResponse_1(uint8_t maxLevel) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_2(uint8_t maxLevel) - { - VerifyOrReturn(CheckValue("maxLevel", maxLevel, 254)); - + VerifyOrReturn(CheckConstraintType("maxLevel", "", "uint8")); + MaxlevelValue = maxLevel; NextTest(); } - CHIP_ERROR TestSendsAMoveUpCommand_3() + CHIP_ERROR TestSendsAMoveUpCommand_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::Move::Type; RequestType request; request.moveMode = static_cast(0); - request.rate = 200; + request.rate = 32; request.optionMask = 1; request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_3(); + (static_cast(context))->OnSuccessResponse_2(); }; auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_3(error); + (static_cast(context))->OnFailureResponse_2(error); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_3(CHIP_ERROR error) + void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_3() { NextTest(); } + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestUserPromptMessage_3() + { + SetIdentity(kIdentityAlpha); + return UserPrompt("Physically verify that the DUT moves at a rate of 32 units per second or as close as possible to this " + "rate and completes moving to its maximum level"); + } CHIP_ERROR TestWait3000ms_4() { @@ -25050,7 +25178,7 @@ class Test_TC_LVL_4_1Suite : public TestCommand void OnSuccessResponse_5(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 254)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, MaxlevelValue)); NextTest(); } @@ -25074,8 +25202,8 @@ class Test_TC_LVL_4_1Suite : public TestCommand void OnSuccessResponse_6(uint8_t minLevel) { - VerifyOrReturn(CheckValue("minLevel", minLevel, 0)); - + VerifyOrReturn(CheckConstraintType("minLevel", "", "uint8")); + MinlevelValue = minLevel; NextTest(); } @@ -25086,7 +25214,7 @@ class Test_TC_LVL_4_1Suite : public TestCommand RequestType request; request.moveMode = static_cast(1); - request.rate = 250; + request.rate = 64; request.optionMask = 1; request.optionOverride = 1; @@ -25110,59 +25238,44 @@ class Test_TC_LVL_4_1Suite : public TestCommand void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestWait3000ms_8() + CHIP_ERROR TestUserPromptMessage_8() { SetIdentity(kIdentityAlpha); - return WaitForMs(3000); + return UserPrompt("Physically verify that the DUT moves at a rate of 64 units per second or as close as possible to this " + "rate and complete moving to its minimum level"); } - CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_9() + CHIP_ERROR TestWait5000ms_9() + { + SetIdentity(kIdentityAlpha); + return WaitForMs(5000); + } + + CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_10() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::LevelControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); + this, OnSuccessCallback_10, OnFailureCallback_10, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_9(CHIP_ERROR error) + void OnFailureResponse_10(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t currentLevel) + void OnSuccessResponse_10(uint8_t currentLevel) { + VerifyOrReturn(CheckValue("currentLevel", currentLevel, 1)); VerifyOrReturn(CheckConstraintMinValue("currentLevel", currentLevel, 0)); VerifyOrReturn(CheckConstraintMaxValue("currentLevel", currentLevel, 1)); NextTest(); } - CHIP_ERROR TestWriteDefaultMoveRateAttributeFromDut_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::LevelControlClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::DataModel::Nullable defaultMoveRateArgument; - defaultMoveRateArgument.SetNonNull(); - defaultMoveRateArgument.Value() = 20; - - ReturnErrorOnFailure(cluster.WriteAttribute( - defaultMoveRateArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_10() { NextTest(); } - CHIP_ERROR TestReadsDefaultMoveRateAttributeFromDut_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; @@ -25182,9 +25295,8 @@ class Test_TC_LVL_4_1Suite : public TestCommand void OnSuccessResponse_11(const chip::app::DataModel::Nullable & defaultMoveRate) { - VerifyOrReturn(CheckValueNonNull("defaultMoveRate", defaultMoveRate)); - VerifyOrReturn(CheckValue("defaultMoveRate.Value()", defaultMoveRate.Value(), 20)); - + VerifyOrReturn(CheckConstraintType("defaultMoveRate", "", "uint8")); + DefaultMoveRateValue = defaultMoveRate; NextTest(); } @@ -25249,7 +25361,14 @@ class Test_TC_LVL_4_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestResetLevelTo254_15() + CHIP_ERROR TestUserPromptMessage_15() + { + SetIdentity(kIdentityAlpha); + return UserPrompt( + "Physically verify that the device moves at the rate recorded in step 3a and completes moving to its maximum level."); + } + + CHIP_ERROR TestResetLevelTo254_16() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type; @@ -25261,26 +25380,26 @@ class Test_TC_LVL_4_1Suite : public TestCommand request.optionOverride = 1; auto success = [](void * context, const typename RequestType::ResponseType & data) { - (static_cast(context))->OnSuccessResponse_15(); + (static_cast(context))->OnSuccessResponse_16(); }; auto failure = [](void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_15(error); + (static_cast(context))->OnFailureResponse_16(error); }; ReturnErrorOnFailure(chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request)); return CHIP_NO_ERROR; } - void OnFailureResponse_15(CHIP_ERROR error) + void OnFailureResponse_16(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_15() { NextTest(); } + void OnSuccessResponse_16() { NextTest(); } - CHIP_ERROR TestWait100ms_16() + CHIP_ERROR TestWait100ms_17() { SetIdentity(kIdentityAlpha); return WaitForMs(100); @@ -25335,32 +25454,32 @@ class Test_TC_LVL_5_1Suite : public TestCommand err = TestSendingOnCommand_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to 0x80\n"); - err = TestPreconditionDutLevelIsSetTo0x80_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Precondition: DUT level is set to its lowest point\n"); + err = TestPreconditionDutLevelIsSetToItsLowestPoint_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 4000ms\n"); - err = TestWait4000ms_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Wait 3000ms\n"); + err = TestWait3000ms_3(); break; case 4: ChipLogProgress(chipTool, " ***** Test Step 4 : Reads current level attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step down command to DUT\n"); - err = TestSendsStepDownCommandToDut_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : Sends step up command to DUT\n"); + err = TestSendsStepUpCommandToDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 4000ms\n"); - err = TestWait4000ms_6(); + ChipLogProgress(chipTool, " ***** Test Step 6 : Wait 5000ms\n"); + err = TestWait5000ms_6(); break; case 7: ChipLogProgress(chipTool, " ***** Test Step 7 : Reads current level attribute from DUT\n"); err = TestReadsCurrentLevelAttributeFromDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step up command\n"); - err = TestSendsAStepUpCommand_8(); + ChipLogProgress(chipTool, " ***** Test Step 8 : Sends a Step down command\n"); + err = TestSendsAStepDownCommand_8(); break; case 9: ChipLogProgress(chipTool, " ***** Test Step 9 : Wait 4000ms\n"); @@ -25405,6 +25524,8 @@ class Test_TC_LVL_5_1Suite : public TestCommand chip::Optional mEndpoint; chip::Optional mTimeout; + uint8_t CurrentlevelValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override { bool isExpectedDnssdResult = false; @@ -25480,14 +25601,14 @@ class Test_TC_LVL_5_1Suite : public TestCommand void OnSuccessResponse_1() { NextTest(); } - CHIP_ERROR TestPreconditionDutLevelIsSetTo0x80_2() + CHIP_ERROR TestPreconditionDutLevelIsSetToItsLowestPoint_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; RequestType request; request.stepMode = static_cast(1); - request.stepSize = 126; + request.stepSize = 100; request.transitionTime = 20U; request.optionMask = 0; request.optionOverride = 0; @@ -25512,10 +25633,10 @@ class Test_TC_LVL_5_1Suite : public TestCommand void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestWait4000ms_3() + CHIP_ERROR TestWait3000ms_3() { SetIdentity(kIdentityAlpha); - return WaitForMs(4000); + return WaitForMs(3000); } CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_4() @@ -25537,20 +25658,20 @@ class Test_TC_LVL_5_1Suite : public TestCommand void OnSuccessResponse_4(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); - + VerifyOrReturn(CheckConstraintType("currentLevel", "", "uint8")); + CurrentlevelValue = currentLevel; NextTest(); } - CHIP_ERROR TestSendsStepDownCommandToDut_5() + CHIP_ERROR TestSendsStepUpCommandToDut_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; RequestType request; - request.stepMode = static_cast(1); + request.stepMode = static_cast(0); request.stepSize = 64; - request.transitionTime = 20U; + request.transitionTime = 2U; request.optionMask = 0; request.optionOverride = 0; @@ -25574,10 +25695,10 @@ class Test_TC_LVL_5_1Suite : public TestCommand void OnSuccessResponse_5() { NextTest(); } - CHIP_ERROR TestWait4000ms_6() + CHIP_ERROR TestWait5000ms_6() { SetIdentity(kIdentityAlpha); - return WaitForMs(4000); + return WaitForMs(5000); } CHIP_ERROR TestReadsCurrentLevelAttributeFromDut_7() @@ -25599,20 +25720,20 @@ class Test_TC_LVL_5_1Suite : public TestCommand void OnSuccessResponse_7(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 64)); + VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, CurrentlevelValue)); NextTest(); } - CHIP_ERROR TestSendsAStepUpCommand_8() + CHIP_ERROR TestSendsAStepDownCommand_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; using RequestType = chip::app::Clusters::LevelControl::Commands::Step::Type; RequestType request; - request.stepMode = static_cast(0); + request.stepMode = static_cast(1); request.stepSize = 64; - request.transitionTime = 20U; + request.transitionTime = 2U; request.optionMask = 0; request.optionOverride = 0; @@ -25661,7 +25782,7 @@ class Test_TC_LVL_5_1Suite : public TestCommand void OnSuccessResponse_10(uint8_t currentLevel) { - VerifyOrReturn(CheckValue("currentLevel", currentLevel, 128)); + VerifyOrReturn(CheckValue("currentLevel", currentLevel, CurrentlevelValue)); NextTest(); } @@ -25841,6 +25962,8 @@ class Test_TC_LVL_6_1Suite : public TestCommand chip::Optional mEndpoint; chip::Optional mTimeout; + uint8_t CurrentLevelValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override { bool isExpectedDnssdResult = false; @@ -25964,6 +26087,7 @@ class Test_TC_LVL_6_1Suite : public TestCommand { VerifyOrReturn(CheckConstraintMinValue("currentLevel", currentLevel, 0)); VerifyOrReturn(CheckConstraintMaxValue("currentLevel", currentLevel, 1)); + CurrentLevelValue = currentLevel; NextTest(); } @@ -26052,8 +26176,8 @@ class Test_TC_LVL_6_1Suite : public TestCommand void OnSuccessResponse_8(uint8_t currentLevel) { - VerifyOrReturn(CheckConstraintMinValue("currentLevel", currentLevel, 2)); - VerifyOrReturn(CheckConstraintMaxValue("currentLevel", currentLevel, 3)); + VerifyOrReturn(CheckConstraintNotValue("currentLevel", currentLevel, CurrentLevelValue)); + NextTest(); } @@ -31912,13 +32036,13 @@ class Test_TC_OCC_2_2Suite : public TestCommand err = TestReadsOccupancyAttributeFromDut_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads Occupancy attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads back Occupancy attribute from DUT after few seconds\n"); if (ShouldSkip("A_OCCUPANCY")) { NextTest(); return; } - err = TestReadsOccupancyAttributeFromDut_2(); + err = TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2(); break; } @@ -31943,6 +32067,8 @@ class Test_TC_OCC_2_2Suite : public TestCommand chip::Optional mEndpoint; chip::Optional mTimeout; + uint8_t OccupancyValue; + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override { bool isExpectedDnssdResult = false; @@ -32000,11 +32126,13 @@ class Test_TC_OCC_2_2Suite : public TestCommand void OnSuccessResponse_1(uint8_t occupancy) { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); + VerifyOrReturn(CheckValue("occupancy", occupancy, 0)); + + OccupancyValue = occupancy; NextTest(); } - CHIP_ERROR TestReadsOccupancyAttributeFromDut_2() + CHIP_ERROR TestReadsBackOccupancyAttributeFromDutAfterFewSeconds_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::OccupancySensingClusterTest cluster; @@ -32021,11 +32149,7 @@ class Test_TC_OCC_2_2Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(uint8_t occupancy) - { - VerifyOrReturn(CheckConstraintType("occupancy", "", "map8")); - NextTest(); - } + void OnSuccessResponse_2(uint8_t occupancy) { NextTest(); } }; class Test_TC_OO_1_1Suite : public TestCommand @@ -35336,21 +35460,16 @@ class Test_TC_PS_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute constraints: ClusterRevision\n"); - err = TestReadTheGlobalAttributeConstraintsClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, - " ***** Test Step 3 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : reads back global attribute: ClusterRevision\n"); - err = TestReadsBackGlobalAttributeClusterRevision_4(); - break; - case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_5(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -35368,7 +35487,7 @@ class Test_TC_PS_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 6; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -35398,9 +35517,9 @@ class Test_TC_PS_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) { - (static_cast(context))->OnSuccessResponse_2(clusterRevision); + (static_cast(context))->OnSuccessResponse_2(attributeList); } static void OnFailureCallback_3(void * context, CHIP_ERROR error) @@ -35408,26 +35527,21 @@ class Test_TC_PS_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } - - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t clusterRevision) + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) { - (static_cast(context))->OnSuccessResponse_4(clusterRevision); + (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); } - static void OnFailureCallback_5(void * context, CHIP_ERROR error) + static void OnFailureCallback_4(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_5(error); + (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_5(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) { - (static_cast(context))->OnSuccessResponse_5(attributeList); + (static_cast(context))->OnSuccessResponse_4(generatedCommandList); } // @@ -35464,13 +35578,13 @@ class Test_TC_PS_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeConstraintsClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::PowerSourceClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( + ReturnErrorOnFailure(cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } @@ -35481,79 +35595,55 @@ class Test_TC_PS_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t clusterRevision) + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) { - VerifyOrReturn(CheckConstraintType("clusterRevision", "", "uint16")); + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::PowerSourceClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_3() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsBackGlobalAttributeClusterRevision_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::PowerSourceClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_4(uint16_t clusterRevision) + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) { - VerifyOrReturn(CheckValue("clusterRevision", clusterRevision, 1U)); - + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); NextTest(); } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::PowerSourceClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_5(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); } }; @@ -36660,8 +36750,28 @@ class Test_TC_PCC_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeAttributeList_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional global attribute: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeFeatureMap_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : read the optional global attribute: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeFeatureMap_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : write the default values to optional global attribute: FeatureMap\n"); + err = TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : reads back optional global attribute: FeatureMap\n"); + err = TestReadsBackOptionalGlobalAttributeFeatureMap_9(); break; } @@ -36679,7 +36789,7 @@ class Test_TC_PCC_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 10; chip::Optional mNodeId; chip::Optional mCluster; @@ -36726,9 +36836,58 @@ class Test_TC_PCC_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context, uint32_t featureMap) + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) + { + (static_cast(context))->OnSuccessResponse_4(acceptedCommandList); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) + { + (static_cast(context))->OnSuccessResponse_5(generatedCommandList); + } + + static void OnFailureCallback_6(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_6(error); + } + + static void OnSuccessCallback_6(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_6(featureMap); + } + + static void OnFailureCallback_7(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_7(error); + } + + static void OnSuccessCallback_7(void * context, uint32_t featureMap) { - (static_cast(context))->OnSuccessResponse_4(featureMap); + (static_cast(context))->OnSuccessResponse_7(featureMap); + } + + static void OnFailureCallback_8(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_8(error); + } + + static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } + + static void OnFailureCallback_9(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_9(error); + } + + static void OnSuccessCallback_9(void * context, uint32_t featureMap) + { + (static_cast(context))->OnSuccessResponse_9(featureMap); } // @@ -36813,14 +36972,14 @@ class Test_TC_PCC_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_4() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::PumpConfigurationAndControlClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( + cluster.ReadAttribute( this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } @@ -36831,8 +36990,130 @@ class Test_TC_PCC_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_4(uint32_t featureMap) + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & acceptedCommandList) + { + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_6() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_6(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_6(uint32_t featureMap) + { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); + + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalGlobalAttributeFeatureMap_7() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_7(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_7(uint32_t featureMap) + { + VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); + NextTest(); + } + + CHIP_ERROR TestWriteTheDefaultValuesToOptionalGlobalAttributeFeatureMap_8() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + uint32_t featureMapArgument; + featureMapArgument = 0UL; + + ReturnErrorOnFailure( + cluster.WriteAttribute( + featureMapArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_8(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); + NextTest(); + } + + void OnSuccessResponse_8() { ThrowSuccessResponse(); } + + CHIP_ERROR TestReadsBackOptionalGlobalAttributeFeatureMap_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::PumpConfigurationAndControlClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_9(uint32_t featureMap) { + VerifyOrReturn(CheckValue("featureMap", featureMap, 0UL)); VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); } @@ -38566,6 +38847,7 @@ class Test_TC_PCC_2_1Suite : public TestCommand { VerifyOrReturn(CheckConstraintType("minConstTemp", "", "int16")); VerifyOrReturn(CheckConstraintMinValue("minConstTemp", minConstTemp, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("minConstTemp", minConstTemp, 32767)); NextTest(); } @@ -38591,6 +38873,7 @@ class Test_TC_PCC_2_1Suite : public TestCommand { VerifyOrReturn(CheckConstraintType("maxConstTemp", "", "int16")); VerifyOrReturn(CheckConstraintMinValue("maxConstTemp", maxConstTemp, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("maxConstTemp", maxConstTemp, 32767)); NextTest(); } @@ -39981,13 +40264,16 @@ class Test_TC_RH_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -40005,7 +40291,7 @@ class Test_TC_RH_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -40035,16 +40321,31 @@ class Test_TC_RH_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) + { + (static_cast(context))->OnSuccessResponse_2(attributeList); + } static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) + { + (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) { - (static_cast(context))->OnSuccessResponse_3(attributeList); + (static_cast(context))->OnSuccessResponse_4(generatedCommandList); } // @@ -40081,38 +40382,38 @@ class Test_TC_RH_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::RelativeHumidityMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 1U; - ReturnErrorOnFailure( - cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ThrowFailureResponse(); } - void OnSuccessResponse_2() { ThrowSuccessResponse(); } + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) + { + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::RelativeHumidityMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( + cluster.ReadAttribute( this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } @@ -40123,9 +40424,33 @@ class Test_TC_RH_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); } }; @@ -40182,12 +40507,8 @@ class Test_TC_RH_2_1Suite : public TestCommand err = TestReadsConstraintsOfAttributeMinMeasuredValue_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Reads the optional attribute: Tolerance\n"); - err = TestReadsTheOptionalAttributeTolerance_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Reads constraints of attribute: Tolerance\n"); - err = TestReadsConstraintsOfAttributeTolerance_4(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads constraints of attribute: Tolerance\n"); + err = TestReadsConstraintsOfAttributeTolerance_3(); break; } @@ -40205,7 +40526,7 @@ class Test_TC_RH_2_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -40250,16 +40571,6 @@ class Test_TC_RH_2_1Suite : public TestCommand (static_cast(context))->OnSuccessResponse_3(tolerance); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_4(error); - } - - static void OnSuccessCallback_4(void * context, uint16_t tolerance) - { - (static_cast(context))->OnSuccessResponse_4(tolerance); - } - // // Tests methods // @@ -40290,7 +40601,9 @@ class Test_TC_RH_2_1Suite : public TestCommand void OnSuccessResponse_1(uint16_t measuredValue) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", measuredValue, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", measuredValue, 10000U)); NextTest(); } @@ -40314,13 +40627,13 @@ class Test_TC_RH_2_1Suite : public TestCommand void OnSuccessResponse_2(uint16_t minMeasuredValue) { - VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, 0U)); VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999U)); NextTest(); } - CHIP_ERROR TestReadsTheOptionalAttributeTolerance_3() + CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::RelativeHumidityMeasurementClusterTest cluster; @@ -40339,31 +40652,6 @@ class Test_TC_RH_2_1Suite : public TestCommand } void OnSuccessResponse_3(uint16_t tolerance) - { - VerifyOrReturn(CheckValue("tolerance", tolerance, 0U)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfAttributeTolerance_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::RelativeHumidityMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_4(uint16_t tolerance) { VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); @@ -40416,22 +40704,26 @@ class Test_TC_RH_2_2Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads MeasuredValue attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 1 : Reads constraints of attribute: MinMeasuredValue\n"); + err = TestReadsConstraintsOfAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads MeasuredValue attribute from DUT\n"); if (ShouldSkip("A_RELATIVEHUMIDITY")) { NextTest(); return; } - err = TestReadsMeasuredValueAttributeFromDut_1(); + err = TestReadsMeasuredValueAttributeFromDut_2(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the mandatory attribute: MeasuredValue\n"); + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the mandatory attribute: MeasuredValue\n"); if (ShouldSkip("A_RELATIVEHUMIDITY")) { NextTest(); return; } - err = TestReadTheMandatoryAttributeMeasuredValue_2(); + err = TestReadTheMandatoryAttributeMeasuredValue_3(); break; } @@ -40449,7 +40741,7 @@ class Test_TC_RH_2_2Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -40469,9 +40761,9 @@ class Test_TC_RH_2_2Suite : public TestCommand (static_cast(context))->OnFailureResponse_1(error); } - static void OnSuccessCallback_1(void * context, uint16_t measuredValue) + static void OnSuccessCallback_1(void * context, uint16_t minMeasuredValue) { - (static_cast(context))->OnSuccessResponse_1(measuredValue); + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); } static void OnFailureCallback_2(void * context, CHIP_ERROR error) @@ -40484,6 +40776,16 @@ class Test_TC_RH_2_2Suite : public TestCommand (static_cast(context))->OnSuccessResponse_2(measuredValue); } + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, uint16_t measuredValue) + { + (static_cast(context))->OnSuccessResponse_3(measuredValue); + } + // // Tests methods // @@ -40494,14 +40796,14 @@ class Test_TC_RH_2_2Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_1() + CHIP_ERROR TestReadsConstraintsOfAttributeMinMeasuredValue_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::RelativeHumidityMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( + cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } @@ -40512,13 +40814,15 @@ class Test_TC_RH_2_2Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_1(uint16_t measuredValue) + void OnSuccessResponse_1(uint16_t minMeasuredValue) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 9999U)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_2() + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::RelativeHumidityMeasurementClusterTest cluster; @@ -40537,6 +40841,32 @@ class Test_TC_RH_2_2Suite : public TestCommand } void OnSuccessResponse_2(uint16_t measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("measuredValue", measuredValue, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("measuredValue", measuredValue, 10000U)); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::RelativeHumidityMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(uint16_t measuredValue) { VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); NextTest(); @@ -41415,13 +41745,8 @@ class Test_TC_TM_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); - break; - case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; } @@ -41439,7 +41764,7 @@ class Test_TC_TM_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 3; chip::Optional mNodeId; chip::Optional mCluster; @@ -41469,16 +41794,9 @@ class Test_TC_TM_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) { - (static_cast(context))->OnSuccessResponse_3(attributeList); + (static_cast(context))->OnSuccessResponse_2(attributeList); } // @@ -41515,31 +41833,7 @@ class Test_TC_TM_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::TemperatureMeasurementClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 4U; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::TemperatureMeasurementClusterTest cluster; @@ -41547,17 +41841,17 @@ class Test_TC_TM_1_1Suite : public TestCommand ReturnErrorOnFailure( cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); + this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_3(CHIP_ERROR error) + void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) { VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); @@ -41612,8 +41906,16 @@ class Test_TC_TM_2_1Suite : public TestCommand err = TestReadTheMandatoryAttributeMeasuredValue_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : read the optional attribute: Tolerance\n"); - err = TestReadTheOptionalAttributeTolerance_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : read the optional attribute: Tolerance\n"); + err = TestReadTheOptionalAttributeTolerance_4(); break; } @@ -41631,7 +41933,7 @@ class Test_TC_TM_2_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -41661,9 +41963,29 @@ class Test_TC_TM_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, uint16_t tolerance) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_2(minMeasuredValue); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_3(maxMeasuredValue); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, uint16_t tolerance) { - (static_cast(context))->OnSuccessResponse_2(tolerance); + (static_cast(context))->OnSuccessResponse_4(tolerance); } // @@ -41700,24 +42022,76 @@ class Test_TC_TM_2_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeTolerance_2() + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2(const chip::app::DataModel::Nullable & minMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 32766)); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TemperatureMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(const chip::app::DataModel::Nullable & maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", maxMeasuredValue, -27314)); + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", maxMeasuredValue, 32767)); + NextTest(); + } + + CHIP_ERROR TestReadTheOptionalAttributeTolerance_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TemperatureMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_2(uint16_t tolerance) + void OnSuccessResponse_4(uint16_t tolerance) { VerifyOrReturn(CheckConstraintType("tolerance", "", "uint16")); VerifyOrReturn(CheckConstraintMinValue("tolerance", tolerance, 0U)); @@ -41770,22 +42144,30 @@ class Test_TC_TM_2_2Suite : public TestCommand err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); break; case 1: - ChipLogProgress(chipTool, " ***** Test Step 1 : Reads MeasuredValue attribute from DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 1 : read the mandatory attribute: MinMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMinMeasuredValue_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : read the mandatory attribute: MaxMeasuredValue\n"); + err = TestReadTheMandatoryAttributeMaxMeasuredValue_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads MeasuredValue attribute from DUT\n"); if (ShouldSkip("A_TEMPERATURE")) { NextTest(); return; } - err = TestReadsMeasuredValueAttributeFromDut_1(); + err = TestReadsMeasuredValueAttributeFromDut_3(); break; - case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Read the mandatory attribute: MeasuredValue\n"); + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the mandatory attribute: MeasuredValue\n"); if (ShouldSkip("A_TEMPERATURE")) { NextTest(); return; } - err = TestReadTheMandatoryAttributeMeasuredValue_2(); + err = TestReadTheMandatoryAttributeMeasuredValue_4(); break; } @@ -41803,7 +42185,7 @@ class Test_TC_TM_2_2Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 3; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -41823,9 +42205,9 @@ class Test_TC_TM_2_2Suite : public TestCommand (static_cast(context))->OnFailureResponse_1(error); } - static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & measuredValue) + static void OnSuccessCallback_1(void * context, const chip::app::DataModel::Nullable & minMeasuredValue) { - (static_cast(context))->OnSuccessResponse_1(measuredValue); + (static_cast(context))->OnSuccessResponse_1(minMeasuredValue); } static void OnFailureCallback_2(void * context, CHIP_ERROR error) @@ -41833,9 +42215,29 @@ class Test_TC_TM_2_2Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & measuredValue) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::Nullable & maxMeasuredValue) + { + (static_cast(context))->OnSuccessResponse_2(maxMeasuredValue); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { - (static_cast(context))->OnSuccessResponse_2(measuredValue); + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3(void * context, const chip::app::DataModel::Nullable & measuredValue) + { + (static_cast(context))->OnSuccessResponse_3(measuredValue); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & measuredValue) + { + (static_cast(context))->OnSuccessResponse_4(measuredValue); } // @@ -41848,14 +42250,14 @@ class Test_TC_TM_2_2Suite : public TestCommand return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_1() + CHIP_ERROR TestReadTheMandatoryAttributeMinMeasuredValue_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( + cluster.ReadAttribute( this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } @@ -41866,20 +42268,22 @@ class Test_TC_TM_2_2Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_1(const chip::app::DataModel::Nullable & measuredValue) + void OnSuccessResponse_1(const chip::app::DataModel::Nullable & minMeasuredValue) { - VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + VerifyOrReturn(CheckConstraintType("minMeasuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("minMeasuredValue", minMeasuredValue, -27315)); + VerifyOrReturn(CheckConstraintMaxValue("minMeasuredValue", minMeasuredValue, 32766)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_2() + CHIP_ERROR TestReadTheMandatoryAttributeMaxMeasuredValue_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::TemperatureMeasurementClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure( - cluster.ReadAttribute( + cluster.ReadAttribute( this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } @@ -41890,7 +42294,57 @@ class Test_TC_TM_2_2Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_2(const chip::app::DataModel::Nullable & measuredValue) + void OnSuccessResponse_2(const chip::app::DataModel::Nullable & maxMeasuredValue) + { + VerifyOrReturn(CheckConstraintType("maxMeasuredValue", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("maxMeasuredValue", maxMeasuredValue, -27314)); + VerifyOrReturn(CheckConstraintMaxValue("maxMeasuredValue", maxMeasuredValue, 32767)); + NextTest(); + } + + CHIP_ERROR TestReadsMeasuredValueAttributeFromDut_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TemperatureMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3(const chip::app::DataModel::Nullable & measuredValue) + { + VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadTheMandatoryAttributeMeasuredValue_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::TemperatureMeasurementClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::Nullable & measuredValue) { VerifyOrReturn(CheckConstraintType("measuredValue", "", "uint16")); NextTest(); @@ -41945,17 +42399,12 @@ class Test_TC_TSTAT_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); - break; - case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Read the optional global attribute constraints: FeatureMap\n"); - err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_4(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the optional global attribute constraints: FeatureMap\n"); + err = TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3(); break; } @@ -41973,7 +42422,7 @@ class Test_TC_TSTAT_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 5; + const uint16_t mTestCount = 4; chip::Optional mNodeId; chip::Optional mCluster; @@ -42003,26 +42452,19 @@ class Test_TC_TSTAT_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } - - static void OnFailureCallback_3(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_3(error); - } - - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) { - (static_cast(context))->OnSuccessResponse_3(attributeList); + (static_cast(context))->OnSuccessResponse_2(attributeList); } - static void OnFailureCallback_4(void * context, CHIP_ERROR error) + static void OnFailureCallback_3(void * context, CHIP_ERROR error) { - (static_cast(context))->OnFailureResponse_4(error); + (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_4(void * context, uint32_t featureMap) + static void OnSuccessCallback_3(void * context, uint32_t featureMap) { - (static_cast(context))->OnSuccessResponse_4(featureMap); + (static_cast(context))->OnSuccessResponse_3(featureMap); } // @@ -42058,70 +42500,47 @@ class Test_TC_TSTAT_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 5U; - - ReturnErrorOnFailure(cluster.WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_2() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); + this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_3(CHIP_ERROR error) + void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) { VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); NextTest(); } - CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_4() + CHIP_ERROR TestReadTheOptionalGlobalAttributeConstraintsFeatureMap_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_4(CHIP_ERROR error) + void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_4(uint32_t featureMap) + void OnSuccessResponse_3(uint32_t featureMap) { VerifyOrReturn(CheckConstraintType("featureMap", "", "map32")); NextTest(); @@ -42177,285 +42596,82 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand err = TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1(); break; case 2: - ChipLogProgress(chipTool, " ***** Test Step 2 : Reads mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); + ChipLogProgress(chipTool, + " ***** Test Step 2 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2(); break; case 3: ChipLogProgress(chipTool, - " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_3(); + " ***** Test Step 3 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3(); break; case 4: ChipLogProgress(chipTool, - " ***** Test Step 4 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMinHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinHeatSetpointLimit_4(); + " ***** Test Step 4 : Reads constraints of optional attributes from DUT: AbsMinCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Read back mandatory attributes from DUT: AbsMinHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMinHeatSetpointLimit_5(); + ChipLogProgress(chipTool, + " ***** Test Step 5 : Reads constraints of optional attributes from DUT: AbsMaxCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Reads mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_6(); + ChipLogProgress(chipTool, + " ***** Test Step 6 : Reads constraints of optional attributes from DUT: OccupiedCoolingSetpoint\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6(); break; case 7: ChipLogProgress(chipTool, - " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_7(); + " ***** Test Step 7 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7(); break; case 8: ChipLogProgress(chipTool, - " ***** Test Step 8 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMaxHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxHeatSetpointLimit_8(); + " ***** Test Step 8 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8(); break; case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : Read back mandatory attributes from DUT: AbsMaxHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_9(); + ChipLogProgress(chipTool, + " ***** Test Step 9 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9(); break; case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : Reads mandatory attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMinCoolSetpointLimit_10(); + ChipLogProgress(chipTool, + " ***** Test Step 10 : Reads constraints of optional attributes from DUT: MinCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10(); break; case 11: ChipLogProgress(chipTool, - " ***** Test Step 11 : Reads constraints of mandatory attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinCoolSetpointLimit_11(); + " ***** Test Step 11 : Reads constraints of optional attributes from DUT: MaxCoolSetpointLimit\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11(); break; case 12: - ChipLogProgress(chipTool, - " ***** Test Step 12 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMinCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinCoolSetpointLimit_12(); + ChipLogProgress( + chipTool, " ***** Test Step 12 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12(); break; case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : Read back mandatory attributes from DUT: AbsMinCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMinCoolSetpointLimit_13(); + ChipLogProgress(chipTool, " ***** Test Step 13 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); + err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13(); break; case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : Reads mandatory attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_14(); + ChipLogProgress(chipTool, + " ***** Test Step 14 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14(); break; case 15: - ChipLogProgress(chipTool, - " ***** Test Step 15 : Reads constraints of mandatory attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_15(); + ChipLogProgress(chipTool, " ***** Test Step 15 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15(); break; case 16: ChipLogProgress(chipTool, - " ***** Test Step 16 : Writes the respective default value to mandatory attributes to DUT: " - "AbsMaxCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxCoolSetpointLimit_16(); + " ***** Test Step 16 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16(); break; case 17: - ChipLogProgress(chipTool, " ***** Test Step 17 : Read back mandatory attributes from DUT: AbsMaxCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_17(); - break; - case 18: - ChipLogProgress(chipTool, " ***** Test Step 18 : Reads mandatory attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadsMandatoryAttributesFromDutOccupiedCoolingSetpoint_18(); - break; - case 19: - ChipLogProgress(chipTool, - " ***** Test Step 19 : Reads constraints of mandatory attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedCoolingSetpoint_19(); - break; - case 20: - ChipLogProgress(chipTool, - " ***** Test Step 20 : Writes the respective default value to mandatory attributes to DUT: " - "OccupiedCoolingSetpoint\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedCoolingSetpoint_20(); - break; - case 21: - ChipLogProgress(chipTool, " ***** Test Step 21 : Read back mandatory attributes from DUT: OccupiedCoolingSetpoint\n"); - err = TestReadBackMandatoryAttributesFromDutOccupiedCoolingSetpoint_21(); - break; - case 22: - ChipLogProgress(chipTool, " ***** Test Step 22 : Reads mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadsMandatoryAttributesFromDutOccupiedHeatingSetpoint_22(); - break; - case 23: - ChipLogProgress(chipTool, - " ***** Test Step 23 : Reads constraints of mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_23(); - break; - case 24: - ChipLogProgress(chipTool, - " ***** Test Step 24 : Writes the respective default value to mandatory attributes to DUT: " - "OccupiedHeatingSetpoint\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedHeatingSetpoint_24(); - break; - case 25: - ChipLogProgress(chipTool, " ***** Test Step 25 : Read back mandatory attributes from DUT: OccupiedHeatingSetpoint\n"); - err = TestReadBackMandatoryAttributesFromDutOccupiedHeatingSetpoint_25(); - break; - case 26: - ChipLogProgress(chipTool, " ***** Test Step 26 : Reads mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMinHeatSetpointLimit_26(); - break; - case 27: - ChipLogProgress(chipTool, - " ***** Test Step 27 : Reads constraints of mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_27(); - break; - case 28: - ChipLogProgress( - chipTool, - " ***** Test Step 28 : Writes the respective default value to mandatory attributes to DUT: MinHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinHeatSetpointLimit_28(); - break; - case 29: - ChipLogProgress(chipTool, " ***** Test Step 29 : Read back mandatory attributes from DUT: MinHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMinHeatSetpointLimit_29(); - break; - case 30: - ChipLogProgress(chipTool, " ***** Test Step 30 : Reads mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMaxHeatSetpointLimit_30(); - break; - case 31: - ChipLogProgress(chipTool, - " ***** Test Step 31 : Reads constraints of mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_31(); - break; - case 32: - ChipLogProgress( - chipTool, - " ***** Test Step 32 : Writes the respective default value to mandatory attributes to DUT: MaxHeatSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxHeatSetpointLimit_32(); - break; - case 33: - ChipLogProgress(chipTool, " ***** Test Step 33 : Read back mandatory attributes from DUT: MaxHeatSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMaxHeatSetpointLimit_33(); - break; - case 34: - ChipLogProgress(chipTool, " ***** Test Step 34 : Reads mandatory attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMinCoolSetpointLimit_34(); - break; - case 35: - ChipLogProgress(chipTool, - " ***** Test Step 35 : Reads constraints of mandatory attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMinCoolSetpointLimit_35(); - break; - case 36: - ChipLogProgress( - chipTool, - " ***** Test Step 36 : Writes the respective default value to mandatory attributes to DUT: MinCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinCoolSetpointLimit_36(); - break; - case 37: - ChipLogProgress(chipTool, " ***** Test Step 37 : Read back mandatory attributes from DUT: MinCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMinCoolSetpointLimit_37(); - break; - case 38: - ChipLogProgress(chipTool, " ***** Test Step 38 : Reads mandatory attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadsMandatoryAttributesFromDutMaxCoolSetpointLimit_38(); - break; - case 39: - ChipLogProgress(chipTool, - " ***** Test Step 39 : Reads constraints of mandatory attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutMaxCoolSetpointLimit_39(); - break; - case 40: - ChipLogProgress( - chipTool, - " ***** Test Step 40 : Writes the respective default value to mandatory attributes to DUT: MaxCoolSetpointLimit\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxCoolSetpointLimit_40(); - break; - case 41: - ChipLogProgress(chipTool, " ***** Test Step 41 : Read back mandatory attributes from DUT: MaxCoolSetpointLimit\n"); - err = TestReadBackMandatoryAttributesFromDutMaxCoolSetpointLimit_41(); - break; - case 42: - ChipLogProgress(chipTool, " ***** Test Step 42 : Reads mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadsMandatoryAttributesFromDutControlSequenceOfOperation_42(); - break; - case 43: - ChipLogProgress( - chipTool, " ***** Test Step 43 : Reads constraints of mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_43(); - break; - case 44: - ChipLogProgress(chipTool, - " ***** Test Step 44 : Writes the respective default value to mandatory attributes to DUT: " - "ControlSequenceOfOperation\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutControlSequenceOfOperation_44(); - break; - case 45: - ChipLogProgress(chipTool, - " ***** Test Step 45 : Read back mandatory attributes from DUT: ControlSequenceOfOperation\n"); - err = TestReadBackMandatoryAttributesFromDutControlSequenceOfOperation_45(); - break; - case 46: - ChipLogProgress(chipTool, " ***** Test Step 46 : Reads mandatory attributes from DUT: SystemMode\n"); - err = TestReadsMandatoryAttributesFromDutSystemMode_46(); - break; - case 47: - ChipLogProgress(chipTool, " ***** Test Step 47 : Reads constraints of mandatory attributes from DUT: SystemMode\n"); - err = TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_47(); - break; - case 48: - ChipLogProgress( - chipTool, " ***** Test Step 48 : Writes the respective default value to mandatory attributes to DUT: SystemMode\n"); - err = TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutSystemMode_48(); - break; - case 49: - ChipLogProgress(chipTool, " ***** Test Step 49 : Read back mandatory attributes from DUT: SystemMode\n"); - err = TestReadBackMandatoryAttributesFromDutSystemMode_49(); - break; - case 50: - ChipLogProgress(chipTool, " ***** Test Step 50 : Reads optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadsOptionalAttributesFromDutMinSetpointDeadBand_50(); - break; - case 51: - ChipLogProgress(chipTool, - " ***** Test Step 51 : Reads constraints of optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_51(); - break; - case 52: - ChipLogProgress( - chipTool, - " ***** Test Step 52 : Writes the respective default value to optional attributes to DUT: MinSetpointDeadBand\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutMinSetpointDeadBand_52(); - break; - case 53: - ChipLogProgress(chipTool, " ***** Test Step 53 : Read back optional attributes from DUT: MinSetpointDeadBand\n"); - err = TestReadBackOptionalAttributesFromDutMinSetpointDeadBand_53(); - break; - case 54: - ChipLogProgress(chipTool, " ***** Test Step 54 : Reads constraints of optional attributes from DUT: StartOfWeek\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_54(); - break; - case 55: - ChipLogProgress( - chipTool, " ***** Test Step 55 : Writes the respective default value to optional attributes to DUT: StartOfWeek\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutStartOfWeek_55(); - break; - case 56: - ChipLogProgress(chipTool, " ***** Test Step 56 : Read back optional attributes from DUT: StartOfWeek\n"); - err = TestReadBackOptionalAttributesFromDutStartOfWeek_56(); - break; - case 57: - ChipLogProgress(chipTool, - " ***** Test Step 57 : Reads constraints of optional attributes from DUT: NumberOfWeeklyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_57(); - break; - case 58: - ChipLogProgress(chipTool, - " ***** Test Step 58 : Writes the respective default value to optional attributes to DUT: " - "NumberOfWeeklyTransitions\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfWeeklyTransitions_58(); - break; - case 59: - ChipLogProgress(chipTool, - " ***** Test Step 59 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); - err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_59(); - break; - case 60: ChipLogProgress(chipTool, - " ***** Test Step 60 : Writes the respective default value to optional attributes to DUT: " - "NumberOfDailyTransitions\n"); - err = TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfDailyTransitions_60(); + " ***** Test Step 17 : Reads constraints of optional attributes from DUT: NumberOfDailyTransitions\n"); + err = TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17(); break; } @@ -42473,7 +42689,7 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 61; + const uint16_t mTestCount = 18; chip::Optional mNodeId; chip::Optional mCluster; @@ -42513,9 +42729,9 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context, int16_t absMinHeatSetpointLimit) + static void OnSuccessCallback_3(void * context, int16_t absMaxHeatSetpointLimit) { - (static_cast(context))->OnSuccessResponse_3(absMinHeatSetpointLimit); + (static_cast(context))->OnSuccessResponse_3(absMaxHeatSetpointLimit); } static void OnFailureCallback_4(void * context, CHIP_ERROR error) @@ -42523,16 +42739,19 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context) { (static_cast(context))->OnSuccessResponse_4(); } + static void OnSuccessCallback_4(void * context, int16_t absMinCoolSetpointLimit) + { + (static_cast(context))->OnSuccessResponse_4(absMinCoolSetpointLimit); + } static void OnFailureCallback_5(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_5(error); } - static void OnSuccessCallback_5(void * context, int16_t absMinHeatSetpointLimit) + static void OnSuccessCallback_5(void * context, int16_t absMaxCoolSetpointLimit) { - (static_cast(context))->OnSuccessResponse_5(absMinHeatSetpointLimit); + (static_cast(context))->OnSuccessResponse_5(absMaxCoolSetpointLimit); } static void OnFailureCallback_6(void * context, CHIP_ERROR error) @@ -42540,9 +42759,9 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_6(error); } - static void OnSuccessCallback_6(void * context, int16_t absMaxHeatSetpointLimit) + static void OnSuccessCallback_6(void * context, int16_t occupiedCoolingSetpoint) { - (static_cast(context))->OnSuccessResponse_6(absMaxHeatSetpointLimit); + (static_cast(context))->OnSuccessResponse_6(occupiedCoolingSetpoint); } static void OnFailureCallback_7(void * context, CHIP_ERROR error) @@ -42550,9 +42769,9 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_7(error); } - static void OnSuccessCallback_7(void * context, int16_t absMaxHeatSetpointLimit) + static void OnSuccessCallback_7(void * context, int16_t occupiedHeatingSetpoint) { - (static_cast(context))->OnSuccessResponse_7(absMaxHeatSetpointLimit); + (static_cast(context))->OnSuccessResponse_7(occupiedHeatingSetpoint); } static void OnFailureCallback_8(void * context, CHIP_ERROR error) @@ -42560,16 +42779,19 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_8(error); } - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } + static void OnSuccessCallback_8(void * context, int16_t minHeatSetpointLimit) + { + (static_cast(context))->OnSuccessResponse_8(minHeatSetpointLimit); + } static void OnFailureCallback_9(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_9(error); } - static void OnSuccessCallback_9(void * context, int16_t absMaxHeatSetpointLimit) + static void OnSuccessCallback_9(void * context, int16_t maxHeatSetpointLimit) { - (static_cast(context))->OnSuccessResponse_9(absMaxHeatSetpointLimit); + (static_cast(context))->OnSuccessResponse_9(maxHeatSetpointLimit); } static void OnFailureCallback_10(void * context, CHIP_ERROR error) @@ -42577,9 +42799,9 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_10(error); } - static void OnSuccessCallback_10(void * context, int16_t absMinCoolSetpointLimit) + static void OnSuccessCallback_10(void * context, int16_t minCoolSetpointLimit) { - (static_cast(context))->OnSuccessResponse_10(absMinCoolSetpointLimit); + (static_cast(context))->OnSuccessResponse_10(minCoolSetpointLimit); } static void OnFailureCallback_11(void * context, CHIP_ERROR error) @@ -42587,9 +42809,9 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_11(error); } - static void OnSuccessCallback_11(void * context, int16_t absMinCoolSetpointLimit) + static void OnSuccessCallback_11(void * context, int16_t maxCoolSetpointLimit) { - (static_cast(context))->OnSuccessResponse_11(absMinCoolSetpointLimit); + (static_cast(context))->OnSuccessResponse_11(maxCoolSetpointLimit); } static void OnFailureCallback_12(void * context, CHIP_ERROR error) @@ -42597,1675 +42819,414 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_12(error); } - static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context, int16_t absMinCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_13(absMinCoolSetpointLimit); - } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, int16_t absMaxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_14(absMaxCoolSetpointLimit); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, int16_t absMaxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_15(absMaxCoolSetpointLimit); - } - - static void OnFailureCallback_16(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_16(error); - } - - static void OnSuccessCallback_16(void * context) { (static_cast(context))->OnSuccessResponse_16(); } - - static void OnFailureCallback_17(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_17(error); - } - - static void OnSuccessCallback_17(void * context, int16_t absMaxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_17(absMaxCoolSetpointLimit); - } - - static void OnFailureCallback_18(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_18(error); - } - - static void OnSuccessCallback_18(void * context, int16_t occupiedCoolingSetpoint) - { - (static_cast(context))->OnSuccessResponse_18(occupiedCoolingSetpoint); - } - - static void OnFailureCallback_19(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_19(error); - } - - static void OnSuccessCallback_19(void * context, int16_t occupiedCoolingSetpoint) - { - (static_cast(context))->OnSuccessResponse_19(occupiedCoolingSetpoint); - } - - static void OnFailureCallback_20(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_20(error); - } - - static void OnSuccessCallback_20(void * context) { (static_cast(context))->OnSuccessResponse_20(); } - - static void OnFailureCallback_21(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_21(error); - } - - static void OnSuccessCallback_21(void * context, int16_t occupiedCoolingSetpoint) - { - (static_cast(context))->OnSuccessResponse_21(occupiedCoolingSetpoint); - } - - static void OnFailureCallback_22(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_22(error); - } - - static void OnSuccessCallback_22(void * context, int16_t occupiedHeatingSetpoint) - { - (static_cast(context))->OnSuccessResponse_22(occupiedHeatingSetpoint); - } - - static void OnFailureCallback_23(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_23(error); - } - - static void OnSuccessCallback_23(void * context, int16_t occupiedHeatingSetpoint) - { - (static_cast(context))->OnSuccessResponse_23(occupiedHeatingSetpoint); - } - - static void OnFailureCallback_24(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_24(error); - } - - static void OnSuccessCallback_24(void * context) { (static_cast(context))->OnSuccessResponse_24(); } - - static void OnFailureCallback_25(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_25(error); - } - - static void OnSuccessCallback_25(void * context, int16_t occupiedHeatingSetpoint) - { - (static_cast(context))->OnSuccessResponse_25(occupiedHeatingSetpoint); - } - - static void OnFailureCallback_26(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_26(error); - } - - static void OnSuccessCallback_26(void * context, int16_t minHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_26(minHeatSetpointLimit); - } - - static void OnFailureCallback_27(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_27(error); - } - - static void OnSuccessCallback_27(void * context, int16_t minHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_27(minHeatSetpointLimit); - } - - static void OnFailureCallback_28(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_28(error); - } - - static void OnSuccessCallback_28(void * context) { (static_cast(context))->OnSuccessResponse_28(); } - - static void OnFailureCallback_29(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_29(error); - } - - static void OnSuccessCallback_29(void * context, int16_t minHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_29(minHeatSetpointLimit); - } - - static void OnFailureCallback_30(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_30(error); - } - - static void OnSuccessCallback_30(void * context, int16_t maxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_30(maxHeatSetpointLimit); - } - - static void OnFailureCallback_31(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_31(error); - } - - static void OnSuccessCallback_31(void * context, int16_t maxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_31(maxHeatSetpointLimit); - } - - static void OnFailureCallback_32(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_32(error); - } - - static void OnSuccessCallback_32(void * context) { (static_cast(context))->OnSuccessResponse_32(); } - - static void OnFailureCallback_33(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_33(error); - } - - static void OnSuccessCallback_33(void * context, int16_t maxHeatSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_33(maxHeatSetpointLimit); - } - - static void OnFailureCallback_34(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_34(error); - } - - static void OnSuccessCallback_34(void * context, int16_t minCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_34(minCoolSetpointLimit); - } - - static void OnFailureCallback_35(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_35(error); - } - - static void OnSuccessCallback_35(void * context, int16_t minCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_35(minCoolSetpointLimit); - } - - static void OnFailureCallback_36(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_36(error); - } - - static void OnSuccessCallback_36(void * context) { (static_cast(context))->OnSuccessResponse_36(); } - - static void OnFailureCallback_37(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_37(error); - } - - static void OnSuccessCallback_37(void * context, int16_t minCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_37(minCoolSetpointLimit); - } - - static void OnFailureCallback_38(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_38(error); - } - - static void OnSuccessCallback_38(void * context, int16_t maxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_38(maxCoolSetpointLimit); - } - - static void OnFailureCallback_39(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_39(error); - } - - static void OnSuccessCallback_39(void * context, int16_t maxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_39(maxCoolSetpointLimit); - } - - static void OnFailureCallback_40(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_40(error); - } - - static void OnSuccessCallback_40(void * context) { (static_cast(context))->OnSuccessResponse_40(); } - - static void OnFailureCallback_41(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_41(error); - } - - static void OnSuccessCallback_41(void * context, int16_t maxCoolSetpointLimit) - { - (static_cast(context))->OnSuccessResponse_41(maxCoolSetpointLimit); - } - - static void OnFailureCallback_42(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_42(error); - } - - static void OnSuccessCallback_42(void * context, - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - (static_cast(context))->OnSuccessResponse_42(controlSequenceOfOperation); - } - - static void OnFailureCallback_43(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_43(error); - } - - static void OnSuccessCallback_43(void * context, - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - (static_cast(context))->OnSuccessResponse_43(controlSequenceOfOperation); - } - - static void OnFailureCallback_44(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_44(error); - } - - static void OnSuccessCallback_44(void * context) { (static_cast(context))->OnSuccessResponse_44(); } - - static void OnFailureCallback_45(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_45(error); - } - - static void OnSuccessCallback_45(void * context, - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) - { - (static_cast(context))->OnSuccessResponse_45(controlSequenceOfOperation); - } - - static void OnFailureCallback_46(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_46(error); - } - - static void OnSuccessCallback_46(void * context, uint8_t systemMode) - { - (static_cast(context))->OnSuccessResponse_46(systemMode); - } - - static void OnFailureCallback_47(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_47(error); - } - - static void OnSuccessCallback_47(void * context, uint8_t systemMode) - { - (static_cast(context))->OnSuccessResponse_47(systemMode); - } - - static void OnFailureCallback_48(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_48(error); - } - - static void OnSuccessCallback_48(void * context) { (static_cast(context))->OnSuccessResponse_48(); } - - static void OnFailureCallback_49(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_49(error); - } - - static void OnSuccessCallback_49(void * context, uint8_t systemMode) - { - (static_cast(context))->OnSuccessResponse_49(systemMode); - } - - static void OnFailureCallback_50(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_50(error); - } - - static void OnSuccessCallback_50(void * context, int8_t minSetpointDeadBand) - { - (static_cast(context))->OnSuccessResponse_50(minSetpointDeadBand); - } - - static void OnFailureCallback_51(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_51(error); - } - - static void OnSuccessCallback_51(void * context, int8_t minSetpointDeadBand) - { - (static_cast(context))->OnSuccessResponse_51(minSetpointDeadBand); - } - - static void OnFailureCallback_52(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_52(error); - } - - static void OnSuccessCallback_52(void * context) { (static_cast(context))->OnSuccessResponse_52(); } - - static void OnFailureCallback_53(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_53(error); - } - - static void OnSuccessCallback_53(void * context, int8_t minSetpointDeadBand) - { - (static_cast(context))->OnSuccessResponse_53(minSetpointDeadBand); - } - - static void OnFailureCallback_54(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_54(error); - } - - static void OnSuccessCallback_54(void * context, uint8_t startOfWeek) - { - (static_cast(context))->OnSuccessResponse_54(startOfWeek); - } - - static void OnFailureCallback_55(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_55(error); - } - - static void OnSuccessCallback_55(void * context) { (static_cast(context))->OnSuccessResponse_55(); } - - static void OnFailureCallback_56(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_56(error); - } - - static void OnSuccessCallback_56(void * context, uint8_t startOfWeek) - { - (static_cast(context))->OnSuccessResponse_56(startOfWeek); - } - - static void OnFailureCallback_57(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_57(error); - } - - static void OnSuccessCallback_57(void * context, uint8_t numberOfWeeklyTransitions) - { - (static_cast(context))->OnSuccessResponse_57(numberOfWeeklyTransitions); - } - - static void OnFailureCallback_58(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_58(error); - } - - static void OnSuccessCallback_58(void * context) { (static_cast(context))->OnSuccessResponse_58(); } - - static void OnFailureCallback_59(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_59(error); - } - - static void OnSuccessCallback_59(void * context, uint8_t numberOfDailyTransitions) - { - (static_cast(context))->OnSuccessResponse_59(numberOfDailyTransitions); - } - - static void OnFailureCallback_60(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_60(error); - } - - static void OnSuccessCallback_60(void * context) { (static_cast(context))->OnSuccessResponse_60(); } - - // - // Tests methods - // - - CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() - { - SetIdentity(kIdentityAlpha); - return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_1, OnFailureCallback_1, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_1(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_1(int16_t localTemperature) - { - VerifyOrReturn(CheckConstraintType("localTemperature", "", "int16")); - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_2, OnFailureCallback_2, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_2(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_2(int16_t absMinHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 700)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_3(int16_t absMinHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMinHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinHeatSetpointLimit_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t absMinHeatSetpointLimitArgument; - absMinHeatSetpointLimitArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - absMinHeatSetpointLimitArgument, this, OnSuccessCallback_4, OnFailureCallback_4)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_4() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMinHeatSetpointLimit_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_5(int16_t absMinHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 700)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_6(int16_t absMaxHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 3000)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_7(int16_t absMaxHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMaxHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxHeatSetpointLimit_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t absMaxHeatSetpointLimitArgument; - absMaxHeatSetpointLimitArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - absMaxHeatSetpointLimitArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_8() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_9() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_9(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_9(int16_t absMaxHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 3000)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMinCoolSetpointLimit_10() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_10(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_10(int16_t absMinCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 1600)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinCoolSetpointLimit_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_11(int16_t absMinCoolSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMinCoolSetpointLimit_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t absMinCoolSetpointLimitArgument; - absMinCoolSetpointLimitArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - absMinCoolSetpointLimitArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_12() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMinCoolSetpointLimit_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_13, OnFailureCallback_13, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_13(int16_t absMinCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 1600)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_14() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_14(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_14(int16_t absMaxCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 3200)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_15() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_15(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_15(int16_t absMaxCoolSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 3200)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutAbsMaxCoolSetpointLimit_16() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t absMaxCoolSetpointLimitArgument; - absMaxCoolSetpointLimitArgument = 3200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - absMaxCoolSetpointLimitArgument, this, OnSuccessCallback_16, OnFailureCallback_16)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_16(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - - void OnSuccessResponse_16() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutAbsMaxCoolSetpointLimit_17() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_17, OnFailureCallback_17, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_17(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_17(int16_t absMaxCoolSetpointLimit) - { - VerifyOrReturn(CheckValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 3200)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutOccupiedCoolingSetpoint_18() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_18, OnFailureCallback_18, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_18(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_18(int16_t occupiedCoolingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedCoolingSetpoint_19() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_19, OnFailureCallback_19, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_19(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_19(int16_t occupiedCoolingSetpoint) - { - VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedCoolingSetpoint_20() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedCoolingSetpointArgument; - occupiedCoolingSetpointArgument = 2600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedCoolingSetpointArgument, this, OnSuccessCallback_20, OnFailureCallback_20)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_20(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_20() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutOccupiedCoolingSetpoint_21() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_21, OnFailureCallback_21, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_21(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_21(int16_t occupiedCoolingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutOccupiedHeatingSetpoint_22() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_22, OnFailureCallback_22, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_22(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_22(int16_t occupiedHeatingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2000)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_23() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_23, OnFailureCallback_23, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_23(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_23(int16_t occupiedHeatingSetpoint) - { - VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 700)); - VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2600)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutOccupiedHeatingSetpoint_24() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t occupiedHeatingSetpointArgument; - occupiedHeatingSetpointArgument = 2000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - occupiedHeatingSetpointArgument, this, OnSuccessCallback_24, OnFailureCallback_24)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_24(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_24() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutOccupiedHeatingSetpoint_25() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_25, OnFailureCallback_25, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_25(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_25(int16_t occupiedHeatingSetpoint) - { - VerifyOrReturn(CheckValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2000)); - - NextTest(); - } - - CHIP_ERROR TestReadsMandatoryAttributesFromDutMinHeatSetpointLimit_26() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_26, OnFailureCallback_26, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_26(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_26(int16_t minHeatSetpointLimit) - { - VerifyOrReturn(CheckValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_27() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_27, OnFailureCallback_27, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_27(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_27(int16_t minHeatSetpointLimit) - { - VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", minHeatSetpointLimit, 3000)); - NextTest(); - } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinHeatSetpointLimit_28() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minHeatSetpointLimitArgument; - minHeatSetpointLimitArgument = 700; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minHeatSetpointLimitArgument, this, OnSuccessCallback_28, OnFailureCallback_28)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_28(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_28() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMinHeatSetpointLimit_29() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_29, OnFailureCallback_29, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_29(CHIP_ERROR error) + static void OnSuccessCallback_12(void * context, + chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) { - chip::app::StatusIB status(error); - ThrowFailureResponse(); + (static_cast(context))->OnSuccessResponse_12(controlSequenceOfOperation); } - void OnSuccessResponse_29(int16_t minHeatSetpointLimit) + static void OnFailureCallback_13(void * context, CHIP_ERROR error) { - VerifyOrReturn(CheckValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); - - NextTest(); + (static_cast(context))->OnFailureResponse_13(error); } - CHIP_ERROR TestReadsMandatoryAttributesFromDutMaxHeatSetpointLimit_30() + static void OnSuccessCallback_13(void * context, uint8_t systemMode) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_30, OnFailureCallback_30, true)); - return CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_13(systemMode); } - void OnFailureResponse_30(CHIP_ERROR error) + static void OnFailureCallback_14(void * context, CHIP_ERROR error) { - chip::app::StatusIB status(error); - ThrowFailureResponse(); + (static_cast(context))->OnFailureResponse_14(error); } - void OnSuccessResponse_30(int16_t maxHeatSetpointLimit) + static void OnSuccessCallback_14(void * context, int8_t minSetpointDeadBand) { - VerifyOrReturn(CheckValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); - - NextTest(); + (static_cast(context))->OnSuccessResponse_14(minSetpointDeadBand); } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_31() + static void OnFailureCallback_15(void * context, CHIP_ERROR error) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_31, OnFailureCallback_31, true)); - return CHIP_NO_ERROR; + (static_cast(context))->OnFailureResponse_15(error); } - void OnFailureResponse_31(CHIP_ERROR error) + static void OnSuccessCallback_15(void * context, uint8_t startOfWeek) { - chip::app::StatusIB status(error); - ThrowFailureResponse(); + (static_cast(context))->OnSuccessResponse_15(startOfWeek); } - void OnSuccessResponse_31(int16_t maxHeatSetpointLimit) + static void OnFailureCallback_16(void * context, CHIP_ERROR error) { - VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 700)); - VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); - NextTest(); + (static_cast(context))->OnFailureResponse_16(error); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxHeatSetpointLimit_32() + static void OnSuccessCallback_16(void * context, uint8_t numberOfWeeklyTransitions) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxHeatSetpointLimitArgument; - maxHeatSetpointLimitArgument = 3000; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxHeatSetpointLimitArgument, this, OnSuccessCallback_32, OnFailureCallback_32)); - return CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_16(numberOfWeeklyTransitions); } - void OnFailureResponse_32(CHIP_ERROR error) + static void OnFailureCallback_17(void * context, CHIP_ERROR error) { - chip::app::StatusIB status(error); - ThrowFailureResponse(); + (static_cast(context))->OnFailureResponse_17(error); } - void OnSuccessResponse_32() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMaxHeatSetpointLimit_33() + static void OnSuccessCallback_17(void * context, uint8_t numberOfDailyTransitions) { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_33, OnFailureCallback_33, true)); - return CHIP_NO_ERROR; + (static_cast(context))->OnSuccessResponse_17(numberOfDailyTransitions); } - void OnFailureResponse_33(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } + // + // Tests methods + // - void OnSuccessResponse_33(int16_t maxHeatSetpointLimit) + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() { - VerifyOrReturn(CheckValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); - - NextTest(); + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); } - CHIP_ERROR TestReadsMandatoryAttributesFromDutMinCoolSetpointLimit_34() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutLocalTemperature_1() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_34, OnFailureCallback_34, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_1, OnFailureCallback_1, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_34(CHIP_ERROR error) + void OnFailureResponse_1(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_34(int16_t minCoolSetpointLimit) + void OnSuccessResponse_1(int16_t localTemperature) { - VerifyOrReturn(CheckValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); - + VerifyOrReturn(CheckConstraintType("localTemperature", "", "int16")); NextTest(); } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinCoolSetpointLimit_35() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMinHeatSetpointLimit_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_35, OnFailureCallback_35, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_35(CHIP_ERROR error) + void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_35(int16_t minCoolSetpointLimit) + void OnSuccessResponse_2(int16_t absMinHeatSetpointLimit) { - VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", minCoolSetpointLimit, 3200)); + VerifyOrReturn(CheckConstraintType("absMinHeatSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 700)); + VerifyOrReturn(CheckConstraintMaxValue("absMinHeatSetpointLimit", absMinHeatSetpointLimit, 3000)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMinCoolSetpointLimit_36() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t minCoolSetpointLimitArgument; - minCoolSetpointLimitArgument = 1600; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minCoolSetpointLimitArgument, this, OnSuccessCallback_36, OnFailureCallback_36)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_36(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_36() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMinCoolSetpointLimit_37() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutAbsMaxHeatSetpointLimit_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_37, OnFailureCallback_37, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_37(CHIP_ERROR error) + void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_37(int16_t minCoolSetpointLimit) + void OnSuccessResponse_3(int16_t absMaxHeatSetpointLimit) { - VerifyOrReturn(CheckValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); - + VerifyOrReturn(CheckConstraintType("absMaxHeatSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 700)); + VerifyOrReturn(CheckConstraintMaxValue("absMaxHeatSetpointLimit", absMaxHeatSetpointLimit, 3000)); NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributesFromDutMaxCoolSetpointLimit_38() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMinCoolSetpointLimit_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_38, OnFailureCallback_38, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_38(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_38(int16_t maxCoolSetpointLimit) + void OnSuccessResponse_4(int16_t absMinCoolSetpointLimit) { - VerifyOrReturn(CheckValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); - + VerifyOrReturn(CheckConstraintType("absMinCoolSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("absMinCoolSetpointLimit", absMinCoolSetpointLimit, 3200)); NextTest(); } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxCoolSetpointLimit_39() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutAbsMaxCoolSetpointLimit_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_39, OnFailureCallback_39, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_39(CHIP_ERROR error) + void OnFailureResponse_5(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_39(int16_t maxCoolSetpointLimit) + void OnSuccessResponse_5(int16_t absMaxCoolSetpointLimit) { - VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); - VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 1600)); - VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); + VerifyOrReturn(CheckConstraintType("absMaxCoolSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("absMaxCoolSetpointLimit", absMaxCoolSetpointLimit, 3200)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutMaxCoolSetpointLimit_40() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int16_t maxCoolSetpointLimitArgument; - maxCoolSetpointLimitArgument = 3200; - - ReturnErrorOnFailure(cluster.WriteAttribute( - maxCoolSetpointLimitArgument, this, OnSuccessCallback_40, OnFailureCallback_40)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_40(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_40() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutMaxCoolSetpointLimit_41() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutOccupiedCoolingSetpoint_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_41, OnFailureCallback_41, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_6, OnFailureCallback_6, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_41(CHIP_ERROR error) + void OnFailureResponse_6(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_41(int16_t maxCoolSetpointLimit) + void OnSuccessResponse_6(int16_t occupiedCoolingSetpoint) { - VerifyOrReturn(CheckValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); - + VerifyOrReturn(CheckConstraintType("occupiedCoolingSetpoint", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("occupiedCoolingSetpoint", occupiedCoolingSetpoint, 2600)); NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributesFromDutControlSequenceOfOperation_42() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutOccupiedHeatingSetpoint_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_42, OnFailureCallback_42, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_7, OnFailureCallback_7, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_42(CHIP_ERROR error) + void OnFailureResponse_7(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_42(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) + void OnSuccessResponse_7(int16_t occupiedHeatingSetpoint) { - VerifyOrReturn(CheckValue("controlSequenceOfOperation", controlSequenceOfOperation, 4)); - + VerifyOrReturn(CheckConstraintType("occupiedHeatingSetpoint", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 700)); + VerifyOrReturn(CheckConstraintMaxValue("occupiedHeatingSetpoint", occupiedHeatingSetpoint, 2600)); NextTest(); } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_43() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMinHeatSetpointLimit_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_43, OnFailureCallback_43, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_8, OnFailureCallback_8, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_43(CHIP_ERROR error) + void OnFailureResponse_8(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_43(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) + void OnSuccessResponse_8(int16_t minHeatSetpointLimit) { - VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", controlSequenceOfOperation, 0)); - VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", controlSequenceOfOperation, 5)); + VerifyOrReturn(CheckConstraintType("minHeatSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("minHeatSetpointLimit", minHeatSetpointLimit, 700)); + VerifyOrReturn(CheckConstraintMaxValue("minHeatSetpointLimit", minHeatSetpointLimit, 3000)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutControlSequenceOfOperation_44() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperationArgument; - controlSequenceOfOperationArgument = static_cast(4); - - ReturnErrorOnFailure( - cluster.WriteAttribute( - controlSequenceOfOperationArgument, this, OnSuccessCallback_44, OnFailureCallback_44)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_44(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_44() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutControlSequenceOfOperation_45() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutMaxHeatSetpointLimit_9() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_45, OnFailureCallback_45, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_9, OnFailureCallback_9, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_45(CHIP_ERROR error) + void OnFailureResponse_9(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_45(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) + void OnSuccessResponse_9(int16_t maxHeatSetpointLimit) { - VerifyOrReturn(CheckValue("controlSequenceOfOperation", controlSequenceOfOperation, 4)); - + VerifyOrReturn(CheckConstraintType("maxHeatSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 700)); + VerifyOrReturn(CheckConstraintMaxValue("maxHeatSetpointLimit", maxHeatSetpointLimit, 3000)); NextTest(); } - CHIP_ERROR TestReadsMandatoryAttributesFromDutSystemMode_46() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinCoolSetpointLimit_10() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_46, OnFailureCallback_46, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_10, OnFailureCallback_10, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_46(CHIP_ERROR error) + void OnFailureResponse_10(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_46(uint8_t systemMode) + void OnSuccessResponse_10(int16_t minCoolSetpointLimit) { - VerifyOrReturn(CheckValue("systemMode", systemMode, 1)); - + VerifyOrReturn(CheckConstraintType("minCoolSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("minCoolSetpointLimit", minCoolSetpointLimit, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("minCoolSetpointLimit", minCoolSetpointLimit, 3200)); NextTest(); } - CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_47() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMaxCoolSetpointLimit_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_47, OnFailureCallback_47, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_11, OnFailureCallback_11, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_47(CHIP_ERROR error) + void OnFailureResponse_11(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_47(uint8_t systemMode) + void OnSuccessResponse_11(int16_t maxCoolSetpointLimit) { - VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); - VerifyOrReturn(CheckConstraintMinValue("systemMode", systemMode, 0)); - VerifyOrReturn(CheckConstraintMaxValue("systemMode", systemMode, 9)); + VerifyOrReturn(CheckConstraintType("maxCoolSetpointLimit", "", "int16")); + VerifyOrReturn(CheckConstraintMinValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 1600)); + VerifyOrReturn(CheckConstraintMaxValue("maxCoolSetpointLimit", maxCoolSetpointLimit, 3200)); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToMandatoryAttributesToDutSystemMode_48() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t systemModeArgument; - systemModeArgument = 1; - - ReturnErrorOnFailure(cluster.WriteAttribute( - systemModeArgument, this, OnSuccessCallback_48, OnFailureCallback_48)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_48(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_48() { NextTest(); } - - CHIP_ERROR TestReadBackMandatoryAttributesFromDutSystemMode_49() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutControlSequenceOfOperation_12() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_49, OnFailureCallback_49, true)); + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_12, OnFailureCallback_12, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_49(CHIP_ERROR error) + void OnFailureResponse_12(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_49(uint8_t systemMode) + void OnSuccessResponse_12(chip::app::Clusters::Thermostat::ThermostatControlSequence controlSequenceOfOperation) { - VerifyOrReturn(CheckValue("systemMode", systemMode, 1)); - + VerifyOrReturn(CheckConstraintType("controlSequenceOfOperation", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("controlSequenceOfOperation", controlSequenceOfOperation, 0)); + VerifyOrReturn(CheckConstraintMaxValue("controlSequenceOfOperation", controlSequenceOfOperation, 5)); NextTest(); } - CHIP_ERROR TestReadsOptionalAttributesFromDutMinSetpointDeadBand_50() + CHIP_ERROR TestReadsConstraintsOfMandatoryAttributesFromDutSystemMode_13() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_50, OnFailureCallback_50, true)); + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_13, OnFailureCallback_13, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_50(CHIP_ERROR error) + void OnFailureResponse_13(CHIP_ERROR error) { chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); + ThrowFailureResponse(); } - void OnSuccessResponse_50(int8_t minSetpointDeadBand) + void OnSuccessResponse_13(uint8_t systemMode) { - VerifyOrReturn(CheckValue("minSetpointDeadBand", minSetpointDeadBand, 25)); - + VerifyOrReturn(CheckConstraintType("systemMode", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("systemMode", systemMode, 0)); + VerifyOrReturn(CheckConstraintMaxValue("systemMode", systemMode, 9)); NextTest(); } - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_51() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutMinSetpointDeadBand_14() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_51, OnFailureCallback_51, true)); + this, OnSuccessCallback_14, OnFailureCallback_14, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_51(CHIP_ERROR error) + void OnFailureResponse_14(CHIP_ERROR error) { chip::app::StatusIB status(error); (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_51(int8_t minSetpointDeadBand) + void OnSuccessResponse_14(int8_t minSetpointDeadBand) { VerifyOrReturn(CheckConstraintType("minSetpointDeadBand", "", "int8")); VerifyOrReturn(CheckConstraintMinValue("minSetpointDeadBand", minSetpointDeadBand, 0)); @@ -44273,70 +43234,24 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutMinSetpointDeadBand_52() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - int8_t minSetpointDeadBandArgument; - minSetpointDeadBandArgument = 25; - - ReturnErrorOnFailure(cluster.WriteAttribute( - minSetpointDeadBandArgument, this, OnSuccessCallback_52, OnFailureCallback_52)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_52(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_52() { NextTest(); } - - CHIP_ERROR TestReadBackOptionalAttributesFromDutMinSetpointDeadBand_53() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_53, OnFailureCallback_53, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_53(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_53(int8_t minSetpointDeadBand) - { - VerifyOrReturn(CheckValue("minSetpointDeadBand", minSetpointDeadBand, 25)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_54() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutStartOfWeek_15() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_54, OnFailureCallback_54, true)); + this, OnSuccessCallback_15, OnFailureCallback_15, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_54(CHIP_ERROR error) + void OnFailureResponse_15(CHIP_ERROR error) { chip::app::StatusIB status(error); (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_54(uint8_t startOfWeek) + void OnSuccessResponse_15(uint8_t startOfWeek) { VerifyOrReturn(CheckConstraintType("startOfWeek", "", "enum8")); VerifyOrReturn(CheckConstraintMinValue("startOfWeek", startOfWeek, 0)); @@ -44344,61 +43259,7 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutStartOfWeek_55() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t startOfWeekArgument; - startOfWeekArgument = 0; - - ReturnErrorOnFailure(cluster.WriteAttribute( - startOfWeekArgument, this, OnSuccessCallback_55, OnFailureCallback_55)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_55(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) - { - NextTest(); - } - else - { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - } - - void OnSuccessResponse_55() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadBackOptionalAttributesFromDutStartOfWeek_56() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_56, OnFailureCallback_56, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_56(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); - } - - void OnSuccessResponse_56(uint8_t startOfWeek) - { - VerifyOrReturn(CheckValue("startOfWeek", startOfWeek, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_57() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfWeeklyTransitions_16() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; @@ -44406,106 +43267,44 @@ class Test_TC_TSTAT_2_1Suite : public TestCommand ReturnErrorOnFailure( cluster.ReadAttribute( - this, OnSuccessCallback_57, OnFailureCallback_57, true)); + this, OnSuccessCallback_16, OnFailureCallback_16, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_57(CHIP_ERROR error) + void OnFailureResponse_16(CHIP_ERROR error) { chip::app::StatusIB status(error); (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_57(uint8_t numberOfWeeklyTransitions) + void OnSuccessResponse_16(uint8_t numberOfWeeklyTransitions) { VerifyOrReturn(CheckConstraintType("numberOfWeeklyTransitions", "", "uint8")); NextTest(); } - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfWeeklyTransitions_58() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t numberOfWeeklyTransitionsArgument; - numberOfWeeklyTransitionsArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - numberOfWeeklyTransitionsArgument, this, OnSuccessCallback_58, OnFailureCallback_58)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_58(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) - { - NextTest(); - } - else - { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - } - - void OnSuccessResponse_58() { ThrowSuccessResponse(); } - - CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_59() + CHIP_ERROR TestReadsConstraintsOfOptionalAttributesFromDutNumberOfDailyTransitions_17() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); ReturnErrorOnFailure(cluster.ReadAttribute( - this, OnSuccessCallback_59, OnFailureCallback_59, true)); + this, OnSuccessCallback_17, OnFailureCallback_17, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_59(CHIP_ERROR error) + void OnFailureResponse_17(CHIP_ERROR error) { chip::app::StatusIB status(error); (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } - void OnSuccessResponse_59(uint8_t numberOfDailyTransitions) + void OnSuccessResponse_17(uint8_t numberOfDailyTransitions) { VerifyOrReturn(CheckConstraintType("numberOfDailyTransitions", "", "uint8")); NextTest(); } - - CHIP_ERROR TestWritesTheRespectiveDefaultValueToOptionalAttributesToDutNumberOfDailyTransitions_60() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t numberOfDailyTransitionsArgument; - numberOfDailyTransitionsArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - numberOfDailyTransitionsArgument, this, OnSuccessCallback_60, OnFailureCallback_60)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_60(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - if (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) - { - NextTest(); - } - else - { - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); - } - } - - void OnSuccessResponse_60() { ThrowSuccessResponse(); } }; class Test_TC_TSTAT_2_2Suite : public TestCommand @@ -45501,7 +44300,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_1(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_1(int16_t occupiedCoolingSetpoint) @@ -45530,7 +44329,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_2() { NextTest(); } @@ -45549,7 +44348,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_3(int16_t occupiedCoolingSetpoint) @@ -45576,7 +44375,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_4() { NextTest(); } @@ -45598,7 +44397,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_5(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_5() { NextTest(); } @@ -45965,7 +44764,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_21(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_21(int16_t minCoolSetpointLimit) @@ -45994,7 +44793,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_22(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_22() { NextTest(); } @@ -46013,7 +44812,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_23(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_23(int16_t minCoolSetpointLimit) @@ -46040,7 +44839,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_24(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_24() { NextTest(); } @@ -46062,7 +44861,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_25(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_25() { NextTest(); } @@ -46081,7 +44880,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_26(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_26(int16_t maxCoolSetpointLimit) @@ -46110,7 +44909,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_27(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_27() { NextTest(); } @@ -46129,7 +44928,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_28(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_28(int16_t maxCoolSetpointLimit) @@ -46156,7 +44955,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_29(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_29() { NextTest(); } @@ -46178,7 +44977,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_30(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_30() { NextTest(); } @@ -46288,7 +45087,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_35(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_35() { NextTest(); } @@ -46310,7 +45109,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_36(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_36() { NextTest(); } @@ -46332,7 +45131,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_37(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_37() { NextTest(); } @@ -46354,7 +45153,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_38(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_38() { NextTest(); } @@ -46495,7 +45294,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_44(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_44() { NextTest(); } @@ -46517,7 +45316,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_45(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_45() { NextTest(); } @@ -46539,7 +45338,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_46(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_46() { NextTest(); } @@ -46583,7 +45382,7 @@ class Test_TC_TSTAT_2_2Suite : public TestCommand void OnFailureResponse_48(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + (status.mStatus == chip::Protocols::InteractionModel::Status::UnsupportedAttribute) ? NextTest() : ThrowFailureResponse(); } void OnSuccessResponse_48() { NextTest(); } @@ -46659,13 +45458,16 @@ class Test_TC_TSUIC_1_1Suite : public TestCommand err = TestReadTheGlobalAttributeConstraintsClusterRevision_1(); break; case 2: - ChipLogProgress(chipTool, - " ***** Test Step 2 : write the default values to mandatory global attribute: ClusterRevision\n"); - err = TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2(); + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AttributeList\n"); - err = TestReadTheGlobalAttributeAttributeList_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_4(); break; } @@ -46683,7 +45485,7 @@ class Test_TC_TSUIC_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 4; + const uint16_t mTestCount = 5; chip::Optional mNodeId; chip::Optional mCluster; @@ -46713,16 +45515,31 @@ class Test_TC_TSUIC_1_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_2(error); } - static void OnSuccessCallback_2(void * context) { (static_cast(context))->OnSuccessResponse_2(); } + static void OnSuccessCallback_2(void * context, const chip::app::DataModel::DecodableList & attributeList) + { + (static_cast(context))->OnSuccessResponse_2(attributeList); + } static void OnFailureCallback_3(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context, const chip::app::DataModel::DecodableList & attributeList) + static void OnSuccessCallback_3(void * context, + const chip::app::DataModel::DecodableList & acceptedCommandList) { - (static_cast(context))->OnSuccessResponse_3(attributeList); + (static_cast(context))->OnSuccessResponse_3(acceptedCommandList); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, + const chip::app::DataModel::DecodableList & generatedCommandList) + { + (static_cast(context))->OnSuccessResponse_4(generatedCommandList); } // @@ -46759,40 +45576,39 @@ class Test_TC_TSUIC_1_1Suite : public TestCommand NextTest(); } - CHIP_ERROR TestWriteTheDefaultValuesToMandatoryGlobalAttributeClusterRevision_2() + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_2() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint16_t clusterRevisionArgument; - clusterRevisionArgument = 2U; - ReturnErrorOnFailure( - cluster - .WriteAttribute( - clusterRevisionArgument, this, OnSuccessCallback_2, OnFailureCallback_2)); + cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); return CHIP_NO_ERROR; } void OnFailureResponse_2(CHIP_ERROR error) { chip::app::StatusIB status(error); - VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_UNSUPPORTED_WRITE)); - NextTest(); + ThrowFailureResponse(); } - void OnSuccessResponse_2() { ThrowSuccessResponse(); } + void OnSuccessResponse_2(const chip::app::DataModel::DecodableList & attributeList) + { + VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + NextTest(); + } - CHIP_ERROR TestReadTheGlobalAttributeAttributeList_3() + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_3, OnFailureCallback_3, true)); + ReturnErrorOnFailure(cluster.ReadAttribute< + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::AcceptedCommandList::TypeInfo>( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } @@ -46802,9 +45618,33 @@ class Test_TC_TSUIC_1_1Suite : public TestCommand ThrowFailureResponse(); } - void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & attributeList) + void OnSuccessResponse_3(const chip::app::DataModel::DecodableList & acceptedCommandList) { - VerifyOrReturn(CheckConstraintType("attributeList", "", "list")); + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "", "list")); + NextTest(); + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute< + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::GeneratedCommandList::TypeInfo>( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::DecodableList & generatedCommandList) + { + VerifyOrReturn(CheckConstraintType("generatedCommandList", "", "list")); NextTest(); } }; @@ -46861,56 +45701,20 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand err = TestReadTheMandatoryAttributeTemperatureDisplayMode_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : write to the mandatory attribute: TemperatureDisplayMode\n"); - err = TestWriteToTheMandatoryAttributeTemperatureDisplayMode_3(); + ChipLogProgress(chipTool, " ***** Test Step 3 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_4(); + ChipLogProgress(chipTool, " ***** Test Step 4 : read the mandatory attribute: KeypadLockout\n"); + err = TestReadTheMandatoryAttributeKeypadLockout_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : read the mandatory attribute: TemperatureDisplayMode\n"); - err = TestReadTheMandatoryAttributeTemperatureDisplayMode_5(); + ChipLogProgress(chipTool, " ***** Test Step 5 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_6(); - break; - case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_7(); - break; - case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : write to the mandatory attribute: KeypadLockout\n"); - err = TestWriteToTheMandatoryAttributeKeypadLockout_8(); - break; - case 9: - ChipLogProgress(chipTool, " ***** Test Step 9 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_9(); - break; - case 10: - ChipLogProgress(chipTool, " ***** Test Step 10 : read the mandatory attribute: KeypadLockout\n"); - err = TestReadTheMandatoryAttributeKeypadLockout_10(); - break; - case 11: - ChipLogProgress(chipTool, " ***** Test Step 11 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_11(); - break; - case 12: - ChipLogProgress(chipTool, " ***** Test Step 12 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_12(); - break; - case 13: - ChipLogProgress(chipTool, " ***** Test Step 13 : write to the mandatory attribute: ScheduleProgrammingVisibility\n"); - err = TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_13(); - break; - case 14: - ChipLogProgress(chipTool, " ***** Test Step 14 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_14(); - break; - case 15: - ChipLogProgress(chipTool, " ***** Test Step 15 : read the optional attribute: ScheduleProgrammingVisibility\n"); - err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_15(); + ChipLogProgress(chipTool, " ***** Test Step 6 : read the optional attribute: ScheduleProgrammingVisibility\n"); + err = TestReadTheOptionalAttributeScheduleProgrammingVisibility_6(); break; } @@ -46928,7 +45732,7 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 16; + const uint16_t mTestCount = 7; chip::Optional mNodeId; chip::Optional mCluster; @@ -46968,16 +45772,19 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_3(error); } - static void OnSuccessCallback_3(void * context) { (static_cast(context))->OnSuccessResponse_3(); } + static void OnSuccessCallback_3(void * context, uint8_t keypadLockout) + { + (static_cast(context))->OnSuccessResponse_3(keypadLockout); + } static void OnFailureCallback_4(void * context, CHIP_ERROR error) { (static_cast(context))->OnFailureResponse_4(error); } - static void OnSuccessCallback_4(void * context, uint8_t temperatureDisplayMode) + static void OnSuccessCallback_4(void * context, uint8_t keypadLockout) { - (static_cast(context))->OnSuccessResponse_4(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_4(keypadLockout); } static void OnFailureCallback_5(void * context, CHIP_ERROR error) @@ -46985,9 +45792,9 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_5(error); } - static void OnSuccessCallback_5(void * context, uint8_t temperatureDisplayMode) + static void OnSuccessCallback_5(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnSuccessResponse_5(temperatureDisplayMode); + (static_cast(context))->OnSuccessResponse_5(scheduleProgrammingVisibility); } static void OnFailureCallback_6(void * context, CHIP_ERROR error) @@ -46995,93 +45802,9 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand (static_cast(context))->OnFailureResponse_6(error); } - static void OnSuccessCallback_6(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_6(keypadLockout); - } - - static void OnFailureCallback_7(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_7(error); - } - - static void OnSuccessCallback_7(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_7(keypadLockout); - } - - static void OnFailureCallback_8(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_8(error); - } - - static void OnSuccessCallback_8(void * context) { (static_cast(context))->OnSuccessResponse_8(); } - - static void OnFailureCallback_9(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_9(error); - } - - static void OnSuccessCallback_9(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_9(keypadLockout); - } - - static void OnFailureCallback_10(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_10(error); - } - - static void OnSuccessCallback_10(void * context, uint8_t keypadLockout) - { - (static_cast(context))->OnSuccessResponse_10(keypadLockout); - } - - static void OnFailureCallback_11(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_11(error); - } - - static void OnSuccessCallback_11(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_11(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_12(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_12(error); - } - - static void OnSuccessCallback_12(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_12(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_13(void * context, CHIP_ERROR error) + static void OnSuccessCallback_6(void * context, uint8_t scheduleProgrammingVisibility) { - (static_cast(context))->OnFailureResponse_13(error); - } - - static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } - - static void OnFailureCallback_14(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_14(error); - } - - static void OnSuccessCallback_14(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_14(scheduleProgrammingVisibility); - } - - static void OnFailureCallback_15(void * context, CHIP_ERROR error) - { - (static_cast(context))->OnFailureResponse_15(error); - } - - static void OnSuccessCallback_15(void * context, uint8_t scheduleProgrammingVisibility) - { - (static_cast(context))->OnSuccessResponse_15(scheduleProgrammingVisibility); + (static_cast(context))->OnSuccessResponse_6(scheduleProgrammingVisibility); } // @@ -47142,157 +45865,12 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand void OnSuccessResponse_2(uint8_t temperatureDisplayMode) { VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("temperatureDisplayMode", temperatureDisplayMode, 0)); + VerifyOrReturn(CheckConstraintMaxValue("temperatureDisplayMode", temperatureDisplayMode, 1)); NextTest(); } - CHIP_ERROR TestWriteToTheMandatoryAttributeTemperatureDisplayMode_3() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t temperatureDisplayModeArgument; - temperatureDisplayModeArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - temperatureDisplayModeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_3(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_3() { NextTest(); } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_4() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - this, OnSuccessCallback_4, OnFailureCallback_4, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_4(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_4(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckValue("temperatureDisplayMode", temperatureDisplayMode, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeTemperatureDisplayMode_5() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( - this, OnSuccessCallback_5, OnFailureCallback_5, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_5(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_5(uint8_t temperatureDisplayMode) - { - VerifyOrReturn(CheckConstraintType("temperatureDisplayMode", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_6() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_6, OnFailureCallback_6, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_6(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_6(uint8_t keypadLockout) - { - VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_7() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute( - this, OnSuccessCallback_7, OnFailureCallback_7, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_7(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_7(uint8_t keypadLockout) - { - VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestWriteToTheMandatoryAttributeKeypadLockout_8() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_8, OnFailureCallback_8)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_8(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_8() { NextTest(); } - - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_9() + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; @@ -47300,24 +45878,24 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand ReturnErrorOnFailure( cluster.ReadAttribute( - this, OnSuccessCallback_9, OnFailureCallback_9, true)); + this, OnSuccessCallback_3, OnFailureCallback_3, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_9(CHIP_ERROR error) + void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_9(uint8_t keypadLockout) + void OnSuccessResponse_3(uint8_t keypadLockout) { VerifyOrReturn(CheckValue("keypadLockout", keypadLockout, 0)); NextTest(); } - CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_10() + CHIP_ERROR TestReadTheMandatoryAttributeKeypadLockout_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; @@ -47325,98 +45903,25 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand ReturnErrorOnFailure( cluster.ReadAttribute( - this, OnSuccessCallback_10, OnFailureCallback_10, true)); + this, OnSuccessCallback_4, OnFailureCallback_4, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_10(CHIP_ERROR error) + void OnFailureResponse_4(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_10(uint8_t keypadLockout) + void OnSuccessResponse_4(uint8_t keypadLockout) { VerifyOrReturn(CheckConstraintType("keypadLockout", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("keypadLockout", keypadLockout, 0)); + VerifyOrReturn(CheckConstraintMaxValue("keypadLockout", keypadLockout, 5)); NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_11() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - this, OnSuccessCallback_11, OnFailureCallback_11, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_11(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_11(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); - - NextTest(); - } - - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_12() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - ReturnErrorOnFailure( - cluster.ReadAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - this, OnSuccessCallback_12, OnFailureCallback_12, true)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_12(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_12(uint8_t scheduleProgrammingVisibility) - { - VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); - NextTest(); - } - - CHIP_ERROR TestWriteToTheMandatoryAttributeScheduleProgrammingVisibility_13() - { - const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; - chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; - cluster.Associate(mDevices[kIdentityAlpha], endpoint); - - uint8_t scheduleProgrammingVisibilityArgument; - scheduleProgrammingVisibilityArgument = 0; - - ReturnErrorOnFailure( - cluster.WriteAttribute< - chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); - return CHIP_NO_ERROR; - } - - void OnFailureResponse_13(CHIP_ERROR error) - { - chip::app::StatusIB status(error); - ThrowFailureResponse(); - } - - void OnSuccessResponse_13() { NextTest(); } - - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_14() + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; @@ -47425,24 +45930,24 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand ReturnErrorOnFailure( cluster.ReadAttribute< chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - this, OnSuccessCallback_14, OnFailureCallback_14, true)); + this, OnSuccessCallback_5, OnFailureCallback_5, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_14(CHIP_ERROR error) + void OnFailureResponse_5(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_14(uint8_t scheduleProgrammingVisibility) + void OnSuccessResponse_5(uint8_t scheduleProgrammingVisibility) { VerifyOrReturn(CheckValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); NextTest(); } - CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_15() + CHIP_ERROR TestReadTheOptionalAttributeScheduleProgrammingVisibility_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; @@ -47451,19 +45956,21 @@ class Test_TC_TSUIC_2_1Suite : public TestCommand ReturnErrorOnFailure( cluster.ReadAttribute< chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - this, OnSuccessCallback_15, OnFailureCallback_15, true)); + this, OnSuccessCallback_6, OnFailureCallback_6, true)); return CHIP_NO_ERROR; } - void OnFailureResponse_15(CHIP_ERROR error) + void OnFailureResponse_6(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_15(uint8_t scheduleProgrammingVisibility) + void OnSuccessResponse_6(uint8_t scheduleProgrammingVisibility) { VerifyOrReturn(CheckConstraintType("scheduleProgrammingVisibility", "", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 0)); + VerifyOrReturn(CheckConstraintMaxValue("scheduleProgrammingVisibility", scheduleProgrammingVisibility, 1)); NextTest(); } }; @@ -47530,78 +46037,108 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand err = TestWritesAValueOf1ToTemperatureDisplayModeAttributeOfDut_2(); break; case 3: - ChipLogProgress(chipTool, " ***** Test Step 3 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); - if (ShouldSkip("A_KEYPAD_LOCKOUT")) + ChipLogProgress(chipTool, + " ***** Test Step 3 : Writes a value of greater than 1 to TemperatureDisplayMode attribute of DUT\n"); + if (ShouldSkip("A_TEMPERATURE_DISPLAY_MODE")) { NextTest(); return; } - err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_3(); + err = TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3(); break; case 4: - ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 4 : Writes a value of 0 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_4(); + err = TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4(); break; case 5: - ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 5 : Writes a value of 1 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_5(); + err = TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5(); break; case 6: - ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 6 : Writes a value of 2 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_6(); + err = TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6(); break; case 7: - ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 7 : Writes a value of 3 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_7(); + err = TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7(); break; case 8: - ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); + ChipLogProgress(chipTool, " ***** Test Step 8 : Writes a value of 4 to KeypadLockout attribute of DUT\n"); if (ShouldSkip("A_KEYPAD_LOCKOUT")) { NextTest(); return; } - err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_8(); + err = TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8(); break; case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Writes a value of 5 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) + { + NextTest(); + return; + } + err = TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Writes a value of greater than 5 to KeypadLockout attribute of DUT\n"); + if (ShouldSkip("A_KEYPAD_LOCKOUT")) + { + NextTest(); + return; + } + err = TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10(); + break; + case 11: ChipLogProgress(chipTool, - " ***** Test Step 9 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); + " ***** Test Step 11 : Writes a value of 0 to ScheduleProgrammingVisibility attribute of DUT\n"); if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { NextTest(); return; } - err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_9(); + err = TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11(); break; - case 10: + case 12: ChipLogProgress(chipTool, - " ***** Test Step 10 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + " ***** Test Step 12 : Writes a value of 1 to ScheduleProgrammingVisibility attribute of DUT\n"); + if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) + { + NextTest(); + return; + } + err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12(); + break; + case 13: + ChipLogProgress( + chipTool, + " ***** Test Step 13 : Writes a value of greater than 1 to ScheduleProgrammingVisibility attribute of DUT\n"); if (ShouldSkip("A_SCHEDULE_PROGRAMMING_VISIBILITY")) { NextTest(); return; } - err = TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_10(); + err = TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13(); break; } @@ -47619,7 +46156,7 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 11; + const uint16_t mTestCount = 14; chip::Optional mNodeId; chip::Optional mCluster; @@ -47704,6 +46241,27 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand static void OnSuccessCallback_10(void * context) { (static_cast(context))->OnSuccessResponse_10(); } + static void OnFailureCallback_11(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_11(error); + } + + static void OnSuccessCallback_11(void * context) { (static_cast(context))->OnSuccessResponse_11(); } + + static void OnFailureCallback_12(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_12(error); + } + + static void OnSuccessCallback_12(void * context) { (static_cast(context))->OnSuccessResponse_12(); } + + static void OnFailureCallback_13(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_13(error); + } + + static void OnSuccessCallback_13(void * context) { (static_cast(context))->OnSuccessResponse_13(); } + // // Tests methods // @@ -47762,37 +46320,39 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand void OnSuccessResponse_2() { NextTest(); } - CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_3() + CHIP_ERROR TestWritesAValueOfGreaterThan1ToTemperatureDisplayModeAttributeOfDut_3() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); - uint8_t keypadLockoutArgument; - keypadLockoutArgument = 0; + uint8_t temperatureDisplayModeArgument; + temperatureDisplayModeArgument = 2; ReturnErrorOnFailure( - cluster.WriteAttribute( - keypadLockoutArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); + cluster.WriteAttribute< + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::TypeInfo>( + temperatureDisplayModeArgument, this, OnSuccessCallback_3, OnFailureCallback_3)); return CHIP_NO_ERROR; } void OnFailureResponse_3(CHIP_ERROR error) { chip::app::StatusIB status(error); - ThrowFailureResponse(); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); } - void OnSuccessResponse_3() { NextTest(); } + void OnSuccessResponse_3() { ThrowSuccessResponse(); } - CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_4() + CHIP_ERROR TestWritesAValueOf0ToKeypadLockoutAttributeOfDut_4() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); uint8_t keypadLockoutArgument; - keypadLockoutArgument = 1; + keypadLockoutArgument = 0; ReturnErrorOnFailure( cluster.WriteAttribute( @@ -47808,14 +46368,14 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand void OnSuccessResponse_4() { NextTest(); } - CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_5() + CHIP_ERROR TestWritesAValueOf1ToKeypadLockoutAttributeOfDut_5() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); uint8_t keypadLockoutArgument; - keypadLockoutArgument = 2; + keypadLockoutArgument = 1; ReturnErrorOnFailure( cluster.WriteAttribute( @@ -47831,14 +46391,14 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand void OnSuccessResponse_5() { NextTest(); } - CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_6() + CHIP_ERROR TestWritesAValueOf2ToKeypadLockoutAttributeOfDut_6() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); uint8_t keypadLockoutArgument; - keypadLockoutArgument = 3; + keypadLockoutArgument = 2; ReturnErrorOnFailure( cluster.WriteAttribute( @@ -47854,14 +46414,14 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand void OnSuccessResponse_6() { NextTest(); } - CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_7() + CHIP_ERROR TestWritesAValueOf3ToKeypadLockoutAttributeOfDut_7() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); uint8_t keypadLockoutArgument; - keypadLockoutArgument = 4; + keypadLockoutArgument = 3; ReturnErrorOnFailure( cluster.WriteAttribute( @@ -47877,14 +46437,14 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand void OnSuccessResponse_7() { NextTest(); } - CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_8() + CHIP_ERROR TestWritesAValueOf4ToKeypadLockoutAttributeOfDut_8() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; cluster.Associate(mDevices[kIdentityAlpha], endpoint); uint8_t keypadLockoutArgument; - keypadLockoutArgument = 5; + keypadLockoutArgument = 4; ReturnErrorOnFailure( cluster.WriteAttribute( @@ -47900,7 +46460,54 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand void OnSuccessResponse_8() { NextTest(); } - CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_9() + CHIP_ERROR TestWritesAValueOf5ToKeypadLockoutAttributeOfDut_9() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + uint8_t keypadLockoutArgument; + keypadLockoutArgument = 5; + + ReturnErrorOnFailure( + cluster.WriteAttribute( + keypadLockoutArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_9(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_9() { NextTest(); } + + CHIP_ERROR TestWritesAValueOfGreaterThan5ToKeypadLockoutAttributeOfDut_10() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + uint8_t keypadLockoutArgument; + keypadLockoutArgument = 6; + + ReturnErrorOnFailure( + cluster.WriteAttribute( + keypadLockoutArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_10(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_10() { ThrowSuccessResponse(); } + + CHIP_ERROR TestWritesAValueOf0ToScheduleProgrammingVisibilityAttributeOfDut_11() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; @@ -47912,19 +46519,19 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand ReturnErrorOnFailure( cluster.WriteAttribute< chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_9, OnFailureCallback_9)); + scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_11, OnFailureCallback_11)); return CHIP_NO_ERROR; } - void OnFailureResponse_9(CHIP_ERROR error) + void OnFailureResponse_11(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_9() { NextTest(); } + void OnSuccessResponse_11() { NextTest(); } - CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_10() + CHIP_ERROR TestWritesAValueOf1ToScheduleProgrammingVisibilityAttributeOfDut_12() { const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; @@ -47936,17 +46543,42 @@ class Test_TC_TSUIC_2_2Suite : public TestCommand ReturnErrorOnFailure( cluster.WriteAttribute< chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( - scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_10, OnFailureCallback_10)); + scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_12, OnFailureCallback_12)); return CHIP_NO_ERROR; } - void OnFailureResponse_10(CHIP_ERROR error) + void OnFailureResponse_12(CHIP_ERROR error) { chip::app::StatusIB status(error); ThrowFailureResponse(); } - void OnSuccessResponse_10() { NextTest(); } + void OnSuccessResponse_12() { NextTest(); } + + CHIP_ERROR TestWritesAValueOfGreaterThan1ToScheduleProgrammingVisibilityAttributeOfDut_13() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 1; + chip::Controller::ThermostatUserInterfaceConfigurationClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + uint8_t scheduleProgrammingVisibilityArgument; + scheduleProgrammingVisibilityArgument = 2; + + ReturnErrorOnFailure( + cluster.WriteAttribute< + chip::app::Clusters::ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::TypeInfo>( + scheduleProgrammingVisibilityArgument, this, OnSuccessCallback_13, OnFailureCallback_13)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_13(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), EMBER_ZCL_STATUS_CONSTRAINT_ERROR)); + NextTest(); + } + + void OnSuccessResponse_13() { ThrowSuccessResponse(); } }; class Test_TC_DIAG_TH_NW_1_1Suite : public TestCommand @@ -52122,6 +50754,22 @@ class Test_TC_WIFIDIAG_1_1Suite : public TestCommand ChipLogProgress(chipTool, " ***** Test Step 1 : Reads NetworkInterface structure attribute from DUT\n"); err = TestReadsNetworkInterfaceStructureAttributeFromDut_1(); break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Reads SecurityType attribute constraints\n"); + err = TestReadsSecurityTypeAttributeConstraints_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Reads WiFiVersion attribute constraints\n"); + err = TestReadsWiFiVersionAttributeConstraints_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Reads ChannelNumber attribute constraints\n"); + err = TestReadsChannelNumberAttributeConstraints_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Reads RSSI attribute constraints\n"); + err = TestReadsRssiAttributeConstraints_5(); + break; } if (CHIP_NO_ERROR != err) @@ -52138,7 +50786,7 @@ class Test_TC_WIFIDIAG_1_1Suite : public TestCommand private: std::atomic_uint16_t mTestIndex; - const uint16_t mTestCount = 2; + const uint16_t mTestCount = 6; chip::Optional mNodeId; chip::Optional mCluster; @@ -52166,6 +50814,50 @@ class Test_TC_WIFIDIAG_1_1Suite : public TestCommand (static_cast(context))->OnSuccessResponse_1(networkInterfaces); } + static void OnFailureCallback_2(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_2(error); + } + + static void OnSuccessCallback_2( + void * context, + const chip::app::DataModel::Nullable & securityType) + { + (static_cast(context))->OnSuccessResponse_2(securityType); + } + + static void OnFailureCallback_3(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_3(error); + } + + static void OnSuccessCallback_3( + void * context, + const chip::app::DataModel::Nullable & wiFiVersion) + { + (static_cast(context))->OnSuccessResponse_3(wiFiVersion); + } + + static void OnFailureCallback_4(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_4(error); + } + + static void OnSuccessCallback_4(void * context, const chip::app::DataModel::Nullable & channelNumber) + { + (static_cast(context))->OnSuccessResponse_4(channelNumber); + } + + static void OnFailureCallback_5(void * context, CHIP_ERROR error) + { + (static_cast(context))->OnFailureResponse_5(error); + } + + static void OnSuccessCallback_5(void * context, const chip::app::DataModel::Nullable & rssi) + { + (static_cast(context))->OnSuccessResponse_5(rssi); + } + // // Tests methods // @@ -52201,6 +50893,103 @@ class Test_TC_WIFIDIAG_1_1Suite : public TestCommand VerifyOrReturn(CheckConstraintType("networkInterfaces", "", "list")); NextTest(); } + + CHIP_ERROR TestReadsSecurityTypeAttributeConstraints_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_2, OnFailureCallback_2, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2( + const chip::app::DataModel::Nullable & securityType) + { + VerifyOrReturn(CheckConstraintType("securityType", "", "enum")); + NextTest(); + } + + CHIP_ERROR TestReadsWiFiVersionAttributeConstraints_3() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_3, OnFailureCallback_3, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_3(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_3( + const chip::app::DataModel::Nullable & wiFiVersion) + { + VerifyOrReturn(CheckConstraintType("wiFiVersion", "", "enum")); + NextTest(); + } + + CHIP_ERROR TestReadsChannelNumberAttributeConstraints_4() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure( + cluster.ReadAttribute( + this, OnSuccessCallback_4, OnFailureCallback_4, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_4(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_4(const chip::app::DataModel::Nullable & channelNumber) + { + VerifyOrReturn(CheckConstraintType("channelNumber", "", "uint16")); + NextTest(); + } + + CHIP_ERROR TestReadsRssiAttributeConstraints_5() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + chip::Controller::WiFiNetworkDiagnosticsClusterTest cluster; + cluster.Associate(mDevices[kIdentityAlpha], endpoint); + + ReturnErrorOnFailure(cluster.ReadAttribute( + this, OnSuccessCallback_5, OnFailureCallback_5, true)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_5(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_5(const chip::app::DataModel::Nullable & rssi) + { + VerifyOrReturn(CheckConstraintType("rssi", "", "int8")); + VerifyOrReturn(CheckConstraintMinValue("rssi", rssi, -120)); + VerifyOrReturn(CheckConstraintMaxValue("rssi", rssi, 0)); + NextTest(); + } }; class Test_TC_WIFIDIAG_3_1Suite : public TestCommand From 20f8b95fcc4a45bc0cea00bc2338baf1de446de0 Mon Sep 17 00:00:00 2001 From: Zang MingJie Date: Fri, 25 Mar 2022 02:06:03 +0800 Subject: [PATCH 53/70] Crypto: Fix node id in IV (#16098) * Skip calling OnFabricRetrievedFromStorage when the fabric is already initialized * Crypto: Fix node id in nonce * Apply suggestions from code review Co-authored-by: Tennessee Carmel-Veilleux Co-authored-by: Tennessee Carmel-Veilleux --- src/credentials/FabricTable.cpp | 15 +- src/credentials/tests/CHIPCert_test_vectors.h | 1 + src/lib/support/Span.h | 9 + .../secure_channel/tests/TestPASESession.cpp | 8 +- src/transport/CryptoContext.cpp | 38 +-- src/transport/CryptoContext.h | 18 +- src/transport/SecureMessageCodec.cpp | 12 +- src/transport/SecureMessageCodec.h | 8 +- src/transport/SessionManager.cpp | 35 ++- src/transport/tests/TestSecureSession.cpp | 32 ++- src/transport/tests/TestSessionManager.cpp | 257 ++++++++++++------ 11 files changed, 289 insertions(+), 144 deletions(-) diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index a729ecd7f23346..f76db9849d019a 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -609,15 +609,14 @@ CHIP_ERROR FabricTable::LoadFromStorage(FabricInfo * fabric) if (!fabric->IsInitialized()) { ReturnErrorOnFailure(fabric->LoadFromStorage(mStorage)); - } - FabricTableDelegate * delegate = mDelegate; - while (delegate) - { - ChipLogProgress(Discovery, "Fabric (%d) loaded from storage. Calling OnFabricRetrievedFromStorage", - fabric->GetFabricIndex()); - delegate->OnFabricRetrievedFromStorage(fabric); - delegate = delegate->mNext; + FabricTableDelegate * delegate = mDelegate; + while (delegate) + { + ChipLogProgress(Discovery, "Fabric (%d) loaded from storage", fabric->GetFabricIndex()); + delegate->OnFabricRetrievedFromStorage(fabric); + delegate = delegate->mNext; + } } return CHIP_NO_ERROR; } diff --git a/src/credentials/tests/CHIPCert_test_vectors.h b/src/credentials/tests/CHIPCert_test_vectors.h index f7aaa51c5f4908..08085e66a43af4 100644 --- a/src/credentials/tests/CHIPCert_test_vectors.h +++ b/src/credentials/tests/CHIPCert_test_vectors.h @@ -26,6 +26,7 @@ #pragma once +#include #include namespace chip { diff --git a/src/lib/support/Span.h b/src/lib/support/Span.h index 84bf035e6dbe4b..edcdd8ed353a62 100644 --- a/src/lib/support/Span.h +++ b/src/lib/support/Span.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include @@ -46,6 +47,10 @@ class Span constexpr explicit Span(T (&databuf)[N]) : Span(databuf, N) {} + template , std::remove_const_t>::value>> + constexpr Span(std::array & arr) : mDataBuf(arr.data()), mDataLen(N) + {} + template constexpr Span & operator=(T (&databuf)[N]) { @@ -169,6 +174,10 @@ class FixedSpan static_assert(M >= N, "Passed-in buffer too small for FixedSpan"); } + template , std::remove_const_t>::value>> + constexpr FixedSpan(std::array & arr) : mDataBuf(arr.data()) + {} + // Allow implicit construction from a FixedSpan of sufficient size over a // type that matches our type, up to const-ness. template , std::remove_const_t>::value>> diff --git a/src/protocols/secure_channel/tests/TestPASESession.cpp b/src/protocols/secure_channel/tests/TestPASESession.cpp index 13a75f8f66a083..11ada996512c61 100644 --- a/src/protocols/secure_channel/tests/TestPASESession.cpp +++ b/src/protocols/secure_channel/tests/TestPASESession.cpp @@ -416,7 +416,9 @@ void SecurePairingSerializeTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = session1.Encrypt(plain_text, sizeof(plain_text), encrypted, header, mac); + CryptoContext::NonceStorage nonce; + CryptoContext::BuildNonce(nonce, header.GetSecurityFlags(), header.GetMessageCounter(), kUndefinedNodeId); + err = session1.Encrypt(plain_text, sizeof(plain_text), encrypted, nonce, header, mac); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); } @@ -426,7 +428,9 @@ void SecurePairingSerializeTest(nlTestSuite * inSuite, void * inContext) testPairingSession2->DeriveSecureSession(session2, CryptoContext::SessionRole::kResponder) == CHIP_NO_ERROR); uint8_t decrypted[64]; - NL_TEST_ASSERT(inSuite, session2.Decrypt(encrypted, sizeof(plain_text), decrypted, header, mac) == CHIP_NO_ERROR); + CryptoContext::NonceStorage nonce; + CryptoContext::BuildNonce(nonce, header.GetSecurityFlags(), header.GetMessageCounter(), kUndefinedNodeId); + NL_TEST_ASSERT(inSuite, session2.Decrypt(encrypted, sizeof(plain_text), decrypted, nonce, header, mac) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, memcmp(plain_text, decrypted, sizeof(plain_text)) == 0); } diff --git a/src/transport/CryptoContext.cpp b/src/transport/CryptoContext.cpp index ab0ee35c1b2bec..a0d3fcf1305f6b 100644 --- a/src/transport/CryptoContext.cpp +++ b/src/transport/CryptoContext.cpp @@ -37,8 +37,7 @@ namespace chip { namespace { -constexpr size_t kAESCCMNonceLen = 13; -constexpr size_t kMaxAADLen = 128; +constexpr size_t kMaxAADLen = 128; /* Session Establish Key Info */ constexpr uint8_t SEKeysInfo[] = { 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73 }; @@ -131,16 +130,13 @@ CHIP_ERROR CryptoContext::InitFromKeyPair(const Crypto::P256Keypair & local_keyp return InitFromSecret(ByteSpan(secret, secret.Length()), salt, infoType, role); } -CHIP_ERROR CryptoContext::GetNonce(const PacketHeader & header, uint8_t * nonce, size_t len) +CHIP_ERROR CryptoContext::BuildNonce(NonceView nonce, uint8_t securityFlags, uint32_t messageCounter, NodeId nodeId) { + Encoding::LittleEndian::BufferWriter bbuf(nonce.data(), nonce.size()); - VerifyOrReturnError(len == kAESCCMNonceLen, CHIP_ERROR_INVALID_ARGUMENT); - - Encoding::LittleEndian::BufferWriter bbuf(nonce, len); - - bbuf.Put8(header.GetSecurityFlags()); - bbuf.Put32(header.GetMessageCounter()); - bbuf.Put64(header.GetSourceNodeId().ValueOr(0)); + bbuf.Put8(securityFlags); + bbuf.Put32(messageCounter); + bbuf.Put64(nodeId); return bbuf.Fit() ? CHIP_NO_ERROR : CHIP_ERROR_NO_MEMORY; } @@ -161,8 +157,8 @@ CHIP_ERROR CryptoContext::GetAdditionalAuthData(const PacketHeader & header, uin return CHIP_NO_ERROR; } -CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, uint8_t * output, PacketHeader & header, - MessageAuthenticationCode & mac) const +CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, uint8_t * output, ConstNonceView nonce, + PacketHeader & header, MessageAuthenticationCode & mac) const { const size_t taglen = header.MICTagLength(); @@ -174,11 +170,9 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui VerifyOrReturnError(output != nullptr, CHIP_ERROR_INVALID_ARGUMENT); uint8_t AAD[kMaxAADLen]; - uint8_t nonce[kAESCCMNonceLen]; uint16_t aadLen = sizeof(AAD); uint8_t tag[kMaxTagLen]; - ReturnErrorOnFailure(GetNonce(header, nonce, sizeof(nonce))); ReturnErrorOnFailure(GetAdditionalAuthData(header, AAD, aadLen)); if (mKeyContext) @@ -187,7 +181,7 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui MutableByteSpan ciphertext(output, input_length); MutableByteSpan mic(tag, taglen); - ReturnErrorOnFailure(mKeyContext->EncryptMessage(plaintext, ByteSpan(AAD, aadLen), ByteSpan(nonce), mic, ciphertext)); + ReturnErrorOnFailure(mKeyContext->EncryptMessage(plaintext, ByteSpan(AAD, aadLen), nonce, mic, ciphertext)); } else { @@ -202,8 +196,8 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui usage = kI2RKey; } - ReturnErrorOnFailure(AES_CCM_encrypt(input, input_length, AAD, aadLen, mKeys[usage], Crypto::kAES_CCM128_Key_Length, nonce, - sizeof(nonce), output, tag, taglen)); + ReturnErrorOnFailure(AES_CCM_encrypt(input, input_length, AAD, aadLen, mKeys[usage], Crypto::kAES_CCM128_Key_Length, + nonce.data(), nonce.size(), output, tag, taglen)); } mac.SetTag(&header, tag, taglen); @@ -211,12 +205,11 @@ CHIP_ERROR CryptoContext::Encrypt(const uint8_t * input, size_t input_length, ui return CHIP_NO_ERROR; } -CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, uint8_t * output, const PacketHeader & header, - const MessageAuthenticationCode & mac) const +CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, uint8_t * output, ConstNonceView nonce, + const PacketHeader & header, const MessageAuthenticationCode & mac) const { const size_t taglen = header.MICTagLength(); const uint8_t * tag = mac.GetTag(); - uint8_t nonce[kAESCCMNonceLen]; uint8_t AAD[kMaxAADLen]; uint16_t aadLen = sizeof(AAD); @@ -224,7 +217,6 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui VerifyOrReturnError(input_length > 0, CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(output != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - ReturnErrorOnFailure(GetNonce(header, nonce, sizeof(nonce))); ReturnErrorOnFailure(GetAdditionalAuthData(header, AAD, aadLen)); if (nullptr != mKeyContext) @@ -233,7 +225,7 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui MutableByteSpan plaintext(output, input_length); ByteSpan mic(tag, taglen); - CHIP_ERROR err = mKeyContext->DecryptMessage(ciphertext, ByteSpan(AAD, aadLen), ByteSpan(nonce), mic, plaintext); + CHIP_ERROR err = mKeyContext->DecryptMessage(ciphertext, ByteSpan(AAD, aadLen), nonce, mic, plaintext); ReturnErrorOnFailure(err); } else @@ -250,7 +242,7 @@ CHIP_ERROR CryptoContext::Decrypt(const uint8_t * input, size_t input_length, ui } ReturnErrorOnFailure(AES_CCM_decrypt(input, input_length, AAD, aadLen, tag, taglen, mKeys[usage], - Crypto::kAES_CCM128_Key_Length, nonce, sizeof(nonce), output)); + Crypto::kAES_CCM128_Key_Length, nonce.data(), nonce.size(), output)); } return CHIP_NO_ERROR; } diff --git a/src/transport/CryptoContext.h b/src/transport/CryptoContext.h index 5a462fbe45cbaf..97b30cf80dc6bc 100644 --- a/src/transport/CryptoContext.h +++ b/src/transport/CryptoContext.h @@ -35,6 +35,11 @@ namespace chip { class DLL_EXPORT CryptoContext { public: + static constexpr size_t kAESCCMNonceLen = 13; + using NonceStorage = std::array; + using NonceView = FixedSpan; + using ConstNonceView = FixedSpan; + CryptoContext(); ~CryptoContext(); CryptoContext(CryptoContext &&) = default; @@ -86,6 +91,9 @@ class DLL_EXPORT CryptoContext */ CHIP_ERROR InitFromSecret(const ByteSpan & secret, const ByteSpan & salt, SessionInfoType infoType, SessionRole role); + /** @brief Build a Nonce buffer using given parameters for encrypt or decrypt. */ + static CHIP_ERROR BuildNonce(NonceView nonce, uint8_t securityFlags, uint32_t messageCounter, NodeId nodeId); + /** * @brief * Encrypt the input data using keys established in the secure channel @@ -93,12 +101,13 @@ class DLL_EXPORT CryptoContext * @param input Unencrypted input data * @param input_length Length of the input data * @param output Output buffer for encrypted data + * @param nonce Nonce buffer for encrypt * @param header message header structure. Encryption type will be set on the header. * @param mac - output the resulting mac * * @return CHIP_ERROR The result of encryption */ - CHIP_ERROR Encrypt(const uint8_t * input, size_t input_length, uint8_t * output, PacketHeader & header, + CHIP_ERROR Encrypt(const uint8_t * input, size_t input_length, uint8_t * output, ConstNonceView nonce, PacketHeader & header, MessageAuthenticationCode & mac) const; /** @@ -108,12 +117,13 @@ class DLL_EXPORT CryptoContext * @param input Encrypted input data * @param input_length Length of the input data * @param output Output buffer for decrypted data + * @param nonce Nonce buffer for decrypt * @param header message header structure * @return CHIP_ERROR The result of decryption * @param mac Input mac */ - CHIP_ERROR Decrypt(const uint8_t * input, size_t input_length, uint8_t * output, const PacketHeader & header, - const MessageAuthenticationCode & mac) const; + CHIP_ERROR Decrypt(const uint8_t * input, size_t input_length, uint8_t * output, ConstNonceView nonce, + const PacketHeader & header, const MessageAuthenticationCode & mac) const; ByteSpan GetAttestationChallenge() const { return ByteSpan(mKeys[kAttestationChallengeKey], Crypto::kAES_CCM128_Key_Length); } @@ -143,8 +153,6 @@ class DLL_EXPORT CryptoContext CryptoKey mKeys[KeyUsage::kNumCryptoKeys]; Crypto::SymmetricKeyContext * mKeyContext = nullptr; - static CHIP_ERROR GetNonce(const PacketHeader & header, uint8_t * nonce, size_t len); - // Use unencrypted header as additional authenticated data (AAD) during encryption and decryption. // The encryption operations includes AAD when message authentication tag is generated. This tag // is used at the time of decryption to integrity check the received data. diff --git a/src/transport/SecureMessageCodec.cpp b/src/transport/SecureMessageCodec.cpp index 98547858a10515..9c08d535ff57a3 100644 --- a/src/transport/SecureMessageCodec.cpp +++ b/src/transport/SecureMessageCodec.cpp @@ -36,8 +36,8 @@ using System::PacketBufferHandle; namespace SecureMessageCodec { -CHIP_ERROR Encrypt(const CryptoContext & context, PayloadHeader & payloadHeader, PacketHeader & packetHeader, - System::PacketBufferHandle & msgBuf) +CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView nonce, PayloadHeader & payloadHeader, + PacketHeader & packetHeader, System::PacketBufferHandle & msgBuf) { VerifyOrReturnError(!msgBuf.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); @@ -52,7 +52,7 @@ CHIP_ERROR Encrypt(const CryptoContext & context, PayloadHeader & payloadHeader, uint16_t totalLen = msgBuf->TotalLength(); MessageAuthenticationCode mac; - ReturnErrorOnFailure(context.Encrypt(data, totalLen, data, packetHeader, mac)); + ReturnErrorOnFailure(context.Encrypt(data, totalLen, data, nonce, packetHeader, mac)); uint16_t taglen = 0; ReturnErrorOnFailure(mac.Encode(packetHeader, &data[totalLen], msgBuf->AvailableDataLength(), &taglen)); @@ -63,8 +63,8 @@ CHIP_ERROR Encrypt(const CryptoContext & context, PayloadHeader & payloadHeader, return CHIP_NO_ERROR; } -CHIP_ERROR Decrypt(const CryptoContext & context, PayloadHeader & payloadHeader, const PacketHeader & packetHeader, - System::PacketBufferHandle & msg) +CHIP_ERROR Decrypt(const CryptoContext & context, CryptoContext::ConstNonceView nonce, PayloadHeader & payloadHeader, + const PacketHeader & packetHeader, System::PacketBufferHandle & msg) { ReturnErrorCodeIf(msg.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); @@ -93,7 +93,7 @@ CHIP_ERROR Decrypt(const CryptoContext & context, PayloadHeader & payloadHeader, msg->SetDataLength(len); uint8_t * plainText = msg->Start(); - ReturnErrorOnFailure(context.Decrypt(data, len, plainText, packetHeader, mac)); + ReturnErrorOnFailure(context.Decrypt(data, len, plainText, nonce, packetHeader, mac)); ReturnErrorOnFailure(payloadHeader.DecodeAndConsume(msg)); return CHIP_NO_ERROR; diff --git a/src/transport/SecureMessageCodec.h b/src/transport/SecureMessageCodec.h index 32460f0316944d..f074e792b59d21 100644 --- a/src/transport/SecureMessageCodec.h +++ b/src/transport/SecureMessageCodec.h @@ -49,8 +49,8 @@ namespace SecureMessageCodec { * the encrypted message. * @return A CHIP_ERROR value consistent with the result of the encryption operation */ -CHIP_ERROR Encrypt(const CryptoContext & context, PayloadHeader & payloadHeader, PacketHeader & packetHeader, - System::PacketBufferHandle & msgBuf); +CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView nonce, PayloadHeader & payloadHeader, + PacketHeader & packetHeader, System::PacketBufferHandle & msgBuf); /** * @brief @@ -66,8 +66,8 @@ CHIP_ERROR Encrypt(const CryptoContext & context, PayloadHeader & payloadHeader, * the decrypted message. * @return A CHIP_ERROR value consistent with the result of the decryption operation */ -CHIP_ERROR Decrypt(const CryptoContext & context, PayloadHeader & payloadHeader, const PacketHeader & packetHeader, - System::PacketBufferHandle & msgBuf); +CHIP_ERROR Decrypt(const CryptoContext & context, CryptoContext::ConstNonceView nonce, PayloadHeader & payloadHeader, + const PacketHeader & packetHeader, System::PacketBufferHandle & msgBuf); } // namespace SecureMessageCodec diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index db83898ca00ffb..f8dc827f99962c 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -170,7 +170,10 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P VerifyOrReturnError(nullptr != keyContext, CHIP_ERROR_INTERNAL); packetHeader.SetSessionId(keyContext->GetKeyHash()); - CHIP_ERROR err = SecureMessageCodec::Encrypt(CryptoContext(keyContext), payloadHeader, packetHeader, message); + CryptoContext::NonceStorage nonce; + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), packetHeader.GetMessageCounter(), + groupSession->GetSourceNodeId()); + CHIP_ERROR err = SecureMessageCodec::Encrypt(CryptoContext(keyContext), nonce, payloadHeader, packetHeader, message); keyContext->Release(); ReturnErrorOnFailure(err); @@ -197,7 +200,20 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P // Trace before any encryption CHIP_TRACE_MESSAGE_SENT(payloadHeader, packetHeader, message->Start(), message->TotalLength()); - ReturnErrorOnFailure(SecureMessageCodec::Encrypt(session->GetCryptoContext(), payloadHeader, packetHeader, message)); + CryptoContext::NonceStorage nonce; + if (session->GetSecureSessionType() == SecureSession::Type::kCASE) + { + FabricInfo * fabric = mFabricTable->FindFabricWithIndex(session->GetFabricIndex()); + VerifyOrDie(fabric != nullptr); + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), messageCounter, fabric->GetNodeId()); + } + else + { + // PASE Sessions use the undefined node ID of all zeroes, since there is no node ID to use + // and the key is short-lived and always different for each PASE session. + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), messageCounter, kUndefinedNodeId); + } + ReturnErrorOnFailure(SecureMessageCodec::Encrypt(session->GetCryptoContext(), nonce, payloadHeader, packetHeader, message)); ReturnErrorOnFailure(counter.Advance()); #if CHIP_PROGRESS_LOGGING @@ -565,7 +581,13 @@ void SessionManager::SecureUnicastMessageDispatch(const PacketHeader & packetHea Transport::SecureSession * secureSession = session.Value()->AsSecureSession(); // Decrypt and verify the message before message counter verification or any further processing. - if (SecureMessageCodec::Decrypt(secureSession->GetCryptoContext(), payloadHeader, packetHeader, msg) != CHIP_NO_ERROR) + CryptoContext::NonceStorage nonce; + // PASE Sessions use the undefined node ID of all zeroes, since there is no node ID to use + // and the key is short-lived and always different for each PASE session. + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), packetHeader.GetMessageCounter(), + secureSession->GetSecureSessionType() == SecureSession::Type::kCASE ? secureSession->GetPeerNodeId() + : kUndefinedNodeId); + if (SecureMessageCodec::Decrypt(secureSession->GetCryptoContext(), nonce, payloadHeader, packetHeader, msg) != CHIP_NO_ERROR) { ChipLogError(Inet, "Secure transport received message, but failed to decode/authenticate it, discarding"); return; @@ -664,8 +686,11 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & packetHeade continue; } msgCopy = msg.CloneData(); - decrypted = - (CHIP_NO_ERROR == SecureMessageCodec::Decrypt(CryptoContext(groupContext.key), payloadHeader, packetHeader, msgCopy)); + CryptoContext::NonceStorage nonce; + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), packetHeader.GetMessageCounter(), + packetHeader.GetSourceNodeId().Value()); + decrypted = (CHIP_NO_ERROR == + SecureMessageCodec::Decrypt(CryptoContext(groupContext.key), nonce, payloadHeader, packetHeader, msgCopy)); } iter->Release(); if (!decrypted) diff --git a/src/transport/tests/TestSecureSession.cpp b/src/transport/tests/TestSecureSession.cpp index f3fd41e5336af7..60625f717597be 100644 --- a/src/transport/tests/TestSecureSession.cpp +++ b/src/transport/tests/TestSecureSession.cpp @@ -83,6 +83,9 @@ void SecureChannelEncryptTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, packetHeader.IsEncrypted() == true); NL_TEST_ASSERT(inSuite, packetHeader.MICTagLength() == 16); + CryptoContext::NonceStorage nonce; + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), packetHeader.GetMessageCounter(), 0); + P256Keypair keypair; NL_TEST_ASSERT(inSuite, keypair.Initialize() == CHIP_NO_ERROR); @@ -91,7 +94,7 @@ void SecureChannelEncryptTest(nlTestSuite * inSuite, void * inContext) // Test uninitialized channel NL_TEST_ASSERT(inSuite, - channel.Encrypt(plain_text, sizeof(plain_text), output, packetHeader, mac) == + channel.Encrypt(plain_text, sizeof(plain_text), output, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_USE_OF_SESSION_KEY); const char * salt = "Test Salt"; @@ -101,13 +104,13 @@ void SecureChannelEncryptTest(nlTestSuite * inSuite, void * inContext) CryptoContext::SessionRole::kInitiator) == CHIP_NO_ERROR); // Test initialized channel, but invalid arguments - NL_TEST_ASSERT(inSuite, channel.Encrypt(nullptr, 0, nullptr, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, channel.Encrypt(plain_text, 0, nullptr, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, - channel.Encrypt(plain_text, sizeof(plain_text), nullptr, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT(inSuite, channel.Encrypt(nullptr, 0, nullptr, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT(inSuite, channel.Encrypt(plain_text, 0, nullptr, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT( + inSuite, channel.Encrypt(plain_text, sizeof(plain_text), nullptr, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); // Valid arguments - NL_TEST_ASSERT(inSuite, channel.Encrypt(plain_text, sizeof(plain_text), output, packetHeader, mac) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, channel.Encrypt(plain_text, sizeof(plain_text), output, nonce, packetHeader, mac) == CHIP_NO_ERROR); } void SecureChannelDecryptTest(nlTestSuite * inSuite, void * inContext) @@ -122,6 +125,9 @@ void SecureChannelDecryptTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, packetHeader.IsEncrypted() == true); NL_TEST_ASSERT(inSuite, packetHeader.MICTagLength() == 16); + CryptoContext::NonceStorage nonce; + CryptoContext::BuildNonce(nonce, packetHeader.GetSecurityFlags(), packetHeader.GetMessageCounter(), 0); + const char * salt = "Test Salt"; P256Keypair keypair; @@ -134,13 +140,13 @@ void SecureChannelDecryptTest(nlTestSuite * inSuite, void * inContext) channel.InitFromKeyPair(keypair, keypair2.Pubkey(), ByteSpan((const uint8_t *) salt, sizeof(salt)), CryptoContext::SessionInfoType::kSessionEstablishment, CryptoContext::SessionRole::kInitiator) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, channel.Encrypt(plain_text, sizeof(plain_text), encrypted, packetHeader, mac) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, channel.Encrypt(plain_text, sizeof(plain_text), encrypted, nonce, packetHeader, mac) == CHIP_NO_ERROR); CryptoContext channel2; uint8_t output[128]; // Uninitialized channel NL_TEST_ASSERT(inSuite, - channel2.Decrypt(encrypted, sizeof(plain_text), output, packetHeader, mac) == + channel2.Decrypt(encrypted, sizeof(plain_text), output, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_USE_OF_SESSION_KEY); NL_TEST_ASSERT(inSuite, channel2.InitFromKeyPair(keypair2, keypair.Pubkey(), ByteSpan((const uint8_t *) salt, sizeof(salt)), @@ -148,13 +154,13 @@ void SecureChannelDecryptTest(nlTestSuite * inSuite, void * inContext) CryptoContext::SessionRole::kResponder) == CHIP_NO_ERROR); // Channel initialized, but invalid arguments to decrypt - NL_TEST_ASSERT(inSuite, channel2.Decrypt(nullptr, 0, nullptr, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, channel2.Decrypt(encrypted, 0, nullptr, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, - channel2.Decrypt(encrypted, sizeof(encrypted), nullptr, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT(inSuite, channel2.Decrypt(nullptr, 0, nullptr, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT(inSuite, channel2.Decrypt(encrypted, 0, nullptr, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT( + inSuite, channel2.Decrypt(encrypted, sizeof(encrypted), nullptr, nonce, packetHeader, mac) == CHIP_ERROR_INVALID_ARGUMENT); // Valid arguments - NL_TEST_ASSERT(inSuite, channel2.Decrypt(encrypted, sizeof(plain_text), output, packetHeader, mac) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, channel2.Decrypt(encrypted, sizeof(plain_text), output, nonce, packetHeader, mac) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, memcmp(plain_text, output, sizeof(plain_text)) == 0); } diff --git a/src/transport/tests/TestSessionManager.cpp b/src/transport/tests/TestSessionManager.cpp index 5039e3e70ba78d..4cda4fcaa699f3 100644 --- a/src/transport/tests/TestSessionManager.cpp +++ b/src/transport/tests/TestSessionManager.cpp @@ -24,6 +24,7 @@ #define CHIP_ENABLE_TEST_ENCRYPTED_BUFFER_API // Up here in case some other header // includes SessionManager.h indirectly +#include #include #include #include @@ -54,9 +55,7 @@ using TestContext = chip::Test::IOContext; TestContext sContext; -const char PAYLOAD[] = "Hello!"; -constexpr NodeId kSourceNodeId = 123654; -constexpr NodeId kDestinationNodeId = 111222333; +const char PAYLOAD[] = "Hello!"; const char LARGE_PAYLOAD[kMaxAppMessageLen + 1] = "test message"; @@ -147,17 +146,37 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext) sessionManager.SetMessageDelegate(&callback); Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - SessionHolder localToRemoteSession; - SessionHolder remoteToLocalSession; - SecurePairingUsingTestSecret pairing1(1, 2); - err = - sessionManager.NewPairing(localToRemoteSession, peer, kSourceNodeId, &pairing1, CryptoContext::SessionRole::kInitiator, 1); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - - SecurePairingUsingTestSecret pairing2(2, 1); - err = sessionManager.NewPairing(remoteToLocalSession, peer, kDestinationNodeId, &pairing2, - CryptoContext::SessionRole::kResponder, 0); + FabricIndex aliceFabricIndex; + FabricInfo aliceFabric; + aliceFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PrivateKey, TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(aliceFabric, &aliceFabricIndex)); + + FabricIndex bobFabricIndex; + FabricInfo bobFabric; + bobFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PrivateKey, TestCerts::sTestCert_Node02_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(bobFabric, &bobFabricIndex)); + + SessionHolder aliceToBobSession; + SecurePairingUsingTestSecret aliceToBobPairing(1, 2); + err = sessionManager.NewPairing(aliceToBobSession, peer, fabricTable.FindFabricWithIndex(bobFabricIndex)->GetNodeId(), + &aliceToBobPairing, CryptoContext::SessionRole::kInitiator, aliceFabricIndex); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + SecurePairingUsingTestSecret bobToAlicePairing(2, 1); + SessionHolder bobToAliceSession; + err = sessionManager.NewPairing(bobToAliceSession, peer, fabricTable.FindFabricWithIndex(aliceFabricIndex)->GetNodeId(), + &bobToAlicePairing, CryptoContext::SessionRole::kResponder, bobFabricIndex); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); // Should be able to send a message to itself by just calling send. @@ -172,10 +191,10 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext) payloadHeader.SetMessageType(chip::Protocols::Echo::MsgType::EchoRequest); EncryptedPacketBufferHandle preparedMessage; - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); @@ -186,10 +205,10 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext) callback.LargeMessageSent = true; - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(large_buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(large_buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); @@ -202,7 +221,7 @@ void CheckMessageTest(nlTestSuite * inSuite, void * inContext) callback.LargeMessageSent = true; - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(extra_large_buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(extra_large_buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_MESSAGE_TOO_LONG); sessionManager.Shutdown(); @@ -242,17 +261,37 @@ void SendEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) sessionManager.SetMessageDelegate(&callback); Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - SessionHolder localToRemoteSession; - SessionHolder remoteToLocalSession; - - SecurePairingUsingTestSecret pairing1(1, 2); - err = - sessionManager.NewPairing(localToRemoteSession, peer, kSourceNodeId, &pairing1, CryptoContext::SessionRole::kInitiator, 1); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - SecurePairingUsingTestSecret pairing2(2, 1); - err = sessionManager.NewPairing(remoteToLocalSession, peer, kDestinationNodeId, &pairing2, - CryptoContext::SessionRole::kResponder, 0); + FabricIndex aliceFabricIndex; + FabricInfo aliceFabric; + aliceFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PrivateKey, TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(aliceFabric, &aliceFabricIndex)); + + FabricIndex bobFabricIndex; + FabricInfo bobFabric; + bobFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PrivateKey, TestCerts::sTestCert_Node02_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(bobFabric, &bobFabricIndex)); + + SessionHolder aliceToBobSession; + SecurePairingUsingTestSecret aliceToBobPairing(1, 2); + err = sessionManager.NewPairing(aliceToBobSession, peer, fabricTable.FindFabricWithIndex(bobFabricIndex)->GetNodeId(), + &aliceToBobPairing, CryptoContext::SessionRole::kInitiator, aliceFabricIndex); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + SecurePairingUsingTestSecret bobToAlicePairing(2, 1); + SessionHolder bobToAliceSession; + err = sessionManager.NewPairing(bobToAliceSession, peer, fabricTable.FindFabricWithIndex(aliceFabricIndex)->GetNodeId(), + &bobToAlicePairing, CryptoContext::SessionRole::kResponder, bobFabricIndex); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); // Should be able to send a message to itself by just calling send. @@ -269,19 +308,19 @@ void SendEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) payloadHeader.SetInitiator(true); - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); // Reset receive side message counter, or duplicated message will be denied. - Transport::SecureSession * session = remoteToLocalSession.Get()->AsSecureSession(); + Transport::SecureSession * session = bobToAliceSession.Get()->AsSecureSession(); session->GetSessionMessageCounter().GetPeerMessageCounter().SetCounter(1); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); @@ -323,17 +362,37 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) sessionManager.SetMessageDelegate(&callback); Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - SessionHolder localToRemoteSession; - SessionHolder remoteToLocalSession; - - SecurePairingUsingTestSecret pairing1(1, 2); - err = - sessionManager.NewPairing(localToRemoteSession, peer, kSourceNodeId, &pairing1, CryptoContext::SessionRole::kInitiator, 1); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - SecurePairingUsingTestSecret pairing2(2, 1); - err = sessionManager.NewPairing(remoteToLocalSession, peer, kDestinationNodeId, &pairing2, - CryptoContext::SessionRole::kResponder, 0); + FabricIndex aliceFabricIndex; + FabricInfo aliceFabric; + aliceFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PrivateKey, TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(aliceFabric, &aliceFabricIndex)); + + FabricIndex bobFabricIndex; + FabricInfo bobFabric; + bobFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PrivateKey, TestCerts::sTestCert_Node02_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(bobFabric, &bobFabricIndex)); + + SessionHolder aliceToBobSession; + SecurePairingUsingTestSecret aliceToBobPairing(1, 2); + err = sessionManager.NewPairing(aliceToBobSession, peer, fabricTable.FindFabricWithIndex(bobFabricIndex)->GetNodeId(), + &aliceToBobPairing, CryptoContext::SessionRole::kInitiator, aliceFabricIndex); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + SecurePairingUsingTestSecret bobToAlicePairing(2, 1); + SessionHolder bobToAliceSession; + err = sessionManager.NewPairing(bobToAliceSession, peer, fabricTable.FindFabricWithIndex(aliceFabricIndex)->GetNodeId(), + &bobToAlicePairing, CryptoContext::SessionRole::kResponder, bobFabricIndex); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); // Should be able to send a message to itself by just calling send. @@ -350,17 +409,17 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) payloadHeader.SetInitiator(true); - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); /* -------------------------------------------------------------------------------------------*/ // Reset receive side message counter, or duplicated message will be denied. - Transport::SecureSession * session = remoteToLocalSession.Get()->AsSecureSession(); + Transport::SecureSession * session = bobToAliceSession.Get()->AsSecureSession(); session->GetSessionMessageCounter().GetPeerMessageCounter().SetCounter(1); PacketHeader packetHeader; @@ -373,7 +432,7 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) packetHeader.SetMessageCounter(messageCounter + 1); NL_TEST_ASSERT(inSuite, badMessageCounterMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), badMessageCounterMsg); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), badMessageCounterMsg); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); @@ -389,7 +448,7 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) packetHeader.SetSessionId(3); NL_TEST_ASSERT(inSuite, badKeyIdMsg.InsertPacketHeader(packetHeader) == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), badKeyIdMsg); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), badKeyIdMsg); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); /* -------------------------------------------------------------------------------------------*/ @@ -398,7 +457,7 @@ void SendBadEncryptedPacketTest(nlTestSuite * inSuite, void * inContext) NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); // Send the correct encrypted msg - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); @@ -410,6 +469,8 @@ void StaleConnectionDropTest(nlTestSuite * inSuite, void * inContext) { TestContext & ctx = *reinterpret_cast(inContext); + constexpr NodeId kSourceNodeId = 123654; + IPAddress addr; IPAddress::FromString("::1", addr); CHIP_ERROR err = CHIP_NO_ERROR; @@ -507,17 +568,37 @@ void SendPacketWithOldCounterTest(nlTestSuite * inSuite, void * inContext) sessionManager.SetMessageDelegate(&callback); Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - SessionHolder localToRemoteSession; - SessionHolder remoteToLocalSession; - - SecurePairingUsingTestSecret pairing1(1, 2); - err = - sessionManager.NewPairing(localToRemoteSession, peer, kSourceNodeId, &pairing1, CryptoContext::SessionRole::kInitiator, 1); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - SecurePairingUsingTestSecret pairing2(2, 1); - err = sessionManager.NewPairing(remoteToLocalSession, peer, kDestinationNodeId, &pairing2, - CryptoContext::SessionRole::kResponder, 0); + FabricIndex aliceFabricIndex; + FabricInfo aliceFabric; + aliceFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PrivateKey, TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(aliceFabric, &aliceFabricIndex)); + + FabricIndex bobFabricIndex; + FabricInfo bobFabric; + bobFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PrivateKey, TestCerts::sTestCert_Node02_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(bobFabric, &bobFabricIndex)); + + SessionHolder aliceToBobSession; + SecurePairingUsingTestSecret aliceToBobPairing(1, 2); + err = sessionManager.NewPairing(aliceToBobSession, peer, fabricTable.FindFabricWithIndex(bobFabricIndex)->GetNodeId(), + &aliceToBobPairing, CryptoContext::SessionRole::kInitiator, aliceFabricIndex); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + SecurePairingUsingTestSecret bobToAlicePairing(2, 1); + SessionHolder bobToAliceSession; + err = sessionManager.NewPairing(bobToAliceSession, peer, fabricTable.FindFabricWithIndex(aliceFabricIndex)->GetNodeId(), + &bobToAlicePairing, CryptoContext::SessionRole::kResponder, bobFabricIndex); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); callback.ReceiveHandlerCallCount = 0; @@ -533,10 +614,10 @@ void SendPacketWithOldCounterTest(nlTestSuite * inSuite, void * inContext) payloadHeader.SetInitiator(true); - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); @@ -548,18 +629,18 @@ void SendPacketWithOldCounterTest(nlTestSuite * inSuite, void * inContext) buffer = chip::MessagePacketBuffer::NewWithData(PAYLOAD, payload_len); NL_TEST_ASSERT(inSuite, !buffer.IsNull()); - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), newMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), newMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); } - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), newMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), newMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); // Now resend our original message. It should be rejected as a duplicate. - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); @@ -601,17 +682,37 @@ void SendPacketWithTooOldCounterTest(nlTestSuite * inSuite, void * inContext) sessionManager.SetMessageDelegate(&callback); Optional peer(Transport::PeerAddress::UDP(addr, CHIP_PORT)); - SessionHolder localToRemoteSession; - SessionHolder remoteToLocalSession; - - SecurePairingUsingTestSecret pairing1(1, 2); - err = - sessionManager.NewPairing(localToRemoteSession, peer, kSourceNodeId, &pairing1, CryptoContext::SessionRole::kInitiator, 1); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - SecurePairingUsingTestSecret pairing2(2, 1); - err = sessionManager.NewPairing(remoteToLocalSession, peer, kDestinationNodeId, &pairing2, - CryptoContext::SessionRole::kResponder, 0); + FabricIndex aliceFabricIndex; + FabricInfo aliceFabric; + aliceFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root01_Chip, TestCerts::sTestCert_Root01_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA01_Chip, TestCerts::sTestCert_ICA01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_Chip, TestCerts::sTestCert_Node01_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PublicKey, TestCerts::sTestCert_Node01_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node01_01_PrivateKey, TestCerts::sTestCert_Node01_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(aliceFabric, &aliceFabricIndex)); + + FabricIndex bobFabricIndex; + FabricInfo bobFabric; + bobFabric.TestOnlyBuildFabric( + ByteSpan(TestCerts::sTestCert_Root02_Chip, TestCerts::sTestCert_Root02_Chip_Len), + ByteSpan(TestCerts::sTestCert_ICA02_Chip, TestCerts::sTestCert_ICA02_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_Chip, TestCerts::sTestCert_Node02_01_Chip_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PublicKey, TestCerts::sTestCert_Node02_01_PublicKey_Len), + ByteSpan(TestCerts::sTestCert_Node02_01_PrivateKey, TestCerts::sTestCert_Node02_01_PrivateKey_Len)); + NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == fabricTable.AddNewFabric(bobFabric, &bobFabricIndex)); + + SessionHolder aliceToBobSession; + SecurePairingUsingTestSecret aliceToBobPairing(1, 2); + err = sessionManager.NewPairing(aliceToBobSession, peer, fabricTable.FindFabricWithIndex(bobFabricIndex)->GetNodeId(), + &aliceToBobPairing, CryptoContext::SessionRole::kInitiator, aliceFabricIndex); + NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + + SecurePairingUsingTestSecret bobToAlicePairing(2, 1); + SessionHolder bobToAliceSession; + err = sessionManager.NewPairing(bobToAliceSession, peer, fabricTable.FindFabricWithIndex(aliceFabricIndex)->GetNodeId(), + &bobToAlicePairing, CryptoContext::SessionRole::kResponder, bobFabricIndex); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); callback.ReceiveHandlerCallCount = 0; @@ -627,10 +728,10 @@ void SendPacketWithTooOldCounterTest(nlTestSuite * inSuite, void * inContext) payloadHeader.SetInitiator(true); - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), preparedMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 1); @@ -644,18 +745,18 @@ void SendPacketWithTooOldCounterTest(nlTestSuite * inSuite, void * inContext) buffer = chip::MessagePacketBuffer::NewWithData(PAYLOAD, payload_len); NL_TEST_ASSERT(inSuite, !buffer.IsNull()); - err = sessionManager.PrepareMessage(localToRemoteSession.Get(), payloadHeader, std::move(buffer), newMessage); + err = sessionManager.PrepareMessage(aliceToBobSession.Get(), payloadHeader, std::move(buffer), newMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); } - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), newMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), newMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); // Now resend our original message. It should be rejected as a duplicate. - err = sessionManager.SendPreparedMessage(localToRemoteSession.Get(), preparedMessage); + err = sessionManager.SendPreparedMessage(aliceToBobSession.Get(), preparedMessage); NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, callback.ReceiveHandlerCallCount == 2); From f34d233c5aab4fff30f487714d82b4ab4453f302 Mon Sep 17 00:00:00 2001 From: Kundok Park <97262718+kpark-apple@users.noreply.github.com> Date: Thu, 24 Mar 2022 11:52:49 -0700 Subject: [PATCH 54/70] Piggyback darwin attribute cache subscription (#16534) * Piggyback CHIPAttributeCacheContainer on CHIPDevice subscription instead of using a dedicated subscription. --- .../Framework/CHIP.xcodeproj/project.pbxproj | 12 +- ...he.h => CHIPAttributeCacheContainer+XPC.h} | 20 +-- .../CHIP/CHIPAttributeCacheContainer.h | 15 -- .../CHIP/CHIPAttributeCacheContainer.mm | 155 ++++------------ .../CHIPAttributeCacheContainer_Internal.h | 18 +- src/darwin/Framework/CHIP/CHIPDevice.h | 7 + src/darwin/Framework/CHIP/CHIPDevice.mm | 54 +++++- .../Framework/CHIP/CHIPDeviceController+XPC.h | 15 +- ...IPDeviceControllerOverXPC+AttributeCache.m | 124 ------------- .../CHIP/CHIPDeviceControllerOverXPC.m | 1 - src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m | 39 +++- .../Framework/CHIPTests/CHIPDeviceTests.m | 57 ++++-- .../CHIPTests/CHIPXPCListenerSampleTests.m | 97 +++++----- .../CHIPTests/CHIPXPCProtocolTests.m | 166 ++++++++++++------ 14 files changed, 358 insertions(+), 422 deletions(-) rename src/darwin/Framework/CHIP/{CHIPDeviceControllerOverXPC+AttributeCache.h => CHIPAttributeCacheContainer+XPC.h} (50%) delete mode 100644 src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m diff --git a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj index 8fe08ec62fc0e9..c37d02c6a7283a 100644 --- a/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/CHIP.xcodeproj/project.pbxproj @@ -44,6 +44,7 @@ 51E0310027EA20D20083DC9C /* CHIPControllerAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E030FE27EA20D20083DC9C /* CHIPControllerAccessControl.h */; }; 51E0310127EA20D20083DC9C /* CHIPControllerAccessControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E030FF27EA20D20083DC9C /* CHIPControllerAccessControl.mm */; }; 51E24E73274E0DAC007CCF6E /* CHIPErrorTestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E24E72274E0DAC007CCF6E /* CHIPErrorTestUtils.mm */; }; + 5A60370827EA1FF60020DB79 /* CHIPAttributeCacheContainer+XPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A60370727EA1FF60020DB79 /* CHIPAttributeCacheContainer+XPC.h */; }; 5A6FEC9027B563D900F25F42 /* CHIPDeviceControllerOverXPC.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A6FEC8F27B563D900F25F42 /* CHIPDeviceControllerOverXPC.m */; }; 5A6FEC9227B5669C00F25F42 /* CHIPDeviceControllerOverXPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A6FEC8D27B5624E00F25F42 /* CHIPDeviceControllerOverXPC.h */; }; 5A6FEC9627B5983000F25F42 /* CHIPDeviceControllerXPCConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A6FEC9527B5983000F25F42 /* CHIPDeviceControllerXPCConnection.m */; }; @@ -54,9 +55,7 @@ 5A7947DE27BEC3F500434CF2 /* CHIPXPCListenerSampleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A7947DD27BEC3F500434CF2 /* CHIPXPCListenerSampleTests.m */; }; 5A7947E427C0129600434CF2 /* CHIPDeviceController+XPC.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A7947E327C0129500434CF2 /* CHIPDeviceController+XPC.m */; }; 5A7947E527C0129F00434CF2 /* CHIPDeviceController+XPC.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A7947E227C0101200434CF2 /* CHIPDeviceController+XPC.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 5A830D6A27CFCB640053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A830D6927CFCB570053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.h */; }; 5A830D6C27CFCF590053B85D /* CHIPDeviceControllerOverXPC_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5A830D6B27CFCF590053B85D /* CHIPDeviceControllerOverXPC_Internal.h */; }; - 5A830D6E27CFCFF90053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 5A830D6D27CFCFF90053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.m */; }; 5ACDDD7A27CD129700EFD68A /* CHIPAttributeCacheContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACDDD7927CD129700EFD68A /* CHIPAttributeCacheContainer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 5ACDDD7D27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */; }; 5ACDDD7E27CD3F3A00EFD68A /* CHIPAttributeCacheContainer_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */; }; @@ -138,6 +137,7 @@ 51E030FE27EA20D20083DC9C /* CHIPControllerAccessControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHIPControllerAccessControl.h; sourceTree = ""; }; 51E030FF27EA20D20083DC9C /* CHIPControllerAccessControl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPControllerAccessControl.mm; sourceTree = ""; }; 51E24E72274E0DAC007CCF6E /* CHIPErrorTestUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPErrorTestUtils.mm; sourceTree = ""; }; + 5A60370727EA1FF60020DB79 /* CHIPAttributeCacheContainer+XPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CHIPAttributeCacheContainer+XPC.h"; sourceTree = ""; }; 5A6FEC8B27B5609C00F25F42 /* CHIPDeviceOverXPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceOverXPC.h; sourceTree = ""; }; 5A6FEC8D27B5624E00F25F42 /* CHIPDeviceControllerOverXPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceControllerOverXPC.h; sourceTree = ""; }; 5A6FEC8F27B563D900F25F42 /* CHIPDeviceControllerOverXPC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CHIPDeviceControllerOverXPC.m; sourceTree = ""; }; @@ -148,9 +148,7 @@ 5A7947DD27BEC3F500434CF2 /* CHIPXPCListenerSampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CHIPXPCListenerSampleTests.m; sourceTree = ""; }; 5A7947E227C0101200434CF2 /* CHIPDeviceController+XPC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CHIPDeviceController+XPC.h"; sourceTree = ""; }; 5A7947E327C0129500434CF2 /* CHIPDeviceController+XPC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CHIPDeviceController+XPC.m"; sourceTree = ""; }; - 5A830D6927CFCB570053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CHIPDeviceControllerOverXPC+AttributeCache.h"; sourceTree = ""; }; 5A830D6B27CFCF590053B85D /* CHIPDeviceControllerOverXPC_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPDeviceControllerOverXPC_Internal.h; sourceTree = ""; }; - 5A830D6D27CFCFF90053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "CHIPDeviceControllerOverXPC+AttributeCache.m"; sourceTree = ""; }; 5ACDDD7927CD129700EFD68A /* CHIPAttributeCacheContainer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPAttributeCacheContainer.h; sourceTree = ""; }; 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CHIPAttributeCacheContainer_Internal.h; sourceTree = ""; }; 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CHIPAttributeCacheContainer.mm; sourceTree = ""; }; @@ -278,6 +276,7 @@ 2C222ACF255C620600E446B9 /* CHIPDevice.mm */, 2C8C8FBE253E0C2100797F05 /* CHIPPersistentStorageDelegate.h */, 5ACDDD7927CD129700EFD68A /* CHIPAttributeCacheContainer.h */, + 5A60370727EA1FF60020DB79 /* CHIPAttributeCacheContainer+XPC.h */, 5ACDDD7B27CD14AF00EFD68A /* CHIPAttributeCacheContainer_Internal.h */, 5ACDDD7C27CD16D200EFD68A /* CHIPAttributeCacheContainer.mm */, 997DED152695343400975E97 /* CHIPThreadOperationalDataset.mm */, @@ -315,8 +314,6 @@ 5A6FEC8D27B5624E00F25F42 /* CHIPDeviceControllerOverXPC.h */, 5A830D6B27CFCF590053B85D /* CHIPDeviceControllerOverXPC_Internal.h */, 5A6FEC8F27B563D900F25F42 /* CHIPDeviceControllerOverXPC.m */, - 5A830D6927CFCB570053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.h */, - 5A830D6D27CFCFF90053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.m */, 5A6FEC9427B5976200F25F42 /* CHIPDeviceControllerXPCConnection.h */, 5A6FEC9527B5983000F25F42 /* CHIPDeviceControllerXPCConnection.m */, ); @@ -375,6 +372,7 @@ 997DED182695344800975E97 /* CHIPThreadOperationalDataset.h in Headers */, 9956064426420367000C28DE /* CHIPSetupPayload_Internal.h in Headers */, 5A830D6C27CFCF590053B85D /* CHIPDeviceControllerOverXPC_Internal.h in Headers */, + 5A60370827EA1FF60020DB79 /* CHIPAttributeCacheContainer+XPC.h in Headers */, 5ACDDD7E27CD3F3A00EFD68A /* CHIPAttributeCacheContainer_Internal.h in Headers */, 998F286D26D55E10001846C6 /* CHIPKeypair.h in Headers */, 1ED276E426C5832500547A89 /* CHIPCluster.h in Headers */, @@ -385,7 +383,6 @@ 1EC4CE6425CC276600D7304F /* CHIPClustersObjc.h in Headers */, 2C5EEEF6268A85C400CAE3D3 /* CHIPDeviceConnectionBridge.h in Headers */, 2C8C8FC0253E0C2100797F05 /* CHIPPersistentStorageDelegateBridge.h in Headers */, - 5A830D6A27CFCB640053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.h in Headers */, 998F286F26D55EC5001846C6 /* CHIPP256KeypairBridge.h in Headers */, 2C222ADF255C811800E446B9 /* CHIPDevice_Internal.h in Headers */, 51E0310027EA20D20083DC9C /* CHIPControllerAccessControl.h in Headers */, @@ -546,7 +543,6 @@ B2E0D7B6245B0B5C003C5B48 /* CHIPManualSetupPayloadParser.mm in Sources */, 5A6FEC9827B5C6AF00F25F42 /* CHIPDeviceOverXPC.m in Sources */, 51431AF927D2973E008A7943 /* CHIPIMDispatch.mm in Sources */, - 5A830D6E27CFCFF90053B85D /* CHIPDeviceControllerOverXPC+AttributeCache.m in Sources */, 51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.h b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer+XPC.h similarity index 50% rename from src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.h rename to src/darwin/Framework/CHIP/CHIPAttributeCacheContainer+XPC.h index 407bb9d4404dc3..fb9cc654d7eb9a 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.h +++ b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer+XPC.h @@ -17,24 +17,14 @@ #import -#import "CHIPDeviceControllerOverXPC.h" +#import "CHIPAttributeCacheContainer.h" NS_ASSUME_NONNULL_BEGIN -@class CHIPSubscribeParams; - -@interface CHIPDeviceControllerOverXPC (AttributeCache) - -- (void)subscribeAttributeCacheWithNodeId:(uint64_t)nodeId - params:(CHIPSubscribeParams * _Nullable)params - completion:(void (^)(NSError * _Nullable error))completion; - -- (void)readAttributeCacheWithNodeId:(uint64_t)nodeId - endpointId:(NSNumber * _Nullable)endpointId - clusterId:(NSNumber * _Nullable)clusterId - attributeId:(NSNumber * _Nullable)attributeId - completion:(void (^)(id _Nullable values, NSError * _Nullable error))completion; - +@interface CHIPAttributeCacheContainer (XPC) +- (void)setXPCConnection:(CHIPDeviceControllerXPCConnection *)xpcConnection + controllerId:(id)controllerId + deviceId:(uint64_t)deviceId; @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.h b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.h index 2c72c24cf65f2b..d695cb23977271 100644 --- a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.h +++ b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.h @@ -25,21 +25,6 @@ NS_ASSUME_NONNULL_BEGIN @interface CHIPAttributeCacheContainer : NSObject -/** - * Subscribes to all attributes to update attribute cache. - * - * @param deviceController device controller to retrieve connected device from - * @param deviceId device identifier of the device to cache attributes of - * @param params subscription parameters - * @param clientQueue client queue to dispatch the completion handler through - * @param completion completion handler - */ -- (void)subscribeWithDeviceController:(CHIPDeviceController *)deviceController - deviceId:(uint64_t)deviceId - params:(CHIPSubscribeParams * _Nullable)params - clientQueue:(dispatch_queue_t)clientQueue - completion:(void (^)(NSError * _Nullable error))completion; - /** * Reads an attribute with specific attribute path * diff --git a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm index 59c7ec701ff051..6b060374b94bc6 100644 --- a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm +++ b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer.mm @@ -19,7 +19,7 @@ #import "CHIPAttributeCacheContainer_Internal.h" #import "CHIPCluster.h" -#import "CHIPDeviceControllerOverXPC+AttributeCache.h" +#import "CHIPDeviceControllerXPCConnection.h" #import "CHIPDevice_Internal.h" #import "CHIPError.h" #import "CHIPError_Internal.h" @@ -31,123 +31,25 @@ using namespace chip; -void ContainerAttributeCacheCallback::OnDone() -{ - dispatch_async(DeviceLayer::PlatformMgrImpl().GetWorkQueue(), ^{ - CHIPAttributeCacheContainer * container = attributeCacheContainer; - if (container) { - CHIP_LOG_ERROR("Attribute cache read client done for device %llu", container.deviceId); - if (container.cppReadClient) { - delete container.cppReadClient; - container.cppReadClient = nullptr; - } - if (container.cppAttributeCache) { - delete container.cppAttributeCache; - container.cppAttributeCache = nullptr; - } - } else { - CHIP_LOG_ERROR("Attribute cache read client done for a released cache container"); - } - }); -} - @implementation CHIPAttributeCacheContainer - (instancetype)init { if ([super init]) { _cppAttributeCache = nullptr; - _cppReadClient = nullptr; - _attributeCacheCallback = new ContainerAttributeCacheCallback; - if (_attributeCacheCallback) { - _attributeCacheCallback->SetContainer(self); - } + _shouldUseXPC = NO; } return self; } -- (void)dealloc -{ - if (_cppReadClient) { - delete _cppReadClient; - } - if (_cppAttributeCache) { - delete _cppAttributeCache; - } - if (_attributeCacheCallback) { - delete _attributeCacheCallback; - } -} - -- (void)subscribeWithDeviceController:(CHIPDeviceController *)deviceController - deviceId:(uint64_t)deviceId - params:(CHIPSubscribeParams * _Nullable)params - clientQueue:clientQueue - completion:(void (^)(NSError * _Nullable error))completion +- (void)setXPCConnection:(CHIPDeviceControllerXPCConnection *)xpcConnection + controllerId:(id)controllerId + deviceId:(uint64_t)deviceId { - __auto_type workQueue = DeviceLayer::PlatformMgrImpl().GetWorkQueue(); - __auto_type completionHandler = ^(NSError * _Nullable error) { - dispatch_async(clientQueue, ^{ - completion(error); - }); - }; - if ([deviceController isKindOfClass:[CHIPDeviceControllerOverXPC class]]) { - self.deviceId = deviceId; - CHIPDeviceControllerOverXPC * xpcDeviceController = (CHIPDeviceControllerOverXPC *) deviceController; - self.xpcDeviceController = xpcDeviceController; - [xpcDeviceController subscribeAttributeCacheWithNodeId:deviceId params:params completion:completionHandler]; - return; - } - [deviceController - getConnectedDevice:deviceId - queue:workQueue - completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { - if (error) { - CHIP_LOG_ERROR("Error: Failed to get connected device (%llu) for attribute cache: %@", deviceId, error); - completionHandler(error); - return; - } - if (self.cppReadClient) { - delete self.cppReadClient; - self.cppReadClient = nullptr; - } - if (self.cppAttributeCache) { - delete self.cppAttributeCache; - } - self.cppAttributeCache = new app::AttributeCache(*self.attributeCacheCallback); - if (!self.cppAttributeCache) { - CHIP_LOG_ERROR("Error: Failed to allocate attribute cache for device %llu", deviceId); - completionHandler([NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - return; - } - - __auto_type engine = app::InteractionModelEngine::GetInstance(); - __auto_type readClient = new app::ReadClient(engine, [device internalDevice]->GetExchangeManager(), - self.cppAttributeCache->GetBufferedCallback(), app::ReadClient::InteractionType::Subscribe); - if (!readClient) { - CHIP_LOG_ERROR("Error: Failed to allocate attribute cache read client for device %llu", deviceId); - completionHandler([NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - return; - } - self.deviceId = deviceId; - app::ReadPrepareParams readParams([device internalDevice]->GetSecureSession().Value()); - static app::AttributePathParams attributePath; - readParams.mpAttributePathParamsList = &attributePath; - readParams.mAttributePathParamsListSize = 1; - readParams.mMaxIntervalCeilingSeconds = 43200; - readParams.mIsFabricFiltered = (params == nil || params.fabricFiltered == nil || [params.fabricFiltered boolValue]); - readParams.mKeepSubscriptions - = (params != nil && params.keepPreviousSubscriptions != nil && [params.keepPreviousSubscriptions boolValue]); - __auto_type err = readClient->SendAutoResubscribeRequest(std::move(readParams)); - if (err != CHIP_NO_ERROR) { - CHIP_LOG_ERROR("Error: attribute cache subscription failed for device %llu: %s", deviceId, ErrorStr(err)); - completionHandler([NSError errorWithDomain:CHIPErrorDomain code:err.AsInteger() userInfo:nil]); - return; - } - self.cppReadClient = readClient; - CHIP_LOG_DEBUG("Attribute cache subscription succeeded for device %llu", deviceId); - completionHandler(nil); - }]; + self.xpcConnection = xpcConnection; + self.xpcControllerId = controllerId; + self.deviceId = deviceId; + self.shouldUseXPC = YES; } static CHIP_ERROR AppendAttibuteValueToArray( @@ -189,21 +91,36 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId }); }; - if (self.xpcDeviceController) { - CHIPDeviceControllerOverXPC * strongController = self.xpcDeviceController; - if (strongController) { - [strongController - readAttributeCacheWithNodeId:self.deviceId - endpointId:endpointId - clusterId:clusterId - attributeId:attributeId - completion:(void (^)(id _Nullable values, NSError * _Nullable error)) completionHandler]; - } else { - CHIP_LOG_ERROR("Reading attribute cache failed when associated device controller is deleted"); - completionHandler(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); + if (self.shouldUseXPC) { + CHIPDeviceControllerXPCConnection * xpcConnection = self.xpcConnection; + if (!xpcConnection) { + CHIP_LOG_ERROR("Attribute cache read failed: CHIPDeviceController was already disposed"); + completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); + return; } + __auto_type controllerId = self.xpcControllerId; + uint64_t nodeId = self.deviceId; + [xpcConnection getProxyHandleWithCompletion:^( + dispatch_queue_t _Nonnull queue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { + if (handle) { + [handle.proxy readAttributeCacheWithController:controllerId + nodeId:nodeId + endpointId:endpointId + clusterId:clusterId + attributeId:attributeId + completion:^(id _Nullable values, NSError * _Nullable error) { + completion([CHIPDeviceController decodeXPCResponseValues:values], error); + __auto_type handleRetainer = handle; + (void) handleRetainer; + }]; + } else { + CHIP_LOG_ERROR("Attribute cache read failed due to XPC connection failure"); + completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); + } + }]; return; } + dispatch_async(DeviceLayer::PlatformMgrImpl().GetWorkQueue(), ^{ if (endpointId == nil && clusterId == nil) { CHIP_LOG_ERROR("Error: currently read from attribute cache does not support wildcards for both endpoint and cluster"); diff --git a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer_Internal.h b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer_Internal.h index ed9370bcfe952b..9e58fc1c457426 100644 --- a/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer_Internal.h +++ b/src/darwin/Framework/CHIP/CHIPAttributeCacheContainer_Internal.h @@ -24,23 +24,13 @@ NS_ASSUME_NONNULL_BEGIN -class ContainerAttributeCacheCallback : public chip::app::AttributeCache::Callback { -public: - void SetContainer(CHIPAttributeCacheContainer * container) { attributeCacheContainer = container; } - - void OnDone() override; - -private: - __weak CHIPAttributeCacheContainer * _Nullable attributeCacheContainer; -}; - @interface CHIPAttributeCacheContainer () -@property (nonatomic, readwrite) chip::app::AttributeCache * _Nullable cppAttributeCache; -@property (nonatomic, readwrite) chip::app::ReadClient * _Nullable cppReadClient; -@property (nonatomic, readwrite) ContainerAttributeCacheCallback * _Nullable attributeCacheCallback; +@property (atomic, readwrite, nullable) chip::app::AttributeCache * cppAttributeCache; @property (nonatomic, readwrite) uint64_t deviceId; -@property (atomic, readwrite, weak) CHIPDeviceControllerOverXPC * _Nullable xpcDeviceController; +@property (nonatomic, readwrite, weak, nullable) CHIPDeviceControllerXPCConnection * xpcConnection; +@property (nonatomic, readwrite, strong, nullable) id xpcControllerId; +@property (atomic, readwrite) BOOL shouldUseXPC; @end diff --git a/src/darwin/Framework/CHIP/CHIPDevice.h b/src/darwin/Framework/CHIP/CHIPDevice.h index eac211d1593ba8..f321beb9287246 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.h +++ b/src/darwin/Framework/CHIP/CHIPDevice.h @@ -89,6 +89,7 @@ extern NSString * const kCHIPNullValueType; extern NSString * const kCHIPStructureValueType; extern NSString * const kCHIPArrayValueType; +@class CHIPAttributeCacheContainer; @class CHIPReadParams; @class CHIPSubscribeParams; @@ -101,6 +102,9 @@ extern NSString * const kCHIPArrayValueType; * Subscribe to receive attribute reports for everything (all endpoints, all * clusters, all attributes, all events) on the device. * + * A non-nil attribute cache container will cache attribute values, retrievable + * through the designated attribute cache container. + * * reportHandler will be called any time a data update is available (with a * non-nil "value" and nil "error"), or any time there is an error for the * entire subscription (with a nil "value" and non-nil "error"). If it's called @@ -110,6 +114,8 @@ extern NSString * const kCHIPArrayValueType; * instances. Errors for specific paths, not the whole subscription, will be * reported via those objects. * + * reportHandler is not supported over XPC at the moment. + * * subscriptionEstablished block, if not nil, will be called once the * subscription is established. This will be _after_ the first (priming) call * to reportHandler. Note that if the CHIPSubscribeParams are set to @@ -121,6 +127,7 @@ extern NSString * const kCHIPArrayValueType; minInterval:(uint16_t)minInterval maxInterval:(uint16_t)maxInterval params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler; diff --git a/src/darwin/Framework/CHIP/CHIPDevice.mm b/src/darwin/Framework/CHIP/CHIPDevice.mm index 9528022aadea4f..a46ec0dc21099e 100644 --- a/src/darwin/Framework/CHIP/CHIPDevice.mm +++ b/src/darwin/Framework/CHIP/CHIPDevice.mm @@ -15,6 +15,7 @@ * limitations under the License. */ +#import "CHIPAttributeCacheContainer_Internal.h" #import "CHIPAttributeTLVValueDecoder_Internal.h" #import "CHIPCallbackBridgeBase_internal.h" #import "CHIPCluster.h" @@ -26,6 +27,7 @@ #include "lib/core/CHIPError.h" #include "lib/core/DataModelTypes.h" +#include #include #include #include @@ -236,7 +238,7 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device namespace { -class SubscriptionCallback final : public ReadClient::Callback { +class SubscriptionCallback final : public AttributeCache::Callback { public: SubscriptionCallback(dispatch_queue_t queue, ReportCallback reportCallback, SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler) @@ -247,10 +249,21 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device { } + SubscriptionCallback(dispatch_queue_t queue, ReportCallback reportCallback, + SubscriptionEstablishedHandler _Nullable subscriptionEstablishedHandler, void (^onDoneHandler)(void)) + : mQueue(queue) + , mReportCallback(reportCallback) + , mSubscriptionEstablishedHandler(subscriptionEstablishedHandler) + , mBufferedReadAdapter(*this) + , mOnDoneHandler(onDoneHandler) + { + } + BufferedReadCallback & GetBufferedCallback() { return mBufferedReadAdapter; } // We need to exist to get a ReadClient, so can't take this as a constructor argument. void AdoptReadClient(std::unique_ptr aReadClient) { mReadClient = std::move(aReadClient); } + void AdoptAttributeCache(std::unique_ptr aAttributeCache) { mAttributeCache = std::move(aAttributeCache); } private: void OnReportBegin() override; @@ -293,7 +306,9 @@ - (instancetype)initWithDevice:(chip::DeviceProxy *)device // error callback, but not both, by tracking whether we have a queued-up // deletion. std::unique_ptr mReadClient; + std::unique_ptr mAttributeCache; bool mHaveQueuedDeletion = false; + void (^mOnDoneHandler)(void) = nil; }; } // anonymous namespace @@ -302,6 +317,7 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue minInterval:(uint16_t)minInterval maxInterval:(uint16_t)maxInterval params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler { @@ -323,9 +339,25 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue readParams.mKeepSubscriptions = (params != nil) && (params.keepPreviousSubscriptions != nil) && [params.keepPreviousSubscriptions boolValue]; - auto callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler); - auto readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), - callback->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); + std::unique_ptr callback; + std::unique_ptr readClient; + std::unique_ptr attributeCache; + if (attributeCacheContainer) { + __weak CHIPAttributeCacheContainer * weakPtr = attributeCacheContainer; + callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler, ^{ + CHIPAttributeCacheContainer * container = weakPtr; + if (container) { + container.cppAttributeCache = nullptr; + } + }); + attributeCache = std::make_unique(*callback.get()); + readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), + attributeCache->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); + } else { + callback = std::make_unique(queue, reportHandler, subscriptionEstablishedHandler); + readClient = std::make_unique(InteractionModelEngine::GetInstance(), device->GetExchangeManager(), + callback->GetBufferedCallback(), ReadClient::InteractionType::Subscribe); + } CHIP_ERROR err; if (params != nil && params.autoResubscribe != nil && ![params.autoResubscribe boolValue]) { @@ -344,6 +376,11 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue return; } + if (attributeCacheContainer) { + attributeCacheContainer.cppAttributeCache = attributeCache.get(); + // AttributeCache will be deleted when OnDone is called or an error is encountered as well. + callback->AdoptAttributeCache(std::move(attributeCache)); + } // Callback and ReadClient will be deleted when OnDone is called or an error is // encountered. callback->AdoptReadClient(std::move(readClient)); @@ -1310,6 +1347,10 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null void SubscriptionCallback::OnDone() { + if (mOnDoneHandler) { + mOnDoneHandler(); + mOnDoneHandler = nil; + } if (!mHaveQueuedDeletion) { delete this; return; // Make sure we touch nothing else. @@ -1363,8 +1404,13 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(null __block ReportCallback callback = mReportCallback; __block auto * myself = this; mReportCallback = nil; + __auto_type onDoneHandler = mOnDoneHandler; + mOnDoneHandler = nil; dispatch_async(mQueue, ^{ callback(nil, err); + if (onDoneHandler) { + onDoneHandler(); + } // Deletion of our ReadClient (and hence of ourselves, since the // ReadClient has a pointer to us) needs to happen on the Matter work diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h b/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h index 8bb366ba99235f..a81eadfcd6099c 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h +++ b/src/darwin/Framework/CHIP/CHIPDeviceController+XPC.h @@ -139,12 +139,15 @@ NS_ASSUME_NONNULL_BEGIN - (void)stopReportsWithController:(id _Nullable)controller nodeId:(uint64_t)nodeId completion:(void (^)(void))completion; /** - * Requests a specific node attribute subscription into a cache - */ -- (void)subscribeAttributeCacheWithController:(id _Nullable)controller - nodeId:(uint64_t)nodeId - params:(NSDictionary * _Nullable)params - completion:(void (^)(NSError * _Nullable error))completion; + * Requests subscription of all attributes. + */ +- (void)subscribeWithController:(id _Nullable)controller + nodeId:(uint64_t)nodeId + minInterval:(NSNumber *)minInterval + maxInterval:(NSNumber *)maxInterval + params:(NSDictionary * _Nullable)params + shouldCache:(BOOL)shouldCache + completion:(void (^)(NSError * _Nullable error))completion; /** * Requests reading attribute cache diff --git a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m b/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m deleted file mode 100644 index 7ea55db94246b5..00000000000000 --- a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC+AttributeCache.m +++ /dev/null @@ -1,124 +0,0 @@ -/** - * - * Copyright (c) 2022 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. - */ - -#import "CHIPDeviceControllerOverXPC+AttributeCache.h" -#import "CHIPDeviceControllerOverXPC_Internal.h" -#import "CHIPError.h" -#import "CHIPLogging.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation CHIPDeviceControllerOverXPC (AttributeCache) - -- (void)subscribeAttributeCacheWithNodeId:(uint64_t)nodeId - params:(CHIPSubscribeParams * _Nullable)params - completion:(void (^)(NSError * _Nullable error))completion -{ - dispatch_async(self.workQueue, ^{ - dispatch_group_t group = dispatch_group_create(); - if (!self.controllerId) { - dispatch_group_enter(group); - [self.xpcConnection getProxyHandleWithCompletion:^( - dispatch_queue_t _Nonnull queue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { - if (handle) { - [handle.proxy getAnyDeviceControllerWithCompletion:^(id _Nullable controller, NSError * _Nullable error) { - if (error) { - CHIP_LOG_ERROR("Failed to fetch any shared remote controller"); - } else { - self.controllerId = controller; - } - dispatch_group_leave(group); - __auto_type handleRetainer = handle; - (void) handleRetainer; - }]; - } else { - CHIP_LOG_ERROR("XPC disconnected while retrieving any shared remote controller"); - dispatch_group_leave(group); - } - }]; - } - dispatch_group_notify(group, self.workQueue, ^{ - if (self.controllerId) { - [self.xpcConnection getProxyHandleWithCompletion:^( - dispatch_queue_t _Nonnull queue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { - if (handle) { - [handle.proxy subscribeAttributeCacheWithController:self.controllerId - nodeId:nodeId - params:[CHIPDeviceController encodeXPCSubscribeParams:params] - completion:^(NSError * _Nullable error) { - if (error) { - CHIP_LOG_ERROR("Attribute cache subscription for " - "controller %@ and node %llu failed: %@", - self.controllerId, nodeId, error); - completion(error); - return; - } - completion(nil); - __auto_type handleRetainer = handle; - (void) handleRetainer; - }]; - } else { - CHIP_LOG_ERROR( - "Attribute cache subscription for controller %@ and node %llu failed due to XPC connection failure", - self.controllerId, nodeId); - completion([NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - } - }]; - } else { - CHIP_LOG_ERROR("Attribute cache subscription for node %llu failed due to lack of controller ID", nodeId); - completion([NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - } - }); - }); -} - -- (void)readAttributeCacheWithNodeId:(uint64_t)nodeId - endpointId:(NSNumber * _Nullable)endpointId - clusterId:(NSNumber * _Nullable)clusterId - attributeId:(NSNumber * _Nullable)attributeId - completion:(void (^)(id _Nullable values, NSError * _Nullable error))completion -{ - dispatch_async(self.workQueue, ^{ - if (!self.controllerId) { - CHIP_LOG_ERROR("Attribute cache wasn't subscribed yet."); - completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - return; - } - [self.xpcConnection getProxyHandleWithCompletion:^( - dispatch_queue_t _Nonnull queue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { - if (handle) { - [handle.proxy readAttributeCacheWithController:self.controllerId - nodeId:nodeId - endpointId:endpointId - clusterId:clusterId - attributeId:attributeId - completion:^(id _Nullable values, NSError * _Nullable error) { - completion([CHIPDeviceController decodeXPCResponseValues:values], error); - __auto_type handleRetainer = handle; - (void) handleRetainer; - }]; - } else { - CHIP_LOG_ERROR("Attribute cache read failed due to XPC connection failure"); - completion(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - } - }]; - }); -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC.m b/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC.m index 3c4ca4d586e704..4ae6f7051693ee 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC.m +++ b/src/darwin/Framework/CHIP/CHIPDeviceControllerOverXPC.m @@ -15,7 +15,6 @@ * limitations under the License. */ -#import "CHIPDeviceControllerOverXPC+AttributeCache.h" #import "CHIPDeviceControllerOverXPC_Internal.h" #import "CHIPDeviceController+XPC.h" diff --git a/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m b/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m index 8d11e8cb902cee..cd329a11dc8f1a 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m +++ b/src/darwin/Framework/CHIP/CHIPDeviceOverXPC.m @@ -17,6 +17,7 @@ #import "CHIPDeviceOverXPC.h" +#import "CHIPAttributeCacheContainer+XPC.h" #import "CHIPCluster.h" #import "CHIPDeviceController+XPC.h" #import "CHIPDeviceControllerXPCConnection.h" @@ -48,14 +49,42 @@ - (instancetype)initWithController:(id)controller - (void)subscribeWithQueue:(dispatch_queue_t)queue minInterval:(uint16_t)minInterval maxInterval:(uint16_t)maxInterval + params:(nullable CHIPSubscribeParams *)params + cacheContainer:(CHIPAttributeCacheContainer * _Nullable)attributeCacheContainer reportHandler:(void (^)(NSArray * _Nullable value, NSError * _Nullable error))reportHandler subscriptionEstablished:(void (^_Nullable)(void))subscriptionEstablishedHandler { - dispatch_async(queue, ^{ - CHIP_LOG_ERROR("All attribute subscription is not supported by remote device"); - subscriptionEstablishedHandler(); - reportHandler(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); - }); + CHIP_LOG_DEBUG("Subscribing all attributes... Note that reportHandler is not supported."); + if (attributeCacheContainer) { + [attributeCacheContainer setXPCConnection:_xpcConnection controllerId:self.controller deviceId:self.nodeId]; + } + [_xpcConnection getProxyHandleWithCompletion:^( + dispatch_queue_t _Nonnull proxyQueue, CHIPDeviceControllerXPCProxyHandle * _Nullable handle) { + if (handle) { + [handle.proxy subscribeWithController:self.controller + nodeId:self.nodeId + minInterval:@(minInterval) + maxInterval:@(maxInterval) + params:[CHIPDeviceController encodeXPCSubscribeParams:params] + shouldCache:(attributeCacheContainer != nil) + completion:^(NSError * _Nullable error) { + dispatch_async(queue, ^{ + if (error) { + reportHandler(nil, error); + } else { + subscriptionEstablishedHandler(); + } + }); + __auto_type handleRetainer = handle; + (void) handleRetainer; + }]; + } else { + CHIP_LOG_ERROR("Failed to obtain XPC connection to write attribute"); + dispatch_async(queue, ^{ + reportHandler(nil, [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); + }); + } + }]; } - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId diff --git a/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m b/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m index b075c9e4d45838..ace90dc5ea2895 100644 --- a/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPDeviceTests.m @@ -688,16 +688,25 @@ - (void)test011_ReadCachedAttribute XCTestExpectation * subscribeExpectation = [self expectationWithDescription:@"Subscription complete"]; NSLog(@"Subscribing..."); - [attributeCacheContainer subscribeWithDeviceController:controller - deviceId:kDeviceId - params:nil - clientQueue:queue - completion:^(NSError * _Nullable error) { - NSLog(@"Subscription complete with error: %@", error); - XCTAssertNil(error); - [subscribeExpectation fulfill]; - }]; - [self waitForExpectations:[NSArray arrayWithObject:subscribeExpectation] timeout:kTimeoutInSeconds]; + __block void (^reportHandler)(NSArray * _Nullable value, NSError * _Nullable error); + [device subscribeWithQueue:queue + minInterval:2 + maxInterval:60 + params:nil + cacheContainer:attributeCacheContainer + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Received report: %@, error: %@", value, error); + if (reportHandler) { + __auto_type handler = reportHandler; + reportHandler = nil; + handler(value, error); + } + } + subscriptionEstablished:^{ + NSLog(@"Subscription established"); + [subscribeExpectation fulfill]; + }]; + [self waitForExpectations:@[ subscribeExpectation ] timeout:60]; // Invoke command to set the attribute to a known state XCTestExpectation * commandExpectation = [self expectationWithDescription:@"Command invoked"]; @@ -712,11 +721,9 @@ - (void)test011_ReadCachedAttribute }]; [self waitForExpectations:[NSArray arrayWithObject:commandExpectation] timeout:kTimeoutInSeconds]; - // Wait till reports arrive from accessory. It turned out accessory could generate very lengthy initial reports. + // Wait till reports arrive from accessory. NSLog(@"Waiting for reports from accessory..."); - __auto_type idleExpectation = [self expectationWithDescription:@"Must not break out of idle"]; - idleExpectation.inverted = YES; - [self waitForExpectations:[NSArray arrayWithObject:idleExpectation] timeout:60]; + sleep(5); // Read cache NSLog(@"Reading from cache..."); @@ -749,6 +756,22 @@ - (void)test011_ReadCachedAttribute }]; [self waitForExpectations:[NSArray arrayWithObject:newSubscriptionEstablished] timeout:kTimeoutInSeconds]; + __auto_type reportExpectation = [self expectationWithDescription:@"Report handler called"]; + reportHandler = ^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Report received: %@, error: %@", value, error); + for (CHIPAttributeReport * report in value) { + if ([report.path.endpoint isEqualToNumber:@1] && [report.path.cluster isEqualToNumber:@6] && + [report.path.attribute isEqualToNumber:@0]) { + NSLog(@"Report value for OnOff: %@", report.value); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[NSNumber class]]); + XCTAssertEqual([report.value boolValue], NO); + [reportExpectation fulfill]; + break; + } + } + }; + NSLog(@"Invoking another command..."); commandExpectation = [self expectationWithDescription:@"Command invoked"]; [cluster offWithCompletionHandler:^(NSError * _Nullable err) { @@ -760,12 +783,10 @@ - (void)test011_ReadCachedAttribute // Wait till reports arrive from accessory. NSLog(@"Waiting for reports from accessory..."); - idleExpectation = [self expectationWithDescription:@"Must not break out of idle"]; - idleExpectation.inverted = YES; - [self waitForExpectations:[NSArray arrayWithObject:idleExpectation] timeout:3]; + [self waitForExpectations:@[ reportExpectation ] timeout:kTimeoutInSeconds]; NSLog(@"Disconnect accessory to test cache..."); - idleExpectation = [self expectationWithDescription:@"Must not break out of idle"]; + __auto_type idleExpectation = [self expectationWithDescription:@"Must not break out of idle"]; idleExpectation.inverted = YES; [self waitForExpectations:[NSArray arrayWithObject:idleExpectation] timeout:10]; diff --git a/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m b/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m index 5e5502d7c35973..90e56447df9df7 100644 --- a/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPXPCListenerSampleTests.m @@ -341,30 +341,54 @@ - (void)stopReportsWithController:(id _Nullable)controller nodeId:(uint64_t)node } } -- (void)subscribeAttributeCacheWithController:(id _Nullable)controller - nodeId:(uint64_t)nodeId - params:(NSDictionary * _Nullable)params - completion:(void (^)(NSError * _Nullable error))completion +- (void)subscribeWithController:(id _Nullable)controller + nodeId:(uint64_t)nodeId + minInterval:(NSNumber *)minInterval + maxInterval:(NSNumber *)maxInterval + params:(NSDictionary * _Nullable)params + shouldCache:(BOOL)shouldCache + completion:(void (^)(NSError * _Nullable error))completion { __auto_type sharedController = [CHIPDeviceController sharedController]; if (sharedController) { - CHIPAttributeCacheContainer * attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - [attributeCacheContainer - subscribeWithDeviceController:sharedController - deviceId:nodeId + CHIPAttributeCacheContainer * attributeCacheContainer; + if (shouldCache) { + attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; + } + + [sharedController getConnectedDevice:nodeId + queue:dispatch_get_main_queue() + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", nodeId, error); + completion(error); + return; + } + NSMutableArray * established = [NSMutableArray arrayWithCapacity:1]; + [established addObject:@NO]; + [device subscribeWithQueue:dispatch_get_main_queue() + minInterval:[minInterval unsignedShortValue] + maxInterval:[maxInterval unsignedShortValue] params:[CHIPDeviceController decodeXPCSubscribeParams:params] - clientQueue:dispatch_get_main_queue() - completion:^(NSError * _Nullable error) { - NSNumber * nodeIdNumber = [NSNumber numberWithUnsignedLongLong:nodeId]; - if (error) { - NSLog(@"Failed to have subscribe attribute by cache"); - [self.attributeCacheDictionary removeObjectForKey:nodeIdNumber]; - } else { - NSLog(@"Attribute cache for node %llu successfully subscribed attributes", nodeId); - [self.attributeCacheDictionary setObject:attributeCacheContainer forKey:nodeIdNumber]; + cacheContainer:attributeCacheContainer + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Report received: %@, error: %@", value, error); + if (error && ![established[0] boolValue]) { + established[0] = @YES; + completion(error); + } } - completion(error); - }]; + subscriptionEstablished:^{ + NSLog(@"Attribute cache subscription succeeded for device %llu", nodeId); + if (attributeCacheContainer) { + [self.attributeCacheDictionary setObject:attributeCacheContainer forKey:@(nodeId)]; + } + if (![established[0] boolValue]) { + established[0] = @YES; + completion(nil); + } + }]; + }]; } else { NSLog(@"Failed to get shared controller"); completion([NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeGeneralError userInfo:nil]); @@ -418,12 +442,6 @@ - (void)readAttributeCacheWithController:(id _Nullable)controller return mConnectedDevice; } -static CHIPDeviceController * GetDeviceController(void) -{ - XCTAssertNotNil(mDeviceController); - return mDeviceController; -} - @interface CHIPRemoteDeviceSampleTestPairingDelegate : NSObject @property (nonatomic, strong) XCTestExpectation * expectation; @end @@ -1738,23 +1756,22 @@ - (void)test900_SubscribeAttributeCache CHIPDevice * device = GetConnectedDevice(); dispatch_queue_t queue = dispatch_get_main_queue(); - __auto_type * deviceController = GetDeviceController(); CHIPAttributeCacheContainer * attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - NSLog(@"Setting up attribute cache..."); - [attributeCacheContainer subscribeWithDeviceController:deviceController - deviceId:kDeviceId - params:nil - clientQueue:queue - completion:^(NSError * _Nullable error) { - NSLog(@"Attribute cache subscribed attributes"); - [expectation fulfill]; - }]; - [self waitForExpectations:@[ expectation ] timeout:kTimeoutInSeconds]; - - // Wait for initial report to be collected. This can take very long. + NSLog(@"Setting up attribute cache subscription..."); + [device subscribeWithQueue:queue + minInterval:1 + maxInterval:60 + params:nil + cacheContainer:attributeCacheContainer + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Report for attribute cache: %@, error: %@", value, error); + } + subscriptionEstablished:^{ + NSLog(@"Attribute cache subscribed attributes"); + [expectation fulfill]; + }]; + // Wait for subscription establishment. This can take very long to collect initial reports. NSLog(@"Waiting for initial report..."); - expectation = [self expectationWithDescription:@"Must not jump out while waiting for initial report"]; - expectation.inverted = YES; [self waitForExpectations:@[ expectation ] timeout:120]; // Send command to reset attribute state diff --git a/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m b/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m index 706b326a63697f..692144636d2bc7 100644 --- a/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m +++ b/src/darwin/Framework/CHIPTests/CHIPXPCProtocolTests.m @@ -76,6 +76,61 @@ - (NSString *)description } @end +@interface CHIPAttributeCacheContainer (Test) +// Obsolete method is moved to this test suite to keep tests compatible +- (void)subscribeWithDeviceController:(CHIPDeviceController *)deviceController + deviceId:(uint64_t)deviceId + params:(CHIPSubscribeParams * _Nullable)params + clientQueue:(dispatch_queue_t)clientQueue + completion:(void (^)(NSError * _Nullable error))completion; +@end + +@implementation CHIPAttributeCacheContainer (Test) +- (void)subscribeWithDeviceController:(CHIPDeviceController *)deviceController + deviceId:(uint64_t)deviceId + params:(CHIPSubscribeParams * _Nullable)params + clientQueue:clientQueue + completion:(void (^)(NSError * _Nullable error))completion +{ + __auto_type workQueue = dispatch_get_main_queue(); + __auto_type completionHandler = ^(NSError * _Nullable error) { + dispatch_async(clientQueue, ^{ + completion(error); + }); + }; + [deviceController getConnectedDevice:deviceId + queue:workQueue + completionHandler:^(CHIPDevice * _Nullable device, NSError * _Nullable error) { + if (error) { + NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@", deviceId, error); + completionHandler(error); + return; + } + __auto_type established = [NSMutableArray arrayWithCapacity:1]; + [established addObject:@NO]; + [device subscribeWithQueue:clientQueue + minInterval:1 + maxInterval:43200 + params:params + cacheContainer:self + reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { + NSLog(@"Report received for attribute cache: %@, error: %@", value, error); + if (![established[0] boolValue]) { + established[0] = @YES; + completionHandler(error); + } + } + subscriptionEstablished:^{ + NSLog(@"Attribute cache subscription succeeded for device %llu", deviceId); + if (![established[0] boolValue]) { + established[0] = @YES; + completionHandler(nil); + } + }]; + }]; +} +@end + @interface CHIPXPCProtocolTests : XCTestCase @property (nonatomic, readwrite, strong) NSXPCListener * xpcListener; @@ -103,8 +158,9 @@ @interface CHIPXPCProtocolTests NSNumber * _Nullable clusterId, NSNumber * _Nullable attributeId, NSNumber * minInterval, NSNumber * maxInterval, CHIPSubscribeParams * _Nullable params, void (^establishedHandler)(void)); @property (readwrite, strong) void (^handleStopReports)(id controller, uint64_t nodeId, void (^completion)(void)); -@property (readwrite, strong) void (^handleSubscribeAttributeCache) - (id controller, uint64_t nodeId, CHIPSubscribeParams * _Nullable params, void (^completion)(NSError * _Nullable error)); +@property (readwrite, strong) void (^handleSubscribeAll)(id controller, uint64_t nodeId, NSNumber * minInterval, + NSNumber * maxInterval, CHIPSubscribeParams * _Nullable params, BOOL shouldCache, void (^completion)(NSError * _Nullable error)) + ; @property (readwrite, strong) void (^handleReadAttributeCache) (id controller, uint64_t nodeId, NSNumber * _Nullable endpointId, NSNumber * _Nullable clusterId, NSNumber * _Nullable attributeId, void (^completion)(id _Nullable values, NSError * _Nullable error)); @@ -221,14 +277,18 @@ - (void)stopReportsWithController:(id)controller nodeId:(uint64_t)nodeId complet }); } -- (void)subscribeAttributeCacheWithController:(id _Nullable)controller - nodeId:(uint64_t)nodeId - params:(NSDictionary * _Nullable)params - completion:(void (^)(NSError * _Nullable error))completion +- (void)subscribeWithController:(id _Nullable)controller + nodeId:(uint64_t)nodeId + minInterval:(NSNumber *)minInterval + maxInterval:(NSNumber *)maxInterval + params:(NSDictionary * _Nullable)params + shouldCache:(BOOL)shouldCache + completion:(void (^)(NSError * _Nullable error))completion { dispatch_async(dispatch_get_main_queue(), ^{ - XCTAssertNotNil(self.handleSubscribeAttributeCache); - self.handleSubscribeAttributeCache(controller, nodeId, [CHIPDeviceController decodeXPCSubscribeParams:params], completion); + XCTAssertNotNil(self.handleSubscribeAll); + self.handleSubscribeAll(controller, nodeId, minInterval, maxInterval, + [CHIPDeviceController decodeXPCSubscribeParams:params], shouldCache, completion); }); } @@ -2231,15 +2291,15 @@ - (void)testSubscribeAttributeCacheSuccess __auto_type uuid = self.controllerUUID; __auto_type attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - _handleSubscribeAttributeCache - = ^(id controller, uint64_t nodeId, CHIPSubscribeParams * _Nullable params, void (^completion)(NSError * _Nullable error)) { - NSLog(@"Subscribe attribute cache called"); - XCTAssertTrue([controller isEqualToString:uuid]); - XCTAssertEqual(nodeId, myNodeId); - XCTAssertNil(params); - [callExpectation fulfill]; - completion(nil); - }; + _handleSubscribeAll = ^(id controller, uint64_t nodeId, NSNumber * minInterval, NSNumber * maxInterval, + CHIPSubscribeParams * _Nullable params, BOOL shouldCache, void (^completion)(NSError * _Nullable error)) { + NSLog(@"Subscribe called"); + XCTAssertTrue([controller isEqualToString:uuid]); + XCTAssertEqual(nodeId, myNodeId); + XCTAssertNil(params); + [callExpectation fulfill]; + completion(nil); + }; _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [attributeCacheContainer subscribeWithDeviceController:_remoteDeviceController @@ -2267,17 +2327,17 @@ - (void)testSubscribeAttributeCacheWithParamsSuccess __auto_type uuid = self.controllerUUID; __auto_type attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - _handleSubscribeAttributeCache - = ^(id controller, uint64_t nodeId, CHIPSubscribeParams * _Nullable params, void (^completion)(NSError * _Nullable error)) { - NSLog(@"Subscribe attribute cache called"); - XCTAssertTrue([controller isEqualToString:uuid]); - XCTAssertEqual(nodeId, myNodeId); - XCTAssertNotNil(params); - XCTAssertEqual([params.fabricFiltered boolValue], [myParams.fabricFiltered boolValue]); - XCTAssertEqual([params.keepPreviousSubscriptions boolValue], [myParams.keepPreviousSubscriptions boolValue]); - [callExpectation fulfill]; - completion(nil); - }; + _handleSubscribeAll = ^(id controller, uint64_t nodeId, NSNumber * minInterval, NSNumber * maxInterval, + CHIPSubscribeParams * _Nullable params, BOOL shouldCache, void (^completion)(NSError * _Nullable error)) { + NSLog(@"Subscribe attribute cache called"); + XCTAssertTrue([controller isEqualToString:uuid]); + XCTAssertEqual(nodeId, myNodeId); + XCTAssertNotNil(params); + XCTAssertEqual([params.fabricFiltered boolValue], [myParams.fabricFiltered boolValue]); + XCTAssertEqual([params.keepPreviousSubscriptions boolValue], [myParams.keepPreviousSubscriptions boolValue]); + [callExpectation fulfill]; + completion(nil); + }; _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [attributeCacheContainer subscribeWithDeviceController:_remoteDeviceController @@ -2303,15 +2363,15 @@ - (void)testSubscribeAttributeCacheFailure __auto_type uuid = self.controllerUUID; __auto_type attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - _handleSubscribeAttributeCache - = ^(id controller, uint64_t nodeId, CHIPSubscribeParams * _Nullable params, void (^completion)(NSError * _Nullable error)) { - NSLog(@"Subscribe attribute cache called"); - XCTAssertTrue([controller isEqualToString:uuid]); - XCTAssertEqual(nodeId, myNodeId); - XCTAssertNil(params); - [callExpectation fulfill]; - completion(myError); - }; + _handleSubscribeAll = ^(id controller, uint64_t nodeId, NSNumber * minInterval, NSNumber * maxInterval, + CHIPSubscribeParams * _Nullable params, BOOL shouldCache, void (^completion)(NSError * _Nullable error)) { + NSLog(@"Subscribe attribute cache called"); + XCTAssertTrue([controller isEqualToString:uuid]); + XCTAssertEqual(nodeId, myNodeId); + XCTAssertNil(params); + [callExpectation fulfill]; + completion(myError); + }; _xpcDisconnectExpectation = [self expectationWithDescription:@"XPC Disconnected"]; [attributeCacheContainer subscribeWithDeviceController:_remoteDeviceController @@ -2347,14 +2407,14 @@ - (void)testReadAttributeCacheSuccess __auto_type uuid = self.controllerUUID; __auto_type attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - _handleSubscribeAttributeCache - = ^(id controller, uint64_t nodeId, CHIPSubscribeParams * _Nullable params, void (^completion)(NSError * _Nullable error)) { - NSLog(@"Subscribe attribute cache called"); - XCTAssertTrue([controller isEqualToString:uuid]); - XCTAssertEqual(nodeId, myNodeId); - XCTAssertNil(params); - completion(nil); - }; + _handleSubscribeAll = ^(id controller, uint64_t nodeId, NSNumber * minInterval, NSNumber * maxInterval, + CHIPSubscribeParams * _Nullable params, BOOL shouldCache, void (^completion)(NSError * _Nullable error)) { + NSLog(@"Subscribe attribute cache called"); + XCTAssertTrue([controller isEqualToString:uuid]); + XCTAssertEqual(nodeId, myNodeId); + XCTAssertNil(params); + completion(nil); + }; _handleReadAttributeCache = ^(id controller, uint64_t nodeId, NSNumber * _Nullable endpointId, NSNumber * _Nullable clusterId, NSNumber * _Nullable attributeId, void (^completion)(id _Nullable values, NSError * _Nullable error)) { @@ -2409,14 +2469,14 @@ - (void)testReadAttributeCacheFailure __auto_type uuid = self.controllerUUID; __auto_type attributeCacheContainer = [[CHIPAttributeCacheContainer alloc] init]; - _handleSubscribeAttributeCache - = ^(id controller, uint64_t nodeId, CHIPSubscribeParams * _Nullable params, void (^completion)(NSError * _Nullable error)) { - NSLog(@"Subscribe attribute cache called"); - XCTAssertTrue([controller isEqualToString:uuid]); - XCTAssertEqual(nodeId, myNodeId); - XCTAssertNil(params); - completion(nil); - }; + _handleSubscribeAll = ^(id controller, uint64_t nodeId, NSNumber * minInterval, NSNumber * maxInterval, + CHIPSubscribeParams * _Nullable params, BOOL shouldCache, void (^completion)(NSError * _Nullable error)) { + NSLog(@"Subscribe attribute cache called"); + XCTAssertTrue([controller isEqualToString:uuid]); + XCTAssertEqual(nodeId, myNodeId); + XCTAssertNil(params); + completion(nil); + }; _handleReadAttributeCache = ^(id controller, uint64_t nodeId, NSNumber * _Nullable endpointId, NSNumber * _Nullable clusterId, NSNumber * _Nullable attributeId, void (^completion)(id _Nullable values, NSError * _Nullable error)) { From 98e0e7c7af801551041b1e78c794873ca3709727 Mon Sep 17 00:00:00 2001 From: rgoliver Date: Thu, 24 Mar 2022 15:23:08 -0400 Subject: [PATCH 55/70] RPC: Add tokenized log support to console (#16537) - Update Pigwee to 67506a1a448 to bring in console fix. - Hide Python Repl when opened in raw mode. - Add tokenized log support to console. - Cleanup py setup so install is cleaner, and also add chip-console as an entrypoint to make it cleaner to run. --- examples/all-clusters-app/ameba/README.md | 2 +- examples/all-clusters-app/esp32/README.md | 2 +- .../build_overrides/pigweed_environment.gni | 1 + examples/common/pigweed/rpc_console/README.md | 2 +- .../common/pigweed/rpc_console/py/BUILD.gn | 15 +++----- .../rpc_console/py/chip_rpc/console.py | 38 ++++++++++++++++--- .../pigweed/rpc_console/py/pyproject.toml | 16 ++++++++ .../common/pigweed/rpc_console/py/setup.cfg | 29 ++++++++++++++ .../common/pigweed/rpc_console/py/setup.py | 17 +++++++++ examples/ipv6only-app/esp32/README.md | 2 +- examples/light-switch-app/efr32/README.md | 2 +- examples/lighting-app/efr32/README.md | 2 +- examples/lighting-app/linux/README.md | 2 +- examples/lighting-app/mbed/README.md | 2 +- examples/lighting-app/nrfconnect/README.md | 2 +- examples/lock-app/esp32/README.md | 2 +- examples/lock-app/mbed/README.md | 2 +- examples/pigweed-app/mbed/README.md | 2 +- third_party/pigweed/repo | 2 +- 19 files changed, 114 insertions(+), 28 deletions(-) create mode 120000 examples/build_overrides/pigweed_environment.gni create mode 100644 examples/common/pigweed/rpc_console/py/pyproject.toml create mode 100644 examples/common/pigweed/rpc_console/py/setup.cfg create mode 100644 examples/common/pigweed/rpc_console/py/setup.py diff --git a/examples/all-clusters-app/ameba/README.md b/examples/all-clusters-app/ameba/README.md index 8ff6e342433981..0b333950067ca7 100644 --- a/examples/all-clusters-app/ameba/README.md +++ b/examples/all-clusters-app/ameba/README.md @@ -127,7 +127,7 @@ to be On or Off. - Launch the chip-rpc console after resetting Ameba board - $ python3 -m chip_rpc.console --device /dev/tty -b 115200 + $ chip-console --device /dev/tty -b 115200 - Get and Set lighting directly using the RPC console diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index a0b79d926d33e8..9af884bd7fabfd 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -315,7 +315,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console - python -m chip_rpc.console --device /dev/ttyUSB0 + chip-console --device /dev/ttyUSB0 From within the console you can then invoke rpcs: diff --git a/examples/build_overrides/pigweed_environment.gni b/examples/build_overrides/pigweed_environment.gni new file mode 120000 index 00000000000000..bb2374b01537e6 --- /dev/null +++ b/examples/build_overrides/pigweed_environment.gni @@ -0,0 +1 @@ +../../build_overrides/pigweed_environment.gni \ No newline at end of file diff --git a/examples/common/pigweed/rpc_console/README.md b/examples/common/pigweed/rpc_console/README.md index 1b50a83812f08a..202d02b4ab68a5 100644 --- a/examples/common/pigweed/rpc_console/README.md +++ b/examples/common/pigweed/rpc_console/README.md @@ -39,7 +39,7 @@ files required for CHIP. To start the console provide the path to the device, for example: - $ python -m chip_rpc.console --device /dev/ttyUSB0 + $ chip-console --device /dev/ttyUSB0 An example RPC command: diff --git a/examples/common/pigweed/rpc_console/py/BUILD.gn b/examples/common/pigweed/rpc_console/py/BUILD.gn index 67c6164eeaf1c4..bcc57f42a7f07a 100644 --- a/examples/common/pigweed/rpc_console/py/BUILD.gn +++ b/examples/common/pigweed/rpc_console/py/BUILD.gn @@ -20,16 +20,13 @@ import("$dir_pw_build/python_dist.gni") import("${chip_root}/examples/common/pigweed/pigweed_rpcs.gni") pw_python_package("chip_rpc") { - generate_setup = { - metadata = { - name = "chip_rpc" - version = "0.0.1" - } - options = { - install_requires = [ "ipython" ] - } - } + setup = [ + "pyproject.toml", + "setup.cfg", + "setup.py", + ] sources = [ + "chip_rpc/__init__.py", "chip_rpc/console.py", "chip_rpc/plugins/device_toolbar.py", "chip_rpc/plugins/helper_scripts.py", diff --git a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py index 34567bbd19ca64..66daafbf1035c5 100644 --- a/examples/common/pigweed/rpc_console/py/chip_rpc/console.py +++ b/examples/common/pigweed/rpc_console/py/chip_rpc/console.py @@ -30,7 +30,6 @@ rpcs - used to invoke RPCs device - the serial device used for communication client - the pw_rpc.Client - scripts - helper scripts for working with chip devices protos - protocol buffer messages indexed by proto package An example RPC command: @@ -47,7 +46,7 @@ from concurrent.futures import ThreadPoolExecutor import sys import threading -from typing import Any, BinaryIO +from typing import Any, BinaryIO, Collection from chip_rpc.plugins.device_toolbar import DeviceToolbar from chip_rpc.plugins.helper_scripts import HelperScripts @@ -59,6 +58,10 @@ from pw_rpc import callback_client from pw_rpc.console_tools.console import ClientInfo, flattened_rpc_completions +from pw_tokenizer.database import LoadTokenDatabases +from pw_tokenizer.detokenize import Detokenizer, detokenize_base64 +from pw_tokenizer import tokens + # Protos from attributes_service import attributes_service_pb2 from button_service import button_service_pb2 @@ -112,6 +115,11 @@ def _parse_args(): '--raw_serial', action="store_true", help=('Use raw serial instead of HDLC/RPC')) + parser.add_argument("--token-databases", + metavar='elf_or_token_database', + nargs="+", + action=LoadTokenDatabases, + help="Path to tokenizer database csv file(s).") group.add_argument('-s', '--socket-addr', type=str, @@ -152,6 +160,7 @@ def _start_ipython_raw_terminal() -> None: interactive_console.hide_windows('Host Logs') interactive_console.hide_windows('Serial Debug') + interactive_console.hide_windows('Python Repl') # Setup Python logger propagation interactive_console.setup_python_logging() @@ -236,7 +245,8 @@ def read(self, num_bytes: int = PW_RPC_MAX_PACKET_SIZE): def write_to_output(data: bytes, - unused_output: BinaryIO = sys.stdout.buffer,): + unused_output: BinaryIO = sys.stdout.buffer, + detokenizer=None): log_line = data RegexStruct = namedtuple('RegexStruct', 'platform type regex match_num') LEVEL_MAPPING = {"I": logging.INFO, "W": logging.WARNING, "P": logging.INFO, @@ -276,9 +286,17 @@ def write_to_output(data: bytes, fields.update(match.groupdict()) if "level" in match.groupdict(): fields["level"] = LEVEL_MAPPING[fields["level"]] + if detokenizer: + _LOG.warn(fields["msg"]) + if len(fields["msg"]) % 2: + # TODO the msg likely wrapped, trim for now + fields["msg"] = fields["msg"][:-1] + fields["msg"] = detokenizer.detokenize( + bytes.fromhex(fields["msg"])) break + _DEVICE_LOG.log(fields["level"], fields["msg"], extra={'extra_metadata_fields': { - "time": fields["time"], "type": fields["type"], "mod": fields["mod"]}}) + "timestamp": fields["time"], "type": fields["type"], "mod": fields["mod"]}}) def _read_raw_serial(read: Callable[[], bytes], output): @@ -294,6 +312,7 @@ def _read_raw_serial(read: Callable[[], bytes], output): def console(device: str, baudrate: int, + token_databases: Collection[tokens.Database], socket_addr: str, output: Any, raw_serial: bool) -> int: """Starts an interactive RPC console for HDLC.""" # argparse.FileType doesn't correctly handle '-' for binary files. @@ -323,15 +342,22 @@ def read(): return serial_device.read(8192) default_stream_timeout_s=None, ) + detokenizer = Detokenizer(tokens.Database.merged(*token_databases), + show_errors=False) if token_databases else None + if raw_serial: threading.Thread(target=_read_raw_serial, daemon=True, - args=(read, write_to_output)).start() + args=(read, + lambda data: write_to_output( + data, output, detokenizer), + )).start() _start_ipython_raw_terminal() else: _start_ipython_hdlc_terminal( HdlcRpcClient(read, PROTOS, default_channels(write), - lambda data: write_to_output(data, output), + lambda data: write_to_output( + data, output, detokenizer), client_impl=callback_client_impl) ) return 0 diff --git a/examples/common/pigweed/rpc_console/py/pyproject.toml b/examples/common/pigweed/rpc_console/py/pyproject.toml new file mode 100644 index 00000000000000..bc6b8958f9666c --- /dev/null +++ b/examples/common/pigweed/rpc_console/py/pyproject.toml @@ -0,0 +1,16 @@ +# Copyright (c) 2022 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. +[build-system] +requires = ['setuptools', 'wheel'] +build-backend = 'setuptools.build_meta' diff --git a/examples/common/pigweed/rpc_console/py/setup.cfg b/examples/common/pigweed/rpc_console/py/setup.cfg new file mode 100644 index 00000000000000..a60214e5ab05e8 --- /dev/null +++ b/examples/common/pigweed/rpc_console/py/setup.cfg @@ -0,0 +1,29 @@ +# Copyright (c) 2022 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. +[metadata] +name = chip_rpc +version = 0.0.1 + +[options] +packages = find: +zip_safe = False +install_requires = + pw_console + pw_hdlc + pw_protobuf_compiler + pw_rpc + pw_tokenizer + +[options.entry_points] +console_scripts = chip-console = chip_rpc.console:main diff --git a/examples/common/pigweed/rpc_console/py/setup.py b/examples/common/pigweed/rpc_console/py/setup.py new file mode 100644 index 00000000000000..ba255890ff2490 --- /dev/null +++ b/examples/common/pigweed/rpc_console/py/setup.py @@ -0,0 +1,17 @@ +# Copyright (c) 2022 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. + +import setuptools # type: ignore + +setuptools.setup() # Package definition in setup.cfg diff --git a/examples/ipv6only-app/esp32/README.md b/examples/ipv6only-app/esp32/README.md index 21972720729bd9..0bc7ef61eef976 100644 --- a/examples/ipv6only-app/esp32/README.md +++ b/examples/ipv6only-app/esp32/README.md @@ -96,7 +96,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console: - $ python -m chip_rpc.console --device /dev/ttyUSB0 -b 115200 + $ chip-console --device /dev/ttyUSB0 -b 115200 An example flow of performing a scan, connecting, and getting the IPv6 address: diff --git a/examples/light-switch-app/efr32/README.md b/examples/light-switch-app/efr32/README.md index 9e8d40c8da6d84..a4c9d154c5a6c8 100644 --- a/examples/light-switch-app/efr32/README.md +++ b/examples/light-switch-app/efr32/README.md @@ -347,7 +347,7 @@ via 2002::2 - To use the chip-rpc console after it has been installed run: - `python3 -m chip_rpc.console --device /dev/tty. -b 115200 -o //pw_log.out` + `chip-console --device /dev/tty. -b 115200 -o //pw_log.out` - Then you can simulate a button press or release using the following command where : idx = 0 or 1 for Button PB0 or PB1 action = 0 for PRESSED, 1 for diff --git a/examples/lighting-app/efr32/README.md b/examples/lighting-app/efr32/README.md index bb6b24f113337e..a6fc76292a8d4a 100644 --- a/examples/lighting-app/efr32/README.md +++ b/examples/lighting-app/efr32/README.md @@ -290,7 +290,7 @@ via 2002::2 `pip3 install out/debug/chip_rpc_console_wheels/*.whl` - To use the chip-rpc console after it has been installed run: - `python3 -m chip_rpc.console --device /dev/tty. -b 115200 -o //pw_log.out` + `chip-console --device /dev/tty. -b 115200 -o //pw_log.out` - Then you can simulate a button press or release using the following command where : idx = 0 or 1 for Button PB0 or PB1 action = 0 for PRESSED, 1 for diff --git a/examples/lighting-app/linux/README.md b/examples/lighting-app/linux/README.md index 03f079532cad75..262f1a6e2a6073 100644 --- a/examples/lighting-app/linux/README.md +++ b/examples/lighting-app/linux/README.md @@ -130,7 +130,7 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** `pip3 install out/debug/chip_rpc_console_wheels/*.whl` - To use the chip-rpc console after it has been installed run: - `python3 -m chip_rpc.console -s localhost:33000 -o //pw_log.out` + `chip-console -s localhost:33000 -o //pw_log.out` - Then you can Get and Set the light using the RPCs: `rpcs.chip.rpc.Lighting.Get()` diff --git a/examples/lighting-app/mbed/README.md b/examples/lighting-app/mbed/README.md index e9f3ac7b99054d..8c39ce7b772414 100644 --- a/examples/lighting-app/mbed/README.md +++ b/examples/lighting-app/mbed/README.md @@ -266,7 +266,7 @@ parameters as arguments: Example: - python -m chip_rpc.console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out + chip-console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out To control the lighting type the following command, where you define if 'on' state is true or false: diff --git a/examples/lighting-app/nrfconnect/README.md b/examples/lighting-app/nrfconnect/README.md index 2d4ca5f2b940b2..ac041d994de9c5 100644 --- a/examples/lighting-app/nrfconnect/README.md +++ b/examples/lighting-app/nrfconnect/README.md @@ -563,7 +563,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console - $ python -m chip_rpc.console --device /dev/ttyUSB0 + $ chip-console --device /dev/ttyUSB0 From within the console you can then invoke rpcs: diff --git a/examples/lock-app/esp32/README.md b/examples/lock-app/esp32/README.md index d810491160ef7b..f44bc3f07b791f 100644 --- a/examples/lock-app/esp32/README.md +++ b/examples/lock-app/esp32/README.md @@ -212,7 +212,7 @@ Build or install the [rpc console](../../common/pigweed/rpc_console/README.md) Start the console - python -m chip_rpc.console --device /dev/ttyUSB0 + chip-console --device /dev/ttyUSB0 From within the console you can then invoke rpcs: diff --git a/examples/lock-app/mbed/README.md b/examples/lock-app/mbed/README.md index 076794944445b8..7f6db4d2886c4a 100644 --- a/examples/lock-app/mbed/README.md +++ b/examples/lock-app/mbed/README.md @@ -256,7 +256,7 @@ parameters as arguments: Example: - python -m chip_rpc.console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out + chip-console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out To control the lock type the following command, where you define if 'on' state is true or false: diff --git a/examples/pigweed-app/mbed/README.md b/examples/pigweed-app/mbed/README.md index 05b8d469163d32..44612c82a3edef 100644 --- a/examples/pigweed-app/mbed/README.md +++ b/examples/pigweed-app/mbed/README.md @@ -225,7 +225,7 @@ parameters as arguments: Example: - python -m chip_rpc.console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out + chip-console -d /dev/ttyUSB0 -b 115200 -o /tmp/pw_rpc.out To send the echo message type the following command, where you define the message content: diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 86698c0b9620fe..67506a1a4487c7 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 86698c0b9620febe11cc274a44c9457e6127dd62 +Subproject commit 67506a1a4487c7fb1306bedc391883ec58841522 From 710b9d8e043b45ca96e09f15df5dbef44b5bc4b4 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 24 Mar 2022 16:08:47 -0400 Subject: [PATCH 56/70] Add a helper class for opening commissioning windows. (#16474) * Add a helper class for opening commissioning windows. There's a bunch of state involved in this, and trying to hang it all off the controller leads to too many complications, ranging from the inability to be opening more than one commissioning window at a time to crashes. Fixes https://github.com/project-chip/connectedhomeip/issues/16209 * Address review comments. * Address review comments. --- .../OpenCommissioningWindowCommand.cpp | 43 ++- .../pairing/OpenCommissioningWindowCommand.h | 20 +- src/controller/BUILD.gn | 2 + src/controller/CHIPDeviceController.cpp | 181 --------- src/controller/CHIPDeviceController.h | 90 ----- src/controller/CommissioningWindowOpener.cpp | 350 ++++++++++++++++++ src/controller/CommissioningWindowOpener.h | 176 +++++++++ .../java/CHIPDeviceController-JNI.cpp | 21 +- .../ChipDeviceController-ScriptBinding.cpp | 21 +- .../Framework/CHIP/CHIPDeviceController.mm | 18 +- 10 files changed, 598 insertions(+), 324 deletions(-) create mode 100644 src/controller/CommissioningWindowOpener.cpp create mode 100644 src/controller/CommissioningWindowOpener.h diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp index abc94a593e3948..bd39eb855b715b 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.cpp @@ -18,30 +18,40 @@ #include "OpenCommissioningWindowCommand.h" +#include + using namespace ::chip; CHIP_ERROR OpenCommissioningWindowCommand::RunCommand() { - return CurrentCommissioner().GetConnectedDevice(mNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); + mWindowOpener = Platform::MakeUnique(&CurrentCommissioner()); + if (mCommissioningWindowOption == Controller::CommissioningWindowOpener::CommissioningWindowOption::kOriginalSetupCode) + { + return mWindowOpener->OpenBasicCommissioningWindow(mNodeId, System::Clock::Seconds16(mTimeout), + &mOnOpenBasicCommissioningWindowCallback); + } + + if (mCommissioningWindowOption == Controller::CommissioningWindowOpener::CommissioningWindowOption::kTokenWithRandomPIN) + { + SetupPayload ignored; + return mWindowOpener->OpenCommissioningWindow(mNodeId, System::Clock::Seconds16(mTimeout), mIteration, mDiscriminator, + NullOptional, &mOnOpenCommissioningWindowCallback, ignored, + /* readVIDPIDAttributes */ true); + } + + ChipLogError(chipTool, "Unknown commissioning window option: %d", to_underlying(mCommissioningWindowOption)); + return CHIP_ERROR_INVALID_ARGUMENT; } -void OpenCommissioningWindowCommand::OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device) -{ - OpenCommissioningWindowCommand * command = reinterpret_cast(context); - VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); - command->OpenCommissioningWindow(); -} -void OpenCommissioningWindowCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR err) +void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, + chip::SetupPayload payload) { LogErrorOnFailure(err); - OpenCommissioningWindowCommand * command = reinterpret_cast(context); - VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectionFailureFn: context is null")); - command->SetCommandExitStatus(err); + OnOpenBasicCommissioningWindowResponse(context, remoteId, err); } -void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err, - chip::SetupPayload payload) +void OpenCommissioningWindowCommand::OnOpenBasicCommissioningWindowResponse(void * context, NodeId remoteId, CHIP_ERROR err) { LogErrorOnFailure(err); @@ -49,10 +59,3 @@ void OpenCommissioningWindowCommand::OnOpenCommissioningWindowResponse(void * co VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnOpenCommissioningWindowCommand: context is null")); command->SetCommandExitStatus(err); } - -CHIP_ERROR OpenCommissioningWindowCommand::OpenCommissioningWindow() -{ - return CurrentCommissioner().OpenCommissioningWindowWithCallback( - mNodeId, mTimeout, mIteration, mDiscriminator, mCommissioningWindowOption, &mOnOpenCommissioningWindowCallback, - /* readVIDPIDAttributes */ true); -} diff --git a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h index d29e328dde22da..b06f13ffea84e8 100644 --- a/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h +++ b/examples/chip-tool/commands/pairing/OpenCommissioningWindowCommand.h @@ -20,13 +20,16 @@ #include "../common/CHIPCommand.h" +#include +#include + class OpenCommissioningWindowCommand : public CHIPCommand { public: OpenCommissioningWindowCommand(CredentialIssuerCommands * credIssuerCommands) : - CHIPCommand("open-commissioning-window", credIssuerCommands), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), - mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this), - mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this) + CHIPCommand("open-commissioning-window", credIssuerCommands), + mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this), + mOnOpenBasicCommissioningWindowCallback(OnOpenBasicCommissioningWindowResponse, this) { AddArgument("node-id", 0, UINT64_MAX, &mNodeId); AddArgument("option", 0, 2, &mCommissioningWindowOption); @@ -41,17 +44,16 @@ class OpenCommissioningWindowCommand : public CHIPCommand private: NodeId mNodeId; - ChipDeviceController::CommissioningWindowOption mCommissioningWindowOption; + chip::Controller::CommissioningWindowOpener::CommissioningWindowOption mCommissioningWindowOption; uint16_t mTimeout; uint32_t mIteration; uint16_t mDiscriminator; - CHIP_ERROR OpenCommissioningWindow(); - static void OnDeviceConnectedFn(void * context, chip::OperationalDeviceProxy * device); - static void OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHIP_ERROR error); + chip::Platform::UniquePtr mWindowOpener; + static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); + static void OnOpenBasicCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status); - chip::Callback::Callback mOnDeviceConnectedCallback; - chip::Callback::Callback mOnDeviceConnectionFailureCallback; chip::Callback::Callback mOnOpenCommissioningWindowCallback; + chip::Callback::Callback mOnOpenBasicCommissioningWindowCallback; }; diff --git a/src/controller/BUILD.gn b/src/controller/BUILD.gn index 013f2101c457e1..e3d39d57747957 100644 --- a/src/controller/BUILD.gn +++ b/src/controller/BUILD.gn @@ -47,6 +47,8 @@ static_library("controller") { "CommissionerDiscoveryController.cpp", "CommissionerDiscoveryController.h", "CommissioningDelegate.cpp", + "CommissioningWindowOpener.cpp", + "CommissioningWindowOpener.h", "DeviceDiscoveryDelegate.h", "EmptyDataModelHandler.cpp", "ExampleOperationalCredentialsIssuer.cpp", diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 90553946503d92..8b8a168a134288 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -70,8 +70,6 @@ #include #include #include -#include -#include #include #include @@ -399,76 +397,6 @@ CHIP_ERROR DeviceController::GetPeerAddressAndPort(PeerId peerId, Inet::IPAddres return CHIP_NO_ERROR; } -void DeviceController::OnPIDReadResponse(void * context, uint16_t value) -{ - ChipLogProgress(Controller, "Received PID for the device. Value %d", value); - DeviceController * controller = static_cast(context); - controller->mSetupPayload.productID = value; - - if (controller->OpenCommissioningWindowInternal() != CHIP_NO_ERROR) - { - OnOpenPairingWindowFailureResponse(context, CHIP_NO_ERROR); - } -} - -void DeviceController::OnVIDReadResponse(void * context, VendorId value) -{ - ChipLogProgress(Controller, "Received VID for the device. Value %d", to_underlying(value)); - - DeviceController * controller = static_cast(context); - - controller->mSetupPayload.vendorID = value; - - OperationalDeviceProxy * device = - controller->mSystemState->CASESessionMgr()->FindExistingSession(controller->GetPeerIdWithCommissioningWindowOpen()); - if (device == nullptr) - { - ChipLogError(Controller, "Could not find device for opening commissioning window"); - OnOpenPairingWindowFailureResponse(context, CHIP_NO_ERROR); - return; - } - - constexpr EndpointId kBasicClusterEndpoint = 0; - chip::Controller::BasicCluster cluster; - cluster.Associate(device, kBasicClusterEndpoint); - - if (cluster.ReadAttribute(context, OnPIDReadResponse, - OnVIDPIDReadFailureResponse) != CHIP_NO_ERROR) - { - ChipLogError(Controller, "Could not read PID for opening commissioning window"); - OnOpenPairingWindowFailureResponse(context, CHIP_NO_ERROR); - } -} - -void DeviceController::OnVIDPIDReadFailureResponse(void * context, CHIP_ERROR error) -{ - ChipLogProgress(Controller, "Failed to read VID/PID for the device. error %" CHIP_ERROR_FORMAT, error.Format()); - OnOpenPairingWindowFailureResponse(context, error); -} - -void DeviceController::OnOpenPairingWindowSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &) -{ - ChipLogProgress(Controller, "Successfully opened pairing window on the device"); - DeviceController * controller = static_cast(context); - if (controller->mCommissioningWindowCallback != nullptr) - { - controller->mCommissioningWindowCallback->mCall(controller->mCommissioningWindowCallback->mContext, - controller->mDeviceWithCommissioningWindowOpen, CHIP_NO_ERROR, - controller->mSetupPayload); - } -} - -void DeviceController::OnOpenPairingWindowFailureResponse(void * context, CHIP_ERROR error) -{ - ChipLogError(Controller, "Failed to open pairing window on the device. Status %s", chip::ErrorStr(error)); - DeviceController * controller = static_cast(context); - if (controller->mCommissioningWindowCallback != nullptr) - { - controller->mCommissioningWindowCallback->mCall(controller->mCommissioningWindowCallback->mContext, - controller->mDeviceWithCommissioningWindowOpen, error, SetupPayload()); - } -} - CHIP_ERROR DeviceController::ComputePASEVerifier(uint32_t iterations, uint32_t setupPincode, const ByteSpan & salt, Spake2pVerifier & outVerifier) { @@ -477,115 +405,6 @@ CHIP_ERROR DeviceController::ComputePASEVerifier(uint32_t iterations, uint32_t s return CHIP_NO_ERROR; } -CHIP_ERROR DeviceController::OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint32_t iteration, - uint16_t discriminator, CommissioningWindowOption option, - chip::Callback::Callback * callback, - bool readVIDPIDAttributes) -{ - mSetupPayload = SetupPayload(); - - switch (option) - { - case CommissioningWindowOption::kOriginalSetupCode: - case CommissioningWindowOption::kTokenWithRandomPIN: - break; - case CommissioningWindowOption::kTokenWithProvidedPIN: - mSetupPayload.setUpPINCode = mSuggestedSetUpPINCode; - break; - default: - return CHIP_ERROR_INVALID_ARGUMENT; - } - - mSetupPayload.version = 0; - mSetupPayload.discriminator = discriminator; - mSetupPayload.rendezvousInformation = RendezvousInformationFlags(RendezvousInformationFlag::kOnNetwork); - - mCommissioningWindowOption = option; - mCommissioningWindowCallback = callback; - mDeviceWithCommissioningWindowOpen = deviceId; - mCommissioningWindowTimeout = timeout; - mCommissioningWindowIteration = iteration; - - if (callback != nullptr && mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode && readVIDPIDAttributes) - { - OperationalDeviceProxy * device = - mSystemState->CASESessionMgr()->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); - VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - constexpr EndpointId kBasicClusterEndpoint = 0; - chip::Controller::BasicCluster cluster; - cluster.Associate(device, kBasicClusterEndpoint); - return cluster.ReadAttribute(this, OnVIDReadResponse, - OnVIDPIDReadFailureResponse); - } - - return OpenCommissioningWindowInternal(); -} - -CHIP_ERROR DeviceController::OpenCommissioningWindowInternal() -{ - ChipLogProgress(Controller, "OpenCommissioningWindow for device ID %" PRIu64, mDeviceWithCommissioningWindowOpen); - VerifyOrReturnError(mState == State::Initialized, CHIP_ERROR_INCORRECT_STATE); - - OperationalDeviceProxy * device = mSystemState->CASESessionMgr()->FindExistingSession(GetPeerIdWithCommissioningWindowOpen()); - VerifyOrReturnError(device != nullptr, CHIP_ERROR_INVALID_ARGUMENT); - - constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; - - chip::Controller::AdministratorCommissioningCluster cluster; - cluster.Associate(device, kAdministratorCommissioningClusterEndpoint); - - if (mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode) - { - // TODO: Salt should be provided as an input or it should be randomly generated when - // the PIN is randomly generated. - const char kSpake2pKeyExchangeSalt[] = "SPAKE2P Key Salt"; - ByteSpan salt(Uint8::from_const_char(kSpake2pKeyExchangeSalt), sizeof(kSpake2pKeyExchangeSalt)); - bool randomSetupPIN = (mCommissioningWindowOption == CommissioningWindowOption::kTokenWithRandomPIN); - Spake2pVerifier verifier; - - ReturnErrorOnFailure(PASESession::GeneratePASEVerifier(verifier, mCommissioningWindowIteration, salt, randomSetupPIN, - mSetupPayload.setUpPINCode)); - - chip::Spake2pVerifierSerialized serializedVerifier; - MutableByteSpan serializedVerifierSpan(serializedVerifier); - ReturnErrorOnFailure(verifier.Serialize(serializedVerifierSpan)); - - AdministratorCommissioning::Commands::OpenCommissioningWindow::Type request; - request.commissioningTimeout = mCommissioningWindowTimeout; - request.PAKEVerifier = serializedVerifierSpan; - request.discriminator = mSetupPayload.discriminator; - request.iterations = mCommissioningWindowIteration; - request.salt = salt; - - // TODO: What should the timed invoke timeout here be? - uint16_t timedInvokeTimeoutMs = 10000; - ReturnErrorOnFailure(cluster.InvokeCommand(request, this, OnOpenPairingWindowSuccessResponse, - OnOpenPairingWindowFailureResponse, MakeOptional(timedInvokeTimeoutMs))); - - char payloadBuffer[QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength]; - - MutableCharSpan manualCode(payloadBuffer); - ReturnErrorOnFailure(ManualSetupPayloadGenerator(mSetupPayload).payloadDecimalStringRepresentation(manualCode)); - ChipLogProgress(Controller, "Manual pairing code: [%s]", payloadBuffer); - - MutableCharSpan QRCode(payloadBuffer); - ReturnErrorOnFailure(QRCodeBasicSetupPayloadGenerator(mSetupPayload).payloadBase38Representation(QRCode)); - ChipLogProgress(Controller, "SetupQRCode: [%s]", payloadBuffer); - } - else - { - AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type request; - request.commissioningTimeout = mCommissioningWindowTimeout; - // TODO: What should the timed invoke timeout here be? - uint16_t timedInvokeTimeoutMs = 10000; - ReturnErrorOnFailure(cluster.InvokeCommand(request, this, OnOpenPairingWindowSuccessResponse, - OnOpenPairingWindowFailureResponse, MakeOptional(timedInvokeTimeoutMs))); - } - - return CHIP_NO_ERROR; -} - ControllerDeviceInitParams DeviceController::GetControllerDeviceInitParams() { return ControllerDeviceInitParams{ diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index e4f1b3d888ea5d..c2365bb122fd5e 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -158,8 +158,6 @@ struct CommissionerInitParams : public ControllerInitParams CommissioningDelegate * defaultCommissioner = nullptr; }; -typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload); - /** * @brief * Controller applications can use this class to communicate with already paired CHIP devices. The @@ -174,13 +172,6 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr DeviceController(); ~DeviceController() override {} - enum class CommissioningWindowOption : uint8_t - { - kOriginalSetupCode = 0, - kTokenWithRandomPIN, - kTokenWithProvidedPIN, - }; - CHIP_ERROR Init(ControllerInitParams params); /** @@ -240,62 +231,6 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr CHIP_ERROR ComputePASEVerifier(uint32_t iterations, uint32_t setupPincode, const ByteSpan & salt, Spake2pVerifier & outVerifier); - /** - * @brief - * Trigger a paired device to re-enter the commissioning mode. The device will exit the commissioning mode - * after a successful commissioning, or after the given `timeout` time. - * - * @param[in] deviceId The device Id. - * @param[in] timeout The commissioning mode should terminate after this much time. - * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral - * PAKE passcode verifier to be used for this commissioning. - * @param[in] discriminator The long discriminator for the DNS-SD advertisement. - * @param[in] option The commissioning window can be opened using the original setup code, or an - * onboarding token can be generated using a random setup PIN code (or with - * the PIN code provied in the setupPayload). - * @param[in,out] payload The generated setup payload. - * - The payload is generated only if the user didn't ask for using the original setup code. - * - If the user asked to use the provided setup PIN, the PIN must be provided as part of - * this payload - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR OpenCommissioningWindow(NodeId deviceId, uint16_t timeout, uint32_t iteration, uint16_t discriminator, - CommissioningWindowOption option, SetupPayload & payload) - { - mSuggestedSetUpPINCode = payload.setUpPINCode; - ReturnErrorOnFailure(OpenCommissioningWindowWithCallback(deviceId, timeout, iteration, discriminator, option, nullptr)); - payload = mSetupPayload; - return CHIP_NO_ERROR; - } - - /** - * @brief - * Trigger a paired device to re-enter the commissioning mode. The device will exit the commissioning mode - * after a successful commissioning, or after the given `timeout` time. - * - * @param[in] deviceId The device Id. - * @param[in] timeout The commissioning mode should terminate after this much time. - * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral - * PAKE passcode verifier to be used for this commissioning. - * @param[in] discriminator The long discriminator for the DNS-SD advertisement. - * @param[in] option The commissioning window can be opened using the original setup code, or an - * onboarding token can be generated using a random setup PIN code (or with - * the PIN code provied in the setupPayload). - * @param[in] callback The function to be called on success or failure of opening of commissioning window. - * - * @param[in] readVIDPIDAttributes Should the API internally read VID and PID from the device while opening the - * commissioning window. VID and PID is only needed for enchanced commissioning mode. - * If this argument is `true`, and enhanced commissioning mode is used, the API will - * read VID and PID from the device. - * - * @return CHIP_ERROR CHIP_NO_ERROR on success, or corresponding error - */ - CHIP_ERROR OpenCommissioningWindowWithCallback(NodeId deviceId, uint16_t timeout, uint32_t iteration, uint16_t discriminator, - CommissioningWindowOption option, - Callback::Callback * callback, - bool readVIDPIDAttributes = false); - void RegisterDeviceDiscoveryDelegate(DeviceDiscoveryDelegate * delegate) { mDeviceDiscoveryDelegate = delegate; } /** @@ -384,31 +319,6 @@ class DLL_EXPORT DeviceController : public SessionRecoveryDelegate, public Abstr private: void ReleaseOperationalDevice(OperationalDeviceProxy * device); - static void OnPIDReadResponse(void * context, uint16_t value); - static void OnVIDReadResponse(void * context, VendorId value); - static void OnVIDPIDReadFailureResponse(void * context, CHIP_ERROR error); - - CHIP_ERROR OpenCommissioningWindowInternal(); - - PeerId GetPeerIdWithCommissioningWindowOpen() - { - return mFabricInfo ? mFabricInfo->GetPeerIdForNode(mDeviceWithCommissioningWindowOpen) : PeerId(); - } - - // TODO - Support opening commissioning window simultaneously on multiple devices - Callback::Callback * mCommissioningWindowCallback = nullptr; - SetupPayload mSetupPayload; - NodeId mDeviceWithCommissioningWindowOpen; - uint32_t mSuggestedSetUpPINCode = 0; - - uint16_t mCommissioningWindowTimeout; - uint32_t mCommissioningWindowIteration; - - CommissioningWindowOption mCommissioningWindowOption; - - static void OnOpenPairingWindowSuccessResponse(void * context, const chip::app::DataModel::NullObjectType &); - static void OnOpenPairingWindowFailureResponse(void * context, CHIP_ERROR error); - CHIP_ERROR ProcessControllerNOCChain(const ControllerInitParams & params); }; diff --git a/src/controller/CommissioningWindowOpener.cpp b/src/controller/CommissioningWindowOpener.cpp new file mode 100644 index 00000000000000..977c44ffc74245 --- /dev/null +++ b/src/controller/CommissioningWindowOpener.cpp @@ -0,0 +1,350 @@ +/* + * Copyright (c) 2022 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 +#include +#include + +using namespace chip::app::Clusters; +using namespace chip::System::Clock; + +namespace { +// TODO: What should the timed invoke timeout here be? +constexpr uint16_t kTimedInvokeTimeoutMs = 10000; +} // anonymous namespace + +namespace chip { +namespace Controller { + +CHIP_ERROR CommissioningWindowOpener::OpenBasicCommissioningWindow(NodeId deviceId, Seconds16 timeout, + Callback::Callback * callback) +{ + VerifyOrReturnError(mNextStep == Step::kAcceptCommissioningStart, CHIP_ERROR_INCORRECT_STATE); + mSetupPayload = SetupPayload(); + + // Basic commissioning does not use the setup payload. + + mCommissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode; + mBasicCommissioningWindowCallback = callback; + mCommissioningWindowCallback = nullptr; + mNodeId = deviceId; + mCommissioningWindowTimeout = timeout; + + mNextStep = Step::kOpenCommissioningWindow; + return mController->GetConnectedDevice(mNodeId, &mDeviceConnected, &mDeviceConnectionFailure); +} + +CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindow(NodeId deviceId, Seconds16 timeout, uint32_t iteration, + uint16_t discriminator, Optional setupPIN, + Callback::Callback * callback, + SetupPayload & payload, bool readVIDPIDAttributes) +{ + VerifyOrReturnError(mNextStep == Step::kAcceptCommissioningStart, CHIP_ERROR_INCORRECT_STATE); + + mSetupPayload = SetupPayload(); + + if (setupPIN.HasValue()) + { + mCommissioningWindowOption = CommissioningWindowOption::kTokenWithProvidedPIN; + mSetupPayload.setUpPINCode = setupPIN.Value(); + } + else + { + mCommissioningWindowOption = CommissioningWindowOption::kTokenWithRandomPIN; + } + + mSetupPayload.version = 0; + mSetupPayload.discriminator = discriminator; + mSetupPayload.rendezvousInformation = RendezvousInformationFlags(RendezvousInformationFlag::kOnNetwork); + + mCommissioningWindowCallback = callback; + mBasicCommissioningWindowCallback = nullptr; + mNodeId = deviceId; + mCommissioningWindowTimeout = timeout; + mCommissioningWindowIteration = iteration; + + bool randomSetupPIN = !setupPIN.HasValue(); + ReturnErrorOnFailure(PASESession::GeneratePASEVerifier(mVerifier, mCommissioningWindowIteration, GetSPAKE2Salt(), + randomSetupPIN, mSetupPayload.setUpPINCode)); + + payload = mSetupPayload; + + if (readVIDPIDAttributes) + { + mNextStep = Step::kReadVID; + } + else + { + mNextStep = Step::kOpenCommissioningWindow; + } + + return mController->GetConnectedDevice(mNodeId, &mDeviceConnected, &mDeviceConnectionFailure); +} + +CHIP_ERROR CommissioningWindowOpener::OpenCommissioningWindowInternal(OperationalDeviceProxy * device) +{ + ChipLogProgress(Controller, "OpenCommissioningWindow for device ID %" PRIu64, mNodeId); + + constexpr EndpointId kAdministratorCommissioningClusterEndpoint = 0; + + AdministratorCommissioningCluster cluster; + cluster.Associate(device, kAdministratorCommissioningClusterEndpoint); + + if (mCommissioningWindowOption != CommissioningWindowOption::kOriginalSetupCode) + { + chip::Spake2pVerifierSerialized serializedVerifier; + MutableByteSpan serializedVerifierSpan(serializedVerifier); + ReturnErrorOnFailure(mVerifier.Serialize(serializedVerifierSpan)); + + AdministratorCommissioning::Commands::OpenCommissioningWindow::Type request; + request.commissioningTimeout = mCommissioningWindowTimeout.count(); + request.PAKEVerifier = serializedVerifierSpan; + request.discriminator = mSetupPayload.discriminator; + request.iterations = mCommissioningWindowIteration; + request.salt = GetSPAKE2Salt(); + + ReturnErrorOnFailure(cluster.InvokeCommand(request, this, OnOpenCommissioningWindowSuccess, + OnOpenCommissioningWindowFailure, MakeOptional(kTimedInvokeTimeoutMs))); + + char payloadBuffer[QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength]; + + MutableCharSpan manualCode(payloadBuffer); + ReturnErrorOnFailure(ManualSetupPayloadGenerator(mSetupPayload).payloadDecimalStringRepresentation(manualCode)); + ChipLogProgress(Controller, "Manual pairing code: [%s]", payloadBuffer); + + MutableCharSpan QRCode(payloadBuffer); + ReturnErrorOnFailure(QRCodeBasicSetupPayloadGenerator(mSetupPayload).payloadBase38Representation(QRCode)); + ChipLogProgress(Controller, "SetupQRCode: [%s]", payloadBuffer); + } + else + { + AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type request; + request.commissioningTimeout = mCommissioningWindowTimeout.count(); + ReturnErrorOnFailure(cluster.InvokeCommand(request, this, OnOpenCommissioningWindowSuccess, + OnOpenCommissioningWindowFailure, MakeOptional(kTimedInvokeTimeoutMs))); + } + + return CHIP_NO_ERROR; +} + +void CommissioningWindowOpener::OnPIDReadResponse(void * context, uint16_t value) +{ + ChipLogProgress(Controller, "Received PID for the device. Value %d", value); + auto * self = static_cast(context); + self->mSetupPayload.productID = value; + + self->mNextStep = Step::kOpenCommissioningWindow; + + CHIP_ERROR err = self->mController->GetConnectedDevice(self->mNodeId, &self->mDeviceConnected, &self->mDeviceConnectionFailure); + if (err != CHIP_NO_ERROR) + { + OnOpenCommissioningWindowFailure(context, err); + } +} + +void CommissioningWindowOpener::OnVIDReadResponse(void * context, VendorId value) +{ + ChipLogProgress(Controller, "Received VID for the device. Value %d", to_underlying(value)); + + auto * self = static_cast(context); + + self->mSetupPayload.vendorID = value; + + self->mNextStep = Step::kReadPID; + CHIP_ERROR err = self->mController->GetConnectedDevice(self->mNodeId, &self->mDeviceConnected, &self->mDeviceConnectionFailure); + if (err != CHIP_NO_ERROR) + { + OnOpenCommissioningWindowFailure(context, err); + } +} + +void CommissioningWindowOpener::OnVIDPIDReadFailureResponse(void * context, CHIP_ERROR error) +{ + ChipLogProgress(Controller, "Failed to read VID/PID for the device. error %" CHIP_ERROR_FORMAT, error.Format()); + OnOpenCommissioningWindowFailure(context, error); +} + +void CommissioningWindowOpener::OnOpenCommissioningWindowSuccess(void * context, const chip::app::DataModel::NullObjectType &) +{ + ChipLogProgress(Controller, "Successfully opened pairing window on the device"); + auto * self = static_cast(context); + self->mNextStep = Step::kAcceptCommissioningStart; + if (self->mCommissioningWindowCallback != nullptr) + { + self->mCommissioningWindowCallback->mCall(self->mCommissioningWindowCallback->mContext, self->mNodeId, CHIP_NO_ERROR, + self->mSetupPayload); + } + else if (self->mBasicCommissioningWindowCallback != nullptr) + { + self->mBasicCommissioningWindowCallback->mCall(self->mBasicCommissioningWindowCallback->mContext, self->mNodeId, + CHIP_NO_ERROR); + } +} + +void CommissioningWindowOpener::OnOpenCommissioningWindowFailure(void * context, CHIP_ERROR error) +{ + ChipLogError(Controller, "Failed to open pairing window on the device. Status %" CHIP_ERROR_FORMAT, error.Format()); + auto * self = static_cast(context); + self->mNextStep = Step::kAcceptCommissioningStart; + if (self->mCommissioningWindowCallback != nullptr) + { + self->mCommissioningWindowCallback->mCall(self->mCommissioningWindowCallback->mContext, self->mNodeId, error, + SetupPayload()); + } + else if (self->mBasicCommissioningWindowCallback != nullptr) + { + self->mBasicCommissioningWindowCallback->mCall(self->mBasicCommissioningWindowCallback->mContext, self->mNodeId, error); + } +} + +void CommissioningWindowOpener::OnDeviceConnectedCallback(void * context, OperationalDeviceProxy * device) +{ + auto * self = static_cast(context); + +#if CHIP_ERROR_LOGGING + const char * messageIfError = nullptr; +#endif // CHIP_ERROR_LOGGING + CHIP_ERROR err = CHIP_NO_ERROR; + + switch (self->mNextStep) + { + case Step::kReadVID: { + constexpr EndpointId kBasicClusterEndpoint = 0; + BasicCluster cluster; + cluster.Associate(device, kBasicClusterEndpoint); + err = cluster.ReadAttribute(context, OnVIDReadResponse, + OnVIDPIDReadFailureResponse); +#if CHIP_ERROR_LOGGING + messageIfError = "Could not read VID for opening commissioning window"; +#endif // CHIP_ERROR_LOGGING + break; + } + case Step::kReadPID: { + constexpr EndpointId kBasicClusterEndpoint = 0; + chip::Controller::BasicCluster cluster; + cluster.Associate(device, kBasicClusterEndpoint); + err = cluster.ReadAttribute(context, OnPIDReadResponse, + OnVIDPIDReadFailureResponse); +#if CHIP_ERROR_LOGGING + messageIfError = "Could not read PID for opening commissioning window"; +#endif // CHIP_ERROR_LOGGING + break; + } + case Step::kOpenCommissioningWindow: { + err = self->OpenCommissioningWindowInternal(device); +#if CHIP_ERROR_LOGGING + messageIfError = "Could not connect to open commissioning window"; +#endif // CHIP_ERROR_LOGGING + break; + } + case Step::kAcceptCommissioningStart: { + err = CHIP_ERROR_INCORRECT_STATE; +#if CHIP_ERROR_LOGGING + messageIfError = "Just got a connected device; how can we be done?"; +#endif // CHIP_ERROR_LOGGING + break; + } + } + + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "%s: %" CHIP_ERROR_FORMAT, messageIfError, err.Format()); + OnOpenCommissioningWindowFailure(context, err); + } +} + +void CommissioningWindowOpener::OnDeviceConnectionFailureCallback(void * context, PeerId peerId, CHIP_ERROR error) +{ + OnOpenCommissioningWindowFailure(context, error); +} + +namespace { +constexpr char kSpake2pKeyExchangeSalt[] = "SPAKE2P Key Salt"; +} // anonymous namespace + +ByteSpan CommissioningWindowOpener::GetSPAKE2Salt() +{ + return ByteSpan(Uint8::from_const_char(kSpake2pKeyExchangeSalt), sizeof(kSpake2pKeyExchangeSalt) - 1); +} + +AutoCommissioningWindowOpener::AutoCommissioningWindowOpener(DeviceController * controller) : + CommissioningWindowOpener(controller), mOnOpenCommissioningWindowCallback(OnOpenCommissioningWindowResponse, this), + mOnOpenBasicCommissioningWindowCallback(OnOpenBasicCommissioningWindowResponse, this) +{} + +CHIP_ERROR AutoCommissioningWindowOpener::OpenBasicCommissioningWindow(DeviceController * controller, NodeId deviceId, + Seconds16 timeout) +{ + // Not using Platform::New because we want to keep our constructor private. + auto * opener = new AutoCommissioningWindowOpener(controller); + if (opener == nullptr) + { + return CHIP_ERROR_NO_MEMORY; + } + + CHIP_ERROR err = opener->CommissioningWindowOpener::OpenBasicCommissioningWindow( + deviceId, timeout, &opener->mOnOpenBasicCommissioningWindowCallback); + if (err != CHIP_NO_ERROR) + { + delete opener; + } + // Else will clean up when the callback is called. + return err; +} + +CHIP_ERROR AutoCommissioningWindowOpener::OpenCommissioningWindow(DeviceController * controller, NodeId deviceId, Seconds16 timeout, + uint32_t iteration, uint16_t discriminator, + Optional setupPIN, SetupPayload & payload, + bool readVIDPIDAttributes) +{ + // Not using Platform::New because we want to keep our constructor private. + auto * opener = new AutoCommissioningWindowOpener(controller); + if (opener == nullptr) + { + return CHIP_ERROR_NO_MEMORY; + } + + CHIP_ERROR err = opener->CommissioningWindowOpener::OpenCommissioningWindow( + deviceId, timeout, iteration, discriminator, setupPIN, &opener->mOnOpenCommissioningWindowCallback, payload, + readVIDPIDAttributes); + if (err != CHIP_NO_ERROR) + { + delete opener; + } + // Else will clean up when the callback is called. + return err; +} + +void AutoCommissioningWindowOpener::OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, + chip::SetupPayload payload) +{ + auto * self = static_cast(context); + delete self; +} +void AutoCommissioningWindowOpener::OnOpenBasicCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status) +{ + auto * self = static_cast(context); + delete self; +} + +} // namespace Controller +} // namespace chip diff --git a/src/controller/CommissioningWindowOpener.h b/src/controller/CommissioningWindowOpener.h new file mode 100644 index 00000000000000..d3bc789d35c06f --- /dev/null +++ b/src/controller/CommissioningWindowOpener.h @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2022 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 +#include +#include +#include +#include +#include +#include +#include + +namespace chip { +namespace Controller { + +// Passing SetupPayload by value on purpose, in case a consumer decides to reuse +// this object from inside the callback. +typedef void (*OnOpenCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status, SetupPayload payload); +typedef void (*OnOpenBasicCommissioningWindow)(void * context, NodeId deviceId, CHIP_ERROR status); + +/** + * A helper class to open a commissioning window given some parameters. + */ +class CommissioningWindowOpener +{ +public: + CommissioningWindowOpener(DeviceController * controller) : + mController(controller), mDeviceConnected(&OnDeviceConnectedCallback, this), + mDeviceConnectionFailure(&OnDeviceConnectionFailureCallback, this) + {} + + enum class CommissioningWindowOption : uint8_t + { + kOriginalSetupCode = 0, + kTokenWithRandomPIN, + kTokenWithProvidedPIN, + }; + + /* + * @brief + * Try to look up the device attached to our controller with the given + * node id and ask it to re-enter commissioning mode with its original + * PASE verifier, discriminator, etc. The device will exit commissioning + * mode after a successful commissioning, or after the given `timeout` + * time. + * + * @param[in] deviceId The device Id. + * @param[in] timeout The commissioning mode should terminate after this much time. + * @param[in] callback The callback to call once the commissioning window is + * open or if an error occurs. + */ + CHIP_ERROR OpenBasicCommissioningWindow(NodeId deviceId, System::Clock::Seconds16 timeout, + Callback::Callback * callback); + + /** + * @brief + * Try to look up the device attached to our controller with the given + * node id and ask it to re-enter commissioning mode with a PASE verifier + * derived from the given information and the given discriminator. The + * device will exit commissioning mode after a successful commissioning, + * or after the given `timeout` time. + * + * @param[in] deviceId The device Id. + * @param[in] timeout The commissioning mode should terminate after this much time. + * @param[in] iteration The PAKE iteration count associated with the PAKE Passcode ID and ephemeral + * PAKE passcode verifier to be used for this commissioning. + * @param[in] discriminator The long discriminator for the DNS-SD advertisement. + * @param[in] setupPIN The setup PIN to use, or NullOptional to use a randomly-generated one. + * @param[in] callback The function to be called on success or failure of opening of commissioning window. + * @param[out] payload The setup payload, not including the VID/PID bits, + * even if those were asked for, that is generated + * based on the passed-in information. The payload + * provided to the callback function, unlike this + * out parameter, will include the VID/PID bits if + * readVIDPIDAttributes is true. + * + * @param[in] readVIDPIDAttributes Should the API internally read VID and PID from the device while opening the + * commissioning window. If this argument is `true`, the API will read VID and + * PID from the device and include them in the setup payload passed to the + * callback. + */ + CHIP_ERROR OpenCommissioningWindow(NodeId deviceId, System::Clock::Seconds16 timeout, uint32_t iteration, + uint16_t discriminator, Optional setupPIN, + Callback::Callback * callback, SetupPayload & payload, + bool readVIDPIDAttributes = false); + +private: + enum class Step : uint8_t + { + // Ready to start opening a commissioning window. + kAcceptCommissioningStart, + // Need to read VID. + kReadVID, + // Need to read PID. + kReadPID, + // Need to open commissioning window. + kOpenCommissioningWindow, + }; + + CHIP_ERROR OpenCommissioningWindowInternal(OperationalDeviceProxy * device); + static void OnPIDReadResponse(void * context, uint16_t value); + static void OnVIDReadResponse(void * context, VendorId value); + static void OnVIDPIDReadFailureResponse(void * context, CHIP_ERROR error); + static void OnOpenCommissioningWindowSuccess(void * context, const app::DataModel::NullObjectType &); + static void OnOpenCommissioningWindowFailure(void * context, CHIP_ERROR error); + static void OnDeviceConnectedCallback(void * context, OperationalDeviceProxy * device); + static void OnDeviceConnectionFailureCallback(void * context, PeerId peerId, CHIP_ERROR error); + + // TODO: Salt should be provided as an input or it should be randomly generated when + // the PIN is randomly generated. + static ByteSpan GetSPAKE2Salt(); + + DeviceController * const mController = nullptr; + Step mNextStep = Step::kAcceptCommissioningStart; + + Callback::Callback * mCommissioningWindowCallback = nullptr; + Callback::Callback * mBasicCommissioningWindowCallback = nullptr; + SetupPayload mSetupPayload; + NodeId mNodeId = kUndefinedNodeId; + System::Clock::Seconds16 mCommissioningWindowTimeout = System::Clock::kZero; + uint32_t mCommissioningWindowIteration = 0; + CommissioningWindowOption mCommissioningWindowOption = CommissioningWindowOption::kOriginalSetupCode; + Spake2pVerifier mVerifier; // Used for non-basic commissioning. + + Callback::Callback mDeviceConnected; + Callback::Callback mDeviceConnectionFailure; +}; + +/** + * A helper class that can be used by consumers that don't care about the callback from the + * open-commissioning-window process and just want automatic cleanup of the CommissioningWindowOpener when done + * with it. + */ +class AutoCommissioningWindowOpener : private CommissioningWindowOpener +{ +public: + // Takes the same arguments as CommissioningWindowOpener::OpenBasicCommissioningWindow except without the + // callback. + static CHIP_ERROR OpenBasicCommissioningWindow(DeviceController * controller, NodeId deviceId, + System::Clock::Seconds16 timeout); + // Takes the same arguments as CommissioningWindowOpener::OpenCommissioningWindow except without the + // callback. + static CHIP_ERROR OpenCommissioningWindow(DeviceController * controller, NodeId deviceId, System::Clock::Seconds16 timeout, + uint32_t iteration, uint16_t discriminator, Optional setupPIN, + SetupPayload & payload, bool readVIDPIDAttributes = false); + +private: + AutoCommissioningWindowOpener(DeviceController * controller); + + static void OnOpenCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status, chip::SetupPayload payload); + static void OnOpenBasicCommissioningWindowResponse(void * context, NodeId deviceId, CHIP_ERROR status); + + chip::Callback::Callback mOnOpenCommissioningWindowCallback; + chip::Callback::Callback mOnOpenBasicCommissioningWindowCallback; +}; + +} // Namespace Controller +} // namespace chip diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index f4456bd11c888d..b4338f067e5b66 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -47,6 +48,7 @@ #include #include #include +#include #include #include @@ -584,7 +586,6 @@ JNI_METHOD(jboolean, openPairingWindow)(JNIEnv * env, jobject self, jlong handle { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; - chip::SetupPayload setupPayload; DeviceProxy * chipDevice = reinterpret_cast(devicePtr); if (chipDevice == nullptr) @@ -593,10 +594,10 @@ JNI_METHOD(jboolean, openPairingWindow)(JNIEnv * env, jobject self, jlong handle return false; } - AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); - DeviceController::CommissioningWindowOption option = DeviceController::CommissioningWindowOption::kOriginalSetupCode; + AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); - err = wrapper->Controller()->OpenCommissioningWindow(chipDevice->GetDeviceId(), duration, 0, 0, option, setupPayload); + err = AutoCommissioningWindowOpener::OpenBasicCommissioningWindow(wrapper->Controller(), chipDevice->GetDeviceId(), + System::Clock::Seconds16(duration)); if (err != CHIP_NO_ERROR) { @@ -612,9 +613,6 @@ JNI_METHOD(jboolean, openPairingWindowWithPIN) { chip::DeviceLayer::StackLock lock; CHIP_ERROR err = CHIP_NO_ERROR; - chip::SetupPayload setupPayload; - setupPayload.discriminator = discriminator; - setupPayload.setUpPINCode = setupPinCode; DeviceProxy * chipDevice = reinterpret_cast(devicePtr); if (chipDevice == nullptr) @@ -623,11 +621,12 @@ JNI_METHOD(jboolean, openPairingWindowWithPIN) return false; } - AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); - DeviceController::CommissioningWindowOption option = DeviceController::CommissioningWindowOption::kTokenWithProvidedPIN; + AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); - err = wrapper->Controller()->OpenCommissioningWindow(chipDevice->GetDeviceId(), duration, iteration, discriminator, option, - setupPayload); + chip::SetupPayload setupPayload; + err = AutoCommissioningWindowOpener::OpenCommissioningWindow(wrapper->Controller(), chipDevice->GetDeviceId(), + System::Clock::Seconds16(duration), iteration, discriminator, + MakeOptional(static_cast(setupPinCode)), setupPayload); if (err != CHIP_NO_ERROR) { diff --git a/src/controller/python/ChipDeviceController-ScriptBinding.cpp b/src/controller/python/ChipDeviceController-ScriptBinding.cpp index 04276868b47abb..482a062e924f34 100644 --- a/src/controller/python/ChipDeviceController-ScriptBinding.cpp +++ b/src/controller/python/ChipDeviceController-ScriptBinding.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,7 @@ #include #include #include +#include using namespace chip; using namespace chip::Ble; @@ -412,10 +414,23 @@ ChipError::StorageType pychip_DeviceController_OpenCommissioningWindow(chip::Con chip::NodeId nodeid, uint16_t timeout, uint32_t iteration, uint16_t discriminator, uint8_t optionInt) { - SetupPayload payload; - const auto option = static_cast(optionInt); + const auto option = static_cast(optionInt); + if (option == Controller::CommissioningWindowOpener::CommissioningWindowOption::kOriginalSetupCode) + { + return Controller::AutoCommissioningWindowOpener::OpenBasicCommissioningWindow(devCtrl, nodeid, + System::Clock::Seconds16(timeout)) + .AsInteger(); + } + + if (option == Controller::CommissioningWindowOpener::CommissioningWindowOption::kTokenWithRandomPIN) + { + SetupPayload payload; + return Controller::AutoCommissioningWindowOpener::OpenCommissioningWindow( + devCtrl, nodeid, System::Clock::Seconds16(timeout), iteration, discriminator, NullOptional, payload) + .AsInteger(); + } - return devCtrl->OpenCommissioningWindow(nodeid, timeout, iteration, discriminator, option, payload).AsInteger(); + return CHIP_ERROR_INVALID_ARGUMENT.AsInteger(); } void pychip_DeviceController_PrintDiscoveredDevices(chip::Controller::DeviceCommissioner * devCtrl) diff --git a/src/darwin/Framework/CHIP/CHIPDeviceController.mm b/src/darwin/Framework/CHIP/CHIPDeviceController.mm index b11abb160d61b3..cd15f0bf622c11 100644 --- a/src/darwin/Framework/CHIP/CHIPDeviceController.mm +++ b/src/darwin/Framework/CHIP/CHIPDeviceController.mm @@ -37,11 +37,13 @@ #include #include +#include #include #include #include #include #include +#include static const char * const CHIP_COMMISSIONER_DEVICE_ID_KEY = "com.zigbee.chip.commissioner.device_id"; @@ -482,9 +484,8 @@ - (BOOL)openPairingWindow:(uint64_t)deviceID duration:(NSUInteger)duration error return NO; } - chip::SetupPayload setupPayload; - err = self.cppCommissioner->OpenCommissioningWindow(deviceID, (uint16_t) duration, 0, 0, - chip::Controller::DeviceController::CommissioningWindowOption::kOriginalSetupCode, setupPayload); + err = chip::Controller::AutoCommissioningWindowOpener::OpenBasicCommissioningWindow( + self.cppCommissioner, deviceID, chip::System::Clock::Seconds16(static_cast(duration))); if (err != CHIP_NO_ERROR) { CHIP_LOG_ERROR("Error(%s): Open Pairing Window failed", chip::ErrorStr(err)); @@ -505,8 +506,6 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID { CHIP_ERROR err = CHIP_NO_ERROR; - chip::SetupPayload setupPayload; - if (duration > UINT16_MAX) { CHIP_LOG_ERROR("Error: Duration %tu is too large. Max value %d", duration, UINT16_MAX); if (error) { @@ -521,15 +520,14 @@ - (NSString *)openPairingWindowWithPIN:(uint64_t)deviceID *error = [CHIPError errorForCHIPErrorCode:CHIP_ERROR_INVALID_INTEGER_VALUE]; } return nil; - } else { - setupPayload.discriminator = (uint16_t) discriminator; } setupPIN &= ((1 << chip::kSetupPINCodeFieldLengthInBits) - 1); - setupPayload.setUpPINCode = (uint32_t) setupPIN; - err = self.cppCommissioner->OpenCommissioningWindow(deviceID, (uint16_t) duration, 1000, (uint16_t) discriminator, - chip::Controller::DeviceController::CommissioningWindowOption::kTokenWithProvidedPIN, setupPayload); + chip::SetupPayload setupPayload; + err = chip::Controller::AutoCommissioningWindowOpener::OpenCommissioningWindow(self.cppCommissioner, deviceID, + chip::System::Clock::Seconds16(static_cast(duration)), chip::Crypto::kSpake2p_Min_PBKDF_Iterations, + static_cast(discriminator), chip::MakeOptional(static_cast(setupPIN)), setupPayload); if (err != CHIP_NO_ERROR) { CHIP_LOG_ERROR("Error(%s): Open Pairing Window failed", chip::ErrorStr(err)); From 8de5e9adb7a2b824567b4d766daee01477a2145f Mon Sep 17 00:00:00 2001 From: Carol Yang Date: Thu, 24 Mar 2022 13:27:56 -0700 Subject: [PATCH 57/70] [OTA] Respond with a valid query image response in subsequent requests (#16598) --- examples/ota-provider-app/esp32/main/main.cpp | 15 +- examples/ota-provider-app/linux/main.cpp | 34 +-- .../OTAProviderExample.cpp | 213 ++++++++---------- .../ota-provider-common/OTAProviderExample.h | 38 ++-- 4 files changed, 149 insertions(+), 151 deletions(-) diff --git a/examples/ota-provider-app/esp32/main/main.cpp b/examples/ota-provider-app/esp32/main/main.cpp index 546df355fa285c..fad067f2c9b0ca 100644 --- a/examples/ota-provider-app/esp32/main/main.cpp +++ b/examples/ota-provider-app/esp32/main/main.cpp @@ -36,12 +36,13 @@ #include using chip::Callback::Callback; -using namespace ::chip; -using namespace ::chip::Shell; -using namespace ::chip::System; -using namespace ::chip::Credentials; -using namespace ::chip::DeviceManager; -using namespace ::chip::DeviceLayer; +using namespace chip; +using namespace chip::Shell; +using namespace chip::System; +using namespace chip::Credentials; +using namespace chip::DeviceManager; +using namespace chip::DeviceLayer; +using namespace chip::app::Clusters::OtaSoftwareUpdateProvider; CHIP_ERROR OnBlockQuery(void * context, chip::System::PacketBufferHandle & blockBuf, size_t & size, bool & isEof, uint32_t offset); void OnTransferComplete(void * context); @@ -124,7 +125,7 @@ static void InitServer(intptr_t context) ESP_LOGI(TAG, "The OTA image size: %d", otaImageLen); if (otaImageLen > 0) { - otaProvider.SetQueryImageBehavior(OTAProviderExample::kRespondWithUpdateAvailable); + otaProvider.SetQueryImageStatus(OTAQueryStatus::kUpdateAvailable); otaProvider.SetOTAFilePath(otaFilename); } diff --git a/examples/ota-provider-app/linux/main.cpp b/examples/ota-provider-app/linux/main.cpp index bc7076da265a1a..47643487cdc31f 100644 --- a/examples/ota-provider-app/linux/main.cpp +++ b/examples/ota-provider-app/linux/main.cpp @@ -58,16 +58,16 @@ OTAProviderExample gOtaProvider; chip::ota::DefaultUserConsentProvider gUserConsentProvider; // Global variables used for passing the CLI arguments to the OTAProviderExample object -static OTAProviderExample::QueryImageBehaviorType gQueryImageBehavior = OTAProviderExample::kRespondWithUnknown; -static OTAApplyUpdateAction gOptionUpdateAction = OTAApplyUpdateAction::kProceed; -static uint32_t gDelayedQueryActionTimeSec = 0; -static uint32_t gDelayedApplyActionTimeSec = 0; -static const char * gOtaFilepath = nullptr; -static const char * gOtaImageListFilepath = nullptr; -static chip::ota::UserConsentState gUserConsentState = chip::ota::UserConsentState::kUnknown; -static bool gUserConsentNeeded = false; -static uint32_t gIgnoreQueryImageCount = 0; -static uint32_t gIgnoreApplyUpdateCount = 0; +static OTAQueryStatus gQueryImageStatus = OTAQueryStatus::kUpdateAvailable; +static OTAApplyUpdateAction gOptionUpdateAction = OTAApplyUpdateAction::kProceed; +static uint32_t gDelayedQueryActionTimeSec = 0; +static uint32_t gDelayedApplyActionTimeSec = 0; +static const char * gOtaFilepath = nullptr; +static const char * gOtaImageListFilepath = nullptr; +static chip::ota::UserConsentState gUserConsentState = chip::ota::UserConsentState::kUnknown; +static bool gUserConsentNeeded = false; +static uint32_t gIgnoreQueryImageCount = 0; +static uint32_t gIgnoreApplyUpdateCount = 0; // Parses the JSON filepath and extracts DeviceSoftwareVersionModel parameters static bool ParseJsonFileAndPopulateCandidates(const char * filepath, @@ -172,15 +172,15 @@ bool HandleOptions(const char * aProgram, OptionSet * aOptions, int aIdentifier, } else if (strcmp(aValue, "updateAvailable") == 0) { - gQueryImageBehavior = OTAProviderExample::kRespondWithUpdateAvailable; + gQueryImageStatus = OTAQueryStatus::kUpdateAvailable; } else if (strcmp(aValue, "busy") == 0) { - gQueryImageBehavior = OTAProviderExample::kRespondWithBusy; + gQueryImageStatus = OTAQueryStatus::kBusy; } else if (strcmp(aValue, "updateNotAvailable") == 0) { - gQueryImageBehavior = OTAProviderExample::kRespondWithNotAvailable; + gQueryImageStatus = OTAQueryStatus::kNotAvailable; } else { @@ -330,9 +330,9 @@ void ApplicationInit() gOtaProvider.SetOTAFilePath(gOtaFilepath); } - gOtaProvider.SetQueryImageBehavior(gQueryImageBehavior); gOtaProvider.SetIgnoreQueryImageCount(gIgnoreQueryImageCount); gOtaProvider.SetIgnoreApplyUpdateCount(gIgnoreApplyUpdateCount); + gOtaProvider.SetQueryImageStatus(gQueryImageStatus); gOtaProvider.SetApplyUpdateAction(gOptionUpdateAction); gOtaProvider.SetDelayedQueryActionTimeSec(gDelayedQueryActionTimeSec); gOtaProvider.SetDelayedApplyActionTimeSec(gDelayedApplyActionTimeSec); @@ -358,6 +358,12 @@ void ApplicationInit() gOtaProvider.SetOTACandidates(candidates); } + if ((gOtaFilepath == nullptr) && (gOtaImageListFilepath == nullptr)) + { + ChipLogError(SoftwareUpdate, "Either an OTA file or image list file must be specified"); + chipDie(); + } + chip::app::Clusters::OTAProvider::SetDelegate(kOtaProviderEndpoint, &gOtaProvider); } diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp index e583fe0ad4de84..c3f1e2754e2b61 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.cpp @@ -80,9 +80,14 @@ void GenerateUpdateToken(uint8_t * buf, size_t bufSize) OTAProviderExample::OTAProviderExample() { memset(mOTAFilePath, 0, kFilepathBufLen); - mQueryImageBehavior = kRespondWithNotAvailable; + mIgnoreQueryImageCount = 0; + mIgnoreApplyUpdateCount = 0; + mQueryImageStatus = OTAQueryStatus::kNotAvailable; + mUpdateAction = OTAApplyUpdateAction::kDiscontinue; mDelayedQueryActionTimeSec = 0; mDelayedApplyActionTimeSec = 0; + mUserConsentDelegate = nullptr; + mUserConsentNeeded = false; mCandidates.clear(); } @@ -210,107 +215,22 @@ bool OTAProviderExample::ParseOTAHeader(const char * otaFilePath, OTAImageHeader return true; } -EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * commandObj, - const chip::app::ConcreteCommandPath & commandPath, - const QueryImage::DecodableType & commandData) +CHIP_ERROR OTAProviderExample::SendQueryImageResponse(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, + const QueryImage::DecodableType & commandData) { - OTAQueryStatus queryStatus = OTAQueryStatus::kNotAvailable; - OTAProviderExample::DeviceSoftwareVersionModel candidate; - uint32_t newSoftwareVersion = 0; - char newSoftwareVersionString[SW_VER_STR_MAX_LEN] = { 0 }; - const char * otaFilePath = mOTAFilePath; - uint8_t updateToken[kUpdateTokenLen] = { 0 }; - char strBuf[kUpdateTokenStrLen] = { 0 }; - char uriBuf[kUriMaxLen] = { 0 }; - uint32_t delayedQueryActionTimeSec = mDelayedQueryActionTimeSec; - bool requestorCanConsent = commandData.requestorCanConsent.ValueOr(false); QueryImageResponse::Type response; + bool requestorCanConsent = commandData.requestorCanConsent.ValueOr(false); + uint8_t updateToken[kUpdateTokenLen] = { 0 }; + char strBuf[kUpdateTokenStrLen] = { 0 }; + char uriBuf[kUriMaxLen] = { 0 }; - if (mIgnoreQueryImageCount > 0) - { - ChipLogDetail(SoftwareUpdate, "Skip HandleQueryImage response. mIgnoreQueryImageCount %" PRIu32, mIgnoreQueryImageCount); - mIgnoreQueryImageCount--; - return EMBER_ZCL_STATUS_SUCCESS; - } - - switch (mQueryImageBehavior) - { - case kRespondWithUnknown: - // This use-case is a subset of the ota-candidates-file option. - // Can be removed once all other platforms start using the ota-candidates-file method. - if (strlen(mOTAFilePath) > 0) // If OTA file is directly provided - { - // Parse the header and set version info based on the header - OTAImageHeader header; - VerifyOrDie(ParseOTAHeader(mOTAFilePath, header) == true); - VerifyOrDie(sizeof(newSoftwareVersionString) > header.mSoftwareVersionString.size()); - newSoftwareVersion = header.mSoftwareVersion; - memcpy(newSoftwareVersionString, header.mSoftwareVersionString.data(), header.mSoftwareVersionString.size()); - - queryStatus = OTAQueryStatus::kUpdateAvailable; - } - else if (!mCandidates.empty()) // If list of OTA candidates is supplied instead - { - if (SelectOTACandidate(commandData.vendorId, commandData.productId, commandData.softwareVersion, candidate)) - { - VerifyOrDie(sizeof(newSoftwareVersionString) > strlen(candidate.softwareVersionString)); - - // This assumes all candidates have passed verification so the values are safe to use - newSoftwareVersion = candidate.softwareVersion; - memcpy(newSoftwareVersionString, candidate.softwareVersionString, strlen(candidate.softwareVersionString)); - otaFilePath = candidate.otaURL; - queryStatus = OTAQueryStatus::kUpdateAvailable; - } - } - - // If mUserConsentNeeded (set by the CLI) is true and requestor is capable of taking user consent - // then delegate obtaining user consent to the requestor - if (mUserConsentDelegate && queryStatus == OTAQueryStatus::kUpdateAvailable && - (requestorCanConsent && mUserConsentNeeded) == false) - { - UserConsentState state = mUserConsentDelegate->GetUserConsentState( - GetUserConsentSubject(commandObj, commandPath, commandData, newSoftwareVersion)); - ChipLogProgress(SoftwareUpdate, "User Consent state: %s", mUserConsentDelegate->UserConsentStateToString(state)); - switch (state) - { - case UserConsentState::kGranted: - queryStatus = OTAQueryStatus::kUpdateAvailable; - break; - - case UserConsentState::kObtaining: - queryStatus = OTAQueryStatus::kBusy; - break; - - case UserConsentState::kDenied: - case UserConsentState::kUnknown: - queryStatus = OTAQueryStatus::kNotAvailable; - break; - } - } - break; - - case kRespondWithUpdateAvailable: - queryStatus = OTAQueryStatus::kUpdateAvailable; - break; - - case kRespondWithBusy: - queryStatus = OTAQueryStatus::kBusy; - break; - - case kRespondWithNotAvailable: - queryStatus = OTAQueryStatus::kNotAvailable; - break; - - default: - queryStatus = OTAQueryStatus::kNotAvailable; - break; - } - - if (queryStatus == OTAQueryStatus::kUpdateAvailable) + // Set fields specific for an available status response + if (mQueryImageStatus == OTAQueryStatus::kUpdateAvailable) { GenerateUpdateToken(updateToken, kUpdateTokenLen); GetUpdateTokenString(ByteSpan(updateToken), strBuf, kUpdateTokenStrLen); - ChipLogDetail(SoftwareUpdate, "generated updateToken: %s", strBuf); + ChipLogDetail(SoftwareUpdate, "Generated updateToken: %s", strBuf); // TODO: This uses the current node as the provider to supply the OTA image. This can be configurable such that the // provider supplying the response is not the provider supplying the OTA image. @@ -318,9 +238,9 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c FabricInfo * fabricInfo = Server::GetInstance().GetFabricTable().FindFabricWithIndex(fabricIndex); NodeId nodeId = fabricInfo->GetPeerId().GetNodeId(); - // Only doing BDX transport for now + // Only supporting BDX protocol for now MutableCharSpan uri(uriBuf, kUriMaxLen); - chip::bdx::MakeURI(nodeId, CharSpan::fromCharString(otaFilePath), uri); + chip::bdx::MakeURI(nodeId, CharSpan::fromCharString(mOTAFilePath), uri); ChipLogDetail(SoftwareUpdate, "Generated URI: %.*s", static_cast(uri.size()), uri.data()); // Initialize the transfer session in prepartion for a BDX transfer @@ -329,28 +249,25 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c if (mBdxOtaSender.InitializeTransfer(commandObj->GetSubjectDescriptor().fabricIndex, commandObj->GetSubjectDescriptor().subject) == CHIP_NO_ERROR) { - CHIP_ERROR err = mBdxOtaSender.PrepareForTransfer(&chip::DeviceLayer::SystemLayer(), chip::bdx::TransferRole::kSender, - bdxFlags, kMaxBdxBlockSize, kBdxTimeout, kBdxPollFreq); - if (err != CHIP_NO_ERROR) - { - ChipLogError(BDX, "Failed to initialize BDX transfer session: %s", chip::ErrorStr(err)); - return EMBER_ZCL_STATUS_FAILURE; - } + ReturnErrorOnFailure(mBdxOtaSender.PrepareForTransfer(&chip::DeviceLayer::SystemLayer(), + chip::bdx::TransferRole::kSender, bdxFlags, kMaxBdxBlockSize, + kBdxTimeout, kBdxPollFreq)); response.imageURI.Emplace(chip::CharSpan::fromCharString(uriBuf)); - response.softwareVersion.Emplace(newSoftwareVersion); - response.softwareVersionString.Emplace(chip::CharSpan::fromCharString(newSoftwareVersionString)); + response.softwareVersion.Emplace(mSoftwareVersion); + response.softwareVersionString.Emplace(chip::CharSpan::fromCharString(mSoftwareVersionString)); response.updateToken.Emplace(chip::ByteSpan(updateToken)); } else { // Another BDX transfer in progress - queryStatus = OTAQueryStatus::kBusy; + mQueryImageStatus = OTAQueryStatus::kBusy; } } - response.status = queryStatus; - response.delayedActionTime.Emplace(delayedQueryActionTimeSec); + // Set remaining fields common to all status types + response.status = mQueryImageStatus; + response.delayedActionTime.Emplace(mDelayedQueryActionTimeSec); if (mUserConsentNeeded && requestorCanConsent) { response.userConsentNeeded.Emplace(true); @@ -365,10 +282,80 @@ EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * c response.metadataForRequestor.Emplace(chip::ByteSpan()); } - VerifyOrReturnError(commandObj->AddResponseData(commandPath, response) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); + ReturnErrorOnFailure(commandObj->AddResponseData(commandPath, response)); + + return CHIP_NO_ERROR; +} + +EmberAfStatus OTAProviderExample::HandleQueryImage(chip::app::CommandHandler * commandObj, + const chip::app::ConcreteCommandPath & commandPath, + const QueryImage::DecodableType & commandData) +{ + bool requestorCanConsent = commandData.requestorCanConsent.ValueOr(false); + + if (mIgnoreQueryImageCount > 0) + { + ChipLogDetail(SoftwareUpdate, "Skip HandleQueryImage response. mIgnoreQueryImageCount %" PRIu32, mIgnoreQueryImageCount); + mIgnoreQueryImageCount--; + return EMBER_ZCL_STATUS_SUCCESS; + } + + if (mQueryImageStatus == OTAQueryStatus::kUpdateAvailable) + { + memset(mSoftwareVersionString, 0, SW_VER_STR_MAX_LEN); + + if (!mCandidates.empty()) // If list of OTA candidates is supplied + { + OTAProviderExample::DeviceSoftwareVersionModel candidate; + if (SelectOTACandidate(commandData.vendorId, commandData.productId, commandData.softwareVersion, candidate)) + { + VerifyOrDie(sizeof(mSoftwareVersionString) > strlen(candidate.softwareVersionString)); + + // This assumes all candidates have passed verification so the values are safe to use + mSoftwareVersion = candidate.softwareVersion; + memcpy(mSoftwareVersionString, candidate.softwareVersionString, strlen(candidate.softwareVersionString)); + SetOTAFilePath(candidate.otaURL); + } + } + else if (strlen(mOTAFilePath) > 0) // If OTA file is directly provided + { + // Parse the header and set version info based on the header + OTAImageHeader header; + VerifyOrDie(ParseOTAHeader(mOTAFilePath, header) == true); + VerifyOrDie(sizeof(mSoftwareVersionString) > header.mSoftwareVersionString.size()); + mSoftwareVersion = header.mSoftwareVersion; + memcpy(mSoftwareVersionString, header.mSoftwareVersionString.data(), header.mSoftwareVersionString.size()); + } + + // If mUserConsentNeeded (set by the CLI) is true and requestor is capable of taking user consent + // then delegate obtaining user consent to the requestor + if (mUserConsentDelegate && (requestorCanConsent && mUserConsentNeeded) == false) + { + UserConsentState state = mUserConsentDelegate->GetUserConsentState( + GetUserConsentSubject(commandObj, commandPath, commandData, mSoftwareVersion)); + ChipLogProgress(SoftwareUpdate, "User Consent state: %s", mUserConsentDelegate->UserConsentStateToString(state)); + switch (state) + { + case UserConsentState::kGranted: + mQueryImageStatus = OTAQueryStatus::kUpdateAvailable; + break; + + case UserConsentState::kObtaining: + mQueryImageStatus = OTAQueryStatus::kBusy; + break; + + case UserConsentState::kDenied: + case UserConsentState::kUnknown: + mQueryImageStatus = OTAQueryStatus::kNotAvailable; + break; + } + } + } + + VerifyOrReturnError(SendQueryImageResponse(commandObj, commandPath, commandData) == CHIP_NO_ERROR, EMBER_ZCL_STATUS_FAILURE); - // After the first response is sent back, default to these values - mQueryImageBehavior = OTAProviderExample::kRespondWithUpdateAvailable; + // After the first response is sent, default to these values for subsequent queries + mQueryImageStatus = OTAQueryStatus::kUpdateAvailable; mDelayedQueryActionTimeSec = 0; return EMBER_ZCL_STATUS_SUCCESS; diff --git a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h index 19be8e613d49c1..40c414bea31aab 100644 --- a/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h +++ b/examples/ota-provider-app/ota-provider-common/OTAProviderExample.h @@ -32,6 +32,9 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate { public: + using OTAQueryStatus = chip::app::Clusters::OtaSoftwareUpdateProvider::OTAQueryStatus; + using OTAApplyUpdateAction = chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction; + OTAProviderExample(); void SetOTAFilePath(const char * path); @@ -48,15 +51,10 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::DecodableType & commandData) override; - enum QueryImageBehaviorType - { - kRespondWithUnknown, - kRespondWithUpdateAvailable, - kRespondWithBusy, - kRespondWithNotAvailable - }; static constexpr uint16_t SW_VER_STR_MAX_LEN = 64; static constexpr uint16_t OTA_URL_MAX_LEN = 512; + static constexpr size_t kFilepathBufLen = 256; + typedef struct DeviceSoftwareVersionModel { chip::VendorId vendorId; @@ -69,10 +67,11 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate uint32_t maxApplicableSoftwareVersion; char otaURL[OTA_URL_MAX_LEN]; } DeviceSoftwareVersionModel; + void SetOTACandidates(std::vector candidates); - void SetQueryImageBehavior(QueryImageBehaviorType behavior) { mQueryImageBehavior = behavior; } void SetIgnoreQueryImageCount(uint32_t count) { mIgnoreQueryImageCount = count; } void SetIgnoreApplyUpdateCount(uint32_t count) { mIgnoreApplyUpdateCount = count; } + void SetQueryImageStatus(OTAQueryStatus status) { mQueryImageStatus = status; } void SetApplyUpdateAction(chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction action) { mUpdateAction = action; @@ -94,16 +93,21 @@ class OTAProviderExample : public chip::app::Clusters::OTAProviderDelegate bool ParseOTAHeader(const char * otaFilePath, chip::OTAImageHeader & header); + CHIP_ERROR + SendQueryImageResponse(chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::DecodableType & commandData); + BdxOtaSender mBdxOtaSender; std::vector mCandidates; - static constexpr size_t kFilepathBufLen = 256; char mOTAFilePath[kFilepathBufLen]; // null-terminated - QueryImageBehaviorType mQueryImageBehavior; - uint32_t mIgnoreQueryImageCount = 0; - uint32_t mIgnoreApplyUpdateCount = 0; - chip::app::Clusters::OtaSoftwareUpdateProvider::OTAApplyUpdateAction mUpdateAction; - uint32_t mDelayedApplyActionTimeSec = 0; - uint32_t mDelayedQueryActionTimeSec = 0; - chip::ota::UserConsentDelegate * mUserConsentDelegate = nullptr; - bool mUserConsentNeeded = false; + OTAQueryStatus mQueryImageStatus; + OTAApplyUpdateAction mUpdateAction; + uint32_t mIgnoreQueryImageCount; + uint32_t mIgnoreApplyUpdateCount; + uint32_t mDelayedQueryActionTimeSec; + uint32_t mDelayedApplyActionTimeSec; + chip::ota::UserConsentDelegate * mUserConsentDelegate; + bool mUserConsentNeeded; + uint32_t mSoftwareVersion; + char mSoftwareVersionString[SW_VER_STR_MAX_LEN]; }; From c76a681a88d1c043699b26386e9a3a44bf2149dc Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 24 Mar 2022 16:52:54 -0400 Subject: [PATCH 58/70] Adding a clang-tidy helper script that is outside the build process. (#16382) * Make clang variant as a requirement for asan/tsan builds, add support for required variants for build systems * Restyle * Also update workflows * Adding a clang-tidy helper script that is outside the build process. Replaces the pw_command_runner path we had before and allows independent execution of the checker. * Remove pw command launcher from darwin as well. clang tidy on linux should be sufficient for now * Use clang builds and validate more compile databases * Adjust test group ordering since we have placed clang as a last variant * More moving of chip tool variants to make the options in yaml file make sense * add missin $ for var specifier * Add clang variant to tsan * Asan/tsan not limited by clang, so updated as such * Restyle * Ensure darwin clang-tidy is also run * Ensure compile commands are exported * Update to use same coverage for tidy for linux as well as before * Undo changes to TestCommand * Remove modernize-nullptr for now: it is still too strict * Select individual OS compilations and do not compile gcc variants on mac * It looks like IOS is always compiled with gcc - see build/toolchain/build/ios. Do not attempt to clang-enable it nor clang-tidy * Tidy gcc/g++ as well * fix typo * Remove PWcommandlauncher from default build as well * Bump up the timeout value for clang validation a lot just in case * Make code easier to read * Fix darwin paths: when using gcc/g++, sysroot is required * More robust gcc finding of sysroot * Typo fix and restyle * Disabled optin-osx-cocoa-localizability-emptylocalizationcontextchecker-objc for clang tidy default * Fix optin to be case correct: clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker --- .clang-tidy | 2 +- .github/workflows/build.yaml | 41 ++- scripts/helpers/clang-tidy-launcher.py | 74 ---- scripts/run-clang-tidy-on-compile-commands.py | 341 ++++++++++++++++++ 4 files changed, 371 insertions(+), 87 deletions(-) delete mode 100755 scripts/helpers/clang-tidy-launcher.py create mode 100755 scripts/run-clang-tidy-on-compile-commands.py diff --git a/.clang-tidy b/.clang-tidy index cda8ea53a5f4cc..1998473bf95879 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,4 +1,4 @@ --- -Checks: 'bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion' +Checks: 'bugprone-*,-bugprone-not-null-terminated-result,-bugprone-suspicious-memory-comparison,-bugprone-argument-comment,-bugprone-unused-return-value,-bugprone-branch-clone,-bugprone-easily-swappable-parameters,-bugprone-reserved-identifier,-bugprone-macro-parentheses,-bugprone-forward-declaration-namespace,-bugprone-forwarding-reference-overload,-bugprone-undelegated-constructor,-bugprone-sizeof-expression,-bugprone-implicit-widening-of-multiplication-result,-bugprone-too-small-loop-variable,-bugprone-narrowing-conversions,-bugprone-misplaced-widening-cast,-bugprone-suspicious-include,-bugprone-signed-char-misuse,-bugprone-copy-constructor-init,-clang-analyzer-core.CallAndMessage,-clang-analyzer-core.UndefinedBinaryOperatorResult,-clang-analyzer-core.NullDereference,-clang-analyzer-optin.cplusplus.UninitializedObject,-clang-analyzer-core.uninitialized.Branch,-clang-analyzer-optin.performance,-clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker,-clang-analyzer-deadcode.DeadStores,-clang-analyzer-cplusplus.Move,-clang-analyzer-optin.cplusplus.VirtualCall,-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-nullability.NullablePassedToNonnull,-clang-analyzer-optin.performance.Padding,-clang-analyzer-security.insecureAPI.bzero,-clang-analyzer-unix.cstring.NullArg,-clang-analyzer-security.insecureAPI.rand,-clang-analyzer-core.NonNullParamChecker,-clang-analyzer-nullability.NullPassedToNonnull,-clang-analyzer-unix.Malloc,-clang-analyzer-valist.Unterminated,-clang-analyzer-cplusplus.NewDeleteLeaks,-clang-diagnostic-implicit-int-conversion' WarningsAsErrors: '*' HeaderFilterRegex: '(src|examples|zzz_generated|credentials)' diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 6e220b7ab0bd47..92adeac81dd3cb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -160,13 +160,22 @@ jobs: for BUILD_TYPE in gcc_release clang; do case $BUILD_TYPE in "gcc_release") GN_ARGS='is_debug=false';; - "clang") GN_ARGS='is_clang=true pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; + "clang") GN_ARGS='is_clang=true';; esac - scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/run_in_build_env.sh "ninja -C ./out" - scripts/tests/gn_tests.sh + BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh done + - name: Clang-tidy validation + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/run-clang-tidy-on-compile-commands.py \ + --no-log-timestamps \ + --compile-database out/clang/compile_commands.json \ + check \ + " - name: Run Tests with sanitizers timeout-minutes: 30 env: @@ -189,13 +198,12 @@ jobs: run: | ./scripts/run_in_build_env.sh \ "./scripts/build/build_examples.py --no-log-timestamps \ - --target linux-x64-all-clusters-ipv6only \ - --target linux-x64-chip-tool-ipv6only \ - --target linux-x64-minmdns-ipv6only \ + --target linux-x64-all-clusters-ipv6only-clang \ + --target linux-x64-chip-tool-ipv6only-clang \ + --target linux-x64-minmdns-ipv6only-clang \ --target linux-x64-rpc-console \ build \ " - - name: Run fake linux tests with build_examples timeout-minutes: 15 run: | @@ -335,13 +343,22 @@ jobs: # use that on Darwin. # * the "host clang" build, which uses the pigweed # clang. - "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false enable_host_gcc_mbedtls_build=false pw_command_launcher="`pwd`/../scripts/helpers/clang-tidy-launcher.py"';; + "default") GN_ARGS='target_os="all" is_asan=true enable_host_clang_build=false enable_host_gcc_mbedtls_build=false';; "python_lib") GN_ARGS='enable_rtti=true enable_pylib=true';; esac - scripts/build/gn_gen.sh --args="$GN_ARGS" - scripts/run_in_build_env.sh "ninja -C ./out" - scripts/tests/gn_tests.sh + BUILD_TYPE=$BUILD_TYPE scripts/build/gn_gen.sh --args="$GN_ARGS" --export-compile-commands + scripts/run_in_build_env.sh "ninja -C ./out/$BUILD_TYPE" + BUILD_TYPE=$BUILD_TYPE scripts/tests/gn_tests.sh done + - name: Clang-tidy validation + timeout-minutes: 45 + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/run-clang-tidy-on-compile-commands.py \ + --no-log-timestamps \ + --compile-database out/default/compile_commands.json \ + check \ + " - name: Uploading diagnostic logs uses: actions/upload-artifact@v2 if: ${{ failure() }} && ${{ !env.ACT }} diff --git a/scripts/helpers/clang-tidy-launcher.py b/scripts/helpers/clang-tidy-launcher.py deleted file mode 100755 index 157f354ce5addd..00000000000000 --- a/scripts/helpers/clang-tidy-launcher.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env -S python3 -B - -# 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. - -import subprocess -import sys - - -def consumeArgument(args): - if len(args) == 0: - return None - return args.pop(0) - - -def maybeRunClangTidy(args): - # If the command is not a clang command, do no try to run clang-tidy on it - cc = consumeArgument(args) - if cc is None or not cc.startswith("clang"): - return 0 - - clang_tidy_srcs = [] - clang_tidy_args = [] - - # If warnings comes from third_party, ignore it as there is little we can do. - ignored_list = ['third_party/mbedtls', 'third_party/lwip'] - - arg = consumeArgument(args) - while arg: - if arg == "-c": - sourceFile = consumeArgument(args) - if sourceFile is None: - return 1 - - for name in ignored_list: - if name in sourceFile: - return 0 - - clang_tidy_srcs.append(sourceFile) - - elif arg == "-o": - objectFile = consumeArgument(args) - if objectFile is None: - return 1 - else: - clang_tidy_args.append(arg) - - arg = consumeArgument(args) - - command = ["clang-tidy"] + clang_tidy_srcs + ["--"] + clang_tidy_args - return subprocess.run(command).returncode - - -def main(): - returnCode = maybeRunClangTidy(sys.argv[1:]) - if returnCode != 0: - return returnCode - - return subprocess.run(sys.argv[1:]).returncode - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/scripts/run-clang-tidy-on-compile-commands.py b/scripts/run-clang-tidy-on-compile-commands.py new file mode 100755 index 00000000000000..2de0944671c7aa --- /dev/null +++ b/scripts/run-clang-tidy-on-compile-commands.py @@ -0,0 +1,341 @@ +#!/usr/bin/env python +# +# Runs clang-tidy on files based on a `compile_commands.json` file +# + +""" +Run clang-tidy in parallel on compile databases. + +Example run: + +# This prepares the build. NOTE this is `build` not `gen` because the build +# step generates required header files (this can be simplified if needed +# to invoke ninja to compile only generated files if needed) + +./scripts/build/build_examples.py --target linux-x64-chip-tool-clang build + +# Actually running clang-tidy to check status + +./scripts/run-clang-tidy-on-compile-commands.py check + +""" + +import build +import click +import coloredlogs +import glob +import json +import logging +import multiprocessing +import os +import re +import shlex +import subprocess +import sys +import threading +import traceback +import queue + + +class TidyResult: + def __init__(self, path: str, ok: bool): + self.path = path + self.ok = ok + + def __repr__(self): + if self.ok: + status = "OK" + else: + status = "FAIL" + + return "%s(%s)" % (status, self.path) + + def __str__(self): + return self.__repr__() + + +class ClangTidyEntry: + """Represents a single entry for running clang-tidy based + on a compile_commands.json item. + """ + + def __init__(self, json_entry, gcc_sysroot=None): + # Entries in compile_commands: + # - "directory": location to run the compile + # - "file": a relative path to directory + # - "command": full compilation command + + self.directory = json_entry["directory"] + self.file = json_entry["file"] + self.valid = False + self.clang_arguments = [] + self.tidy_arguments = [] + + command = json_entry["command"] + + command_items = shlex.split(command) + compiler = os.path.basename(command_items[0]) + + # Allow gcc/g++ invocations to also be tidied - arguments should be + # compatible and on darwin gcc/g++ is actually a symlink to clang + if compiler in ['clang++', 'clang', 'gcc', 'g++']: + self.valid = True + self.clang_arguments = command_items[1:] + else: + logging.warning( + "Cannot tidy %s - not a clang compile command", self.file) + return + + if compiler in ['gcc', 'g++'] and gcc_sysroot: + self.clang_arguments.insert(0, '--sysroot='+gcc_sysroot) + + @property + def full_path(self): + return os.path.abspath(os.path.join(self.directory, self.file)) + + def ExportFixesTo(self, f: str): + self.tidy_arguments.append("--export-fixes") + self.tidy_arguments.append(f) + + def Check(self): + logging.debug("Running tidy on %s from %s", self.file, self.directory) + try: + cmd = ["clang-tidy", self.file, "--"] + self.clang_arguments + logging.debug("Executing: %r" % cmd) + + proc = subprocess.Popen( + cmd, + cwd=self.directory, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + output, err = proc.communicate() + if output: + logging.info("TIDY %s: %s", self.file, output.decode("utf-8")) + + if err: + logging.warning("TIDY %s: %s", self.file, err.decode("utf-8")) + + if proc.returncode != 0: + if proc.returncode < 0: + logging.error( + "Failed %s with signal %d", self.file, -proc.returncode + ) + else: + logging.warning( + "Tidy %s ended with code %d", self.file, proc.returncode + ) + return TidyResult(self.full_path, False) + except: + traceback.print_exc() + return TidyResult(self.full_path, False) + + return TidyResult(self.full_path, True) + + +class TidyState: + def __init__(self): + self.successes = 0 + self.failures = 0 + self.lock = threading.Lock() + self.failed_files = [] + + def Success(self): + with self.lock: + self.successes += 1 + + def Failure(self, path: str): + with self.lock: + self.failures += 1 + self.failed_files.append(path) + logging.error("Failed to process %s", path) + + +def find_darwin_gcc_sysroot(): + for line in subprocess.check_output('xcodebuild -sdk -version'.split()).decode('utf8').split('\n'): + if not line.startswith('Path: '): + continue + path = line[line.find(': ')+2:] + if not '/MacOSX.platform/' in path: + continue + logging.info("Found %s" % path) + return path + + # A hard-coded value that works on default installations + logging.warning("Using default platform sdk path. This may be incorrect.") + return '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk' + + +class ClangTidyRunner: + """Handles running clang-tidy""" + + def __init__(self): + self.entries = [] + self.state = TidyState() + self.gcc_sysroot = None + + if sys.platform == 'darwin': + # Darwin gcc invocation will auto select a system root, however clang requires an explicit path since + # we are using the built-in pigweed clang-tidy. + logging.info( + 'Searching for a MacOS system root for gcc invocations...') + self.gcc_sysroot = find_darwin_gcc_sysroot() + logging.info(' Chose: %s' % self.gcc_sysroot) + + def AddDatabase(self, compile_commands_json): + database = json.load(open(compile_commands_json)) + + for entry in database: + item = ClangTidyEntry(entry, self.gcc_sysroot) + if not item.valid: + continue + + self.entries.append(item) + + def ExportFixesTo(self, f): + # use absolute path since running things will change working directories + f = os.path.abspath(f) + for e in self.entries: + e.ExportFixesTo(f) + + def FilterEntries(self, f): + for e in self.entries: + if not f(e): + logging.info("Skipping %s in %s", e.file, e.directory) + self.entries = [e for e in self.entries if f(e)] + + def CheckThread(self, task_queue): + while True: + entry = task_queue.get() + status = entry.Check() + + if status.ok: + self.state.Success() + else: + self.state.Failure(status.path) + + task_queue.task_done() + + def Check(self): + count = multiprocessing.cpu_count() + task_queue = queue.Queue(count) + + for _ in range(count): + t = threading.Thread(target=self.CheckThread, args=(task_queue,)) + t.daemon = True + t.start() + + for e in self.entries: + task_queue.put(e) + task_queue.join() + + logging.info("Successfully processed %d paths", self.state.successes) + logging.info("Failed to process %d paths", self.state.failures) + if self.state.failures: + for name in self.state.failed_files: + logging.warning("Failure reported for %s", name) + + sys.exit(1) + + +# Supported log levels, mapping string values required for argument +# parsing into logging constants +__LOG_LEVELS__ = { + "debug": logging.DEBUG, + "info": logging.INFO, + "warn": logging.WARN, + "fatal": logging.FATAL, +} + + +@click.group(chain=True) +@click.option( + "--compile-database", + default=[], + multiple=True, + help="Path to `compile_commands.json` to use for executing clang-tidy.", +) +@click.option( + "--file-include-regex", + default="/(src|examples)/", + help="regular expression to apply to the file paths for running.", +) +@click.option( + "--file-exclude-regex", + # NOTE: if trying '/third_party/' note that a lot of sources are routed through + # paths like `../../examples/chip-tool/third_party/connectedhomeip/src/` + default="/(repo|zzz_generated)/", + help="Regular expression to apply to the file paths for running. Skip overrides includes.", +) +@click.option( + "--log-level", + default="INFO", + type=click.Choice(__LOG_LEVELS__.keys(), case_sensitive=False), + help="Determines the verbosity of script output.", +) +@click.option( + "--no-log-timestamps", + default=False, + is_flag=True, + help="Skip timestaps in log output", +) +@click.option( + "--export-fixes", + default=None, + type=click.Path(), + help="Where to export fixes to apply. TODO(fix apply not yet implemented).", +) +@click.pass_context +def main( + context, + compile_database, + file_include_regex, + file_exclude_regex, + log_level, + no_log_timestamps, + export_fixes, +): + log_fmt = "%(asctime)s %(levelname)-7s %(message)s" + if no_log_timestamps: + log_fmt = "%(levelname)-7s %(message)s" + coloredlogs.install(level=__LOG_LEVELS__[log_level], fmt=log_fmt) + + if not compile_database: + logging.warning( + "Compilation database file not provided. Searching for first item in ./out" + ) + compile_database = next( + glob.iglob("./out/**/compile_commands.json", recursive=True) + ) + if not compile_database: + raise Exception("Could not find `compile_commands.json` in ./out") + logging.info("Will use %s for compile", compile_database) + + context.obj = ClangTidyRunner() + + for name in compile_database: + context.obj.AddDatabase(name) + + if file_include_regex: + r = re.compile(file_include_regex) + context.obj.FilterEntries(lambda e: r.search(e.file)) + + if file_exclude_regex: + r = re.compile(file_exclude_regex) + context.obj.FilterEntries(lambda e: not r.search(e.file)) + + if export_fixes: + context.obj.ExportFixesTo(export_fixes) + + for e in context.obj.entries: + logging.info("Will tidy %s", e.full_path) + + +@main.command("check", help="Run clang-tidy check") +@click.pass_context +def cmd_check(context): + context.obj.Check() + + +if __name__ == "__main__": + main() From b583b57d25a465b77912467793febcdc678dd928 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 24 Mar 2022 16:53:00 -0400 Subject: [PATCH 59/70] Apply most of readability-simplify-boolean-expr from clang-tidy (#16635) --- .../chip-tool/commands/common/CHIPCommand.cpp | 2 +- examples/chip-tool/commands/common/Commands.cpp | 10 +++++----- .../commands/discovery/DiscoveryCommands.cpp | 2 +- src/lib/asn1/ASN1Reader.cpp | 2 +- src/lib/dnssd/Resolver.h | 17 ++++------------- src/platform/Linux/ConnectivityUtils.cpp | 2 +- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index b09b4d993fefc3..6edcda0252ac6e 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -133,7 +133,7 @@ void CHIPCommand::StartTracing() { chip::trace::SetTraceStream(new chip::trace::TraceStreamFile(mTraceFile.Value())); } - else if (mTraceLog.HasValue() && mTraceLog.Value() == true) + else if (mTraceLog.HasValue() && mTraceLog.Value()) { chip::trace::SetTraceStream(new chip::trace::TraceStreamLog()); } diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index e6b98bc0662b40..0e444768ac5739 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -227,23 +227,23 @@ void Commands::ShowCluster(std::string executable, std::string clusterName, Comm if (IsGlobalCommand(command->GetName())) { - if (strcmp(command->GetName(), "read") == 0 && readCommand == false) + if (strcmp(command->GetName(), "read") == 0 && !readCommand) { readCommand = true; } - else if (strcmp(command->GetName(), "write") == 0 && writeCommand == false) + else if (strcmp(command->GetName(), "write") == 0 && !writeCommand) { writeCommand = true; } - else if (strcmp(command->GetName(), "subscribe") == 0 && subscribeCommand == false) + else if (strcmp(command->GetName(), "subscribe") == 0 && !subscribeCommand) { subscribeCommand = true; } - else if (strcmp(command->GetName(), "read-event") == 0 && readEventCommand == false) + else if (strcmp(command->GetName(), "read-event") == 0 && !readEventCommand) { readEventCommand = true; } - else if (strcmp(command->GetName(), "subscribe-event") == 0 && subscribeEventCommand == false) + else if (strcmp(command->GetName(), "subscribe-event") == 0 && !subscribeEventCommand) { subscribeEventCommand = true; } diff --git a/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp b/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp index 1af491838f20e0..71be49564599f8 100644 --- a/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp +++ b/src/app/tests/suites/commands/discovery/DiscoveryCommands.cpp @@ -98,7 +98,7 @@ CHIP_ERROR DiscoveryCommands::SetupDiscoveryCommands() { ReturnErrorOnFailure(TearDownDiscoveryCommands()); - if (mReady == false) + if (!mReady) { ReturnErrorOnFailure(mDNSResolver.Init(chip::DeviceLayer::UDPEndPointManager())); mReady = true; diff --git a/src/lib/asn1/ASN1Reader.cpp b/src/lib/asn1/ASN1Reader.cpp index a6aaec2548b3a8..b45f32daeb2244 100644 --- a/src/lib/asn1/ASN1Reader.cpp +++ b/src/lib/asn1/ASN1Reader.cpp @@ -297,7 +297,7 @@ CHIP_ERROR ASN1Reader::DecodeHead() mHeadLen = static_cast(p - mElemStart); - EndOfContents = (Class == kASN1TagClass_Universal && Tag == 0 && Constructed == false && ValueLen == 0); + EndOfContents = (Class == kASN1TagClass_Universal && Tag == 0 && !Constructed && ValueLen == 0); Value = p; diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index 8984790d9f9326..f8298e41809b05 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -71,12 +71,8 @@ struct ResolvedNodeData // If either retry interval (Idle - CRI, Active - CRA) has a value and that value is greater // than the value passed to this function, then the peer device will be treated as if it is // a Sleepy End Device (SED) - if ((mMrpRetryIntervalIdle.HasValue() && (mMrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || - (mMrpRetryIntervalActive.HasValue() && (mMrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout))) - { - return true; - } - return false; + return (mMrpRetryIntervalIdle.HasValue() && (mMrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || + (mMrpRetryIntervalActive.HasValue() && (mMrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout)); } PeerId mPeerId; @@ -156,13 +152,8 @@ struct DiscoveredNodeData // If either retry interval (Idle - CRI, Active - CRA) has a value and that value is greater // than the value passed to this function, then the peer device will be treated as if it is // a Sleepy End Device (SED) - if ((mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || - (mrpRetryIntervalActive.HasValue() && (mrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout))) - - { - return true; - } - return false; + return (mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || + (mrpRetryIntervalActive.HasValue() && (mrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout)); } void LogDetail() const diff --git a/src/platform/Linux/ConnectivityUtils.cpp b/src/platform/Linux/ConnectivityUtils.cpp index ac8206cb9f2440..8f9b43613fe24d 100644 --- a/src/platform/Linux/ConnectivityUtils.cpp +++ b/src/platform/Linux/ConnectivityUtils.cpp @@ -632,7 +632,7 @@ CHIP_ERROR ConnectivityUtils::GetEthFullDuplex(const char * ifname, bool & fullD } else { - fullDuplex = (ecmd.duplex == DUPLEX_FULL) ? true : false; + fullDuplex = ecmd.duplex == DUPLEX_FULL; err = CHIP_NO_ERROR; } From 7a8bf2b08584fdafab602ede29c0b955273ca412 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 24 Mar 2022 18:27:35 -0400 Subject: [PATCH 60/70] Fix fabric index management in the fabric table. (#16587) * Fix fabric index management in the fabric table. Before this change, the fabric index for a fabric table entry had to match its offset in the table. Therefore we only used indices up to CHIP_CONFIG_MAX_FABRICS and then looped back around to index 1. Furthermore, we did not use to persist our mNextAvailableFabricIndex, so after a restart would start assigning fabric indices that corresponded to deleted fabrics, instead of not-yet-used ones, even if we had not yet exceeded CHIP_CONFIG_MAX_FABRICS total commissioning events. This change decouples the fabric index from the table offset. We now store the list of fabric indices used and the fabric index we should use for the next time a fabric is added. * Fix TestCASESession compilation. * Address review comments. --- src/credentials/FabricTable.cpp | 338 +++++++++++++----- src/credentials/FabricTable.h | 61 +++- src/lib/support/DefaultStorageKeyAllocator.h | 1 + .../secure_channel/tests/TestCASESession.cpp | 4 +- 4 files changed, 300 insertions(+), 104 deletions(-) diff --git a/src/credentials/FabricTable.cpp b/src/credentials/FabricTable.cpp index f76db9849d019a..48d6eb6dc0127b 100644 --- a/src/credentials/FabricTable.cpp +++ b/src/credentials/FabricTable.cpp @@ -54,6 +54,10 @@ constexpr TLV::Tag kOpKeyDataTag = TLV::ContextTag(1); // If this version grows beyond UINT16_MAX, adjust OpKeypairTLVMaxSize // accordingly. constexpr uint16_t kOpKeyVersion = 1; + +// Tags for our index list storage. +constexpr TLV::Tag kNextAvailableFabricIndexTag = TLV::ContextTag(0); +constexpr TLV::Tag kFabricIndicesTag = TLV::ContextTag(1); } // anonymous namespace CHIP_ERROR FabricInfo::CommitToStorage(PersistentStorageDelegate * storage) @@ -66,7 +70,7 @@ CHIP_ERROR FabricInfo::CommitToStorage(PersistentStorageDelegate * storage) static_assert(kMaxCHIPCertLength <= UINT16_MAX, "Casting to uint16_t won't be safe"); ReturnErrorOnFailure( - storage->SyncSetKeyValue(keyAlloc.FabricRCAC(mFabric), mRootCert.data(), static_cast(mRootCert.size()))); + storage->SyncSetKeyValue(keyAlloc.FabricRCAC(mFabricIndex), mRootCert.data(), static_cast(mRootCert.size()))); // Workaround for the fact that some storage backends do not allow storing // a nullptr with 0 length. See @@ -74,12 +78,12 @@ CHIP_ERROR FabricInfo::CommitToStorage(PersistentStorageDelegate * storage) if (!mICACert.empty()) { ReturnErrorOnFailure( - storage->SyncSetKeyValue(keyAlloc.FabricICAC(mFabric), mICACert.data(), static_cast(mICACert.size()))); + storage->SyncSetKeyValue(keyAlloc.FabricICAC(mFabricIndex), mICACert.data(), static_cast(mICACert.size()))); } else { // Make sure there is no stale data. - CHIP_ERROR err = storage->SyncDeleteKeyValue(keyAlloc.FabricICAC(mFabric)); + CHIP_ERROR err = storage->SyncDeleteKeyValue(keyAlloc.FabricICAC(mFabricIndex)); if (err != CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) { ReturnErrorOnFailure(err); @@ -87,7 +91,7 @@ CHIP_ERROR FabricInfo::CommitToStorage(PersistentStorageDelegate * storage) } ReturnErrorOnFailure( - storage->SyncSetKeyValue(keyAlloc.FabricNOC(mFabric), mNOCCert.data(), static_cast(mNOCCert.size()))); + storage->SyncSetKeyValue(keyAlloc.FabricNOC(mFabricIndex), mNOCCert.data(), static_cast(mNOCCert.size()))); { Crypto::P256SerializedKeypair serializedOpKey; @@ -119,7 +123,7 @@ CHIP_ERROR FabricInfo::CommitToStorage(PersistentStorageDelegate * storage) const auto opKeyLength = writer.GetLengthWritten(); VerifyOrReturnError(CanCastTo(opKeyLength), CHIP_ERROR_BUFFER_TOO_SMALL); - ReturnErrorOnFailure(storage->SyncSetKeyValue(keyAlloc.FabricOpKey(mFabric), buf, static_cast(opKeyLength))); + ReturnErrorOnFailure(storage->SyncSetKeyValue(keyAlloc.FabricOpKey(mFabricIndex), buf, static_cast(opKeyLength))); } { @@ -139,7 +143,7 @@ CHIP_ERROR FabricInfo::CommitToStorage(PersistentStorageDelegate * storage) const auto metadataLength = writer.GetLengthWritten(); VerifyOrReturnError(CanCastTo(metadataLength), CHIP_ERROR_BUFFER_TOO_SMALL); ReturnErrorOnFailure( - storage->SyncSetKeyValue(keyAlloc.FabricMetadata(mFabric), buf, static_cast(metadataLength))); + storage->SyncSetKeyValue(keyAlloc.FabricMetadata(mFabricIndex), buf, static_cast(metadataLength))); } return CHIP_NO_ERROR; @@ -149,21 +153,21 @@ CHIP_ERROR FabricInfo::LoadFromStorage(PersistentStorageDelegate * storage) { DefaultStorageKeyAllocator keyAlloc; - ChipLogProgress(Inet, "Loading from storage for fabric index %u", mFabric); + ChipLogProgress(Inet, "Loading from storage for fabric index %u", mFabricIndex); // Scopes for "size" so we don't forget to re-initialize it between gets, // since each get modifies it. { uint8_t buf[Credentials::kMaxCHIPCertLength]; uint16_t size = sizeof(buf); - ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricRCAC(mFabric), buf, size)); + ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricRCAC(mFabricIndex), buf, size)); ReturnErrorOnFailure(SetRootCert(ByteSpan(buf, size))); } { uint8_t buf[Credentials::kMaxCHIPCertLength]; uint16_t size = sizeof(buf); - CHIP_ERROR err = storage->SyncGetKeyValue(keyAlloc.FabricICAC(mFabric), buf, size); + CHIP_ERROR err = storage->SyncGetKeyValue(keyAlloc.FabricICAC(mFabricIndex), buf, size); if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) { // That's OK; that just means no ICAC. @@ -179,7 +183,7 @@ CHIP_ERROR FabricInfo::LoadFromStorage(PersistentStorageDelegate * storage) { uint8_t buf[Credentials::kMaxCHIPCertLength]; uint16_t size = sizeof(buf); - ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricNOC(mFabric), buf, size)); + ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricNOC(mFabricIndex), buf, size)); ByteSpan nocCert(buf, size); NodeId nodeId; ReturnErrorOnFailure(ExtractNodeIdFabricIdFromOpCert(nocCert, &nodeId, &mFabricId)); @@ -193,7 +197,7 @@ CHIP_ERROR FabricInfo::LoadFromStorage(PersistentStorageDelegate * storage) { uint8_t buf[OpKeyTLVMaxSize()]; uint16_t size = sizeof(buf); - ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricOpKey(mFabric), buf, size)); + ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricOpKey(mFabricIndex), buf, size)); TLV::ContiguousBufferTLVReader reader; reader.Init(buf, size); @@ -240,7 +244,7 @@ CHIP_ERROR FabricInfo::LoadFromStorage(PersistentStorageDelegate * storage) { uint8_t buf[MetadataTLVMaxSize()]; uint16_t size = sizeof(buf); - ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricMetadata(mFabric), buf, size)); + ReturnErrorOnFailure(storage->SyncGetKeyValue(keyAlloc.FabricMetadata(mFabricIndex), buf, size)); TLV::ContiguousBufferTLVReader reader; reader.Init(buf, size); @@ -479,7 +483,7 @@ CHIP_ERROR FabricInfo::GenerateDestinationID(const ByteSpan & ipk, const ByteSpa } CHIP_ERROR FabricInfo::MatchDestinationID(const ByteSpan & targetDestinationId, const ByteSpan & initiatorRandom, - const ByteSpan * ipkList, size_t ipkListEntries) + const ByteSpan * ipkList, size_t ipkListEntries) const { uint8_t localDestID[kSHA256_Hash_Length] = { 0 }; MutableByteSpan localDestIDSpan(localDestID); @@ -511,23 +515,20 @@ FabricTable::~FabricTable() FabricInfo * FabricTable::FindFabric(P256PublicKeySpan rootPubKey, FabricId fabricId) { - static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); - for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) + for (auto & fabric : mStates) { - FabricInfo * fabric = FindFabricWithIndex(i); - if (fabric == nullptr) + if (!fabric.IsInitialized()) { continue; } P256PublicKeySpan candidatePubKey; - if (fabric->GetRootPubkey(candidatePubKey) != CHIP_NO_ERROR) + if (fabric.GetRootPubkey(candidatePubKey) != CHIP_NO_ERROR) { continue; } - if (rootPubKey.data_equal(candidatePubKey) && fabricId == fabric->GetFabricId()) + if (rootPubKey.data_equal(candidatePubKey) && fabricId == fabric.GetFabricId()) { - LoadFromStorage(fabric); - return fabric; + return &fabric; } } return nullptr; @@ -535,11 +536,17 @@ FabricInfo * FabricTable::FindFabric(P256PublicKeySpan rootPubKey, FabricId fabr FabricInfo * FabricTable::FindFabricWithIndex(FabricIndex fabricIndex) { - if (fabricIndex >= kMinValidFabricIndex && fabricIndex <= kMaxValidFabricIndex) + for (auto & fabric : mStates) { - FabricInfo * fabric = &mStates[fabricIndex - kMinValidFabricIndex]; - LoadFromStorage(fabric); - return fabric; + if (!fabric.IsInitialized()) + { + continue; + } + + if (fabric.GetFabricIndex() == fabricIndex) + { + return &fabric; + } } return nullptr; @@ -547,34 +554,19 @@ FabricInfo * FabricTable::FindFabricWithIndex(FabricIndex fabricIndex) FabricInfo * FabricTable::FindFabricWithCompressedId(CompressedFabricId fabricId) { - static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); - for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) + for (auto & fabric : mStates) { - FabricInfo * fabric = FindFabricWithIndex(i); - - if (fabric != nullptr && fabricId == fabric->GetPeerId().GetCompressedFabricId()) + if (!fabric.IsInitialized()) { - LoadFromStorage(fabric); - return fabric; + continue; } - } - return nullptr; -} -void FabricTable::Reset() -{ - static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); - for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) - { - FabricInfo * fabric = FindFabricWithIndex(i); - - if (fabric != nullptr) + if (fabricId == fabric.GetPeerId().GetCompressedFabricId()) { - fabric->Reset(); - - fabric->mFabric = i; + return &fabric; } } + return nullptr; } CHIP_ERROR FabricTable::Store(FabricIndex index) @@ -649,14 +641,11 @@ CHIP_ERROR FabricInfo::SetFabricInfo(FabricInfo & newFabric) FabricIndex FabricTable::FindDestinationIDCandidate(const ByteSpan & destinationId, const ByteSpan & initiatorRandom, const ByteSpan * ipkList, size_t ipkListEntries) { - static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); - for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) + for (auto & fabric : *this) { - FabricInfo * fabric = FindFabricWithIndex(i); - if (fabric != nullptr && - fabric->MatchDestinationID(destinationId, initiatorRandom, ipkList, ipkListEntries) == CHIP_NO_ERROR) + if (fabric.MatchDestinationID(destinationId, initiatorRandom, ipkList, ipkListEntries) == CHIP_NO_ERROR) { - return i; + return fabric.GetFabricIndex(); } } @@ -692,31 +681,49 @@ CHIP_ERROR FabricTable::AddNewFabric(FabricInfo & newFabric, FabricIndex * outpu } } - for (FabricIndex i = mNextAvailableFabricIndex; i <= kMaxValidFabricIndex; i++) + if (!mNextAvailableFabricIndex.HasValue()) { - FabricInfo * fabric = FindFabricWithIndex(i); - if (fabric != nullptr && !fabric->IsInitialized()) - { - ReturnErrorOnFailure(fabric->SetFabricInfo(newFabric)); - ReturnErrorOnFailure(Store(i)); - mNextAvailableFabricIndex = static_cast((i + 1) % UINT8_MAX); - *outputIndex = i; - mFabricCount++; - return CHIP_NO_ERROR; - } + // No more indices available. Bail out. + return CHIP_ERROR_NO_MEMORY; } - for (FabricIndex i = kMinValidFabricIndex; i < kMaxValidFabricIndex; i++) + // Find an available slot. + for (auto & fabric : mStates) { - FabricInfo * fabric = FindFabricWithIndex(i); - if (fabric != nullptr && !fabric->IsInitialized()) + if (!fabric.IsInitialized()) { - ReturnErrorOnFailure(fabric->SetFabricInfo(newFabric)); - ReturnErrorOnFailure(Store(i)); - mNextAvailableFabricIndex = static_cast((i + 1) % UINT8_MAX); - *outputIndex = i; - mFabricCount++; - return CHIP_NO_ERROR; + FabricIndex newFabricIndex = mNextAvailableFabricIndex.Value(); + fabric.mFabricIndex = newFabricIndex; + CHIP_ERROR err = fabric.SetFabricInfo(newFabric); + if (err != CHIP_NO_ERROR) + { + fabric.Reset(); + return err; + } + + err = Store(newFabricIndex); + if (err != CHIP_NO_ERROR) + { + fabric.Reset(); + FabricInfo::DeleteFromStorage(mStorage, newFabricIndex); + return err; + } + + UpdateNextAvailableFabricIndex(); + err = StoreFabricIndexInfo(); + if (err != CHIP_NO_ERROR) + { + // Roll everything back. + mNextAvailableFabricIndex.SetValue(newFabricIndex); + fabric.Reset(); + FabricInfo::DeleteFromStorage(mStorage, newFabricIndex); + } + else + { + *outputIndex = newFabricIndex; + mFabricCount++; + } + return err; } } @@ -743,6 +750,22 @@ CHIP_ERROR FabricTable::Delete(FabricIndex index) // Since fabricIsInitialized was true, fabric is not null. fabric->Reset(); + // If we ever start moving the FabricInfo entries around in the array on + // delete, we should update DeleteAllFabrics to handle that. + + if (!mNextAvailableFabricIndex.HasValue()) + { + // We must have been in a situation where CHIP_CONFIG_MAX_FABRICS is 254 + // and our fabric table was full, so there was no valid next index. We + // have a single available index now, though; use it as + // mNextAvailableFabricIndex. + mNextAvailableFabricIndex.SetValue(index); + } + // If StoreFabricIndexInfo fails here, that's probably OK. When we try to + // read things from storage later we will realize there is nothing for this + // index. + StoreFabricIndexInfo(); + if (mDelegate != nullptr) { if (mFabricCount == 0) @@ -768,9 +791,9 @@ CHIP_ERROR FabricTable::Delete(FabricIndex index) void FabricTable::DeleteAllFabrics() { static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); - for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) + for (auto & fabric : *this) { - Delete(i); + Delete(fabric.GetFabricIndex()); } } @@ -785,13 +808,29 @@ CHIP_ERROR FabricTable::Init(PersistentStorageDelegate * storage) // iterator doesn't have mechanism to load fabric info from storage on demand. // TODO - Update ConstFabricIterator to load fabric info from storage static_assert(kMaxValidFabricIndex <= UINT8_MAX, "Cannot create more fabrics than UINT8_MAX"); - for (FabricIndex i = kMinValidFabricIndex; i <= kMaxValidFabricIndex; i++) + + mFabricCount = 0; + for (auto & fabric : mStates) { - FabricInfo * fabric = &mStates[i - kMinValidFabricIndex]; - if (LoadFromStorage(fabric) == CHIP_NO_ERROR) - { - mFabricCount++; - } + fabric.Reset(); + } + mNextAvailableFabricIndex.SetValue(kMinValidFabricIndex); + + uint8_t buf[IndexInfoTLVMaxSize()]; + uint16_t size = sizeof(buf); + DefaultStorageKeyAllocator keyAlloc; + CHIP_ERROR err = mStorage->SyncGetKeyValue(keyAlloc.FabricIndexInfo(), buf, size); + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + // No fabrics yet. Nothing to be done here. + } + else + { + ReturnErrorOnFailure(err); + TLV::ContiguousBufferTLVReader reader; + reader.Init(buf, size); + + ReturnErrorOnFailure(ReadFabricInfo(reader)); } return CHIP_NO_ERROR; @@ -813,17 +852,142 @@ CHIP_ERROR FabricTable::AddFabricDelegate(FabricTableDelegate * delegate) return CHIP_NO_ERROR; } -CHIP_ERROR formatKey(FabricIndex fabricIndex, MutableCharSpan formattedKey, const char * key) +namespace { +// Increment a fabric index in a way that ensures that it stays in the valid +// range [kMinValidFabricIndex, kMaxValidFabricIndex]. +FabricIndex NextFabricIndex(FabricIndex index) { - CHIP_ERROR err = CHIP_NO_ERROR; + if (index == kMaxValidFabricIndex) + { + return kMinValidFabricIndex; + } - int res = snprintf(formattedKey.data(), formattedKey.size(), "F%02X/%s", fabricIndex, key); - if (res < 0 || (size_t) res >= formattedKey.size()) + return static_cast(index + 1); +} +} // anonymous namespace + +void FabricTable::UpdateNextAvailableFabricIndex() +{ + // Only called when mNextAvailableFabricIndex.HasValue() + for (FabricIndex candidate = NextFabricIndex(mNextAvailableFabricIndex.Value()); candidate != mNextAvailableFabricIndex.Value(); + candidate = NextFabricIndex(candidate)) { - ChipLogError(Discovery, "Failed to format Key %s. snprintf error: %d", key, res); - return CHIP_ERROR_NO_MEMORY; + if (!FindFabricWithIndex(candidate)) + { + mNextAvailableFabricIndex.SetValue(candidate); + return; + } } - return err; + + mNextAvailableFabricIndex.ClearValue(); + return; +} + +CHIP_ERROR FabricTable::StoreFabricIndexInfo() const +{ + uint8_t buf[IndexInfoTLVMaxSize()]; + TLV::TLVWriter writer; + writer.Init(buf); + + TLV::TLVType outerType; + ReturnErrorOnFailure(writer.StartContainer(TLV::AnonymousTag(), TLV::kTLVType_Structure, outerType)); + + if (mNextAvailableFabricIndex.HasValue()) + { + writer.Put(kNextAvailableFabricIndexTag, mNextAvailableFabricIndex.Value()); + } + else + { + writer.PutNull(kNextAvailableFabricIndexTag); + } + + TLV::TLVType innerContainerType; + ReturnErrorOnFailure(writer.StartContainer(kFabricIndicesTag, TLV::kTLVType_Array, innerContainerType)); + // Only enumerate the fabrics that are initialized. + for (const auto & fabric : *this) + { + writer.Put(TLV::AnonymousTag(), fabric.GetFabricIndex()); + } + + ReturnErrorOnFailure(writer.EndContainer(innerContainerType)); + ReturnErrorOnFailure(writer.EndContainer(outerType)); + + const auto indexInfoLength = writer.GetLengthWritten(); + VerifyOrReturnError(CanCastTo(indexInfoLength), CHIP_ERROR_BUFFER_TOO_SMALL); + + DefaultStorageKeyAllocator keyAlloc; + ReturnErrorOnFailure(mStorage->SyncSetKeyValue(keyAlloc.FabricIndexInfo(), buf, static_cast(indexInfoLength))); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR FabricTable::ReadFabricInfo(TLV::ContiguousBufferTLVReader & reader) +{ + ReturnErrorOnFailure(reader.Next(TLV::kTLVType_Structure, TLV::AnonymousTag())); + TLV::TLVType containerType; + ReturnErrorOnFailure(reader.EnterContainer(containerType)); + + ReturnErrorOnFailure(reader.Next(kNextAvailableFabricIndexTag)); + if (reader.GetType() == TLV::kTLVType_Null) + { + mNextAvailableFabricIndex.ClearValue(); + } + else + { + ReturnErrorOnFailure(reader.Get(mNextAvailableFabricIndex.Emplace())); + } + + ReturnErrorOnFailure(reader.Next(TLV::kTLVType_Array, kFabricIndicesTag)); + TLV::TLVType arrayType; + ReturnErrorOnFailure(reader.EnterContainer(arrayType)); + + CHIP_ERROR err; + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (mFabricCount >= ArraySize(mStates)) + { + // We have nowhere to deserialize this fabric info into. + return CHIP_ERROR_NO_MEMORY; + } + + auto & fabric = mStates[mFabricCount]; + ReturnErrorOnFailure(reader.Get(fabric.mFabricIndex)); + + err = LoadFromStorage(&fabric); + if (err == CHIP_NO_ERROR) + { + ++mFabricCount; + } + else + { + // This could happen if we failed to store our fabric index info + // after we deleted the fabric from storage. Just ignore this + // fabric index and keep going. + } + } + + if (err != CHIP_END_OF_TLV) + { + return err; + } + + ReturnErrorOnFailure(reader.ExitContainer(arrayType)); + ReturnErrorOnFailure(reader.ExitContainer(containerType)); + ReturnErrorOnFailure(reader.VerifyEndOfContainer()); + + if (!mNextAvailableFabricIndex.HasValue() && mFabricCount < kMaxValidFabricIndex) + { + // We must have a fabric index available here. This situation could + // happen if we fail to store fabric index info when deleting a + // fabric. + mNextAvailableFabricIndex.SetValue(kMinValidFabricIndex); + if (FindFabricWithIndex(kMinValidFabricIndex)) + { + UpdateNextAvailableFabricIndex(); + } + } + + return CHIP_NO_ERROR; } CHIP_ERROR FabricInfo::TestOnlyBuildFabric(ByteSpan rootCert, ByteSpan icacCert, ByteSpan nocCert, ByteSpan nodePubKey, diff --git a/src/credentials/FabricTable.h b/src/credentials/FabricTable.h index 5d8bdd15710a7b..c87042ce1c5a41 100644 --- a/src/credentials/FabricTable.h +++ b/src/credentials/FabricTable.h @@ -44,8 +44,12 @@ namespace chip { -static constexpr FabricIndex kMinValidFabricIndex = 1; -static constexpr FabricIndex kMaxValidFabricIndex = std::min(UINT8_MAX - 1, CHIP_CONFIG_MAX_FABRICS); +static constexpr FabricIndex kMinValidFabricIndex = 1; +static constexpr FabricIndex kMaxValidFabricIndex = UINT8_MAX - 1; + +static_assert(kMinValidFabricIndex <= CHIP_CONFIG_MAX_FABRICS, "Must support some fabrics."); +static_assert(CHIP_CONFIG_MAX_FABRICS <= kMaxValidFabricIndex, "Max fabric count out of range."); + static constexpr uint8_t kFabricLabelMaxLengthInBytes = 32; static_assert(kUndefinedFabricIndex < chip::kMinValidFabricIndex, "Undefined fabric index should not be valid"); @@ -64,11 +68,7 @@ static_assert(kUndefinedFabricIndex < chip::kMinValidFabricIndex, "Undefined fab class DLL_EXPORT FabricInfo { public: - FabricInfo() - { - Reset(); - mFabric = kUndefinedFabricIndex; - } + FabricInfo() { Reset(); } // Returns a span into our internal storage. CharSpan GetFabricLabel() const { return CharSpan(mFabricLabel, strnlen(mFabricLabel, kFabricLabelMaxLengthInBytes)); } @@ -95,7 +95,7 @@ class DLL_EXPORT FabricInfo } FabricId GetFabricId() const { return mFabricId; } - FabricIndex GetFabricIndex() const { return mFabric; } + FabricIndex GetFabricIndex() const { return mFabricIndex; } CompressedFabricId GetCompressedId() const { return mOperationalId.GetCompressedFabricId(); } @@ -144,7 +144,7 @@ class DLL_EXPORT FabricInfo MutableByteSpan & destinationId) const; CHIP_ERROR MatchDestinationID(const ByteSpan & destinationId, const ByteSpan & initiatorRandom, const ByteSpan * ipkList, - size_t ipkListEntries); + size_t ipkListEntries) const; // TODO - Refactor storing and loading of fabric info from persistent storage. // The op cert array doesn't need to be in RAM except when it's being @@ -197,6 +197,7 @@ class DLL_EXPORT FabricInfo mOperationalKey = nullptr; } ReleaseOperationalCerts(); + mFabricIndex = kUndefinedFabricIndex; } CHIP_ERROR SetFabricInfo(FabricInfo & fabric); @@ -225,7 +226,7 @@ class DLL_EXPORT FabricInfo PeerId mOperationalId; - FabricIndex mFabric = kUndefinedFabricIndex; + FabricIndex mFabricIndex = kUndefinedFabricIndex; uint16_t mVendorId = VendorId::NotSpecified; char mFabricLabel[kFabricLabelMaxLengthInBytes + 1] = { '\0' }; @@ -372,7 +373,7 @@ class ConstFabricIterator class DLL_EXPORT FabricTable { public: - FabricTable() { Reset(); } + FabricTable() {} ~FabricTable(); CHIP_ERROR Store(FabricIndex index); @@ -400,8 +401,6 @@ class DLL_EXPORT FabricTable FabricIndex FindDestinationIDCandidate(const ByteSpan & destinationId, const ByteSpan & initiatorRandom, const ByteSpan * ipkList, size_t ipkListEntries); - void Reset(); - CHIP_ERROR Init(PersistentStorageDelegate * storage); CHIP_ERROR AddFabricDelegate(FabricTableDelegate * delegate); @@ -413,13 +412,45 @@ class DLL_EXPORT FabricTable ConstFabricIterator end() const { return cend(); } private: + static constexpr size_t IndexInfoTLVMaxSize() + { + // We have a single next-available index and an array of anonymous-tagged + // fabric indices. + // + // The max size of the list is (1 byte control + bytes for actual value) + // times max number of list items, plus one byte for the list terminator. + return TLV::EstimateStructOverhead(sizeof(FabricIndex), CHIP_CONFIG_MAX_FABRICS * (1 + sizeof(FabricIndex)) + 1); + } + + /** + * UpdateNextAvailableFabricIndex should only be called when + * mNextAvailableFabricIndex has a value and that value stops being + * available. It will set mNextAvailableFabricIndex to the next available + * value, or no value if there is none available. + */ + void UpdateNextAvailableFabricIndex(); + + /** + * Store our current fabric index state: what our next available index is + * and what indices we're using right now. + */ + CHIP_ERROR StoreFabricIndexInfo() const; + + /** + * Read our fabric index info from the given TLV reader and set up the + * fabric table accordingly. + */ + CHIP_ERROR ReadFabricInfo(TLV::ContiguousBufferTLVReader & reader); + FabricInfo mStates[CHIP_CONFIG_MAX_FABRICS]; PersistentStorageDelegate * mStorage = nullptr; FabricTableDelegate * mDelegate = nullptr; - FabricIndex mNextAvailableFabricIndex = kMinValidFabricIndex; - uint8_t mFabricCount = 0; + // We may not have an mNextAvailableFabricIndex if our table is as large as + // it can go and is full. + Optional mNextAvailableFabricIndex; + uint8_t mFabricCount = 0; }; } // namespace chip diff --git a/src/lib/support/DefaultStorageKeyAllocator.h b/src/lib/support/DefaultStorageKeyAllocator.h index 971e2f301b5e3d..fa1e3dcdfaae04 100644 --- a/src/lib/support/DefaultStorageKeyAllocator.h +++ b/src/lib/support/DefaultStorageKeyAllocator.h @@ -35,6 +35,7 @@ class DefaultStorageKeyAllocator const char * KeyName() { return mKeyName; } // Fabric Table + const char * FabricIndexInfo() { return Format("g/fidx"); } const char * FabricNOC(FabricIndex fabric) { return Format("f/%x/n", fabric); } const char * FabricICAC(FabricIndex fabric) { return Format("f/%x/i", fabric); } const char * FabricRCAC(FabricIndex fabric) { return Format("f/%x/r", fabric); } diff --git a/src/protocols/secure_channel/tests/TestCASESession.cpp b/src/protocols/secure_channel/tests/TestCASESession.cpp index 66f52f1e862678..252acda9d88aa6 100644 --- a/src/protocols/secure_channel/tests/TestCASESession.cpp +++ b/src/protocols/secure_channel/tests/TestCASESession.cpp @@ -685,8 +685,8 @@ int CASE_TestSecurePairing_Teardown(void * inContext) { gCommissionerStorageDelegate.Cleanup(); gDeviceStorageDelegate.Cleanup(); - gCommissionerFabrics.Reset(); - gDeviceFabrics.Reset(); + gCommissionerFabrics.DeleteAllFabrics(); + gDeviceFabrics.DeleteAllFabrics(); static_cast(inContext)->Shutdown(); return SUCCESS; } From e59b02eb33b494a05b782d9d17dd3d691fd32d13 Mon Sep 17 00:00:00 2001 From: Vijay Selvaraj Date: Thu, 24 Mar 2022 19:08:16 -0400 Subject: [PATCH 61/70] Created Trust Store using the Test Attestation PAA if paa-trust-store-path is not available (#16620) --- .github/.wordlist.txt | 1 + examples/chip-tool/README.md | 14 ++++++++++++++ examples/chip-tool/commands/common/CHIPCommand.cpp | 10 ++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 7d416e04f4b17f..8c987aacb69624 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -913,6 +913,7 @@ outgoingCommands OxygenConcentrationMeasurement OzoneConcentrationMeasurement PAA +PAAs PacketBuffer PAI PairDevice diff --git a/examples/chip-tool/README.md b/examples/chip-tool/README.md index 8424541088f710..c31348a1780e98 100644 --- a/examples/chip-tool/README.md +++ b/examples/chip-tool/README.md @@ -105,6 +105,20 @@ devices log when they start up) and try to pair with the first one it discovers. In all these cases, the device will be assigned node id `${NODE_ID_TO_ASSIGN}` (which must be a decimal number or a 0x-prefixed hex number). +#### Trust Store + +Trust store will be automatically created using the default Test Attestation +PAA. To use a different set of PAAs, pass the path using the optional parameter +--paa-trust-store-path while running the built executable. Trusted PAAs are +available at credentials/development/paa-root-certs/. + +The command below will select a set of trusted PAAs to be used during +Attestation Verification. It will also discover devices with long discriminator +3840 and try to pair with the first one it discovers using the provided setup +code. + + $ chip-tool pairing onnetwork-long ${NODE_ID_TO_ASSIGN} 20202021 3840 --paa-trust-store-path path/to/PAAs + ### Forget the currently-commissioned device $ chip-tool pairing unpair diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index 6edcda0252ac6e..51475fb1e06c3c 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -75,11 +75,13 @@ CHIP_ERROR CHIPCommand::Run() factoryInitParams.listenPort = port; ReturnLogErrorOnFailure(DeviceControllerFactory::GetInstance().Init(factoryInitParams)); - const chip::Credentials::AttestationTrustStore * trustStore = - GetTestFileAttestationTrustStore(mPaaTrustStorePath.HasValue() ? mPaaTrustStorePath.Value() : "."); - if (trustStore == nullptr) + const chip::Credentials::AttestationTrustStore * trustStore = mPaaTrustStorePath.HasValue() + ? GetTestFileAttestationTrustStore(mPaaTrustStorePath.Value()) + : chip::Credentials::GetTestAttestationTrustStore(); + ; + if (mPaaTrustStorePath.HasValue() && trustStore == nullptr) { - ChipLogError(chipTool, "No PAAs found in path: %s", mPaaTrustStorePath.HasValue() ? mPaaTrustStorePath.Value() : "."); + ChipLogError(chipTool, "No PAAs found in path: %s", mPaaTrustStorePath.Value()); ChipLogError(chipTool, "Please specify a valid path containing trusted PAA certificates using [--paa-trust-store-path paa/file/path] " "argument"); From 91f0c5af3cc349bb2e8215173cfd859ed622ee7c Mon Sep 17 00:00:00 2001 From: "Irene Siu (Apple)" Date: Thu, 24 Mar 2022 17:05:42 -0700 Subject: [PATCH 62/70] Add a watchdog timer to catch OTA process getting stuck (#16542) --- .../GenericOTARequestorDriver.cpp | 84 +++++++++++++++---- .../ota-requestor/GenericOTARequestorDriver.h | 12 ++- .../clusters/ota-requestor/OTARequestor.cpp | 7 +- .../ota-requestor/OTARequestorDriver.h | 10 +++ 4 files changed, 94 insertions(+), 19 deletions(-) diff --git a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp index cc2bdb109a82e3..a94a2aa2348fa2 100644 --- a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp +++ b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.cpp @@ -85,7 +85,7 @@ void GenericOTARequestorDriver::Init(OTARequestorInterface * requestor, OTAImage else { // Start the first periodic query timer - StartDefaultProviderTimer(); + StartSelectedTimer(SelectedTimer::kPeriodicQueryTimer); } } @@ -118,17 +118,23 @@ bool GenericOTARequestorDriver::ProviderLocationsEqual(const ProviderLocationTyp void GenericOTARequestorDriver::HandleError(UpdateFailureState state, CHIP_ERROR error) {} +void GenericOTARequestorDriver::HandleIdleStateExit() +{ + // Start watchdog timer to monitor new Query Image session + StartSelectedTimer(SelectedTimer::kWatchdogTimer); +} + void GenericOTARequestorDriver::HandleIdleState(IdleStateReason reason) { switch (reason) { case IdleStateReason::kUnknown: ChipLogProgress(SoftwareUpdate, "Unknown idle state reason so set the periodic timer for a next attempt"); - StartDefaultProviderTimer(); + StartSelectedTimer(SelectedTimer::kPeriodicQueryTimer); break; case IdleStateReason::kIdle: // There is no current OTA update in progress so start the periodic query timer - StartDefaultProviderTimer(); + StartSelectedTimer(SelectedTimer::kPeriodicQueryTimer); break; case IdleStateReason::kInvalidSession: // An invalid session is detected which may be temporary so try to query the same provider again @@ -201,7 +207,7 @@ void GenericOTARequestorDriver::UpdateNotFound(UpdateNotFoundReason reason, Syst else { ChipLogProgress(SoftwareUpdate, "UpdateNotFound, not scheduling further retries"); - StartDefaultProviderTimer(); + StartSelectedTimer(SelectedTimer::kPeriodicQueryTimer); } } @@ -240,7 +246,7 @@ void GenericOTARequestorDriver::UpdateDiscontinued() UpdateCancelled(); // Restart the periodic default provider timer - StartDefaultProviderTimer(); + StartSelectedTimer(SelectedTimer::kPeriodicQueryTimer); } // Cancel all OTA update timers @@ -336,15 +342,15 @@ void GenericOTARequestorDriver::SendQueryImage() UpdateCancelled(); // Default provider timer only runs when there is no ongoing query/update; must stop it now. - // TriggerImmediateQueryInternal() will cause the state to change from kIdle - StopDefaultProviderTimer(); + // TriggerImmediateQueryInternal() will cause the state to change from kIdle, which will start + // the Watchdog timer. (Clean this up with Issue#16151) mProviderRetryCount++; DeviceLayer::SystemLayer().ScheduleLambda([this] { mRequestor->TriggerImmediateQueryInternal(); }); } -void GenericOTARequestorDriver::DefaultProviderTimerHandler(System::Layer * systemLayer, void * appState) +void GenericOTARequestorDriver::PeriodicQueryTimerHandler(System::Layer * systemLayer, void * appState) { ChipLogProgress(SoftwareUpdate, "Default Provider timer handler is invoked"); @@ -353,7 +359,7 @@ void GenericOTARequestorDriver::DefaultProviderTimerHandler(System::Layer * syst bool listExhausted = false; if (GetNextProviderLocation(providerLocation, listExhausted) != true) { - StartDefaultProviderTimer(); + StartSelectedTimer(SelectedTimer::kPeriodicQueryTimer); return; } @@ -362,28 +368,76 @@ void GenericOTARequestorDriver::DefaultProviderTimerHandler(System::Layer * syst SendQueryImage(); } -void GenericOTARequestorDriver::StartDefaultProviderTimer() +void GenericOTARequestorDriver::StartPeriodicQueryTimer() { - ChipLogProgress(SoftwareUpdate, "Starting the Default Provider timer, timeout: %u seconds", + ChipLogProgress(SoftwareUpdate, "Starting the periodic query timer, timeout: %u seconds", (unsigned int) mPeriodicQueryTimeInterval); ScheduleDelayedAction( System::Clock::Seconds32(mPeriodicQueryTimeInterval), [](System::Layer *, void * context) { - (static_cast(context))->DefaultProviderTimerHandler(nullptr, context); + (static_cast(context))->PeriodicQueryTimerHandler(nullptr, context); }, this); } -void GenericOTARequestorDriver::StopDefaultProviderTimer() +void GenericOTARequestorDriver::StopPeriodicQueryTimer() { - ChipLogProgress(SoftwareUpdate, "Stopping the Default Provider timer"); + ChipLogProgress(SoftwareUpdate, "Stopping the Periodic Query timer"); CancelDelayedAction( [](System::Layer *, void * context) { - (static_cast(context))->DefaultProviderTimerHandler(nullptr, context); + (static_cast(context))->PeriodicQueryTimerHandler(nullptr, context); + }, + this); +} + +void GenericOTARequestorDriver::WatchdogTimerHandler(System::Layer * systemLayer, void * appState) +{ + ChipLogError(SoftwareUpdate, "Watchdog timer detects state stuck at %u. Cancelling download and resetting state.", + to_underlying(mRequestor->GetCurrentUpdateState())); + + // Something went wrong and OTA requestor is stuck in a non-idle state for too long. + // Let's just cancel download, reset state, and re-start periodic query timer. + UpdateDiscontinued(); + mRequestor->CancelImageUpdate(); + StartPeriodicQueryTimer(); +} + +void GenericOTARequestorDriver::StartWatchdogTimer() +{ + ChipLogProgress(SoftwareUpdate, "Starting the watchdog timer, timeout: %u seconds", (unsigned int) mWatchdogTimeInterval); + ScheduleDelayedAction( + System::Clock::Seconds32(mWatchdogTimeInterval), + [](System::Layer *, void * context) { + (static_cast(context))->WatchdogTimerHandler(nullptr, context); }, this); } +void GenericOTARequestorDriver::StopWatchdogTimer() +{ + ChipLogProgress(SoftwareUpdate, "Stopping the watchdog timer"); + CancelDelayedAction( + [](System::Layer *, void * context) { + (static_cast(context))->WatchdogTimerHandler(nullptr, context); + }, + this); +} + +void GenericOTARequestorDriver::StartSelectedTimer(SelectedTimer timer) +{ + switch (timer) + { + case SelectedTimer::kPeriodicQueryTimer: + StopWatchdogTimer(); + StartPeriodicQueryTimer(); + break; + case SelectedTimer::kWatchdogTimer: + StopPeriodicQueryTimer(); + StartWatchdogTimer(); + break; + } +} + /** * Returns the next available Provider location. The algorithm is to simply loop through the list of DefaultOtaProviders as a * circular list and return the next value (based on the last used provider). If the list of DefaultOtaProviders is empty, FALSE is diff --git a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h index 5b2e51762ea0c3..25bc2ba8a359cd 100644 --- a/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h +++ b/src/app/clusters/ota-requestor/GenericOTARequestorDriver.h @@ -56,6 +56,7 @@ class GenericOTARequestorDriver : public OTARequestorDriver bool CanConsent() override; uint16_t GetMaxDownloadBlockSize() override; void HandleError(UpdateFailureState state, CHIP_ERROR error) override; + void HandleIdleStateExit() override; void HandleIdleState(IdleStateReason reason) override; void UpdateAvailable(const UpdateDescription & update, System::Clock::Seconds32 delay) override; void UpdateNotFound(UpdateNotFoundReason reason, System::Clock::Seconds32 delay) override; @@ -71,9 +72,13 @@ class GenericOTARequestorDriver : public OTARequestorDriver bool GetNextProviderLocation(ProviderLocationType & providerLocation, bool & listExhausted) override; protected: - void StartDefaultProviderTimer(); - void StopDefaultProviderTimer(); - void DefaultProviderTimerHandler(System::Layer * systemLayer, void * appState); + void StartPeriodicQueryTimer(); + void StopPeriodicQueryTimer(); + void PeriodicQueryTimerHandler(System::Layer * systemLayer, void * appState); + void StartWatchdogTimer(); + void StopWatchdogTimer(); + void WatchdogTimerHandler(System::Layer * systemLayer, void * appState); + void StartSelectedTimer(SelectedTimer timer); void ScheduleDelayedAction(System::Clock::Seconds32 delay, System::TimerCompleteCallback action, void * aAppState); void CancelDelayedAction(System::TimerCompleteCallback action, void * aAppState); bool ProviderLocationsEqual(const ProviderLocationType & a, const ProviderLocationType & b); @@ -82,6 +87,7 @@ class GenericOTARequestorDriver : public OTARequestorDriver OTAImageProcessorInterface * mImageProcessor = nullptr; uint32_t mOtaStartDelaySec = 0; uint32_t mPeriodicQueryTimeInterval = (24 * 60 * 60); // Timeout for querying providers on the default OTA provider list + uint32_t mWatchdogTimeInterval = (6 * 60 * 60); // Timeout (in seconds) for checking if Requestor has reverted back to idle mode // Maximum number of times to retry a BUSY OTA provider before moving to the next available one static constexpr uint8_t kMaxBusyProviderRetryCount = 3; uint8_t mProviderRetryCount; // Track retry count for the current provider diff --git a/src/app/clusters/ota-requestor/OTARequestor.cpp b/src/app/clusters/ota-requestor/OTARequestor.cpp index f6b19f5981922c..561c29f5c7f582 100644 --- a/src/app/clusters/ota-requestor/OTARequestor.cpp +++ b/src/app/clusters/ota-requestor/OTARequestor.cpp @@ -400,7 +400,7 @@ void OTARequestor::CancelImageUpdate() mOtaRequestorDriver->UpdateCancelled(); - RecordNewUpdateState(OTAUpdateStateEnum::kIdle, OTAChangeReasonEnum::kUnknown); + Reset(); } CHIP_ERROR OTARequestor::GetUpdateStateProgressAttribute(EndpointId endpointId, app::DataModel::Nullable & progress) @@ -658,6 +658,7 @@ void OTARequestor::RecordNewUpdateState(OTAUpdateStateEnum newState, OTAChangeRe } OtaRequestorServerOnStateTransition(mCurrentUpdateState, newState, reason, targetSoftwareVersion); + // Issue#16151 tracks re-factoring error and state transitioning handling. if ((newState == OTAUpdateStateEnum::kIdle) && (mCurrentUpdateState != OTAUpdateStateEnum::kIdle)) { IdleStateReason idleStateReason = MapErrorToIdleStateReason(error); @@ -665,6 +666,10 @@ void OTARequestor::RecordNewUpdateState(OTAUpdateStateEnum newState, OTAChangeRe // Inform the driver that the OTARequestor has entered the Idle state mOtaRequestorDriver->HandleIdleState(idleStateReason); } + else if ((mCurrentUpdateState == OTAUpdateStateEnum::kIdle) && (newState != OTAUpdateStateEnum::kIdle)) + { + mOtaRequestorDriver->HandleIdleStateExit(); + } mCurrentUpdateState = newState; } diff --git a/src/app/clusters/ota-requestor/OTARequestorDriver.h b/src/app/clusters/ota-requestor/OTARequestorDriver.h index fe2e52fabb3788..6ed7a74e0e208c 100644 --- a/src/app/clusters/ota-requestor/OTARequestorDriver.h +++ b/src/app/clusters/ota-requestor/OTARequestorDriver.h @@ -69,6 +69,13 @@ enum class IdleStateReason kInvalidSession, }; +// The current selected OTA Requestor timer to be running +enum class SelectedTimer +{ + kPeriodicQueryTimer, + kWatchdogTimer, +}; + // Interface class to abstract the OTA-related business logic. Each application // must implement this interface. All calls must be non-blocking unless stated otherwise class OTARequestorDriver @@ -87,6 +94,9 @@ class OTARequestorDriver /// Called when an error occurs at any OTA requestor operation virtual void HandleError(UpdateFailureState state, CHIP_ERROR error) = 0; + /// Called when OTA Requestor has exited the Idle state for which the driver may need to take various actions + virtual void HandleIdleStateExit() = 0; + // Called when the OTA Requestor has entered the Idle state for which the driver may need to take various actions virtual void HandleIdleState(IdleStateReason reason) = 0; From 45f5ffc14c35a651f21e9f7bf761483f718d2da6 Mon Sep 17 00:00:00 2001 From: krypton36 Date: Thu, 24 Mar 2022 17:18:44 -0700 Subject: [PATCH 63/70] Fix false potive when the test does not connect to a device. (#16568) --- examples/chip-tool/commands/tests/TestCommand.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chip-tool/commands/tests/TestCommand.cpp b/examples/chip-tool/commands/tests/TestCommand.cpp index 2f08fa6a89f61c..36cd8b785ac4f1 100644 --- a/examples/chip-tool/commands/tests/TestCommand.cpp +++ b/examples/chip-tool/commands/tests/TestCommand.cpp @@ -53,7 +53,7 @@ void TestCommand::OnDeviceConnectionFailureFn(void * context, PeerId peerId, CHI auto * command = static_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "Test command context is null")); - LogErrorOnFailure(command->ContinueOnChipMainThread(CHIP_NO_ERROR)); + LogErrorOnFailure(command->ContinueOnChipMainThread(error)); } void TestCommand::Exit(std::string message) From a49813adb44c8813898e21f52e8c1b587248ffe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Fri, 25 Mar 2022 01:23:29 +0100 Subject: [PATCH 64/70] [nrfconnect] Fix OTA initialization order (#16609) Recent OTA changes impose an assumption that OTA Requestor must be initialized prior to the OTA Requestor driver. Fix the order and extract OTA requestor initialization to a common function to reduce code duplication in the future. --- .github/workflows/examples-nrfconnect.yaml | 2 +- .../nrfconnect/CMakeLists.txt | 5 +- .../nrfconnect/main/AppTask.cpp | 20 +++---- .../nrfconnect/main/include/AppTask.h | 16 ----- .../lighting-app/nrfconnect/CMakeLists.txt | 4 ++ .../lighting-app/nrfconnect/main/AppTask.cpp | 27 +-------- .../nrfconnect/main/include/AppTask.h | 1 - examples/lock-app/nrfconnect/CMakeLists.txt | 4 ++ examples/lock-app/nrfconnect/main/AppTask.cpp | 27 +-------- .../nrfconnect/main/include/AppTask.h | 1 - examples/platform/nrfconnect/util/OTAUtil.cpp | 58 +++++++++++++++++++ .../nrfconnect/util/include/OTAUtil.h | 37 +++++++----- examples/pump-app/nrfconnect/CMakeLists.txt | 4 ++ examples/pump-app/nrfconnect/main/AppTask.cpp | 27 +-------- .../nrfconnect/main/include/AppTask.h | 1 - .../nrfconnect/CMakeLists.txt | 4 ++ .../nrfconnect/main/AppTask.cpp | 27 +-------- .../nrfconnect/main/include/AppTask.h | 1 - 18 files changed, 119 insertions(+), 147 deletions(-) create mode 100644 examples/platform/nrfconnect/util/OTAUtil.cpp diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 48db1803792002..715d858646040a 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -111,7 +111,7 @@ jobs: /tmp/bloat_reports/ - name: Build example nRF Connect SDK Lighting App on nRF52840 DK with RPC if: github.event_name == 'push' || steps.changed_paths.outputs.nrfconnect == 'true' - timeout-minutes: 10 + timeout-minutes: 20 run: | scripts/examples/nrfconnect_example.sh lighting-app nrf52840dk_nrf52840 -DOVERLAY_CONFIG=rpc.overlay .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ diff --git a/examples/all-clusters-app/nrfconnect/CMakeLists.txt b/examples/all-clusters-app/nrfconnect/CMakeLists.txt index 8d51e9c7e8fd27..ea6962845cdf1a 100644 --- a/examples/all-clusters-app/nrfconnect/CMakeLists.txt +++ b/examples/all-clusters-app/nrfconnect/CMakeLists.txt @@ -73,8 +73,11 @@ target_sources(app PRIVATE ${GEN_DIR}/all-clusters-app/zap-generated/IMClusterCommandHandler.cpp ${NRFCONNECT_COMMON}/util/LEDWidget.cpp) - chip_configure_data_model(app INCLUDE_SERVER ZAP_FILE ${ALL_CLUSTERS_COMMON_DIR}/all-clusters-app.zap ) + +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() diff --git a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp index 60317685df384a..2cc10a47512849 100644 --- a/examples/all-clusters-app/nrfconnect/main/AppTask.cpp +++ b/examples/all-clusters-app/nrfconnect/main/AppTask.cpp @@ -31,6 +31,10 @@ #include #include +#if CONFIG_CHIP_OTA_REQUESTOR +#include "OTAUtil.h" +#endif + #include #include #include @@ -127,9 +131,11 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE)); - InitOTARequestor(); // Add CHIP event handler and start CHIP thread. // Note that all the initialization code should happen prior to this point to avoid data races @@ -144,18 +150,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - OTAImageProcessorNrf::Get().SetOTADownloader(&mBDXDownloader); - mBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); - mOTARequestorDriver.Init(&mOTARequestor, &OTAImageProcessorNrf::Get()); - mOTARequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); - mOTARequestor.Init(chip::Server::GetInstance(), mOTARequestorStorage, mOTARequestorDriver, mBDXDownloader); - chip::SetRequestorInstance(&mOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); diff --git a/examples/all-clusters-app/nrfconnect/main/include/AppTask.h b/examples/all-clusters-app/nrfconnect/main/include/AppTask.h index 6f0e00ea247a78..e7402653f7237c 100644 --- a/examples/all-clusters-app/nrfconnect/main/include/AppTask.h +++ b/examples/all-clusters-app/nrfconnect/main/include/AppTask.h @@ -19,14 +19,6 @@ #include -#if CONFIG_CHIP_OTA_REQUESTOR -#include "OTAUtil.h" -#include -#include -#include -#include -#endif - struct k_timer; class AppEvent; class LEDWidget; @@ -51,7 +43,6 @@ class AppTask CHIP_ERROR Init(); void DispatchEvent(AppEvent * aEvent); - void InitOTARequestor(); // statics needed to interact with zephyr C API static void CancelTimer(void); @@ -72,11 +63,4 @@ class AppTask bool mIsThreadProvisioned{ false }; bool mIsThreadEnabled{ false }; bool mHaveBLEConnections{ false }; - -#if CONFIG_CHIP_OTA_REQUESTOR - chip::DefaultOTARequestorStorage mOTARequestorStorage; - chip::DeviceLayer::GenericOTARequestorDriver mOTARequestorDriver; - chip::BDXDownloader mBDXDownloader; - chip::OTARequestor mOTARequestor; -#endif }; diff --git a/examples/lighting-app/nrfconnect/CMakeLists.txt b/examples/lighting-app/nrfconnect/CMakeLists.txt index 1656937b0b050a..c3a87f4b99ced2 100644 --- a/examples/lighting-app/nrfconnect/CMakeLists.txt +++ b/examples/lighting-app/nrfconnect/CMakeLists.txt @@ -100,6 +100,10 @@ chip_configure_data_model(app GEN_DIR ${GEN_DIR}/lighting-app/zap-generated ) +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() + if(BUILD_WITH_DFU STREQUAL "BLE") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/lighting-app/nrfconnect/main/AppTask.cpp b/examples/lighting-app/nrfconnect/main/AppTask.cpp index 064f8b7738ad64..a05cca313beb5b 100644 --- a/examples/lighting-app/nrfconnect/main/AppTask.cpp +++ b/examples/lighting-app/nrfconnect/main/AppTask.cpp @@ -41,10 +41,6 @@ #if CONFIG_CHIP_OTA_REQUESTOR #include "OTAUtil.h" -#include -#include -#include -#include #endif #include @@ -85,13 +81,6 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; -#if CONFIG_CHIP_OTA_REQUESTOR -DefaultOTARequestorStorage sRequestorStorage; -GenericOTARequestorDriver sOTARequestorDriver; -chip::BDXDownloader sBDXDownloader; -chip::OTARequestor sOTARequestor; -#endif - } // namespace AppTask AppTask::sAppTask; @@ -178,9 +167,11 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - InitOTARequestor(); chip::app::DnssdServer::Instance().SetExtendedDiscoveryTimeoutSecs(kExtDiscoveryTimeoutSecs); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); @@ -198,18 +189,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); - sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); - chip::SetRequestorInstance(&sOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); diff --git a/examples/lighting-app/nrfconnect/main/include/AppTask.h b/examples/lighting-app/nrfconnect/main/include/AppTask.h index 2f635e8d44afbb..71767b76284584 100644 --- a/examples/lighting-app/nrfconnect/main/include/AppTask.h +++ b/examples/lighting-app/nrfconnect/main/include/AppTask.h @@ -56,7 +56,6 @@ class AppTask friend AppTask & GetAppTask(void); CHIP_ERROR Init(); - void InitOTARequestor(); static void ActionInitiated(LightingManager::Action_t aAction, int32_t aActor); static void ActionCompleted(LightingManager::Action_t aAction, int32_t aActor); diff --git a/examples/lock-app/nrfconnect/CMakeLists.txt b/examples/lock-app/nrfconnect/CMakeLists.txt index 44d8a35b11b8ff..9c813ca962a5c4 100644 --- a/examples/lock-app/nrfconnect/CMakeLists.txt +++ b/examples/lock-app/nrfconnect/CMakeLists.txt @@ -91,6 +91,10 @@ chip_configure_data_model(app ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../lock-common/lock-app.zap ) +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() + if(BUILD_WITH_DFU STREQUAL "BLE") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/lock-app/nrfconnect/main/AppTask.cpp b/examples/lock-app/nrfconnect/main/AppTask.cpp index fb7cdfc7e3f671..42219b1dcffb07 100644 --- a/examples/lock-app/nrfconnect/main/AppTask.cpp +++ b/examples/lock-app/nrfconnect/main/AppTask.cpp @@ -37,10 +37,6 @@ #if CONFIG_CHIP_OTA_REQUESTOR #include "OTAUtil.h" -#include -#include -#include -#include #endif #include @@ -74,13 +70,6 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; -#if CONFIG_CHIP_OTA_REQUESTOR -DefaultOTARequestorStorage sRequestorStorage; -GenericOTARequestorDriver sOTARequestorDriver; -chip::BDXDownloader sBDXDownloader; -chip::OTARequestor sOTARequestor; -#endif - } // namespace AppTask AppTask::sAppTask; @@ -160,8 +149,10 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - InitOTARequestor(); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); @@ -179,18 +170,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); - sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); - sRequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); - sOTARequestor.Init(Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); - chip::SetRequestorInstance(&sOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); diff --git a/examples/lock-app/nrfconnect/main/include/AppTask.h b/examples/lock-app/nrfconnect/main/include/AppTask.h index 1106723152b261..2789d15a41e229 100644 --- a/examples/lock-app/nrfconnect/main/include/AppTask.h +++ b/examples/lock-app/nrfconnect/main/include/AppTask.h @@ -44,7 +44,6 @@ class AppTask friend AppTask & GetAppTask(void); CHIP_ERROR Init(); - void InitOTARequestor(); static void ActionInitiated(BoltLockManager::Action_t aAction, int32_t aActor); static void ActionCompleted(BoltLockManager::Action_t aAction, int32_t aActor); diff --git a/examples/platform/nrfconnect/util/OTAUtil.cpp b/examples/platform/nrfconnect/util/OTAUtil.cpp new file mode 100644 index 00000000000000..01e71b44b48c46 --- /dev/null +++ b/examples/platform/nrfconnect/util/OTAUtil.cpp @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2022 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; +using namespace chip::DeviceLayer; + +namespace { + +DefaultOTARequestorStorage sOTARequestorStorage; +GenericOTARequestorDriver sOTARequestorDriver; +chip::BDXDownloader sBDXDownloader; +chip::OTARequestor sOTARequestor; + +} // namespace + +// compile-time factory method +OTAImageProcessorImpl & GetOTAImageProcessor() +{ +#if CONFIG_PM_DEVICE && CONFIG_NORDIC_QSPI_NOR + static ExtFlashHandler sQSPIHandler; + static OTAImageProcessorImplPMDevice sOTAImageProcessor{ sQSPIHandler }; +#else + static OTAImageProcessorImpl sOTAImageProcessor; +#endif + return sOTAImageProcessor; +} + +void InitBasicOTARequestor() +{ + OTAImageProcessorImpl & imageProcessor = GetOTAImageProcessor(); + imageProcessor.SetOTADownloader(&sBDXDownloader); + sBDXDownloader.SetImageProcessorDelegate(&imageProcessor); + sOTARequestorStorage.Init(Server::GetInstance().GetPersistentStorage()); + sOTARequestor.Init(Server::GetInstance(), sOTARequestorStorage, sOTARequestorDriver, sBDXDownloader); + sOTARequestorDriver.Init(&sOTARequestor, &imageProcessor); + chip::SetRequestorInstance(&sOTARequestor); +} diff --git a/examples/platform/nrfconnect/util/include/OTAUtil.h b/examples/platform/nrfconnect/util/include/OTAUtil.h index e8dac963145df7..bd7e174ebc822e 100644 --- a/examples/platform/nrfconnect/util/include/OTAUtil.h +++ b/examples/platform/nrfconnect/util/include/OTAUtil.h @@ -17,21 +17,26 @@ #pragma once -#include +namespace chip { +namespace DeviceLayer { +class OTAImageProcessorImpl; +} // namespace DeviceLayer +} // namespace chip -#ifdef CONFIG_CHIP_OTA_REQUESTOR -namespace OTAImageProcessorNrf { -// compile-time factory method -inline chip::DeviceLayer::OTAImageProcessorImpl & Get() -{ -#if CONFIG_PM_DEVICE && CONFIG_NORDIC_QSPI_NOR - static chip::DeviceLayer::ExtFlashHandler sQSPIHandler; - static chip::DeviceLayer::OTAImageProcessorImplPMDevice sOTAImageProcessor{ sQSPIHandler }; -#else - static chip::DeviceLayer::OTAImageProcessorImpl sOTAImageProcessor; -#endif - return sOTAImageProcessor; -} -} // namespace OTAImageProcessorNrf +/** + * Select recommended OTA image processor implementation. + * + * If the application uses QSPI external flash and enables API for controlling + * power states of peripherals, select the implementation that automatically + * powers off the external flash when no longer needed. Otherwise, select the + * most basic implementation. + */ +chip::DeviceLayer::OTAImageProcessorImpl & GetOTAImageProcessor(); -#endif +/** Initialize basic OTA requestor. + * + * Initialize all necessary components and start the OTA requestor state machine. + * Assume that the device is not able to ask a user for consent before applying + * an update so the confirmation must be done on the OTA provider side. + */ +void InitBasicOTARequestor(); diff --git a/examples/pump-app/nrfconnect/CMakeLists.txt b/examples/pump-app/nrfconnect/CMakeLists.txt index 4893797c5ab8cf..c251817163c0e6 100644 --- a/examples/pump-app/nrfconnect/CMakeLists.txt +++ b/examples/pump-app/nrfconnect/CMakeLists.txt @@ -91,6 +91,10 @@ chip_configure_data_model(app ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../pump-common/pump-app.zap ) +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() + if(BUILD_WITH_DFU STREQUAL "BLE") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/pump-app/nrfconnect/main/AppTask.cpp b/examples/pump-app/nrfconnect/main/AppTask.cpp index c448c5aeaa3de1..8321807aeed371 100644 --- a/examples/pump-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-app/nrfconnect/main/AppTask.cpp @@ -38,10 +38,6 @@ #if CONFIG_CHIP_OTA_REQUESTOR #include "OTAUtil.h" -#include -#include -#include -#include #endif #include @@ -77,13 +73,6 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; -#if CONFIG_CHIP_OTA_REQUESTOR -DefaultOTARequestorStorage sRequestorStorage; -GenericOTARequestorDriver sOTARequestorDriver; -chip::BDXDownloader sBDXDownloader; -chip::OTARequestor sOTARequestor; -#endif - } // namespace AppTask AppTask::sAppTask; @@ -157,8 +146,10 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - InitOTARequestor(); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); @@ -176,18 +167,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); - sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); - sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); - sOTARequestor.Init(chip::Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); - chip::SetRequestorInstance(&sOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); diff --git a/examples/pump-app/nrfconnect/main/include/AppTask.h b/examples/pump-app/nrfconnect/main/include/AppTask.h index 42efbc747020f6..7ca19cdc923f5c 100644 --- a/examples/pump-app/nrfconnect/main/include/AppTask.h +++ b/examples/pump-app/nrfconnect/main/include/AppTask.h @@ -44,7 +44,6 @@ class AppTask friend AppTask & GetAppTask(void); CHIP_ERROR Init(); - void InitOTARequestor(); static void ActionInitiated(PumpManager::Action_t aAction, int32_t aActor); static void ActionCompleted(PumpManager::Action_t aAction, int32_t aActor); diff --git a/examples/pump-controller-app/nrfconnect/CMakeLists.txt b/examples/pump-controller-app/nrfconnect/CMakeLists.txt index 337fded4b30b23..f71527619100db 100644 --- a/examples/pump-controller-app/nrfconnect/CMakeLists.txt +++ b/examples/pump-controller-app/nrfconnect/CMakeLists.txt @@ -91,6 +91,10 @@ chip_configure_data_model(app ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../pump-controller-common/pump-controller-app.zap ) +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/OTAUtil.cpp) +endif() + if(BUILD_WITH_DFU STREQUAL "BLE") target_sources(app PRIVATE ${NRFCONNECT_COMMON}/util/DFUOverSMP.cpp) endif() diff --git a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp index aea8dca3512337..e3d7148dfac823 100644 --- a/examples/pump-controller-app/nrfconnect/main/AppTask.cpp +++ b/examples/pump-controller-app/nrfconnect/main/AppTask.cpp @@ -38,10 +38,6 @@ #if CONFIG_CHIP_OTA_REQUESTOR #include "OTAUtil.h" -#include -#include -#include -#include #endif #include @@ -74,13 +70,6 @@ bool sIsThreadProvisioned = false; bool sIsThreadEnabled = false; bool sHaveBLEConnections = false; -#if CONFIG_CHIP_OTA_REQUESTOR -DefaultOTARequestorStorage sRequestorStorage; -GenericOTARequestorDriver sOTARequestorDriver; -chip::BDXDownloader sBDXDownloader; -chip::OTARequestor sOTARequestor; -#endif - } // namespace AppTask AppTask::sAppTask; @@ -154,8 +143,10 @@ CHIP_ERROR AppTask::Init() // Initialize CHIP server SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); - InitOTARequestor(); ReturnErrorOnFailure(chip::Server::GetInstance().Init()); +#if CONFIG_CHIP_OTA_REQUESTOR + InitBasicOTARequestor(); +#endif ConfigurationMgr().LogDeviceConfig(); PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); @@ -173,18 +164,6 @@ CHIP_ERROR AppTask::Init() return err; } -void AppTask::InitOTARequestor() -{ -#if CONFIG_CHIP_OTA_REQUESTOR - OTAImageProcessorNrf::Get().SetOTADownloader(&sBDXDownloader); - sBDXDownloader.SetImageProcessorDelegate(&OTAImageProcessorNrf::Get()); - sOTARequestorDriver.Init(&sOTARequestor, &OTAImageProcessorNrf::Get()); - sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage()); - sOTARequestor.Init(chip::Server::GetInstance(), sRequestorStorage, sOTARequestorDriver, sBDXDownloader); - chip::SetRequestorInstance(&sOTARequestor); -#endif -} - CHIP_ERROR AppTask::StartApp() { ReturnErrorOnFailure(Init()); diff --git a/examples/pump-controller-app/nrfconnect/main/include/AppTask.h b/examples/pump-controller-app/nrfconnect/main/include/AppTask.h index 42efbc747020f6..7ca19cdc923f5c 100644 --- a/examples/pump-controller-app/nrfconnect/main/include/AppTask.h +++ b/examples/pump-controller-app/nrfconnect/main/include/AppTask.h @@ -44,7 +44,6 @@ class AppTask friend AppTask & GetAppTask(void); CHIP_ERROR Init(); - void InitOTARequestor(); static void ActionInitiated(PumpManager::Action_t aAction, int32_t aActor); static void ActionCompleted(PumpManager::Action_t aAction, int32_t aActor); From 0849adb926e57541126b8c1e2286d04bb76c34cc Mon Sep 17 00:00:00 2001 From: Michael Rupp <95718139+mykrupp@users.noreply.github.com> Date: Thu, 24 Mar 2022 20:36:06 -0400 Subject: [PATCH 65/70] add space to gn_efr32_example.sh (#16643) --- scripts/examples/gn_efr32_example.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/examples/gn_efr32_example.sh b/scripts/examples/gn_efr32_example.sh index 1b0bf0ff50e3c1..0ce40ef66d7287 100755 --- a/scripts/examples/gn_efr32_example.sh +++ b/scripts/examples/gn_efr32_example.sh @@ -159,7 +159,7 @@ else arm-none-eabi-size -A "$BUILD_DIR"/*.out # Generate bootloader file - if [ "${BUILD_DIR:0:2}" == "./"]; then + if [ "${BUILD_DIR:0:2}" == "./" ]; then BUILD_DIR_TRIMMED="${BUILD_DIR:2}" S37_PATH=$(find "$BUILD_DIR_TRIMMED" -type f -name "*.s37") if [ -z "$S37_PATH" ]; then From 4ea2baebb2faa06e4e0dc3c82f90474cec02db70 Mon Sep 17 00:00:00 2001 From: krypton36 Date: Thu, 24 Mar 2022 17:36:32 -0700 Subject: [PATCH 66/70] Resolve wait on subscriptions for attributes. (#16644) * Allow waiting for subscription notifications. * Generated code. --- .../chip-tool-darwin/templates/commands.zapt | 4 +- .../zap-generated/cluster/Commands.h | 3188 ++++++++++++----- 2 files changed, 2367 insertions(+), 825 deletions(-) diff --git a/examples/chip-tool-darwin/templates/commands.zapt b/examples/chip-tool-darwin/templates/commands.zapt index 66b97aebb9bdeb..61ad1914a2abbd 100644 --- a/examples/chip-tool-darwin/templates/commands.zapt +++ b/examples/chip-tool-darwin/templates/commands.zapt @@ -235,7 +235,9 @@ public: params:params subscriptionEstablished: NULL reportHandler:^({{asObjectiveCClass type parent.name}} * _Nullable value, NSError * _Nullable error) { NSLog(@"{{asUpperCamelCase parent.name}}.{{asUpperCamelCase name}} response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait){ + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; diff --git a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h index 610f0d56a7f960..c3a5302311b1c8 100644 --- a/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool-darwin/zap-generated/cluster/Commands.h @@ -230,7 +230,9 @@ class SubscribeAttributeAccessControlAcl : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.Acl response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -307,7 +309,9 @@ class SubscribeAttributeAccessControlExtension : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.Extension response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -383,7 +387,9 @@ class SubscribeAttributeAccessControlGeneratedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -459,7 +465,9 @@ class SubscribeAttributeAccessControlAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -534,7 +542,9 @@ class SubscribeAttributeAccessControlAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -609,7 +619,9 @@ class SubscribeAttributeAccessControlClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccessControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -809,7 +821,9 @@ class SubscribeAttributeAccountLoginGeneratedCommandList : public ModelCommand { reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -885,7 +899,9 @@ class SubscribeAttributeAccountLoginAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -960,7 +976,9 @@ class SubscribeAttributeAccountLoginAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1035,7 +1053,9 @@ class SubscribeAttributeAccountLoginClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AccountLogin.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1251,7 +1271,9 @@ class SubscribeAttributeAdministratorCommissioningWindowStatus : public ModelCom subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.WindowStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1331,7 +1353,9 @@ class SubscribeAttributeAdministratorCommissioningAdminFabricIndex : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AdminFabricIndex response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1411,7 +1435,9 @@ class SubscribeAttributeAdministratorCommissioningAdminVendorId : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AdminVendorId response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1491,7 +1517,9 @@ class SubscribeAttributeAdministratorCommissioningGeneratedCommandList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1571,7 +1599,9 @@ class SubscribeAttributeAdministratorCommissioningAcceptedCommandList : public M reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1651,7 +1681,9 @@ class SubscribeAttributeAdministratorCommissioningAttributeList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1731,7 +1763,9 @@ class SubscribeAttributeAdministratorCommissioningClusterRevision : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AdministratorCommissioning.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1833,7 +1867,9 @@ class SubscribeAttributeApplicationBasicVendorName : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.VendorName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1912,7 +1948,9 @@ class SubscribeAttributeApplicationBasicVendorID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.VendorID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -1991,7 +2029,9 @@ class SubscribeAttributeApplicationBasicApplicationName : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ApplicationName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2070,7 +2110,9 @@ class SubscribeAttributeApplicationBasicProductID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ProductID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2152,7 +2194,9 @@ class SubscribeAttributeApplicationBasicApplication : public ModelCommand { reportHandler:^(CHIPApplicationBasicClusterApplicationBasicApplication * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.Application response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2231,7 +2275,9 @@ class SubscribeAttributeApplicationBasicStatus : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.Status response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2311,7 +2357,9 @@ class SubscribeAttributeApplicationBasicApplicationVersion : public ModelCommand reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ApplicationVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2391,7 +2439,9 @@ class SubscribeAttributeApplicationBasicAllowedVendorList : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AllowedVendorList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2471,7 +2521,9 @@ class SubscribeAttributeApplicationBasicGeneratedCommandList : public ModelComma reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2551,7 +2603,9 @@ class SubscribeAttributeApplicationBasicAcceptedCommandList : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2630,7 +2684,9 @@ class SubscribeAttributeApplicationBasicAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2709,7 +2765,9 @@ class SubscribeAttributeApplicationBasicClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationBasic.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -2919,7 +2977,9 @@ class SubscribeAttributeApplicationLauncherCatalogList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.CatalogList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3034,7 +3094,9 @@ class SubscribeAttributeApplicationLauncherCurrentApp : public ModelCommand { reportHandler:^(CHIPApplicationLauncherClusterApplicationEP * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.CurrentApp response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3114,7 +3176,9 @@ class SubscribeAttributeApplicationLauncherGeneratedCommandList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3194,7 +3258,9 @@ class SubscribeAttributeApplicationLauncherAcceptedCommandList : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3273,7 +3339,9 @@ class SubscribeAttributeApplicationLauncherAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3353,7 +3421,9 @@ class SubscribeAttributeApplicationLauncherClusterRevision : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ApplicationLauncher.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3518,7 +3588,9 @@ class SubscribeAttributeAudioOutputOutputList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.OutputList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3593,7 +3665,9 @@ class SubscribeAttributeAudioOutputCurrentOutput : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.CurrentOutput response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3669,7 +3743,9 @@ class SubscribeAttributeAudioOutputGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3745,7 +3821,9 @@ class SubscribeAttributeAudioOutputAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3820,7 +3898,9 @@ class SubscribeAttributeAudioOutputAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -3895,7 +3975,9 @@ class SubscribeAttributeAudioOutputClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"AudioOutput.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4061,7 +4143,9 @@ class SubscribeAttributeBarrierControlBarrierMovingState : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.BarrierMovingState response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4137,7 +4221,9 @@ class SubscribeAttributeBarrierControlBarrierSafetyStatus : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.BarrierSafetyStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4213,7 +4299,9 @@ class SubscribeAttributeBarrierControlBarrierCapabilities : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.BarrierCapabilities response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4288,7 +4376,9 @@ class SubscribeAttributeBarrierControlBarrierPosition : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.BarrierPosition response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4364,7 +4454,9 @@ class SubscribeAttributeBarrierControlGeneratedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4440,7 +4532,9 @@ class SubscribeAttributeBarrierControlAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4515,7 +4609,9 @@ class SubscribeAttributeBarrierControlAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4590,7 +4686,9 @@ class SubscribeAttributeBarrierControlClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BarrierControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4704,7 +4802,9 @@ class SubscribeAttributeBasicDataModelRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.DataModelRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4779,7 +4879,9 @@ class SubscribeAttributeBasicVendorName : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.VendorName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4854,7 +4956,9 @@ class SubscribeAttributeBasicVendorID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.VendorID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -4929,7 +5033,9 @@ class SubscribeAttributeBasicProductName : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.ProductName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5004,7 +5110,9 @@ class SubscribeAttributeBasicProductID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.ProductID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5115,7 +5223,9 @@ class SubscribeAttributeBasicNodeLabel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.NodeLabel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5226,7 +5336,9 @@ class SubscribeAttributeBasicLocation : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.Location response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5301,7 +5413,9 @@ class SubscribeAttributeBasicHardwareVersion : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.HardwareVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5377,7 +5491,9 @@ class SubscribeAttributeBasicHardwareVersionString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.HardwareVersionString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5452,7 +5568,9 @@ class SubscribeAttributeBasicSoftwareVersion : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.SoftwareVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5528,7 +5646,9 @@ class SubscribeAttributeBasicSoftwareVersionString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.SoftwareVersionString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5603,7 +5723,9 @@ class SubscribeAttributeBasicManufacturingDate : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.ManufacturingDate response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5678,7 +5800,9 @@ class SubscribeAttributeBasicPartNumber : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.PartNumber response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5753,7 +5877,9 @@ class SubscribeAttributeBasicProductURL : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.ProductURL response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5828,7 +5954,9 @@ class SubscribeAttributeBasicProductLabel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.ProductLabel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -5903,7 +6031,9 @@ class SubscribeAttributeBasicSerialNumber : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.SerialNumber response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6012,7 +6142,9 @@ class SubscribeAttributeBasicLocalConfigDisabled : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.LocalConfigDisabled response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6087,7 +6219,9 @@ class SubscribeAttributeBasicReachable : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.Reachable response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6162,7 +6296,9 @@ class SubscribeAttributeBasicUniqueID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.UniqueID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6237,7 +6373,9 @@ class SubscribeAttributeBasicGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6312,7 +6450,9 @@ class SubscribeAttributeBasicAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6387,7 +6527,9 @@ class SubscribeAttributeBasicAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6462,7 +6604,9 @@ class SubscribeAttributeBasicClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Basic.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6601,7 +6745,9 @@ class SubscribeAttributeBinaryInputBasicOutOfService : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.OutOfService response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6716,7 +6862,9 @@ class SubscribeAttributeBinaryInputBasicPresentValue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.PresentValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6795,7 +6943,9 @@ class SubscribeAttributeBinaryInputBasicStatusFlags : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.StatusFlags response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6875,7 +7025,9 @@ class SubscribeAttributeBinaryInputBasicGeneratedCommandList : public ModelComma reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -6955,7 +7107,9 @@ class SubscribeAttributeBinaryInputBasicAcceptedCommandList : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7034,7 +7188,9 @@ class SubscribeAttributeBinaryInputBasicAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7113,7 +7269,9 @@ class SubscribeAttributeBinaryInputBasicClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BinaryInputBasic.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7206,7 +7364,9 @@ class SubscribeAttributeBindingBinding : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.Binding response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7282,7 +7442,9 @@ class SubscribeAttributeBindingGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7357,7 +7519,9 @@ class SubscribeAttributeBindingAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7432,7 +7596,9 @@ class SubscribeAttributeBindingAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7507,7 +7673,9 @@ class SubscribeAttributeBindingClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Binding.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7599,7 +7767,9 @@ class SubscribeAttributeBooleanStateStateValue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.StateValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7675,7 +7845,9 @@ class SubscribeAttributeBooleanStateGeneratedCommandList : public ModelCommand { reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7751,7 +7923,9 @@ class SubscribeAttributeBooleanStateAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7826,7 +8000,9 @@ class SubscribeAttributeBooleanStateAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -7901,7 +8077,9 @@ class SubscribeAttributeBooleanStateClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BooleanState.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8467,7 +8645,9 @@ class SubscribeAttributeBridgedActionsActionList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.ActionList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8542,7 +8722,9 @@ class SubscribeAttributeBridgedActionsEndpointList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.EndpointList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8617,7 +8799,9 @@ class SubscribeAttributeBridgedActionsSetupUrl : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.SetupUrl response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8693,7 +8877,9 @@ class SubscribeAttributeBridgedActionsGeneratedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8769,7 +8955,9 @@ class SubscribeAttributeBridgedActionsAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8844,7 +9032,9 @@ class SubscribeAttributeBridgedActionsAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -8919,7 +9109,9 @@ class SubscribeAttributeBridgedActionsClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedActions.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9032,7 +9224,9 @@ class SubscribeAttributeBridgedDeviceBasicVendorName : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.VendorName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9111,7 +9305,9 @@ class SubscribeAttributeBridgedDeviceBasicVendorID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.VendorID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9190,7 +9386,9 @@ class SubscribeAttributeBridgedDeviceBasicProductName : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.ProductName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9307,7 +9505,9 @@ class SubscribeAttributeBridgedDeviceBasicNodeLabel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.NodeLabel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9387,7 +9587,9 @@ class SubscribeAttributeBridgedDeviceBasicHardwareVersion : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.HardwareVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9467,7 +9669,9 @@ class SubscribeAttributeBridgedDeviceBasicHardwareVersionString : public ModelCo reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.HardwareVersionString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9547,7 +9751,9 @@ class SubscribeAttributeBridgedDeviceBasicSoftwareVersion : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.SoftwareVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9627,7 +9833,9 @@ class SubscribeAttributeBridgedDeviceBasicSoftwareVersionString : public ModelCo reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.SoftwareVersionString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9707,7 +9915,9 @@ class SubscribeAttributeBridgedDeviceBasicManufacturingDate : public ModelComman reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.ManufacturingDate response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9786,7 +9996,9 @@ class SubscribeAttributeBridgedDeviceBasicPartNumber : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.PartNumber response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9865,7 +10077,9 @@ class SubscribeAttributeBridgedDeviceBasicProductURL : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.ProductURL response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -9944,7 +10158,9 @@ class SubscribeAttributeBridgedDeviceBasicProductLabel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.ProductLabel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10023,7 +10239,9 @@ class SubscribeAttributeBridgedDeviceBasicSerialNumber : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.SerialNumber response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10102,7 +10320,9 @@ class SubscribeAttributeBridgedDeviceBasicReachable : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.Reachable response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10181,7 +10401,9 @@ class SubscribeAttributeBridgedDeviceBasicUniqueID : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.UniqueID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10261,7 +10483,9 @@ class SubscribeAttributeBridgedDeviceBasicGeneratedCommandList : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10341,7 +10565,9 @@ class SubscribeAttributeBridgedDeviceBasicAcceptedCommandList : public ModelComm reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10420,7 +10646,9 @@ class SubscribeAttributeBridgedDeviceBasicAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10500,7 +10728,9 @@ class SubscribeAttributeBridgedDeviceBasicClusterRevision : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"BridgedDeviceBasic.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10703,7 +10933,9 @@ class SubscribeAttributeChannelChannelList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.ChannelList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10780,7 +11012,9 @@ class SubscribeAttributeChannelLineup : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(CHIPChannelClusterLineupInfo * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.Lineup response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10857,7 +11091,9 @@ class SubscribeAttributeChannelCurrentChannel : public ModelCommand { reportHandler:^( CHIPChannelClusterChannelInfo * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.CurrentChannel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -10933,7 +11169,9 @@ class SubscribeAttributeChannelGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -11008,7 +11246,9 @@ class SubscribeAttributeChannelAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -11083,7 +11323,9 @@ class SubscribeAttributeChannelAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -11158,7 +11400,9 @@ class SubscribeAttributeChannelClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Channel.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12181,7 +12425,9 @@ class SubscribeAttributeColorControlCurrentHue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentHue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12256,7 +12502,9 @@ class SubscribeAttributeColorControlCurrentSaturation : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentSaturation response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12331,7 +12579,9 @@ class SubscribeAttributeColorControlRemainingTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.RemainingTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12406,7 +12656,9 @@ class SubscribeAttributeColorControlCurrentX : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentX response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12481,7 +12733,9 @@ class SubscribeAttributeColorControlCurrentY : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CurrentY response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12556,7 +12810,9 @@ class SubscribeAttributeColorControlDriftCompensation : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.DriftCompensation response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12631,7 +12887,9 @@ class SubscribeAttributeColorControlCompensationText : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.CompensationText response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12706,7 +12964,9 @@ class SubscribeAttributeColorControlColorTemperature : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTemperature response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12781,7 +13041,9 @@ class SubscribeAttributeColorControlColorMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12892,7 +13154,9 @@ class SubscribeAttributeColorControlColorControlOptions : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorControlOptions response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -12967,7 +13231,9 @@ class SubscribeAttributeColorControlNumberOfPrimaries : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.NumberOfPrimaries response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13042,7 +13308,9 @@ class SubscribeAttributeColorControlPrimary1X : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1X response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13117,7 +13385,9 @@ class SubscribeAttributeColorControlPrimary1Y : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1Y response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13192,7 +13462,9 @@ class SubscribeAttributeColorControlPrimary1Intensity : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary1Intensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13267,7 +13539,9 @@ class SubscribeAttributeColorControlPrimary2X : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2X response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13342,7 +13616,9 @@ class SubscribeAttributeColorControlPrimary2Y : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2Y response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13417,7 +13693,9 @@ class SubscribeAttributeColorControlPrimary2Intensity : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary2Intensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13492,7 +13770,9 @@ class SubscribeAttributeColorControlPrimary3X : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3X response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13567,7 +13847,9 @@ class SubscribeAttributeColorControlPrimary3Y : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3Y response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13642,7 +13924,9 @@ class SubscribeAttributeColorControlPrimary3Intensity : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary3Intensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13717,7 +14001,9 @@ class SubscribeAttributeColorControlPrimary4X : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4X response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13792,7 +14078,9 @@ class SubscribeAttributeColorControlPrimary4Y : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4Y response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13867,7 +14155,9 @@ class SubscribeAttributeColorControlPrimary4Intensity : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary4Intensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -13942,7 +14232,9 @@ class SubscribeAttributeColorControlPrimary5X : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5X response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14017,7 +14309,9 @@ class SubscribeAttributeColorControlPrimary5Y : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5Y response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14092,7 +14386,9 @@ class SubscribeAttributeColorControlPrimary5Intensity : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary5Intensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14167,7 +14463,9 @@ class SubscribeAttributeColorControlPrimary6X : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6X response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14242,7 +14540,9 @@ class SubscribeAttributeColorControlPrimary6Y : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6Y response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14317,7 +14617,9 @@ class SubscribeAttributeColorControlPrimary6Intensity : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.Primary6Intensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14426,7 +14728,9 @@ class SubscribeAttributeColorControlWhitePointX : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.WhitePointX response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14535,7 +14839,9 @@ class SubscribeAttributeColorControlWhitePointY : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.WhitePointY response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14644,7 +14950,9 @@ class SubscribeAttributeColorControlColorPointRX : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRX response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14753,7 +15061,9 @@ class SubscribeAttributeColorControlColorPointRY : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRY response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14864,7 +15174,9 @@ class SubscribeAttributeColorControlColorPointRIntensity : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointRIntensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -14973,7 +15285,9 @@ class SubscribeAttributeColorControlColorPointGX : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGX response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15082,7 +15396,9 @@ class SubscribeAttributeColorControlColorPointGY : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGY response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15193,7 +15509,9 @@ class SubscribeAttributeColorControlColorPointGIntensity : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointGIntensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15302,7 +15620,9 @@ class SubscribeAttributeColorControlColorPointBX : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBX response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15411,7 +15731,9 @@ class SubscribeAttributeColorControlColorPointBY : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBY response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15522,7 +15844,9 @@ class SubscribeAttributeColorControlColorPointBIntensity : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorPointBIntensity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15598,7 +15922,9 @@ class SubscribeAttributeColorControlEnhancedCurrentHue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EnhancedCurrentHue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15673,7 +15999,9 @@ class SubscribeAttributeColorControlEnhancedColorMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.EnhancedColorMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15748,7 +16076,9 @@ class SubscribeAttributeColorControlColorLoopActive : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopActive response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15824,7 +16154,9 @@ class SubscribeAttributeColorControlColorLoopDirection : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopDirection response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15899,7 +16231,9 @@ class SubscribeAttributeColorControlColorLoopTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -15977,7 +16311,9 @@ class SubscribeAttributeColorControlColorLoopStartEnhancedHue : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopStartEnhancedHue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16055,7 +16391,9 @@ class SubscribeAttributeColorControlColorLoopStoredEnhancedHue : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorLoopStoredEnhancedHue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16130,7 +16468,9 @@ class SubscribeAttributeColorControlColorCapabilities : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorCapabilities response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16206,7 +16546,9 @@ class SubscribeAttributeColorControlColorTempPhysicalMin : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTempPhysicalMin response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16282,7 +16624,9 @@ class SubscribeAttributeColorControlColorTempPhysicalMax : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ColorTempPhysicalMax response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16362,7 +16706,9 @@ class SubscribeAttributeColorControlCoupleColorTempToLevelMinMireds : public Mod NSLog( @"ColorControl.CoupleColorTempToLevelMinMireds response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16477,7 +16823,9 @@ class SubscribeAttributeColorControlStartUpColorTemperatureMireds : public Model NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.StartUpColorTemperatureMireds response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16553,7 +16901,9 @@ class SubscribeAttributeColorControlGeneratedCommandList : public ModelCommand { reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16629,7 +16979,9 @@ class SubscribeAttributeColorControlAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16704,7 +17056,9 @@ class SubscribeAttributeColorControlAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16779,7 +17133,9 @@ class SubscribeAttributeColorControlClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ColorControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -16957,7 +17313,9 @@ class SubscribeAttributeContentLauncherAcceptHeader : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AcceptHeader response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17071,7 +17429,9 @@ class SubscribeAttributeContentLauncherSupportedStreamingProtocols : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.SupportedStreamingProtocols response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17147,7 +17507,9 @@ class SubscribeAttributeContentLauncherGeneratedCommandList : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17223,7 +17585,9 @@ class SubscribeAttributeContentLauncherAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17298,7 +17662,9 @@ class SubscribeAttributeContentLauncherAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17373,7 +17739,9 @@ class SubscribeAttributeContentLauncherClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ContentLauncher.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17467,7 +17835,9 @@ class SubscribeAttributeDescriptorDeviceList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.DeviceList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17542,7 +17912,9 @@ class SubscribeAttributeDescriptorServerList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ServerList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17617,7 +17989,9 @@ class SubscribeAttributeDescriptorClientList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ClientList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17692,7 +18066,9 @@ class SubscribeAttributeDescriptorPartsList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.PartsList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17768,7 +18144,9 @@ class SubscribeAttributeDescriptorGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17844,7 +18222,9 @@ class SubscribeAttributeDescriptorAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17919,7 +18299,9 @@ class SubscribeAttributeDescriptorAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -17994,7 +18376,9 @@ class SubscribeAttributeDescriptorClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Descriptor.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -18129,7 +18513,9 @@ class SubscribeAttributeDiagnosticLogsGeneratedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -18205,7 +18591,9 @@ class SubscribeAttributeDiagnosticLogsAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -18280,7 +18668,9 @@ class SubscribeAttributeDiagnosticLogsAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DiagnosticLogs.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19039,7 +19429,9 @@ class SubscribeAttributeDoorLockLockState : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LockState response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19114,7 +19506,9 @@ class SubscribeAttributeDoorLockLockType : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.LockType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19189,7 +19583,9 @@ class SubscribeAttributeDoorLockActuatorEnabled : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ActuatorEnabled response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19264,7 +19660,9 @@ class SubscribeAttributeDoorLockDoorState : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.DoorState response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19342,7 +19740,9 @@ class SubscribeAttributeDoorLockNumberOfTotalUsersSupported : public ModelComman reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfTotalUsersSupported response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19420,7 +19820,9 @@ class SubscribeAttributeDoorLockNumberOfPINUsersSupported : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfPINUsersSupported response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19498,7 +19900,9 @@ class SubscribeAttributeDoorLockNumberOfRFIDUsersSupported : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.NumberOfRFIDUsersSupported response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19579,8 +19983,10 @@ class SubscribeAttributeDoorLockNumberOfWeekDaySchedulesSupportedPerUser : publi @"NumberOfWeekDaySchedulesSupportedPerUser " @"response %@", [value description]); - SetCommandExitStatus( - [CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus( + [CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19661,8 +20067,10 @@ class SubscribeAttributeDoorLockNumberOfYearDaySchedulesSupportedPerUser : publi @"NumberOfYearDaySchedulesSupportedPerUser " @"response %@", [value description]); - SetCommandExitStatus( - [CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus( + [CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19737,7 +20145,9 @@ class SubscribeAttributeDoorLockMaxPINCodeLength : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MaxPINCodeLength response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19812,7 +20222,9 @@ class SubscribeAttributeDoorLockMinPINCodeLength : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MinPINCodeLength response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19887,7 +20299,9 @@ class SubscribeAttributeDoorLockMaxRFIDCodeLength : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MaxRFIDCodeLength response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -19962,7 +20376,9 @@ class SubscribeAttributeDoorLockMinRFIDCodeLength : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.MinRFIDCodeLength response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20073,7 +20489,9 @@ class SubscribeAttributeDoorLockLanguage : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.Language response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20182,7 +20600,9 @@ class SubscribeAttributeDoorLockAutoRelockTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AutoRelockTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20291,7 +20711,9 @@ class SubscribeAttributeDoorLockSoundVolume : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SoundVolume response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20400,7 +20822,9 @@ class SubscribeAttributeDoorLockOperatingMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.OperatingMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20477,7 +20901,9 @@ class SubscribeAttributeDoorLockSupportedOperatingModes : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.SupportedOperatingModes response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20588,7 +21014,9 @@ class SubscribeAttributeDoorLockEnableOneTouchLocking : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnableOneTouchLocking response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20700,7 +21128,9 @@ class SubscribeAttributeDoorLockEnablePrivacyModeButton : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.EnablePrivacyModeButton response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20809,7 +21239,9 @@ class SubscribeAttributeDoorLockWrongCodeEntryLimit : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.WrongCodeEntryLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20885,7 +21317,9 @@ class SubscribeAttributeDoorLockGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -20960,7 +21394,9 @@ class SubscribeAttributeDoorLockAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21035,7 +21471,9 @@ class SubscribeAttributeDoorLockAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21110,7 +21548,9 @@ class SubscribeAttributeDoorLockClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"DoorLock.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21335,7 +21775,9 @@ class SubscribeAttributeElectricalMeasurementMeasurementType : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.MeasurementType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21415,7 +21857,9 @@ class SubscribeAttributeElectricalMeasurementTotalActivePower : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.TotalActivePower response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21494,7 +21938,9 @@ class SubscribeAttributeElectricalMeasurementRmsVoltage : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.RmsVoltage response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21574,7 +22020,9 @@ class SubscribeAttributeElectricalMeasurementRmsVoltageMin : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.RmsVoltageMin response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21654,7 +22102,9 @@ class SubscribeAttributeElectricalMeasurementRmsVoltageMax : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.RmsVoltageMax response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21733,7 +22183,9 @@ class SubscribeAttributeElectricalMeasurementRmsCurrent : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.RmsCurrent response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21813,7 +22265,9 @@ class SubscribeAttributeElectricalMeasurementRmsCurrentMin : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.RmsCurrentMin response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21893,7 +22347,9 @@ class SubscribeAttributeElectricalMeasurementRmsCurrentMax : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.RmsCurrentMax response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -21972,7 +22428,9 @@ class SubscribeAttributeElectricalMeasurementActivePower : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.ActivePower response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22052,7 +22510,9 @@ class SubscribeAttributeElectricalMeasurementActivePowerMin : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.ActivePowerMin response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22132,7 +22592,9 @@ class SubscribeAttributeElectricalMeasurementActivePowerMax : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.ActivePowerMax response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22212,7 +22674,9 @@ class SubscribeAttributeElectricalMeasurementGeneratedCommandList : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22292,7 +22756,9 @@ class SubscribeAttributeElectricalMeasurementAcceptedCommandList : public ModelC reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22372,7 +22838,9 @@ class SubscribeAttributeElectricalMeasurementAttributeList : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22452,7 +22920,9 @@ class SubscribeAttributeElectricalMeasurementClusterRevision : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ElectricalMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22587,7 +23057,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsPHYRate : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PHYRate response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22666,7 +23138,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsFullDuplex : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.FullDuplex response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22746,7 +23220,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsPacketRxCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PacketRxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22826,7 +23302,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsPacketTxCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.PacketTxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22905,7 +23383,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsTxErrCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.TxErrCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -22985,7 +23465,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsCollisionCount : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.CollisionCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23065,7 +23547,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsOverrunCount : public ModelCom subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.OverrunCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23145,7 +23629,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsCarrierDetect : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.CarrierDetect response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23225,7 +23711,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsTimeSinceReset : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.TimeSinceReset response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23305,7 +23793,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsGeneratedCommandList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23385,7 +23875,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsAcceptedCommandList : public M reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23465,7 +23957,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsAttributeList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23544,7 +24038,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsFeatureMap : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23624,7 +24120,9 @@ class SubscribeAttributeEthernetNetworkDiagnosticsClusterRevision : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"EthernetNetworkDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23750,7 +24248,9 @@ class SubscribeAttributeFanControlFanMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FanMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23859,7 +24359,9 @@ class SubscribeAttributeFanControlFanModeSequence : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FanModeSequence response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -23935,7 +24437,9 @@ class SubscribeAttributeFanControlGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24011,7 +24515,9 @@ class SubscribeAttributeFanControlAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24086,7 +24592,9 @@ class SubscribeAttributeFanControlAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24161,7 +24669,9 @@ class SubscribeAttributeFanControlFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24236,7 +24746,9 @@ class SubscribeAttributeFanControlClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FanControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24327,7 +24839,9 @@ class SubscribeAttributeFixedLabelLabelList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.LabelList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24403,7 +24917,9 @@ class SubscribeAttributeFixedLabelGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24479,7 +24995,9 @@ class SubscribeAttributeFixedLabelAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24554,7 +25072,9 @@ class SubscribeAttributeFixedLabelAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24629,7 +25149,9 @@ class SubscribeAttributeFixedLabelClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FixedLabel.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24723,7 +25245,9 @@ class SubscribeAttributeFlowMeasurementMeasuredValue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24799,7 +25323,9 @@ class SubscribeAttributeFlowMeasurementMinMeasuredValue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24875,7 +25401,9 @@ class SubscribeAttributeFlowMeasurementMaxMeasuredValue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -24950,7 +25478,9 @@ class SubscribeAttributeFlowMeasurementTolerance : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25026,7 +25556,9 @@ class SubscribeAttributeFlowMeasurementGeneratedCommandList : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25102,7 +25634,9 @@ class SubscribeAttributeFlowMeasurementAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25177,7 +25711,9 @@ class SubscribeAttributeFlowMeasurementAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25252,7 +25788,9 @@ class SubscribeAttributeFlowMeasurementClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"FlowMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25516,7 +26054,9 @@ class SubscribeAttributeGeneralCommissioningBreadcrumb : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.Breadcrumb response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25600,7 +26140,9 @@ class SubscribeAttributeGeneralCommissioningBasicCommissioningInfo : public Mode NSError * _Nullable error) { NSLog(@"GeneralCommissioning.BasicCommissioningInfo response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25680,7 +26222,9 @@ class SubscribeAttributeGeneralCommissioningRegulatoryConfig : public ModelComma reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.RegulatoryConfig response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25760,7 +26304,9 @@ class SubscribeAttributeGeneralCommissioningLocationCapability : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.LocationCapability response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25840,7 +26386,9 @@ class SubscribeAttributeGeneralCommissioningGeneratedCommandList : public ModelC reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25920,7 +26468,9 @@ class SubscribeAttributeGeneralCommissioningAcceptedCommandList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -25999,7 +26549,9 @@ class SubscribeAttributeGeneralCommissioningAttributeList : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26079,7 +26631,9 @@ class SubscribeAttributeGeneralCommissioningClusterRevision : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralCommissioning.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26186,7 +26740,9 @@ class SubscribeAttributeGeneralDiagnosticsNetworkInterfaces : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.NetworkInterfaces response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26265,7 +26821,9 @@ class SubscribeAttributeGeneralDiagnosticsRebootCount : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.RebootCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26344,7 +26902,9 @@ class SubscribeAttributeGeneralDiagnosticsUpTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.UpTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26424,7 +26984,9 @@ class SubscribeAttributeGeneralDiagnosticsTotalOperationalHours : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.TotalOperationalHours response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26503,7 +27065,9 @@ class SubscribeAttributeGeneralDiagnosticsBootReasons : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.BootReasons response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26583,7 +27147,9 @@ class SubscribeAttributeGeneralDiagnosticsActiveHardwareFaults : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveHardwareFaults response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26663,7 +27229,9 @@ class SubscribeAttributeGeneralDiagnosticsActiveRadioFaults : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveRadioFaults response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26743,7 +27311,9 @@ class SubscribeAttributeGeneralDiagnosticsActiveNetworkFaults : public ModelComm reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ActiveNetworkFaults response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26823,7 +27393,9 @@ class SubscribeAttributeGeneralDiagnosticsGeneratedCommandList : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26903,7 +27475,9 @@ class SubscribeAttributeGeneralDiagnosticsAcceptedCommandList : public ModelComm reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -26982,7 +27556,9 @@ class SubscribeAttributeGeneralDiagnosticsAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27062,7 +27638,9 @@ class SubscribeAttributeGeneralDiagnosticsClusterRevision : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GeneralDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27311,7 +27889,9 @@ class SubscribeAttributeGroupKeyManagementGroupKeyMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GroupKeyMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27392,7 +27972,9 @@ class SubscribeAttributeGroupKeyManagementGroupTable : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GroupTable response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27472,7 +28054,9 @@ class SubscribeAttributeGroupKeyManagementMaxGroupsPerFabric : public ModelComma reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.MaxGroupsPerFabric response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27552,7 +28136,9 @@ class SubscribeAttributeGroupKeyManagementMaxGroupKeysPerFabric : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.MaxGroupKeysPerFabric response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27632,7 +28218,9 @@ class SubscribeAttributeGroupKeyManagementGeneratedCommandList : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27712,7 +28300,9 @@ class SubscribeAttributeGroupKeyManagementAcceptedCommandList : public ModelComm reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27791,7 +28381,9 @@ class SubscribeAttributeGroupKeyManagementAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -27871,7 +28463,9 @@ class SubscribeAttributeGroupKeyManagementClusterRevision : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"GroupKeyManagement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28180,7 +28774,9 @@ class SubscribeAttributeGroupsNameSupport : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.NameSupport response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28255,7 +28851,9 @@ class SubscribeAttributeGroupsGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28330,7 +28928,9 @@ class SubscribeAttributeGroupsAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28405,7 +29005,9 @@ class SubscribeAttributeGroupsAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28480,7 +29082,9 @@ class SubscribeAttributeGroupsClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Groups.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28711,7 +29315,9 @@ class SubscribeAttributeIdentifyIdentifyTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.IdentifyTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28786,7 +29392,9 @@ class SubscribeAttributeIdentifyIdentifyType : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.IdentifyType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28862,7 +29470,9 @@ class SubscribeAttributeIdentifyGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -28937,7 +29547,9 @@ class SubscribeAttributeIdentifyAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29012,7 +29624,9 @@ class SubscribeAttributeIdentifyAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29087,7 +29701,9 @@ class SubscribeAttributeIdentifyClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Identify.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29187,7 +29803,9 @@ class SubscribeAttributeIlluminanceMeasurementMeasuredValue : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29267,7 +29885,9 @@ class SubscribeAttributeIlluminanceMeasurementMinMeasuredValue : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29347,7 +29967,9 @@ class SubscribeAttributeIlluminanceMeasurementMaxMeasuredValue : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29426,7 +30048,9 @@ class SubscribeAttributeIlluminanceMeasurementTolerance : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29506,7 +30130,9 @@ class SubscribeAttributeIlluminanceMeasurementLightSensorType : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.LightSensorType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29586,7 +30212,9 @@ class SubscribeAttributeIlluminanceMeasurementGeneratedCommandList : public Mode reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29666,7 +30294,9 @@ class SubscribeAttributeIlluminanceMeasurementAcceptedCommandList : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29746,7 +30376,9 @@ class SubscribeAttributeIlluminanceMeasurementAttributeList : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29826,7 +30458,9 @@ class SubscribeAttributeIlluminanceMeasurementClusterRevision : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"IlluminanceMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -29953,7 +30587,9 @@ class SubscribeAttributeKeypadInputGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30029,7 +30665,9 @@ class SubscribeAttributeKeypadInputAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30104,7 +30742,9 @@ class SubscribeAttributeKeypadInputAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30179,7 +30819,9 @@ class SubscribeAttributeKeypadInputClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"KeypadInput.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30603,7 +31245,9 @@ class SubscribeAttributeLevelControlCurrentLevel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.CurrentLevel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30678,7 +31322,9 @@ class SubscribeAttributeLevelControlRemainingTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.RemainingTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30753,7 +31399,9 @@ class SubscribeAttributeLevelControlMinLevel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MinLevel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30828,7 +31476,9 @@ class SubscribeAttributeLevelControlMaxLevel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MaxLevel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30903,7 +31553,9 @@ class SubscribeAttributeLevelControlCurrentFrequency : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.CurrentFrequency response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -30978,7 +31630,9 @@ class SubscribeAttributeLevelControlMinFrequency : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MinFrequency response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31053,7 +31707,9 @@ class SubscribeAttributeLevelControlMaxFrequency : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.MaxFrequency response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31162,7 +31818,9 @@ class SubscribeAttributeLevelControlOptions : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.Options response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31273,7 +31931,9 @@ class SubscribeAttributeLevelControlOnOffTransitionTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnOffTransitionTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31382,7 +32042,9 @@ class SubscribeAttributeLevelControlOnLevel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnLevel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31491,7 +32153,9 @@ class SubscribeAttributeLevelControlOnTransitionTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OnTransitionTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31600,7 +32264,9 @@ class SubscribeAttributeLevelControlOffTransitionTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.OffTransitionTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31709,7 +32375,9 @@ class SubscribeAttributeLevelControlDefaultMoveRate : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.DefaultMoveRate response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31820,7 +32488,9 @@ class SubscribeAttributeLevelControlStartUpCurrentLevel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.StartUpCurrentLevel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31896,7 +32566,9 @@ class SubscribeAttributeLevelControlGeneratedCommandList : public ModelCommand { reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -31972,7 +32644,9 @@ class SubscribeAttributeLevelControlAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32047,7 +32721,9 @@ class SubscribeAttributeLevelControlAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32122,7 +32798,9 @@ class SubscribeAttributeLevelControlFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32197,7 +32875,9 @@ class SubscribeAttributeLevelControlClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LevelControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32333,7 +33013,9 @@ class SubscribeAttributeLocalizationConfigurationActiveLocale : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.ActiveLocale response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32413,7 +33095,9 @@ class SubscribeAttributeLocalizationConfigurationSupportedLocales : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.SupportedLocales response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32493,7 +33177,9 @@ class SubscribeAttributeLocalizationConfigurationGeneratedCommandList : public M reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32573,7 +33259,9 @@ class SubscribeAttributeLocalizationConfigurationAcceptedCommandList : public Mo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32653,7 +33341,9 @@ class SubscribeAttributeLocalizationConfigurationClusterRevision : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LocalizationConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32774,7 +33464,9 @@ class SubscribeAttributeLowPowerGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32849,7 +33541,9 @@ class SubscribeAttributeLowPowerAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32924,7 +33618,9 @@ class SubscribeAttributeLowPowerAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -32999,7 +33695,9 @@ class SubscribeAttributeLowPowerClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"LowPower.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -33224,7 +33922,9 @@ class SubscribeAttributeMediaInputInputList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.InputList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -33299,7 +33999,9 @@ class SubscribeAttributeMediaInputCurrentInput : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.CurrentInput response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -33375,7 +34077,9 @@ class SubscribeAttributeMediaInputGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -33451,7 +34155,9 @@ class SubscribeAttributeMediaInputAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -33526,7 +34232,9 @@ class SubscribeAttributeMediaInputAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -33601,7 +34309,9 @@ class SubscribeAttributeMediaInputClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaInput.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34064,7 +34774,9 @@ class SubscribeAttributeMediaPlaybackCurrentState : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.CurrentState response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34139,7 +34851,9 @@ class SubscribeAttributeMediaPlaybackStartTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.StartTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34214,7 +34928,9 @@ class SubscribeAttributeMediaPlaybackDuration : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.Duration response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34291,7 +35007,9 @@ class SubscribeAttributeMediaPlaybackSampledPosition : public ModelCommand { reportHandler:^(CHIPMediaPlaybackClusterPlaybackPosition * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SampledPosition response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34366,7 +35084,9 @@ class SubscribeAttributeMediaPlaybackPlaybackSpeed : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.PlaybackSpeed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34441,7 +35161,9 @@ class SubscribeAttributeMediaPlaybackSeekRangeEnd : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SeekRangeEnd response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34516,7 +35238,9 @@ class SubscribeAttributeMediaPlaybackSeekRangeStart : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.SeekRangeStart response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34592,7 +35316,9 @@ class SubscribeAttributeMediaPlaybackGeneratedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34668,7 +35394,9 @@ class SubscribeAttributeMediaPlaybackAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34743,7 +35471,9 @@ class SubscribeAttributeMediaPlaybackAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34818,7 +35548,9 @@ class SubscribeAttributeMediaPlaybackClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"MediaPlayback.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -34949,7 +35681,9 @@ class SubscribeAttributeModeSelectDescription : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.Description response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35024,7 +35758,9 @@ class SubscribeAttributeModeSelectStandardNamespace : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.StandardNamespace response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35099,7 +35835,9 @@ class SubscribeAttributeModeSelectSupportedModes : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.SupportedModes response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35174,7 +35912,9 @@ class SubscribeAttributeModeSelectCurrentMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.CurrentMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35283,7 +36023,9 @@ class SubscribeAttributeModeSelectStartUpMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.StartUpMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35392,7 +36134,9 @@ class SubscribeAttributeModeSelectOnMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.OnMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35468,7 +36212,9 @@ class SubscribeAttributeModeSelectGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35544,7 +36290,9 @@ class SubscribeAttributeModeSelectAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35619,7 +36367,9 @@ class SubscribeAttributeModeSelectAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35694,7 +36444,9 @@ class SubscribeAttributeModeSelectFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -35769,7 +36521,9 @@ class SubscribeAttributeModeSelectClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ModeSelect.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36129,7 +36883,9 @@ class SubscribeAttributeNetworkCommissioningMaxNetworks : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.MaxNetworks response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36208,7 +36964,9 @@ class SubscribeAttributeNetworkCommissioningNetworks : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.Networks response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36288,7 +37046,9 @@ class SubscribeAttributeNetworkCommissioningScanMaxTimeSeconds : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ScanMaxTimeSeconds response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36368,7 +37128,9 @@ class SubscribeAttributeNetworkCommissioningConnectMaxTimeSeconds : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ConnectMaxTimeSeconds response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36485,7 +37247,9 @@ class SubscribeAttributeNetworkCommissioningInterfaceEnabled : public ModelComma reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.InterfaceEnabled response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36565,7 +37329,9 @@ class SubscribeAttributeNetworkCommissioningLastNetworkingStatus : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastNetworkingStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36644,7 +37410,9 @@ class SubscribeAttributeNetworkCommissioningLastNetworkID : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastNetworkID response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36724,7 +37492,9 @@ class SubscribeAttributeNetworkCommissioningLastConnectErrorValue : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.LastConnectErrorValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36804,7 +37574,9 @@ class SubscribeAttributeNetworkCommissioningGeneratedCommandList : public ModelC reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36884,7 +37656,9 @@ class SubscribeAttributeNetworkCommissioningAcceptedCommandList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -36963,7 +37737,9 @@ class SubscribeAttributeNetworkCommissioningFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37043,7 +37819,9 @@ class SubscribeAttributeNetworkCommissioningClusterRevision : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"NetworkCommissioning.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37278,7 +38056,9 @@ class SubscribeAttributeOtaSoftwareUpdateProviderAttributeList : public ModelCom subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateProvider.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37358,7 +38138,9 @@ class SubscribeAttributeOtaSoftwareUpdateProviderClusterRevision : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateProvider.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37513,7 +38295,9 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorDefaultOtaProviders : public M reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateRequestor.DefaultOtaProviders response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37593,7 +38377,9 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorUpdatePossible : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateRequestor.UpdatePossible response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37673,7 +38459,9 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateState : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateRequestor.UpdateState response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37753,7 +38541,9 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorUpdateStateProgress : public M reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateRequestor.UpdateStateProgress response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37833,7 +38623,9 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorAttributeList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateRequestor.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -37913,7 +38705,9 @@ class SubscribeAttributeOtaSoftwareUpdateRequestorClusterRevision : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OtaSoftwareUpdateRequestor.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38019,7 +38813,9 @@ class SubscribeAttributeOccupancySensingOccupancy : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.Occupancy response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38099,7 +38895,9 @@ class SubscribeAttributeOccupancySensingOccupancySensorType : public ModelComman reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.OccupancySensorType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38181,7 +38979,9 @@ class SubscribeAttributeOccupancySensingOccupancySensorTypeBitmap : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.OccupancySensorTypeBitmap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38261,7 +39061,9 @@ class SubscribeAttributeOccupancySensingGeneratedCommandList : public ModelComma reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38341,7 +39143,9 @@ class SubscribeAttributeOccupancySensingAcceptedCommandList : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38420,7 +39224,9 @@ class SubscribeAttributeOccupancySensingAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38499,7 +39305,9 @@ class SubscribeAttributeOccupancySensingClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OccupancySensing.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38793,7 +39601,9 @@ class SubscribeAttributeOnOffOnOff : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OnOff response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38868,7 +39678,9 @@ class SubscribeAttributeOnOffGlobalSceneControl : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.GlobalSceneControl response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -38977,7 +39789,9 @@ class SubscribeAttributeOnOffOnTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OnTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39086,7 +39900,9 @@ class SubscribeAttributeOnOffOffWaitTime : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.OffWaitTime response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39195,7 +40011,9 @@ class SubscribeAttributeOnOffStartUpOnOff : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.StartUpOnOff response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39270,7 +40088,9 @@ class SubscribeAttributeOnOffGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39345,7 +40165,9 @@ class SubscribeAttributeOnOffAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39420,7 +40242,9 @@ class SubscribeAttributeOnOffAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39495,7 +40319,9 @@ class SubscribeAttributeOnOffFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39570,7 +40396,9 @@ class SubscribeAttributeOnOffClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOff.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39666,7 +40494,9 @@ class SubscribeAttributeOnOffSwitchConfigurationSwitchType : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOffSwitchConfiguration.SwitchType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39783,7 +40613,9 @@ class SubscribeAttributeOnOffSwitchConfigurationSwitchActions : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOffSwitchConfiguration.SwitchActions response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39863,7 +40695,9 @@ class SubscribeAttributeOnOffSwitchConfigurationGeneratedCommandList : public Mo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOffSwitchConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -39943,7 +40777,9 @@ class SubscribeAttributeOnOffSwitchConfigurationAcceptedCommandList : public Mod reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOffSwitchConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40023,7 +40859,9 @@ class SubscribeAttributeOnOffSwitchConfigurationAttributeList : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOffSwitchConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40103,7 +40941,9 @@ class SubscribeAttributeOnOffSwitchConfigurationClusterRevision : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OnOffSwitchConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40569,7 +41409,9 @@ class SubscribeAttributeOperationalCredentialsNOCs : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.NOCs response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40650,7 +41492,9 @@ class SubscribeAttributeOperationalCredentialsFabrics : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.Fabrics response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40730,7 +41574,9 @@ class SubscribeAttributeOperationalCredentialsSupportedFabrics : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.SupportedFabrics response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40810,7 +41656,9 @@ class SubscribeAttributeOperationalCredentialsCommissionedFabrics : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.CommissionedFabrics response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40890,7 +41738,9 @@ class SubscribeAttributeOperationalCredentialsTrustedRootCertificates : public M reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.TrustedRootCertificates response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -40970,7 +41820,9 @@ class SubscribeAttributeOperationalCredentialsCurrentFabricIndex : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.CurrentFabricIndex response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41050,7 +41902,9 @@ class SubscribeAttributeOperationalCredentialsGeneratedCommandList : public Mode reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41130,7 +41984,9 @@ class SubscribeAttributeOperationalCredentialsAcceptedCommandList : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41210,7 +42066,9 @@ class SubscribeAttributeOperationalCredentialsAttributeList : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41290,7 +42148,9 @@ class SubscribeAttributeOperationalCredentialsClusterRevision : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"OperationalCredentials.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41411,7 +42271,9 @@ class SubscribeAttributePowerSourceStatus : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Status response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41486,7 +42348,9 @@ class SubscribeAttributePowerSourceOrder : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Order response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41561,7 +42425,9 @@ class SubscribeAttributePowerSourceDescription : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.Description response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41636,7 +42502,9 @@ class SubscribeAttributePowerSourceBatteryVoltage : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatteryVoltage response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41713,7 +42581,9 @@ class SubscribeAttributePowerSourceBatteryPercentRemaining : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatteryPercentRemaining response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41789,7 +42659,9 @@ class SubscribeAttributePowerSourceBatteryTimeRemaining : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatteryTimeRemaining response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41865,7 +42737,9 @@ class SubscribeAttributePowerSourceBatteryChargeLevel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatteryChargeLevel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -41941,7 +42815,9 @@ class SubscribeAttributePowerSourceActiveBatteryFaults : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ActiveBatteryFaults response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42017,7 +42893,9 @@ class SubscribeAttributePowerSourceBatteryChargeState : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.BatteryChargeState response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42093,7 +42971,9 @@ class SubscribeAttributePowerSourceGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42169,7 +43049,9 @@ class SubscribeAttributePowerSourceAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42244,7 +43126,9 @@ class SubscribeAttributePowerSourceAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42319,7 +43203,9 @@ class SubscribeAttributePowerSourceFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42394,7 +43280,9 @@ class SubscribeAttributePowerSourceClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSource.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42489,7 +43377,9 @@ class SubscribeAttributePowerSourceConfigurationSources : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.Sources response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42569,7 +43459,9 @@ class SubscribeAttributePowerSourceConfigurationGeneratedCommandList : public Mo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42649,7 +43541,9 @@ class SubscribeAttributePowerSourceConfigurationAcceptedCommandList : public Mod reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42729,7 +43623,9 @@ class SubscribeAttributePowerSourceConfigurationAttributeList : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42809,7 +43705,9 @@ class SubscribeAttributePowerSourceConfigurationClusterRevision : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PowerSourceConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42912,7 +43810,9 @@ class SubscribeAttributePressureMeasurementMeasuredValue : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -42992,7 +43892,9 @@ class SubscribeAttributePressureMeasurementMinMeasuredValue : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43072,7 +43974,9 @@ class SubscribeAttributePressureMeasurementMaxMeasuredValue : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43151,7 +44055,9 @@ class SubscribeAttributePressureMeasurementAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43231,7 +44137,9 @@ class SubscribeAttributePressureMeasurementClusterRevision : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PressureMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43367,7 +44275,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxPressure : public ModelCom subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxPressure response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43446,7 +44356,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxSpeed : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxSpeed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43525,7 +44437,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxFlow : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxFlow response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43605,7 +44519,9 @@ class SubscribeAttributePumpConfigurationAndControlMinConstPressure : public Mod reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstPressure response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43685,7 +44601,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxConstPressure : public Mod reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstPressure response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43765,7 +44683,9 @@ class SubscribeAttributePumpConfigurationAndControlMinCompPressure : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinCompPressure response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43845,7 +44765,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxCompPressure : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxCompPressure response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -43925,7 +44847,9 @@ class SubscribeAttributePumpConfigurationAndControlMinConstSpeed : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstSpeed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44005,7 +44929,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxConstSpeed : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstSpeed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44085,7 +45011,9 @@ class SubscribeAttributePumpConfigurationAndControlMinConstFlow : public ModelCo subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstFlow response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44165,7 +45093,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxConstFlow : public ModelCo subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstFlow response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44245,7 +45175,9 @@ class SubscribeAttributePumpConfigurationAndControlMinConstTemp : public ModelCo subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MinConstTemp response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44325,7 +45257,9 @@ class SubscribeAttributePumpConfigurationAndControlMaxConstTemp : public ModelCo subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.MaxConstTemp response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44405,7 +45339,9 @@ class SubscribeAttributePumpConfigurationAndControlPumpStatus : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.PumpStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44486,7 +45422,9 @@ class SubscribeAttributePumpConfigurationAndControlEffectiveOperationMode : publ reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EffectiveOperationMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44566,7 +45504,9 @@ class SubscribeAttributePumpConfigurationAndControlEffectiveControlMode : public reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.EffectiveControlMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44645,7 +45585,9 @@ class SubscribeAttributePumpConfigurationAndControlCapacity : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Capacity response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44724,7 +45666,9 @@ class SubscribeAttributePumpConfigurationAndControlSpeed : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Speed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44841,7 +45785,9 @@ class SubscribeAttributePumpConfigurationAndControlLifetimeRunningHours : public reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.LifetimeRunningHours response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -44920,7 +45866,9 @@ class SubscribeAttributePumpConfigurationAndControlPower : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.Power response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45039,7 +45987,9 @@ class SubscribeAttributePumpConfigurationAndControlLifetimeEnergyConsumed : publ reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.LifetimeEnergyConsumed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45156,7 +46106,9 @@ class SubscribeAttributePumpConfigurationAndControlOperationMode : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.OperationMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45273,7 +46225,9 @@ class SubscribeAttributePumpConfigurationAndControlControlMode : public ModelCom subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.ControlMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45352,7 +46306,9 @@ class SubscribeAttributePumpConfigurationAndControlAlarmMask : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AlarmMask response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45432,7 +46388,9 @@ class SubscribeAttributePumpConfigurationAndControlGeneratedCommandList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45512,7 +46470,9 @@ class SubscribeAttributePumpConfigurationAndControlAcceptedCommandList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45592,7 +46552,9 @@ class SubscribeAttributePumpConfigurationAndControlAttributeList : public ModelC reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45672,7 +46634,9 @@ class SubscribeAttributePumpConfigurationAndControlFeatureMap : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45752,7 +46716,9 @@ class SubscribeAttributePumpConfigurationAndControlClusterRevision : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"PumpConfigurationAndControl.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45851,7 +46817,9 @@ class SubscribeAttributeRelativeHumidityMeasurementMeasuredValue : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -45931,7 +46899,9 @@ class SubscribeAttributeRelativeHumidityMeasurementMinMeasuredValue : public Mod reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46011,7 +46981,9 @@ class SubscribeAttributeRelativeHumidityMeasurementMaxMeasuredValue : public Mod reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46090,7 +47062,9 @@ class SubscribeAttributeRelativeHumidityMeasurementTolerance : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46170,7 +47144,9 @@ class SubscribeAttributeRelativeHumidityMeasurementGeneratedCommandList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46250,7 +47226,9 @@ class SubscribeAttributeRelativeHumidityMeasurementAcceptedCommandList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46330,7 +47308,9 @@ class SubscribeAttributeRelativeHumidityMeasurementAttributeList : public ModelC reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46410,7 +47390,9 @@ class SubscribeAttributeRelativeHumidityMeasurementClusterRevision : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"RelativeHumidityMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46789,7 +47771,9 @@ class SubscribeAttributeScenesSceneCount : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.SceneCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46864,7 +47848,9 @@ class SubscribeAttributeScenesCurrentScene : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.CurrentScene response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -46939,7 +47925,9 @@ class SubscribeAttributeScenesCurrentGroup : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.CurrentGroup response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47014,7 +48002,9 @@ class SubscribeAttributeScenesSceneValid : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.SceneValid response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47089,7 +48079,9 @@ class SubscribeAttributeScenesNameSupport : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.NameSupport response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47164,7 +48156,9 @@ class SubscribeAttributeScenesGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47239,7 +48233,9 @@ class SubscribeAttributeScenesAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47314,7 +48310,9 @@ class SubscribeAttributeScenesAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47389,7 +48387,9 @@ class SubscribeAttributeScenesClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Scenes.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47520,7 +48520,9 @@ class SubscribeAttributeSoftwareDiagnosticsThreadMetrics : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.ThreadMetrics response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47600,7 +48602,9 @@ class SubscribeAttributeSoftwareDiagnosticsCurrentHeapFree : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapFree response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47680,7 +48684,9 @@ class SubscribeAttributeSoftwareDiagnosticsCurrentHeapUsed : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapUsed response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47762,7 +48768,9 @@ class SubscribeAttributeSoftwareDiagnosticsCurrentHeapHighWatermark : public Mod reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.CurrentHeapHighWatermark response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47842,7 +48850,9 @@ class SubscribeAttributeSoftwareDiagnosticsGeneratedCommandList : public ModelCo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -47922,7 +48932,9 @@ class SubscribeAttributeSoftwareDiagnosticsAcceptedCommandList : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48001,7 +49013,9 @@ class SubscribeAttributeSoftwareDiagnosticsAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48080,7 +49094,9 @@ class SubscribeAttributeSoftwareDiagnosticsFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48160,7 +49176,9 @@ class SubscribeAttributeSoftwareDiagnosticsClusterRevision : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"SoftwareDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48260,7 +49278,9 @@ class SubscribeAttributeSwitchNumberOfPositions : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.NumberOfPositions response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48335,7 +49355,9 @@ class SubscribeAttributeSwitchCurrentPosition : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.CurrentPosition response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48410,7 +49432,9 @@ class SubscribeAttributeSwitchMultiPressMax : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.MultiPressMax response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48485,7 +49509,9 @@ class SubscribeAttributeSwitchGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48560,7 +49586,9 @@ class SubscribeAttributeSwitchAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48635,7 +49663,9 @@ class SubscribeAttributeSwitchAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48710,7 +49740,9 @@ class SubscribeAttributeSwitchFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48785,7 +49817,9 @@ class SubscribeAttributeSwitchClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Switch.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48917,7 +49951,9 @@ class SubscribeAttributeTargetNavigatorTargetList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.TargetList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -48992,7 +50028,9 @@ class SubscribeAttributeTargetNavigatorCurrentTarget : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.CurrentTarget response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49068,7 +50106,9 @@ class SubscribeAttributeTargetNavigatorGeneratedCommandList : public ModelComman reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49144,7 +50184,9 @@ class SubscribeAttributeTargetNavigatorAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49219,7 +50261,9 @@ class SubscribeAttributeTargetNavigatorAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49294,7 +50338,9 @@ class SubscribeAttributeTargetNavigatorClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TargetNavigator.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49393,7 +50439,9 @@ class SubscribeAttributeTemperatureMeasurementMeasuredValue : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49473,7 +50521,9 @@ class SubscribeAttributeTemperatureMeasurementMinMeasuredValue : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MinMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49553,7 +50603,9 @@ class SubscribeAttributeTemperatureMeasurementMaxMeasuredValue : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.MaxMeasuredValue response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49632,7 +50684,9 @@ class SubscribeAttributeTemperatureMeasurementTolerance : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.Tolerance response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49712,7 +50766,9 @@ class SubscribeAttributeTemperatureMeasurementAttributeList : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -49792,7 +50848,9 @@ class SubscribeAttributeTemperatureMeasurementClusterRevision : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TemperatureMeasurement.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -50632,7 +51690,9 @@ class SubscribeAttributeTestClusterBoolean : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Boolean response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -50741,7 +51801,9 @@ class SubscribeAttributeTestClusterBitmap8 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Bitmap8 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -50850,7 +51912,9 @@ class SubscribeAttributeTestClusterBitmap16 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Bitmap16 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -50959,7 +52023,9 @@ class SubscribeAttributeTestClusterBitmap32 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Bitmap32 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51068,7 +52134,9 @@ class SubscribeAttributeTestClusterBitmap64 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Bitmap64 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51177,7 +52245,9 @@ class SubscribeAttributeTestClusterInt8u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int8u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51286,7 +52356,9 @@ class SubscribeAttributeTestClusterInt16u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int16u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51395,7 +52467,9 @@ class SubscribeAttributeTestClusterInt24u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int24u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51504,7 +52578,9 @@ class SubscribeAttributeTestClusterInt32u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int32u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51613,7 +52689,9 @@ class SubscribeAttributeTestClusterInt40u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int40u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51722,7 +52800,9 @@ class SubscribeAttributeTestClusterInt48u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int48u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51831,7 +52911,9 @@ class SubscribeAttributeTestClusterInt56u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int56u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -51940,7 +53022,9 @@ class SubscribeAttributeTestClusterInt64u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int64u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52049,7 +53133,9 @@ class SubscribeAttributeTestClusterInt8s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int8s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52158,7 +53244,9 @@ class SubscribeAttributeTestClusterInt16s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int16s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52267,7 +53355,9 @@ class SubscribeAttributeTestClusterInt24s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int24s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52376,7 +53466,9 @@ class SubscribeAttributeTestClusterInt32s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int32s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52485,7 +53577,9 @@ class SubscribeAttributeTestClusterInt40s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int40s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52594,7 +53688,9 @@ class SubscribeAttributeTestClusterInt48s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int48s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52703,7 +53799,9 @@ class SubscribeAttributeTestClusterInt56s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int56s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52812,7 +53910,9 @@ class SubscribeAttributeTestClusterInt64s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Int64s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -52921,7 +54021,9 @@ class SubscribeAttributeTestClusterEnum8 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Enum8 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53030,7 +54132,9 @@ class SubscribeAttributeTestClusterEnum16 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Enum16 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53139,7 +54243,9 @@ class SubscribeAttributeTestClusterFloatSingle : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.FloatSingle response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53248,7 +54354,9 @@ class SubscribeAttributeTestClusterFloatDouble : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.FloatDouble response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53357,7 +54465,9 @@ class SubscribeAttributeTestClusterOctetString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.OctetString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53432,7 +54542,9 @@ class SubscribeAttributeTestClusterListInt8u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ListInt8u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53507,7 +54619,9 @@ class SubscribeAttributeTestClusterListOctetString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ListOctetString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53583,7 +54697,9 @@ class SubscribeAttributeTestClusterListStructOctetString : public ModelCommand { reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ListStructOctetString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53692,7 +54808,9 @@ class SubscribeAttributeTestClusterLongOctetString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.LongOctetString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53803,7 +54921,9 @@ class SubscribeAttributeTestClusterCharString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.CharString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -53914,7 +55034,9 @@ class SubscribeAttributeTestClusterLongCharString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.LongCharString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54023,7 +55145,9 @@ class SubscribeAttributeTestClusterEpochUs : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.EpochUs response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54132,7 +55256,9 @@ class SubscribeAttributeTestClusterEpochS : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.EpochS response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54241,7 +55367,9 @@ class SubscribeAttributeTestClusterVendorId : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.VendorId response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54320,7 +55448,9 @@ class SubscribeAttributeTestClusterListNullablesAndOptionalsStruct : public Mode NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ListNullablesAndOptionalsStruct response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54429,7 +55559,9 @@ class SubscribeAttributeTestClusterEnumAttr : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.EnumAttr response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54538,7 +55670,9 @@ class SubscribeAttributeTestClusterStructAttr : public ModelCommand { reportHandler:^(CHIPTestClusterClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.StructAttr response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54649,7 +55783,9 @@ class SubscribeAttributeTestClusterRangeRestrictedInt8u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.RangeRestrictedInt8u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54760,7 +55896,9 @@ class SubscribeAttributeTestClusterRangeRestrictedInt8s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.RangeRestrictedInt8s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54871,7 +56009,9 @@ class SubscribeAttributeTestClusterRangeRestrictedInt16u : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.RangeRestrictedInt16u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -54982,7 +56122,9 @@ class SubscribeAttributeTestClusterRangeRestrictedInt16s : public ModelCommand { reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.RangeRestrictedInt16s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55058,7 +56200,9 @@ class SubscribeAttributeTestClusterListLongOctetString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ListLongOctetString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55135,7 +56279,9 @@ class SubscribeAttributeTestClusterListFabricScoped : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ListFabricScoped response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55244,7 +56390,9 @@ class SubscribeAttributeTestClusterTimedWriteBoolean : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.TimedWriteBoolean response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55355,7 +56503,9 @@ class SubscribeAttributeTestClusterGeneralErrorBoolean : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.GeneralErrorBoolean response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55466,7 +56616,9 @@ class SubscribeAttributeTestClusterClusterErrorBoolean : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ClusterErrorBoolean response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55575,7 +56727,9 @@ class SubscribeAttributeTestClusterUnsupported : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.Unsupported response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55684,7 +56838,9 @@ class SubscribeAttributeTestClusterNullableBoolean : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableBoolean response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55793,7 +56949,9 @@ class SubscribeAttributeTestClusterNullableBitmap8 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableBitmap8 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -55902,7 +57060,9 @@ class SubscribeAttributeTestClusterNullableBitmap16 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableBitmap16 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56011,7 +57171,9 @@ class SubscribeAttributeTestClusterNullableBitmap32 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableBitmap32 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56120,7 +57282,9 @@ class SubscribeAttributeTestClusterNullableBitmap64 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableBitmap64 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56229,7 +57393,9 @@ class SubscribeAttributeTestClusterNullableInt8u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt8u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56338,7 +57504,9 @@ class SubscribeAttributeTestClusterNullableInt16u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt16u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56447,7 +57615,9 @@ class SubscribeAttributeTestClusterNullableInt24u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt24u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56556,7 +57726,9 @@ class SubscribeAttributeTestClusterNullableInt32u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt32u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56665,7 +57837,9 @@ class SubscribeAttributeTestClusterNullableInt40u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt40u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56774,7 +57948,9 @@ class SubscribeAttributeTestClusterNullableInt48u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt48u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56883,7 +58059,9 @@ class SubscribeAttributeTestClusterNullableInt56u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt56u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -56992,7 +58170,9 @@ class SubscribeAttributeTestClusterNullableInt64u : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt64u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57101,7 +58281,9 @@ class SubscribeAttributeTestClusterNullableInt8s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt8s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57210,7 +58392,9 @@ class SubscribeAttributeTestClusterNullableInt16s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt16s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57319,7 +58503,9 @@ class SubscribeAttributeTestClusterNullableInt24s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt24s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57428,7 +58614,9 @@ class SubscribeAttributeTestClusterNullableInt32s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt32s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57537,7 +58725,9 @@ class SubscribeAttributeTestClusterNullableInt40s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt40s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57646,7 +58836,9 @@ class SubscribeAttributeTestClusterNullableInt48s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt48s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57755,7 +58947,9 @@ class SubscribeAttributeTestClusterNullableInt56s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt56s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57864,7 +59058,9 @@ class SubscribeAttributeTestClusterNullableInt64s : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableInt64s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -57973,7 +59169,9 @@ class SubscribeAttributeTestClusterNullableEnum8 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableEnum8 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58082,7 +59280,9 @@ class SubscribeAttributeTestClusterNullableEnum16 : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableEnum16 response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58193,7 +59393,9 @@ class SubscribeAttributeTestClusterNullableFloatSingle : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableFloatSingle response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58304,7 +59506,9 @@ class SubscribeAttributeTestClusterNullableFloatDouble : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableFloatDouble response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58415,7 +59619,9 @@ class SubscribeAttributeTestClusterNullableOctetString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableOctetString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58528,7 +59734,9 @@ class SubscribeAttributeTestClusterNullableCharString : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableCharString response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58637,7 +59845,9 @@ class SubscribeAttributeTestClusterNullableEnumAttr : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableEnumAttr response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58746,7 +59956,9 @@ class SubscribeAttributeTestClusterNullableStruct : public ModelCommand { reportHandler:^(CHIPTestClusterClusterSimpleStruct * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableStruct response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58859,7 +60071,9 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt8u : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableRangeRestrictedInt8u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -58972,7 +60186,9 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt8s : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableRangeRestrictedInt8s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59087,7 +60303,9 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt16u : public ModelC NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableRangeRestrictedInt16u response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59202,7 +60420,9 @@ class SubscribeAttributeTestClusterNullableRangeRestrictedInt16s : public ModelC NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.NullableRangeRestrictedInt16s response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59278,7 +60498,9 @@ class SubscribeAttributeTestClusterGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59354,7 +60576,9 @@ class SubscribeAttributeTestClusterAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59429,7 +60653,9 @@ class SubscribeAttributeTestClusterAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59504,7 +60730,9 @@ class SubscribeAttributeTestClusterClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TestCluster.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59819,7 +61047,9 @@ class SubscribeAttributeThermostatLocalTemperature : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.LocalTemperature response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59896,7 +61126,9 @@ class SubscribeAttributeThermostatAbsMinHeatSetpointLimit : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMinHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -59973,7 +61205,9 @@ class SubscribeAttributeThermostatAbsMaxHeatSetpointLimit : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMaxHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60050,7 +61284,9 @@ class SubscribeAttributeThermostatAbsMinCoolSetpointLimit : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMinCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60127,7 +61363,9 @@ class SubscribeAttributeThermostatAbsMaxCoolSetpointLimit : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AbsMaxCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60239,7 +61477,9 @@ class SubscribeAttributeThermostatOccupiedCoolingSetpoint : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedCoolingSetpoint response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60351,7 +61591,9 @@ class SubscribeAttributeThermostatOccupiedHeatingSetpoint : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.OccupiedHeatingSetpoint response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60462,7 +61704,9 @@ class SubscribeAttributeThermostatMinHeatSetpointLimit : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60573,7 +61817,9 @@ class SubscribeAttributeThermostatMaxHeatSetpointLimit : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MaxHeatSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60684,7 +61930,9 @@ class SubscribeAttributeThermostatMinCoolSetpointLimit : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60795,7 +62043,9 @@ class SubscribeAttributeThermostatMaxCoolSetpointLimit : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MaxCoolSetpointLimit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -60906,7 +62156,9 @@ class SubscribeAttributeThermostatMinSetpointDeadBand : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.MinSetpointDeadBand response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61019,7 +62271,9 @@ class SubscribeAttributeThermostatControlSequenceOfOperation : public ModelComma reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ControlSequenceOfOperation response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61128,7 +62382,9 @@ class SubscribeAttributeThermostatSystemMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.SystemMode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61203,7 +62459,9 @@ class SubscribeAttributeThermostatStartOfWeek : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.StartOfWeek response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61281,7 +62539,9 @@ class SubscribeAttributeThermostatNumberOfWeeklyTransitions : public ModelComman reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfWeeklyTransitions response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61359,7 +62619,9 @@ class SubscribeAttributeThermostatNumberOfDailyTransitions : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.NumberOfDailyTransitions response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61434,7 +62696,9 @@ class SubscribeAttributeThermostatAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61509,7 +62773,9 @@ class SubscribeAttributeThermostatFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61584,7 +62850,9 @@ class SubscribeAttributeThermostatClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"Thermostat.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61718,7 +62986,9 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationTemperatureDisplayMo NSLog(@"ThermostatUserInterfaceConfiguration.TemperatureDisplayMode " @"response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61832,7 +63102,9 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationKeypadLockout : publ reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.KeypadLockout response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -61943,17 +63215,20 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationScheduleProgrammingV CHIPThermostatUserInterfaceConfiguration * cluster = [[CHIPThermostatUserInterfaceConfiguration alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster subscribeAttributeScheduleProgrammingVisibilityWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThermostatUserInterfaceConfiguration." - @"ScheduleProgrammingVisibility response %@", - [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster + subscribeAttributeScheduleProgrammingVisibilityWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThermostatUserInterfaceConfiguration." + @"ScheduleProgrammingVisibility response %@", + [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; return CHIP_NO_ERROR; } @@ -62031,7 +63306,9 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationGeneratedCommandList NSLog(@"ThermostatUserInterfaceConfiguration.GeneratedCommandList " @"response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62111,7 +63388,9 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationAcceptedCommandList NSLog( @"ThermostatUserInterfaceConfiguration.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62189,7 +63468,9 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationAttributeList : publ reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62267,7 +63548,9 @@ class SubscribeAttributeThermostatUserInterfaceConfigurationClusterRevision : pu reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThermostatUserInterfaceConfiguration.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62457,7 +63740,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsChannel : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Channel response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62536,7 +63821,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRoutingRole : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RoutingRole response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62615,7 +63902,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsNetworkName : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.NetworkName response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62694,7 +63983,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsPanId : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PanId response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62774,7 +64065,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsExtendedPanId : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ExtendedPanId response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62854,7 +64147,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsMeshLocalPrefix : public ModelCo reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.MeshLocalPrefix response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -62934,7 +64229,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsOverrunCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.OverrunCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63014,7 +64311,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsNeighborTableList : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.NeighborTableList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63094,7 +64393,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRouteTableList : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RouteTableList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63173,7 +64474,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsPartitionId : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PartitionId response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63252,7 +64555,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsWeighting : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Weighting response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63331,7 +64636,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsDataVersion : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.DataVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63411,7 +64718,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsStableDataVersion : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.StableDataVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63491,7 +64800,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsLeaderRouterId : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.LeaderRouterId response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63571,7 +64882,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsDetachedRoleCount : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.DetachedRoleCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63651,7 +64964,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsChildRoleCount : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ChildRoleCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63731,7 +65046,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRouterRoleCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RouterRoleCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63811,7 +65128,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsLeaderRoleCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.LeaderRoleCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63891,7 +65210,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsAttachAttemptCount : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AttachAttemptCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -63971,7 +65292,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsPartitionIdChangeCount : public reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PartitionIdChangeCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64045,18 +65368,20 @@ class SubscribeAttributeThreadNetworkDiagnosticsBetterPartitionAttachAttemptCoun endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster - subscribeAttributeBetterPartitionAttachAttemptCountWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics." - @"BetterPartitionAttachAttemptCount response %@", - [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster subscribeAttributeBetterPartitionAttachAttemptCountWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDiagnostics." + @"BetterPartitionAttachAttemptCount response %@", + [value description]); + if (error || !mWait) { + SetCommandExitStatus( + [CHIPError errorToCHIPErrorCode:error]); + } + }]; return CHIP_NO_ERROR; } @@ -64135,7 +65460,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsParentChangeCount : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ParentChangeCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64215,7 +65542,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxTotalCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxTotalCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64295,7 +65624,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxUnicastCount : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxUnicastCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64375,7 +65706,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxBroadcastCount : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBroadcastCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64455,7 +65788,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxAckRequestedCount : public Mod reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxAckRequestedCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64535,7 +65870,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxAckedCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxAckedCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64615,7 +65952,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxNoAckRequestedCount : public M reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxNoAckRequestedCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64694,7 +66033,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxDataCount : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDataCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64774,7 +66115,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxDataPollCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxDataPollCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64854,7 +66197,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconCount : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBeaconCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -64934,7 +66279,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxBeaconRequestCount : public Mo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxBeaconRequestCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65014,7 +66361,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxOtherCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxOtherCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65094,7 +66443,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxRetryCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxRetryCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65177,7 +66528,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxDirectMaxRetryExpiryCount : pu NSLog(@"ThreadNetworkDiagnostics.TxDirectMaxRetryExpiryCount " @"response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65251,17 +66604,20 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxIndirectMaxRetryExpiryCount : endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster subscribeAttributeTxIndirectMaxRetryExpiryCountWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"ThreadNetworkDiagnostics." - @"TxIndirectMaxRetryExpiryCount response %@", - [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster + subscribeAttributeTxIndirectMaxRetryExpiryCountWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"ThreadNetworkDiagnostics.TxIndirectMaxRetryExpiryCount " + @"response %@", + [value description]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } + }]; return CHIP_NO_ERROR; } @@ -65340,7 +66696,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxErrCcaCount : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrCcaCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65420,7 +66778,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxErrAbortCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrAbortCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65500,7 +66860,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsTxErrBusyChannelCount : public M reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.TxErrBusyChannelCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65580,7 +66942,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxTotalCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxTotalCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65660,7 +67024,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxUnicastCount : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxUnicastCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65740,7 +67106,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxBroadcastCount : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBroadcastCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65819,7 +67187,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxDataCount : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDataCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65899,7 +67269,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxDataPollCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDataPollCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -65979,7 +67351,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconCount : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBeaconCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66059,7 +67433,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxBeaconRequestCount : public Mo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxBeaconRequestCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66139,7 +67515,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxOtherCount : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxOtherCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66219,7 +67597,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxAddressFilteredCount : public reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxAddressFilteredCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66301,7 +67681,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxDestAddrFilteredCount : public reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDestAddrFilteredCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66381,7 +67763,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxDuplicatedCount : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxDuplicatedCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66461,7 +67845,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxErrNoFrameCount : public Model reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrNoFrameCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66544,7 +67930,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxErrUnknownNeighborCount : publ NSLog( @"ThreadNetworkDiagnostics.RxErrUnknownNeighborCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66626,7 +68014,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxErrInvalidSrcAddrCount : publi reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrInvalidSrcAddrCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66706,7 +68096,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxErrSecCount : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrSecCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66786,7 +68178,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxErrFcsCount : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrFcsCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66866,7 +68260,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsRxErrOtherCount : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.RxErrOtherCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -66946,7 +68342,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsActiveTimestamp : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ActiveTimestamp response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67026,7 +68424,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsPendingTimestamp : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.PendingTimestamp response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67105,7 +68505,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsDelay : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.Delay response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67185,7 +68587,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsSecurityPolicy : public ModelCom reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.SecurityPolicy response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67264,7 +68668,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsChannelMask : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ChannelMask response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67347,7 +68753,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsOperationalDatasetComponents : p NSLog(@"ThreadNetworkDiagnostics.OperationalDatasetComponents " @"response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67428,7 +68836,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsActiveNetworkFaultsList : public reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ActiveNetworkFaultsList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67508,7 +68918,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsGeneratedCommandList : public Mo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67588,7 +69000,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsAcceptedCommandList : public Mod reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67668,7 +69082,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsAttributeList : public ModelComm subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67747,7 +69163,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsFeatureMap : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67827,7 +69245,9 @@ class SubscribeAttributeThreadNetworkDiagnosticsClusterRevision : public ModelCo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"ThreadNetworkDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -67960,7 +69380,9 @@ class SubscribeAttributeTimeFormatLocalizationHourFormat : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.HourFormat response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68077,7 +69499,9 @@ class SubscribeAttributeTimeFormatLocalizationActiveCalendarType : public ModelC reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.ActiveCalendarType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68157,7 +69581,9 @@ class SubscribeAttributeTimeFormatLocalizationSupportedCalendarTypes : public Mo reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.SupportedCalendarTypes response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68237,7 +69663,9 @@ class SubscribeAttributeTimeFormatLocalizationGeneratedCommandList : public Mode reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68317,7 +69745,9 @@ class SubscribeAttributeTimeFormatLocalizationAcceptedCommandList : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68397,7 +69827,9 @@ class SubscribeAttributeTimeFormatLocalizationClusterRevision : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"TimeFormatLocalization.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68528,7 +69960,9 @@ class SubscribeAttributeUnitLocalizationTemperatureUnit : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.TemperatureUnit response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68607,7 +70041,9 @@ class SubscribeAttributeUnitLocalizationAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68686,7 +70122,9 @@ class SubscribeAttributeUnitLocalizationFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68765,7 +70203,9 @@ class SubscribeAttributeUnitLocalizationClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UnitLocalization.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68856,7 +70296,9 @@ class SubscribeAttributeUserLabelLabelList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.LabelList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -68932,7 +70374,9 @@ class SubscribeAttributeUserLabelGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69008,7 +70452,9 @@ class SubscribeAttributeUserLabelAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69083,7 +70529,9 @@ class SubscribeAttributeUserLabelClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"UserLabel.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69174,7 +70622,9 @@ class SubscribeAttributeWakeOnLanMACAddress : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSString * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLan.MACAddress response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69250,7 +70700,9 @@ class SubscribeAttributeWakeOnLanGeneratedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLan.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69326,7 +70778,9 @@ class SubscribeAttributeWakeOnLanAcceptedCommandList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLan.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69401,7 +70855,9 @@ class SubscribeAttributeWakeOnLanAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLan.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69476,7 +70932,9 @@ class SubscribeAttributeWakeOnLanClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WakeOnLan.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69618,7 +71076,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsBssid : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSData * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.Bssid response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69697,7 +71157,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsSecurityType : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.SecurityType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69776,7 +71238,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsWiFiVersion : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.WiFiVersion response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69856,7 +71320,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsChannelNumber : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.ChannelNumber response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -69935,7 +71401,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsRssi : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.Rssi response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70015,7 +71483,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsBeaconLostCount : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BeaconLostCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70095,7 +71565,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsBeaconRxCount : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.BeaconRxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70175,7 +71647,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastRxCount : public Mo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketMulticastRxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70255,7 +71729,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsPacketMulticastTxCount : public Mo reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketMulticastTxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70335,7 +71811,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastRxCount : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketUnicastRxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70415,7 +71893,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsPacketUnicastTxCount : public Mode reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.PacketUnicastTxCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70495,7 +71975,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsCurrentMaxRate : public ModelComma subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.CurrentMaxRate response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70574,7 +72056,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsOverrunCount : public ModelCommand subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.OverrunCount response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70654,7 +72138,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsGeneratedCommandList : public Mode reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70734,7 +72220,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsAcceptedCommandList : public Model reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70814,7 +72302,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsAttributeList : public ModelComman subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70893,7 +72383,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -70973,7 +72465,9 @@ class SubscribeAttributeWiFiNetworkDiagnosticsClusterRevision : public ModelComm reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WiFiNetworkDiagnostics.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71321,7 +72815,9 @@ class SubscribeAttributeWindowCoveringType : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.Type response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71397,7 +72893,9 @@ class SubscribeAttributeWindowCoveringCurrentPositionLift : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLift response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71473,7 +72971,9 @@ class SubscribeAttributeWindowCoveringCurrentPositionTilt : public ModelCommand reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTilt response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71548,7 +73048,9 @@ class SubscribeAttributeWindowCoveringConfigStatus : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.ConfigStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71627,7 +73129,9 @@ class SubscribeAttributeWindowCoveringCurrentPositionLiftPercentage : public Mod NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionLiftPercentage response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71706,7 +73210,9 @@ class SubscribeAttributeWindowCoveringCurrentPositionTiltPercentage : public Mod NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.CurrentPositionTiltPercentage response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71782,7 +73288,9 @@ class SubscribeAttributeWindowCoveringOperationalStatus : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.OperationalStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71862,7 +73370,9 @@ class SubscribeAttributeWindowCoveringTargetPositionLiftPercent100ths : public M NSLog(@"WindowCovering.TargetPositionLiftPercent100ths response " @"%@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -71942,7 +73452,9 @@ class SubscribeAttributeWindowCoveringTargetPositionTiltPercent100ths : public M NSLog(@"WindowCovering.TargetPositionTiltPercent100ths response " @"%@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72017,7 +73529,9 @@ class SubscribeAttributeWindowCoveringEndProductType : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.EndProductType response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72087,18 +73601,20 @@ class SubscribeAttributeWindowCoveringCurrentPositionLiftPercent100ths : public dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster - subscribeAttributeCurrentPositionLiftPercent100thsWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths " - @"response %@", - [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster subscribeAttributeCurrentPositionLiftPercent100thsWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WindowCovering.CurrentPositionLiftPercent100ths " + @"response %@", + [value description]); + if (error || !mWait) { + SetCommandExitStatus( + [CHIPError errorToCHIPErrorCode:error]); + } + }]; return CHIP_NO_ERROR; } @@ -72167,18 +73683,20 @@ class SubscribeAttributeWindowCoveringCurrentPositionTiltPercent100ths : public dispatch_queue_t callbackQueue = dispatch_queue_create("com.chip.command", DISPATCH_QUEUE_SERIAL); CHIPWindowCovering * cluster = [[CHIPWindowCovering alloc] initWithDevice:device endpoint:endpointId queue:callbackQueue]; CHIPSubscribeParams * params = [[CHIPSubscribeParams alloc] init]; - [cluster - subscribeAttributeCurrentPositionTiltPercent100thsWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] - maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] - params:params - subscriptionEstablished:NULL - reportHandler:^( - NSNumber * _Nullable value, NSError * _Nullable error) { - NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths " - @"response %@", - [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); - }]; + [cluster subscribeAttributeCurrentPositionTiltPercent100thsWithMinInterval:[NSNumber numberWithUnsignedInt:mMinInterval] + maxInterval:[NSNumber numberWithUnsignedInt:mMaxInterval] + params:params + subscriptionEstablished:NULL + reportHandler:^( + NSNumber * _Nullable value, NSError * _Nullable error) { + NSLog(@"WindowCovering.CurrentPositionTiltPercent100ths " + @"response %@", + [value description]); + if (error || !mWait) { + SetCommandExitStatus( + [CHIPError errorToCHIPErrorCode:error]); + } + }]; return CHIP_NO_ERROR; } @@ -72253,7 +73771,9 @@ class SubscribeAttributeWindowCoveringInstalledOpenLimitLift : public ModelComma reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledOpenLimitLift response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72331,7 +73851,9 @@ class SubscribeAttributeWindowCoveringInstalledClosedLimitLift : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledClosedLimitLift response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72407,7 +73929,9 @@ class SubscribeAttributeWindowCoveringInstalledOpenLimitTilt : public ModelComma reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledOpenLimitTilt response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72485,7 +74009,9 @@ class SubscribeAttributeWindowCoveringInstalledClosedLimitTilt : public ModelCom reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.InstalledClosedLimitTilt response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72594,7 +74120,9 @@ class SubscribeAttributeWindowCoveringMode : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.Mode response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72669,7 +74197,9 @@ class SubscribeAttributeWindowCoveringSafetyStatus : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.SafetyStatus response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72745,7 +74275,9 @@ class SubscribeAttributeWindowCoveringGeneratedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.GeneratedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72821,7 +74353,9 @@ class SubscribeAttributeWindowCoveringAcceptedCommandList : public ModelCommand reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.AcceptedCommandList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72896,7 +74430,9 @@ class SubscribeAttributeWindowCoveringAttributeList : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSArray * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.AttributeList response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -72971,7 +74507,9 @@ class SubscribeAttributeWindowCoveringFeatureMap : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.FeatureMap response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; @@ -73046,7 +74584,9 @@ class SubscribeAttributeWindowCoveringClusterRevision : public ModelCommand { subscriptionEstablished:NULL reportHandler:^(NSNumber * _Nullable value, NSError * _Nullable error) { NSLog(@"WindowCovering.ClusterRevision response %@", [value description]); - SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + if (error || !mWait) { + SetCommandExitStatus([CHIPError errorToCHIPErrorCode:error]); + } }]; return CHIP_NO_ERROR; From b590a92f45b0516083dcb6187e6dea1931436ff8 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 25 Mar 2022 05:27:32 +0100 Subject: [PATCH 67/70] [YAML] When waiting for an attribute in a test, the name is not generated properly (#16617) --- examples/chip-tool/templates/tests/partials/test_cluster.zapt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index aa11b89cc0f81b..415815eda16014 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -212,7 +212,7 @@ class {{filename}}Suite: public TestCommand const chip::EndpointId endpoint = {{#if (chip_tests_config_has "endpoint")}}mEndpoint.HasValue() ? mEndpoint.Value() : {{/if}}{{endpoint}}; ChipLogError(chipTool, "[Endpoint: 0x%08x Cluster: {{cluster}} {{#if isAttribute}}Attribute: {{attribute}}{{else}}Command: {{wait}}{{/if}}] {{label}}", endpoint); {{#*inline "waitForTypeName"}}{{#if isAttribute}}Attribute{{else}}Command{{/if}}{{/inline}} - {{#*inline "waitForTypeId"}}chip::app::Clusters::{{asUpperCamelCase cluster}}::{{#if isAttribute}}Attributes::{{attribute}}{{else}}Commands::{{wait}}{{/if}}::Id{{/inline}} + {{#*inline "waitForTypeId"}}chip::app::Clusters::{{asUpperCamelCase cluster}}::{{#if isAttribute}}Attributes::{{asUpperCamelCase attribute}}{{else}}Commands::{{asUpperCamelCase wait}}{{/if}}::Id{{/inline}} ClearAttributeAndCommandPaths(); m{{>waitForTypeName}}Path = chip::app::Concrete{{>waitForTypeName}}Path(endpoint, chip::app::Clusters::{{asUpperCamelCase cluster}}::Id, {{>waitForTypeId}}); return CHIP_NO_ERROR; From 197f65f8f76f48b45842594d39ca8235179a14f6 Mon Sep 17 00:00:00 2001 From: Jean-Francois Penven <67962328+jepenven-silabs@users.noreply.github.com> Date: Fri, 25 Mar 2022 00:27:51 -0400 Subject: [PATCH 68/70] [Group] Remove AssociateWithGroup (#16583) * Remove AssociateWithGroup * Fix comments --- .../tests/partials/test_cluster.zapt | 15 +++-- src/controller/CHIPCluster.cpp | 9 --- src/controller/CHIPCluster.h | 57 +++++++++++++++---- .../chip-tool/zap-generated/test/Commands.h | 10 ++-- 4 files changed, 61 insertions(+), 30 deletions(-) diff --git a/examples/chip-tool/templates/tests/partials/test_cluster.zapt b/examples/chip-tool/templates/tests/partials/test_cluster.zapt index 415815eda16014..dbd550ba87a176 100644 --- a/examples/chip-tool/templates/tests/partials/test_cluster.zapt +++ b/examples/chip-tool/templates/tests/partials/test_cluster.zapt @@ -276,11 +276,9 @@ class {{filename}}Suite: public TestCommand {{> maybeWait }} {{else}} chip::Controller::{{asUpperCamelCase cluster}}ClusterTest cluster; - {{#if isGroupCommand}} - cluster.AssociateWithGroup({{>device}}, groupId); - {{else}} + {{#unless isGroupCommand}} cluster.Associate({{>device}}, endpoint); - {{/if}} + {{/unless}} {{#if (chip_tests_item_has_list)}} ListFreer listFreer;{{/if}} {{#chip_tests_item_parameters}} @@ -289,11 +287,18 @@ class {{filename}}Suite: public TestCommand {{/chip_tests_item_parameters}} {{#if isWriteAttribute}} + {{#if isGroupCommand}} + ReturnErrorOnFailure(cluster.WriteAttribute(groupId, {{>device}}->GetSecureSession().Value()->GetFabricIndex(), {{>device}}->GetDeviceId(),{{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} + {{~> maybeTimedInteractionTimeout ~}} + , {{>staticDoneResponse}} + )); + {{> maybeWait }} + {{else}} ReturnErrorOnFailure(cluster.WriteAttribute({{#chip_tests_item_parameters}}{{asLowerCamelCase name}}Argument, {{/chip_tests_item_parameters}}this, {{>staticSuccessResponse}}, {{>staticFailureResponse}} {{~> maybeTimedInteractionTimeout ~}} - {{~#if isGroupCommand}}, {{>staticDoneResponse}}{{/if~}} )); {{> maybeWait }} + {{/if}} {{else if isReadEvent}} ReturnErrorOnFailure(cluster.ReadEvent<{{zapTypeToDecodableClusterObjectType event ns=cluster isArgument=true}}>(this, {{>staticSuccessResponse}}, {{>staticFailureResponse}})); {{else if isSubscribeEvent}} diff --git a/src/controller/CHIPCluster.cpp b/src/controller/CHIPCluster.cpp index d011ea5832a9b9..b829d575cee52f 100644 --- a/src/controller/CHIPCluster.cpp +++ b/src/controller/CHIPCluster.cpp @@ -42,15 +42,6 @@ CHIP_ERROR ClusterBase::Associate(DeviceProxy * device, EndpointId endpoint) return err; } -CHIP_ERROR ClusterBase::AssociateWithGroup(DeviceProxy * device, GroupId groupId) -{ - // TODO Update this function to work in all possible conditions Issue #11850 - mDevice = device; - mEndpoint = 0; // Set to 0 for now. - mGroupId.SetValue(groupId); - return CHIP_NO_ERROR; -} - void ClusterBase::Dissociate() { mDevice = nullptr; diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h index 5dbbb8aaa91204..859316f4699cb0 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -56,7 +56,6 @@ class DLL_EXPORT ClusterBase virtual ~ClusterBase() {} CHIP_ERROR Associate(DeviceProxy * device, EndpointId endpoint); - CHIP_ERROR AssociateWithGroup(DeviceProxy * device, GroupId groupId); void Dissociate(); // Temporary function to set command timeout before we move over to InvokeCommand @@ -141,21 +140,56 @@ class DLL_EXPORT ClusterBase } }; - if (mGroupId.HasValue()) - { - VerifyOrReturnError(mDevice->GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); - Transport::OutgoingGroupSession groupSession(mGroupId.Value(), mDevice->GetSecureSession().Value()->GetFabricIndex(), - mDevice->GetDeviceId()); - return chip::Controller::WriteAttribute(SessionHandle(groupSession), mEndpoint, clusterId, attributeId, - requestData, onSuccessCb, onFailureCb, aTimedWriteTimeoutMs, onDoneCb, - aDataVersion); - } - return chip::Controller::WriteAttribute(mDevice->GetSecureSession().Value(), mEndpoint, clusterId, attributeId, requestData, onSuccessCb, onFailureCb, aTimedWriteTimeoutMs, onDoneCb, aDataVersion); } + template + CHIP_ERROR WriteAttribute(GroupId groupId, FabricIndex fabricIndex, NodeId sourceNodeId, const AttrType & requestData, + void * context, ClusterId clusterId, AttributeId attributeId, WriteResponseSuccessCallback successCb, + WriteResponseFailureCallback failureCb, const Optional & aTimedWriteTimeoutMs, + WriteResponseDoneCallback doneCb = nullptr, const Optional & aDataVersion = NullOptional) + { + + auto onSuccessCb = [context, successCb](const app::ConcreteAttributePath & aPath) { + if (successCb != nullptr) + { + successCb(context); + } + }; + + auto onFailureCb = [context, failureCb](const app::ConcreteAttributePath * aPath, CHIP_ERROR aError) { + if (failureCb != nullptr) + { + failureCb(context, aError); + } + }; + + auto onDoneCb = [context, doneCb](app::WriteClient * pWriteClient) { + if (doneCb != nullptr) + { + doneCb(context); + } + }; + + Transport::OutgoingGroupSession groupSession(groupId, fabricIndex, sourceNodeId); + return chip::Controller::WriteAttribute(SessionHandle(groupSession), 0 /*Unused for Group*/, clusterId, + attributeId, requestData, onSuccessCb, onFailureCb, aTimedWriteTimeoutMs, + onDoneCb, aDataVersion); + } + + template + CHIP_ERROR WriteAttribute(GroupId groupId, FabricIndex fabricIndex, NodeId sourceNodeId, + const typename AttributeInfo::Type & requestData, void * context, + WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb, + WriteResponseDoneCallback doneCb = nullptr, const Optional & aDataVersion = NullOptional, + const Optional & aTimedWriteTimeoutMs = NullOptional) + { + return WriteAttribute(groupId, fabricIndex, sourceNodeId, requestData, context, AttributeInfo::GetClusterId(), + AttributeInfo::GetAttributeId(), successCb, failureCb, aTimedWriteTimeoutMs, doneCb, aDataVersion); + } + template CHIP_ERROR WriteAttribute(const typename AttributeInfo::Type & requestData, void * context, WriteResponseSuccessCallback successCb, WriteResponseFailureCallback failureCb, @@ -345,7 +379,6 @@ class DLL_EXPORT ClusterBase const ClusterId mClusterId; DeviceProxy * mDevice; EndpointId mEndpoint; - Optional mGroupId; Optional mTimeout; }; diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index 22f68a840de67a..a26056976c19c7 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -101806,13 +101806,14 @@ class TestGroupMessagingSuite : public TestCommand { const chip::GroupId groupId = 258; chip::Controller::BasicClusterTest cluster; - cluster.AssociateWithGroup(mDevices[kIdentityAlpha], groupId); chip::CharSpan locationArgument; locationArgument = chip::Span("USgarbage: not in length on purpose", 2); ReturnErrorOnFailure(cluster.WriteAttribute( - locationArgument, this, OnSuccessCallback_7, OnFailureCallback_7, OnDoneCallback_7)); + groupId, mDevices[kIdentityAlpha]->GetSecureSession().Value()->GetFabricIndex(), + mDevices[kIdentityAlpha]->GetDeviceId(), locationArgument, this, OnSuccessCallback_7, OnFailureCallback_7, + OnDoneCallback_7)); return CHIP_NO_ERROR; } @@ -101854,13 +101855,14 @@ class TestGroupMessagingSuite : public TestCommand { const chip::GroupId groupId = 258; chip::Controller::BasicClusterTest cluster; - cluster.AssociateWithGroup(mDevices[kIdentityAlpha], groupId); chip::CharSpan locationArgument; locationArgument = chip::Span("XXgarbage: not in length on purpose", 2); ReturnErrorOnFailure(cluster.WriteAttribute( - locationArgument, this, OnSuccessCallback_9, OnFailureCallback_9, OnDoneCallback_9)); + groupId, mDevices[kIdentityAlpha]->GetSecureSession().Value()->GetFabricIndex(), + mDevices[kIdentityAlpha]->GetDeviceId(), locationArgument, this, OnSuccessCallback_9, OnFailureCallback_9, + OnDoneCallback_9)); return CHIP_NO_ERROR; } From eb310c7fb75fd374979641c71bb6e795d84c4607 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 25 Mar 2022 09:53:01 -0400 Subject: [PATCH 69/70] Add `--fix` support to clang-tidy runner (#16646) * Make clang variant as a requirement for asan/tsan builds, add support for required variants for build systems * Restyle * Also update workflows * Adding a clang-tidy helper script that is outside the build process. Replaces the pw_command_runner path we had before and allows independent execution of the checker. * Remove pw command launcher from darwin as well. clang tidy on linux should be sufficient for now * Use clang builds and validate more compile databases * Adjust test group ordering since we have placed clang as a last variant * More moving of chip tool variants to make the options in yaml file make sense * add missin $ for var specifier * Add clang variant to tsan * Asan/tsan not limited by clang, so updated as such * Restyle * Ensure darwin clang-tidy is also run * Ensure compile commands are exported * Update to use same coverage for tidy for linux as well as before * Undo changes to TestCommand * Remove modernize-nullptr for now: it is still too strict * Select individual OS compilations and do not compile gcc variants on mac * It looks like IOS is always compiled with gcc - see build/toolchain/build/ios. Do not attempt to clang-enable it nor clang-tidy * Tidy gcc/g++ as well * fix typo * Remove PWcommandlauncher from default build as well * Bump up the timeout value for clang validation a lot just in case * Make code easier to read * Fix darwin paths: when using gcc/g++, sysroot is required * More robust gcc finding of sysroot * Typo fix and restyle * Fix support to clangtidy * Add support for specific checks to be run. Tested with modernize-redundant-void-arg (quite a few found) * Disabled optin-osx-cocoa-localizability-emptylocalizationcontextchecker-objc for clang tidy default * Fix optin to be case correct: clang-analyzer-optin.osx.cocoa.localizability.EmptyLocalizationContextChecker * Restyle --- scripts/run-clang-tidy-on-compile-commands.py | 133 ++++++++++++++++-- 1 file changed, 121 insertions(+), 12 deletions(-) diff --git a/scripts/run-clang-tidy-on-compile-commands.py b/scripts/run-clang-tidy-on-compile-commands.py index 2de0944671c7aa..04bfcd707d9a35 100755 --- a/scripts/run-clang-tidy-on-compile-commands.py +++ b/scripts/run-clang-tidy-on-compile-commands.py @@ -18,6 +18,13 @@ ./scripts/run-clang-tidy-on-compile-commands.py check +# Run and output a fix yaml + +./scripts/run-clang-tidy-on-compile-commands.py --export-fixes out/fixes.yaml check + +# Apply the fixes +clang-apply-replacements out/fixes.yaml + """ import build @@ -28,13 +35,15 @@ import logging import multiprocessing import os +import queue import re import shlex import subprocess import sys +import tempfile import threading import traceback -import queue +import yaml class TidyResult: @@ -97,10 +106,15 @@ def ExportFixesTo(self, f: str): self.tidy_arguments.append("--export-fixes") self.tidy_arguments.append(f) + def SetChecks(self, checks: str): + self.tidy_arguments.append("--checks") + self.tidy_arguments.append(checks) + def Check(self): logging.debug("Running tidy on %s from %s", self.file, self.directory) try: - cmd = ["clang-tidy", self.file, "--"] + self.clang_arguments + cmd = ["clang-tidy", self.file] + \ + self.tidy_arguments + ["--"] + self.clang_arguments logging.debug("Executing: %r" % cmd) proc = subprocess.Popen( @@ -172,6 +186,8 @@ class ClangTidyRunner: def __init__(self): self.entries = [] self.state = TidyState() + self.fixes_file = None + self.fixes_temporary_file_dir = None self.gcc_sysroot = None if sys.platform == 'darwin': @@ -192,11 +208,67 @@ def AddDatabase(self, compile_commands_json): self.entries.append(item) + def Cleanup(self): + if self.fixes_temporary_file_dir: + all_diagnostics = [] + + # When running over several files, fixes may be applied to the same + # file over and over again, like 'append override' can result in the + # same override being appended multiple times. + already_seen = set() + for name in glob.iglob( + os.path.join(self.fixes_temporary_file_dir.name, "*.yaml") + ): + content = yaml.safe_load(open(name, "r")) + if not content: + continue + diagnostics = content.get("Diagnostics", []) + + # Allow all diagnostics for distinct paths to be applied + # at once but never again for future paths + for d in diagnostics: + if d['DiagnosticMessage']['FilePath'] not in already_seen: + all_diagnostics.append(d) + + # in the future assume these files were already processed + for d in diagnostics: + already_seen.add(d['DiagnosticMessage']['FilePath']) + + if all_diagnostics: + with open(self.fixes_file, "w") as out: + yaml.safe_dump( + {"MainSourceFile": "", "Diagnostics": all_diagnostics}, out + ) + else: + open(self.fixes_file, "w").close() + + logging.info( + "Cleaning up directory: %r", self.fixes_temporary_file_dir.name + ) + self.fixes_temporary_file_dir.cleanup() + self.fixes_temporary_file_dir = None + def ExportFixesTo(self, f): # use absolute path since running things will change working directories - f = os.path.abspath(f) + self.fixes_file = os.path.abspath(f) + self.fixes_temporary_file_dir = tempfile.TemporaryDirectory( + prefix="tidy-", suffix="-fixes" + ) + + logging.info( + "Storing temporary fix files into %s", self.fixes_temporary_file_dir.name + ) + for idx, e in enumerate(self.entries): + e.ExportFixesTo( + os.path.join( + self.fixes_temporary_file_dir.name, "fixes%d.yaml" % ( + idx + 1,) + ) + ) + + def SetChecks(self, checks: str): for e in self.entries: - e.ExportFixesTo(f) + e.SetChecks(checks) def FilterEntries(self, f): for e in self.entries: @@ -235,7 +307,7 @@ def Check(self): for name in self.state.failed_files: logging.warning("Failure reported for %s", name) - sys.exit(1) + return self.state.failures == 0 # Supported log levels, mapping string values required for argument @@ -283,7 +355,13 @@ def Check(self): "--export-fixes", default=None, type=click.Path(), - help="Where to export fixes to apply. TODO(fix apply not yet implemented).", + help="Where to export fixes to apply.", +) +@click.option( + "--checks", + default=None, + type=str, + help="Checks to run (passed in to clang-tidy). If not set the .clang-tidy file is used.", ) @click.pass_context def main( @@ -294,6 +372,7 @@ def main( log_level, no_log_timestamps, export_fixes, + checks, ): log_fmt = "%(asctime)s %(levelname)-7s %(message)s" if no_log_timestamps: @@ -311,21 +390,28 @@ def main( raise Exception("Could not find `compile_commands.json` in ./out") logging.info("Will use %s for compile", compile_database) - context.obj = ClangTidyRunner() + context.obj = runner = ClangTidyRunner() + + @context.call_on_close + def cleanup(): + runner.Cleanup() for name in compile_database: - context.obj.AddDatabase(name) + runner.AddDatabase(name) if file_include_regex: r = re.compile(file_include_regex) - context.obj.FilterEntries(lambda e: r.search(e.file)) + runner.FilterEntries(lambda e: r.search(e.file)) if file_exclude_regex: r = re.compile(file_exclude_regex) - context.obj.FilterEntries(lambda e: not r.search(e.file)) + runner.FilterEntries(lambda e: not r.search(e.file)) if export_fixes: - context.obj.ExportFixesTo(export_fixes) + runner.ExportFixesTo(export_fixes) + + if checks: + runner.SetChecks(checks) for e in context.obj.entries: logging.info("Will tidy %s", e.full_path) @@ -334,7 +420,30 @@ def main( @main.command("check", help="Run clang-tidy check") @click.pass_context def cmd_check(context): - context.obj.Check() + if not context.obj.Check(): + sys.exit(1) + + +@main.command("fix", help="Run check followd by fix") +@click.pass_context +def cmd_fix(context): + runner = context.obj + with tempfile.TemporaryDirectory(prefix="tidy-apply-fixes") as tmpdir: + if not runner.fixes_file: + runner.ExportFixesTo(os.path.join(tmpdir, "fixes.tmp")) + + runner.Check() + runner.Cleanup() + + if runner.state.failures: + fixes_yaml = os.path.join(tmpdir, "fixes.yaml") + with open(fixes_yaml, "w") as out: + out.write(open(runner.fixes_file, "r").read()) + + logging.info("Applying fixes in %s", tmpdir) + subprocess.check_call(["clang-apply-replacements", tmpdir]) + else: + logging.info("No failures detected, no fixes to apply.") if __name__ == "__main__": From 0fe4757d111d1e2e5127d55b6e64967c43ff4f85 Mon Sep 17 00:00:00 2001 From: ManjunathRA Date: Fri, 25 Mar 2022 19:45:30 +0530 Subject: [PATCH 70/70] Test added Mar 10 (#16073) * Added Secure channel test TC-SC-4.2 * Added auto generated files --- examples/chip-tool/templates/tests/tests.js | 5 + .../suites/certification/Test_TC_SC_4_2.yaml | 500 ++++++++++++++++++ .../chip-tool/zap-generated/test/Commands.h | 471 +++++++++++++++++ 3 files changed, 976 insertions(+) create mode 100644 src/app/tests/suites/certification/Test_TC_SC_4_2.yaml diff --git a/examples/chip-tool/templates/tests/tests.js b/examples/chip-tool/templates/tests/tests.js index 2ec09673855475..12d68973fef460 100644 --- a/examples/chip-tool/templates/tests/tests.js +++ b/examples/chip-tool/templates/tests/tests.js @@ -449,6 +449,10 @@ function getTests() 'Test_TC_RH_2_2', ]; + const SecureChannel = [ + 'Test_TC_SC_4_2', + ]; + const Switch = [ 'Test_TC_SWTCH_2_1', 'Test_TC_SWTCH_2_2', @@ -578,6 +582,7 @@ function getTests() PressureMeasurement, // PumpConfigurationControl, // RelativeHumidityMeasurement, // + SecureChannel, // Switch, // TemperatureMeasurement, // Thermostat, // diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml new file mode 100644 index 00000000000000..693c7f0ec920ef --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_SC_4_2.yaml @@ -0,0 +1,500 @@ +# 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: + 13.4.2. [TC-SC-4.2] Commissionable Node Discovery - Commissioner Case [DUT - + Commissioner] + +config: + nodeId: 0x12344321 + cluster: "Secure Channel" + endpoint: 0 + discriminator: + type: INT16U + defaultValue: 3840 + vendorId: + type: INT16U + defaultValue: 65521 + productId: + type: INT16U + defaultValue: 32769 + deviceType: + type: INT16U + defaultValue: 5 + +tests: + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: + "TH is put in Commissioning Mode using Open Basic Commissioning Window + command and starts advertising Commissionable Node Discovery service + using DNS-SD" + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 + + - label: "Check Instance Name" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + saveAs: deviceInstanceNameBeforeReboot1 + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + #validate the service type and the service domain not implemented in CI + + - label: "Check Hostname" + # On macOS the hostname is the device name and because of it this test is disabled for now. + disabled: true + PICS: "(WIFI || ETH) && !THREAD" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 12 + isUpperCase: true + isHexString: true + + - label: "Check Hostname" + # On macOS the hostname is the device name and because of it this test is disabled for now. + disabled: true + PICS: "(!WIFI && !ETH) && THREAD" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + #subtype + - label: "Check Long Discriminator _L" + cluster: "DiscoveryCommands" + command: "FindCommissionableByLongDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Short Discriminator (_S)" + cluster: "DiscoveryCommands" + command: "FindCommissionableByShortDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Vendor ID (_V)" + PICS: VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: "Check Device Type ID (_T)" + disabled: true + PICS: DEVTYPE_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + - label: "Check Commissioning Mode (_CM)" + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + - label: "TXT key for Vendor ID and Product ID (VP)" + PICS: VP_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + - label: "TXT key for Vendor ID and Product ID (VP)" + PICS: VP_KEY + optional: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: "Optional TXT key for MRP Retry Interval Idle (CRI)" + PICS: CRI_COMM_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: "Optional TXT key for MRP Retry Interval Active (CRA)" + PICS: CRA_COMM_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode (CM)" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 1 + + - label: "Optional TXT key for device type (DT)" + disabled: true + PICS: DT_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + constraints: + maxValue: 999 + + - label: "Optional TXT key for device name (DN)" + PICS: DN_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: "Optional TXT key for rotating device identifier (RI)" + PICS: RI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: "Optional TXT key for pairing hint (PH)" + PICS: PH_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + notValue: 0 + + - label: "Optional TXT key for pairing instructions (PI)" + PICS: PI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 + + - label: "Check IPs" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "numIPs" + constraints: + minValue: 1 + + # The testplan needs TH needs to be Rebooted so below steps disabled for now + - label: "Reboot target device" + cluster: "SystemCommands" + command: "Reboot" + arguments: + values: + - name: "discriminator" + value: discriminator + + - label: "Open Commissioning Window" + disabled: true + cluster: "AdministratorCommissioning" + command: "OpenBasicCommissioningWindow" + timedInteractionTimeoutMs: 10000 + arguments: + values: + - name: "CommissioningTimeout" + value: 120 + + - label: "Check Instance Name" + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "instanceName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + notValue: deviceInstanceNameBeforeReboot1 + + #validate the service type and the service domain not implemented in CI + + - label: "Check Hostname" + # On macOS the hostname is the device name and because of it this test is disabled for now. + disabled: true + PICS: "(WIFI || ETH) && !THREAD" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 12 + maxLength: 12 + isUpperCase: true + isHexString: true + + - label: "Check Hostname" + # On macOS the hostname is the device name and because of it this test is disabled for now. + disabled: true + PICS: "(!WIFI && !ETH) && THREAD" + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "hostName" + constraints: + minLength: 16 + maxLength: 16 + isUpperCase: true + isHexString: true + + - label: "Check Long Discriminator _L" + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionableByLongDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Short Discriminator (_S)" + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionableByShortDiscriminator" + arguments: + values: + - name: "value" + value: discriminator + + - label: "Check Vendor ID (_V)" + disabled: true + PICS: VENDOR_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByVendorId" + arguments: + values: + - name: "value" + value: vendorId + + - label: "Check Device Type ID (_T)" + # The device type is not broadcasted by the accessory under CI. + disabled: true + PICS: DEVTYPE_SUBTYPE + cluster: "DiscoveryCommands" + command: "FindCommissionableByDeviceType" + arguments: + values: + - name: "value" + value: deviceType + + - label: "Check Commissioning Mode (_CM)" + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionableByCommissioningMode" + + - label: "TXT key for Vendor ID and Product ID (VP)" + PICS: VP_KEY + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "vendorId" + value: vendorId + + - label: "TXT key for Vendor ID and Product ID (VP)" + PICS: VP_KEY + disabled: true + optional: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "productId" + value: productId + + - label: "Optional TXT key for MRP Retry Interval Idle (CRI)" + disabled: true + PICS: CRI_COMM_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalIdle" + constraints: + maxValue: 3600000 + + - label: "Optional TXT key for MRP Retry Interval Active (CRA)" + disabled: true + PICS: CRA_COMM_DISCOVERY_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "mrpRetryIntervalActive" + constraints: + maxValue: 3600000 + + - label: "TXT key for commissioning mode (CM)" + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "commissioningMode" + value: 1 + + - label: "Optional TXT key for device type (DT)" + disabled: true + PICS: DT_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceType" + value: deviceType + constraints: + maxValue: 49151 + + - label: "Optional TXT key for device name (DN)" + disabled: true + PICS: DN_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "deviceName" + constraints: + maxLength: 32 + + - label: "Optional TXT key for rotating device identifier (RI)" + disabled: true + PICS: RI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "rotatingIdLen" + constraints: + maxValue: 100 + + - label: "Optional TXT key for pairing hint (PH)" + disabled: true + PICS: PH_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingHint" + notValue: 0 + + - label: "Optional TXT key for pairing instructions (PI)" + disabled: true + PICS: PI_KEY + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "pairingInstruction" + constraints: + maxLength: 128 + + - label: "Check IPs" + disabled: true + cluster: "DiscoveryCommands" + command: "FindCommissionable" + response: + values: + - name: "numIPs" + constraints: + minValue: 1 + + #Negative scenarios not implemented in CI + - label: "Log commands" + cluster: "LogCommands" + command: "Log" + arguments: + values: + - name: "message" + value: + "TH adds an unknown key/value pair in the advertised data" + + #Negative scenarios not implemented in CI + - label: "Log commands" + cluster: "LogCommands" + command: "Log" + arguments: + values: + - name: "message" + value: "Scan for DNS-SD commissioner advertisements from TH" diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index a26056976c19c7..63a5a0958d43bb 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -136,6 +136,7 @@ class TestList : public Command printf("Test_TC_RH_1_1\n"); printf("Test_TC_RH_2_1\n"); printf("Test_TC_RH_2_2\n"); + printf("Test_TC_SC_4_2\n"); printf("Test_TC_SWTCH_2_1\n"); printf("Test_TC_SWTCH_2_2\n"); printf("Test_TC_TM_1_1\n"); @@ -40873,6 +40874,475 @@ class Test_TC_RH_2_2Suite : public TestCommand } }; +class Test_TC_SC_4_2Suite : public TestCommand +{ +public: + Test_TC_SC_4_2Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_SC_4_2", credsIssuerConfig), mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("discriminator", 0, UINT16_MAX, &mDiscriminator); + AddArgument("vendorId", 0, UINT16_MAX, &mVendorId); + AddArgument("productId", 0, UINT16_MAX, &mProductId); + AddArgument("deviceType", 0, UINT16_MAX, &mDeviceType); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_SC_4_2Suite() + { + if (deviceInstanceNameBeforeReboot1Buffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeReboot1Buffer); + deviceInstanceNameBeforeReboot1Buffer = nullptr; + } + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_SC_4_2\n"); + } + + if (mTestCount == mTestIndex) + { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_SC_4_2\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) + { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Reboot target device\n"); + err = TestRebootTargetDevice_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_1(); + break; + case 2: + ChipLogProgress(chipTool, + " ***** Test Step 2 : TH is put in Commissioning Mode using Open Basic Commissioning Window command " + "and starts advertising Commissionable Node Discovery service using DNS-SD\n"); + err = + TestThIsPutInCommissioningModeUsingOpenBasicCommissioningWindowCommandAndStartsAdvertisingCommissionableNodeDiscoveryServiceUsingDnsSd_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Check Instance Name\n"); + err = TestCheckInstanceName_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Check Long Discriminator _L\n"); + err = TestCheckLongDiscriminatorL_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Check Short Discriminator (_S)\n"); + err = TestCheckShortDiscriminatorS_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Check Vendor ID (_V)\n"); + if (ShouldSkip("VENDOR_SUBTYPE")) + { + NextTest(); + return; + } + err = TestCheckVendorIdV_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Check Commissioning Mode (_CM)\n"); + err = TestCheckCommissioningModeCm_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : TXT key for Vendor ID and Product ID (VP)\n"); + if (ShouldSkip("VP_KEY")) + { + NextTest(); + return; + } + err = TestTxtKeyForVendorIdAndProductIdVp_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : TXT key for Vendor ID and Product ID (VP)\n"); + if (ShouldSkip("VP_KEY")) + { + NextTest(); + return; + } + err = TestTxtKeyForVendorIdAndProductIdVp_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Optional TXT key for MRP Retry Interval Idle (CRI)\n"); + if (ShouldSkip("CRI_COMM_DISCOVERY_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForMrpRetryIntervalIdleCri_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Optional TXT key for MRP Retry Interval Active (CRA)\n"); + if (ShouldSkip("CRA_COMM_DISCOVERY_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForMrpRetryIntervalActiveCra_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : TXT key for commissioning mode (CM)\n"); + err = TestTxtKeyForCommissioningModeCm_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Optional TXT key for device name (DN)\n"); + if (ShouldSkip("DN_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForDeviceNameDn_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Optional TXT key for rotating device identifier (RI)\n"); + if (ShouldSkip("RI_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForRotatingDeviceIdentifierRi_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Optional TXT key for pairing hint (PH)\n"); + if (ShouldSkip("PH_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForPairingHintPh_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Optional TXT key for pairing instructions (PI)\n"); + if (ShouldSkip("PI_KEY")) + { + NextTest(); + return; + } + err = TestOptionalTxtKeyForPairingInstructionsPi_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Check IPs\n"); + err = TestCheckIPs_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Reboot target device\n"); + err = TestRebootTargetDevice_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Log commands\n"); + err = TestLogCommands_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Log commands\n"); + err = TestLogCommands_20(); + break; + } + + if (CHIP_NO_ERROR != err) + { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + 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 = 21; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mDiscriminator; + chip::Optional mVendorId; + chip::Optional mProductId; + chip::Optional mDeviceType; + chip::Optional mTimeout; + + char * deviceInstanceNameBeforeReboot1Buffer = nullptr; + chip::CharSpan deviceInstanceNameBeforeReboot1; + + void OnDiscoveryCommandsResults(const DiscoveryCommandResult & value) override + { + bool isExpectedDnssdResult = false; + if ((mTestIndex - 1) == 3) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintIsUpperCase("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintIsHexString("value.instanceName", value.instanceName, true)); + VerifyOrReturn(CheckConstraintMinLength("value.instanceName", value.instanceName.size(), 16)); + VerifyOrReturn(CheckConstraintMaxLength("value.instanceName", value.instanceName.size(), 16)); + if (deviceInstanceNameBeforeReboot1Buffer != nullptr) + { + chip::Platform::MemoryFree(deviceInstanceNameBeforeReboot1Buffer); + } + deviceInstanceNameBeforeReboot1Buffer = static_cast(chip::Platform::MemoryAlloc(value.instanceName.size())); + memcpy(deviceInstanceNameBeforeReboot1Buffer, value.instanceName.data(), value.instanceName.size()); + deviceInstanceNameBeforeReboot1 = chip::CharSpan(deviceInstanceNameBeforeReboot1Buffer, value.instanceName.size()); + } + if ((mTestIndex - 1) == 4) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 5) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 6) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 7) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 8) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("vendorId", value.vendorId, mVendorId.HasValue() ? mVendorId.Value() : 65521U)); + } + if ((mTestIndex - 1) == 9) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("productId", value.productId, mProductId.HasValue() ? mProductId.Value() : 32769U)); + } + if ((mTestIndex - 1) == 10) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalIdle", value.mrpRetryIntervalIdle)); + VerifyOrReturn( + CheckConstraintMaxValue("value.mrpRetryIntervalIdle.Value()", value.mrpRetryIntervalIdle.Value(), 3600000UL)); + } + if ((mTestIndex - 1) == 11) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValuePresent("value.mrpRetryIntervalActive", value.mrpRetryIntervalActive)); + VerifyOrReturn( + CheckConstraintMaxValue("value.mrpRetryIntervalActive.Value()", value.mrpRetryIntervalActive.Value(), 3600000UL)); + } + if ((mTestIndex - 1) == 12) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckValue("commissioningMode", value.commissioningMode, 1)); + } + if ((mTestIndex - 1) == 13) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMaxLength("value.deviceName", value.deviceName.size(), 32)); + } + if ((mTestIndex - 1) == 14) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMaxValue("value.rotatingIdLen", value.rotatingIdLen, 100ULL)); + } + if ((mTestIndex - 1) == 15) + { + isExpectedDnssdResult = true; + } + if ((mTestIndex - 1) == 16) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMaxLength("value.pairingInstruction", value.pairingInstruction.size(), 128)); + } + if ((mTestIndex - 1) == 17) + { + isExpectedDnssdResult = true; + + VerifyOrReturn(CheckConstraintMinValue("value.numIPs", value.numIPs, 1)); + } + + VerifyOrReturn(isExpectedDnssdResult, Exit("An unexpected dnssd result has been received")); + NextTest(); + } + + // + // Tests methods + // + + CHIP_ERROR TestRebootTargetDevice_0() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_1() + { + SetIdentity(kIdentityAlpha); + return WaitForCommissionee(mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL); + } + + CHIP_ERROR + TestThIsPutInCommissioningModeUsingOpenBasicCommissioningWindowCommandAndStartsAdvertisingCommissionableNodeDiscoveryServiceUsingDnsSd_2() + { + const chip::EndpointId endpoint = mEndpoint.HasValue() ? mEndpoint.Value() : 0; + using RequestType = chip::app::Clusters::AdministratorCommissioning::Commands::OpenBasicCommissioningWindow::Type; + + RequestType request; + request.commissioningTimeout = 120U; + + auto success = [](void * context, const typename RequestType::ResponseType & data) { + (static_cast(context))->OnSuccessResponse_2(); + }; + + auto failure = [](void * context, CHIP_ERROR error) { + (static_cast(context))->OnFailureResponse_2(error); + }; + + ReturnErrorOnFailure( + chip::Controller::InvokeCommand(mDevices[kIdentityAlpha], this, success, failure, endpoint, request, 10000)); + return CHIP_NO_ERROR; + } + + void OnFailureResponse_2(CHIP_ERROR error) + { + chip::app::StatusIB status(error); + ThrowFailureResponse(); + } + + void OnSuccessResponse_2() { NextTest(); } + + CHIP_ERROR TestCheckInstanceName_3() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestCheckLongDiscriminatorL_4() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByLongDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestCheckShortDiscriminatorS_5() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByShortDiscriminator(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestCheckVendorIdV_6() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByVendorId(mVendorId.HasValue() ? mVendorId.Value() : 65521U); + } + + CHIP_ERROR TestCheckCommissioningModeCm_7() + { + SetIdentity(kIdentityAlpha); + return FindCommissionableByCommissioningMode(); + } + + CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_8() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestTxtKeyForVendorIdAndProductIdVp_9() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalIdleCri_10() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForMrpRetryIntervalActiveCra_11() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestTxtKeyForCommissioningModeCm_12() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForDeviceNameDn_13() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForRotatingDeviceIdentifierRi_14() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForPairingHintPh_15() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestOptionalTxtKeyForPairingInstructionsPi_16() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestCheckIPs_17() + { + SetIdentity(kIdentityAlpha); + return FindCommissionable(); + } + + CHIP_ERROR TestRebootTargetDevice_18() + { + SetIdentity(kIdentityAlpha); + return Reboot(mDiscriminator.HasValue() ? mDiscriminator.Value() : 3840U); + } + + CHIP_ERROR TestLogCommands_19() + { + SetIdentity(kIdentityAlpha); + return Log("TH adds an unknown key/value pair in the advertised data"); + } + + CHIP_ERROR TestLogCommands_20() + { + SetIdentity(kIdentityAlpha); + return Log("Scan for DNS-SD commissioner advertisements from TH"); + } +}; + class Test_TC_SWTCH_2_1Suite : public TestCommand { public: @@ -116315,6 +116785,7 @@ 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),