From 80d7e840b277eaf87a535481f8ef3f2e580be282 Mon Sep 17 00:00:00 2001 From: Mihai Ignat <50373067+mihai-ignat@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:38:24 +0300 Subject: [PATCH 01/40] [NXP][docs] Put all NXP guides in nxp folder and update paths (#33092) * [NXP][docs] Put all NXP guides in nxp folder and update paths * Restyled by prettier-markdown --------- Co-authored-by: Restyled.io --- docs/guides/README.md | 3 +-- docs/guides/darwin.md | 2 +- docs/guides/index.md | 5 ++--- docs/guides/nxp/README.md | 14 +++++++++++++ .../{ => nxp}/nxp_imx8m_linux_examples.md | 16 +++++++-------- .../nxp_k32w_android_commissioning.md | 20 +++++++++---------- .../{ => nxp}/nxp_manufacturing_flow.md | 0 .../nxp_rw61x_ota_software_update.md | 10 +++++----- .../nxp_zephyr_ota_software_update.md | 4 ++-- examples/air-purifier-app/linux/README.md | 3 ++- .../air-quality-sensor-app/linux/README.md | 3 ++- .../nxp/linux-imx/imx8m/README.md | 4 ++-- .../all-clusters-app/nxp/rt/rw61x/README.md | 8 ++++---- .../nxp/linux-imx/imx8m/README.md | 4 ++-- .../nxp/k32w/k32w0/README.md | 2 +- .../nxp/k32w/k32w1/README.md | 2 +- examples/dishwasher-app/linux/README.md | 3 ++- .../energy-management-app/linux/README.md | 3 ++- examples/lighting-app/linux/README.md | 3 ++- .../lighting-app/nxp/k32w/k32w0/README.md | 2 +- .../lighting-app/nxp/k32w/k32w1/README.md | 2 +- .../nxp/linux-imx/imx8m/README.md | 4 ++-- examples/refrigerator-app/linux/README.md | 3 ++- .../thermostat/nxp/linux-imx/imx8m/README.md | 4 ++-- examples/thermostat/nxp/linux-se05x/README.md | 4 ++-- .../nxp/factory_data_generator/README.md | 2 +- 26 files changed, 74 insertions(+), 56 deletions(-) create mode 100644 docs/guides/nxp/README.md rename docs/guides/{ => nxp}/nxp_imx8m_linux_examples.md (95%) rename docs/guides/{ => nxp}/nxp_k32w_android_commissioning.md (94%) rename docs/guides/{ => nxp}/nxp_manufacturing_flow.md (100%) rename docs/guides/{ => nxp}/nxp_rw61x_ota_software_update.md (96%) rename docs/guides/{ => nxp}/nxp_zephyr_ota_software_update.md (99%) diff --git a/docs/guides/README.md b/docs/guides/README.md index dbdda1bba07de4..e9a42a15861648 100644 --- a/docs/guides/README.md +++ b/docs/guides/README.md @@ -18,8 +18,7 @@ - [nRF Connect - Factory Data Configuration](./nrfconnect_factory_data_configuration.md) - [nRF Connect - Platform Overview](./nrfconnect_platform_overview.md) - [nRF Connect - Software Update](./nrfconnect_examples_software_update.md) -- [NXP - Android Commissioning](./nxp_k32w_android_commissioning.md) -- [NXP - Linux Examples](./nxp_imx8m_linux_examples.md) +- [NXP - Getting Started Guide](./nxp/README.md) - [Silicon Labs - Documentation](https://siliconlabs.github.io/matter/latest/index.html) - [Silicon Labs - Getting Started](./silabs_getting_started.md) - [Silicon Labs - Software Update](./silabs_efr32_software_update.md) diff --git a/docs/guides/darwin.md b/docs/guides/darwin.md index 0b312807e3457f..4a9a8da939952e 100644 --- a/docs/guides/darwin.md +++ b/docs/guides/darwin.md @@ -259,7 +259,7 @@ Example: - [mbedOS](/examples/all-clusters-app/mbed/README.md) - [nRF Connect All Clusters](./nrfconnect_examples_configuration.md) - [nRF Connect Pump](/examples/pump-app/nrfconnect/README.md) -- [NXP Examples](./nxp_imx8m_linux_examples.md) +- [NXP Examples](./nxp/nxp_imx8m_linux_examples.md) - [NXP](/examples/all-clusters-app/nxp/mw320/README.md) - [Infineon CYW30739 Lighting](/examples/lighting-app/infineon/cyw30739/README.md) - [Infineon PSoC6](/examples/all-clusters-app/infineon/psoc6/README.md) diff --git a/docs/guides/index.md b/docs/guides/index.md index 2a5d3a64f5afe7..7ec0ec61a3cc69 100644 --- a/docs/guides/index.md +++ b/docs/guides/index.md @@ -10,6 +10,7 @@ and features. * esp32/README +nxp/README ti/ti_platform_overview ``` @@ -34,9 +35,7 @@ ti/ti_platform_overview - [nRF Connect - Factory Data Configuration](./nrfconnect_factory_data_configuration.md) - [nRF Connect - Platform Overview](./nrfconnect_platform_overview.md) - [nRF Connect - Software Update](./nrfconnect_examples_software_update.md) -- [NXP - Android Commissioning](./nxp_k32w_android_commissioning.md) -- [NXP - Linux Examples](./nxp_imx8m_linux_examples.md) -- [NXP - Manufacturing Data](./nxp_manufacturing_flow.md) +- [NXP - Getting Started Guide](./nxp/README.md) - [Silicon Labs - Documentation](https://siliconlabs.github.io/matter/latest/index.html) - [Silicon Labs - Getting Started](./silabs_getting_started.md) - [Silicon Labs - Software Update](./silabs_efr32_software_update.md) diff --git a/docs/guides/nxp/README.md b/docs/guides/nxp/README.md new file mode 100644 index 00000000000000..be225ac938f7b5 --- /dev/null +++ b/docs/guides/nxp/README.md @@ -0,0 +1,14 @@ +```{toctree} +:glob: +:maxdepth: 1 + +* +``` + +# NXP Getting Started Guide + +- [NXP - Android Commissioning](nxp_k32w_android_commissioning.md) +- [NXP - Linux Examples](nxp_imx8m_linux_examples.md) +- [NXP - Manufacturing Data](nxp_manufacturing_flow.md) +- [NXP - RW61x OTA Software Update Guide](nxp_rw61x_ota_software_update.md) +- [NXP - Zephyr OTA Software Update Guide](nxp_zephyr_ota_software_update.md) diff --git a/docs/guides/nxp_imx8m_linux_examples.md b/docs/guides/nxp/nxp_imx8m_linux_examples.md similarity index 95% rename from docs/guides/nxp_imx8m_linux_examples.md rename to docs/guides/nxp/nxp_imx8m_linux_examples.md index 6b1ad2b8f6c4bd..4ff8ded6a53515 100644 --- a/docs/guides/nxp_imx8m_linux_examples.md +++ b/docs/guides/nxp/nxp_imx8m_linux_examples.md @@ -4,11 +4,11 @@ This document describes how to build below Linux examples with the NXP embedded Linux Yocto SDK and then run the output executable files on the **NXP i.MX 8M** **Mini EVK** development board. -- [CHIP Linux All-clusters Example](../../examples/all-clusters-app/linux/README.md) -- [CHIP Linux Lighting Example](../../examples/lighting-app/linux/README.md) +- [CHIP Linux All-clusters Example](../../../examples/all-clusters-app/linux/README.md) +- [CHIP Linux Lighting Example](../../../examples/lighting-app/linux/README.md) - [CHIP Linux Thermostat Example](https://github.com/project-chip/connectedhomeip/tree/master/examples/thermostat/linux) -- [CHIP Linux CHIP-tool Example](../../examples/chip-tool/README.md) -- [CHIP Linux OTA-provider Example](../../examples/ota-provider-app/linux/README.md) +- [CHIP Linux CHIP-tool Example](../../../examples/chip-tool/README.md) +- [CHIP Linux OTA-provider Example](../../../examples/ota-provider-app/linux/README.md) This document has been tested on: @@ -234,8 +234,8 @@ Thermostat-app is used as an example below. In order to test the CHIP protocol functions, another device on the same network is needed to run the - [ChipDeviceController](../../src/controller/python) tool to communicate with - the **i.MX 8M Mini EVK**. + [ChipDeviceController](../../../src/controller/python) tool to communicate + with the **i.MX 8M Mini EVK**. The ChipDeviceController can be a laptop / workstation. Bluetooth functionality is mandatory on this device. @@ -252,7 +252,7 @@ Thermostat-app is used as an example below. - Boot up Ubuntu on the Raspberry Pi - Clone this connectedhomeip project - Follow Python ChipDeviceController - [README.md](../../src/controller/python/README.md) document. Refer to + [README.md](../../../src/controller/python/README.md) document. Refer to the "Building and installing" part to build the tool. - Running @@ -283,7 +283,7 @@ Thermostat-app is used as an example below. /home/root/thermostat-app --ble-device 0 --wifi # The bluetooth device used is hci0 and support wifi network ``` - - Run [ChipDeviceController](../../src/controller/python) on the + - Run [ChipDeviceController](../../../src/controller/python) on the controller device to communicate with **i.MX 8M Mini EVK** running the example. diff --git a/docs/guides/nxp_k32w_android_commissioning.md b/docs/guides/nxp/nxp_k32w_android_commissioning.md similarity index 94% rename from docs/guides/nxp_k32w_android_commissioning.md rename to docs/guides/nxp/nxp_k32w_android_commissioning.md index b39a2f2afd2c8c..6d872f5f7ba268 100644 --- a/docs/guides/nxp_k32w_android_commissioning.md +++ b/docs/guides/nxp/nxp_k32w_android_commissioning.md @@ -1,8 +1,8 @@ # Commissioning NXP K32W using Android CHIPTool This article describes how to use -[CHIPTool](../../examples/android/CHIPTool/README.md) for Android smartphones to -commission an NXP K32W061 DK6 running +[CHIPTool](../../../examples/android/CHIPTool/README.md) for Android smartphones +to commission an NXP K32W061 DK6 running [NXP K32W Light Example Application](#building-and-programming-nxp-k32w-light-example-application) onto a CHIP-enabled Thread network. @@ -47,7 +47,7 @@ The following diagram shows the connectivity between network components required to allow communication between devices running the CHIPTool and Light applications: -![nxp_hw_connectivity](../../examples/platform/nxp/k32w/k32w0/doc/images/nxp_hw_connectivity.JPG) +![nxp_hw_connectivity](../../../examples/platform/nxp/k32w/k32w0/doc/images/nxp_hw_connectivity.JPG)
@@ -348,7 +348,7 @@ To make your PC work as a Thread Border Router, complete the following tasks: ## Building and programming NXP K32W Light Example Application See -[NXP K32W Light Example Application README](../../examples/lighting-app/nxp/k32w/k32w0/README.md) +[NXP K32W Light Example Application README](../../../examples/lighting-app/nxp/k32w/k32w0/README.md) to learn how to build and program the light example onto an K32W061 DK6.
@@ -356,7 +356,7 @@ to learn how to build and program the light example onto an K32W061 DK6. ## Building and installing Android CHIPTool To build the CHIPTool application for your smartphone, read -[Android CHIPTool README](../../examples/android/CHIPTool/README.md). +[Android CHIPTool README](../../../examples/android/CHIPTool/README.md). After building, install the application by completing the following steps: @@ -396,7 +396,7 @@ CHIPTool is now ready to be used for commissioning. 3. Navigate to the _Form_ tab then push the _Form_ button using the default parameters: - ![nxp_form_nwk](../../examples/platform/nxp/k32w/k32w0/doc/images/form_web.JPG) + ![nxp_form_nwk](../../../examples/platform/nxp/k32w/k32w0/doc/images/form_web.JPG) 4. The message _Form operation is successful_ should be display after a few seconds. @@ -430,7 +430,7 @@ To prepare the accessory device for commissioning, complete the following steps: 1. Make sure that JP4 and JP7 jumpers are in leftmost position and a mini-USB cable is connected between the LPC connector and PC - ![nxp_connectors](../../examples/platform/nxp/k32w/k32w0/doc/images/k32w-dk6-connectors.jpg) + ![nxp_connectors](../../../examples/platform/nxp/k32w/k32w0/doc/images/k32w-dk6-connectors.jpg) 2. Use a terminal emulator (e.g.: Putty) to connect to the UART console of the accessory device. Use a baudrate of 115200. @@ -466,14 +466,14 @@ section, complete the following steps: progress with scanning, connection, and pairing. At the end of this process, the Thread network settings screen appears. - ![chiptool_main_screen](../../examples/platform/nxp/k32w/k32w0/doc/images/chiptool_main_screen.png) + ![chiptool_main_screen](../../../examples/platform/nxp/k32w/k32w0/doc/images/chiptool_main_screen.png) 6. In the Thread network settings screen, use the default settings and tap the _SAVE NETWORK_ button to send a Thread provisioning message to the accessory device. You will see the "Network provisioning completed" message when the accessory device successfully joins the Thread network. - ![chiptool_credentials](../../examples/platform/nxp/k32w/k32w0/doc/images/thread_credentials.png) + ![chiptool_credentials](../../../examples/platform/nxp/k32w/k32w0/doc/images/thread_credentials.png)
@@ -483,7 +483,7 @@ section, complete the following steps: the provisioning is completed successfully and you are connected to the device. - ![on_off_cluster.png](../../examples/platform/nxp/k32w/k32w0/doc/images/on_off_cluster.png) + ![on_off_cluster.png](../../../examples/platform/nxp/k32w/k32w0/doc/images/on_off_cluster.png) 2. Verify that the text box on the screen is not empty and contains the IPv6 address of the accessory device. diff --git a/docs/guides/nxp_manufacturing_flow.md b/docs/guides/nxp/nxp_manufacturing_flow.md similarity index 100% rename from docs/guides/nxp_manufacturing_flow.md rename to docs/guides/nxp/nxp_manufacturing_flow.md diff --git a/docs/guides/nxp_rw61x_ota_software_update.md b/docs/guides/nxp/nxp_rw61x_ota_software_update.md similarity index 96% rename from docs/guides/nxp_rw61x_ota_software_update.md rename to docs/guides/nxp/nxp_rw61x_ota_software_update.md index cdabf5e012da96..1543b2f94402cf 100644 --- a/docs/guides/nxp_rw61x_ota_software_update.md +++ b/docs/guides/nxp/nxp_rw61x_ota_software_update.md @@ -89,7 +89,7 @@ J-Link > erase 0x8000000, 0x88a0000 - Using MCUXPresso, import the `mcuboot_opensource` demo example from the SDK previously downloaded. The example can be found under the `ota_examples` folder. - ![mcuboot_demo](../../examples/platform/nxp/rt/rw61x/doc/images/mcuboot_demo.PNG) + ![mcuboot_demo](../../../examples/platform/nxp/rt/rw61x/doc/images/mcuboot_demo.PNG) - Before building the demo example, it should be specified that the application to be run by the bootloader is monolithic. As a result, only one image will be upgraded by the bootloader. This can be done by defining @@ -99,7 +99,7 @@ J-Link > erase 0x8000000, 0x88a0000 Right click on the Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU C Compiler -> Preprocessor -> Add "MONOLITHIC_APP=1" in the Defined Symbols ``` -![rw610_mcuboot_monolithic](../../examples/platform/nxp/rt/rw61x/doc/images/mcuboot_monolithic_app.PNG) +![rw610_mcuboot_monolithic](../../../examples/platform/nxp/rt/rw61x/doc/images/mcuboot_monolithic_app.PNG) - Build the demo example project. @@ -149,7 +149,7 @@ The image must have the following format : signature, the upgrade type, the swap status... The all-clusters application can be generated using the instructions from the -[README.md 'Building'](../../examples/all-clusters-app/nxp/rt/rw61x/README.md#building) +[README.md 'Building'](../../../examples/all-clusters-app/nxp/rt/rw61x/README.md#building) section. The application is automatically linked to be executed from the primary image partition, taking into consideration the offset imposed by mcuboot. @@ -242,8 +242,8 @@ instructions below describe the procedure step-by-step. Setup example : -- [Chip-tool](../../examples/chip-tool/README.md) application running on the - RPi. +- [Chip-tool](../../../examples/chip-tool/README.md) application running on + the RPi. - OTA Provider application built on the same RPi (as explained below). - RW61x board programmed with the example application (with the instructions above). diff --git a/docs/guides/nxp_zephyr_ota_software_update.md b/docs/guides/nxp/nxp_zephyr_ota_software_update.md similarity index 99% rename from docs/guides/nxp_zephyr_ota_software_update.md rename to docs/guides/nxp/nxp_zephyr_ota_software_update.md index a36ac3281cb116..314765aaa4d7c6 100644 --- a/docs/guides/nxp_zephyr_ota_software_update.md +++ b/docs/guides/nxp/nxp_zephyr_ota_software_update.md @@ -178,8 +178,8 @@ Update. The instructions below describes the procedure step-by-step. Setup example : -- [Chip-tool](../../examples/chip-tool/README.md) application running on the - RPi. +- [Chip-tool](../../../examples/chip-tool/README.md) application running on + the RPi. - OTA Provider application built on the same RPi (as explained below). - Board programmed with the example application (with the instructions above). diff --git a/examples/air-purifier-app/linux/README.md b/examples/air-purifier-app/linux/README.md index d2352bca201e1a..2d771bdf5b5ff4 100644 --- a/examples/air-purifier-app/linux/README.md +++ b/examples/air-purifier-app/linux/README.md @@ -11,7 +11,8 @@ Temperature Sensor and Endpoint 5 is a Thermostat. To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details. +[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +details.
diff --git a/examples/air-quality-sensor-app/linux/README.md b/examples/air-quality-sensor-app/linux/README.md index b1c2e92461d8f0..ef90a4bd23df9f 100644 --- a/examples/air-quality-sensor-app/linux/README.md +++ b/examples/air-quality-sensor-app/linux/README.md @@ -7,7 +7,8 @@ for Raspberry Pi Desktop 20.10 (aarch64)** To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details. +[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +details.
diff --git a/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md b/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md index 9a90a11e0dccc4..e20ff1065d3dfb 100644 --- a/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md +++ b/examples/all-clusters-app/nxp/linux-imx/imx8m/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp_imx8m_linux_examples.md) for -details. +[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +for details. diff --git a/examples/all-clusters-app/nxp/rt/rw61x/README.md b/examples/all-clusters-app/nxp/rt/rw61x/README.md index 8a6889909dffa3..bdec2c58956274 100644 --- a/examples/all-clusters-app/nxp/rt/rw61x/README.md +++ b/examples/all-clusters-app/nxp/rt/rw61x/README.md @@ -139,16 +139,16 @@ Optional GN options that can be added when building an application: - To build with the option to have Matter certificates/keys pre-loaded in a specific flash area the argument `chip_with_factory_data=1` must be added to the _gn gen_ command. (for more information see - [Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). + [Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). - To build the application with the OTA Requestor enabled, the arguments `chip_enable_ota_requestor=true no_mcuboot=false` must be added to the _gn gen_ command. (More information about the OTA Requestor feature in - [OTA Requestor README](../../../../../docs/guides/nxp_rw61x_ota_software_update.md) + [OTA Requestor README](../../../../../docs/guides/nxp/nxp_rw61x_ota_software_update.md) ## Manufacturing data See -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md) +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md) Other comments: @@ -374,4 +374,4 @@ Done Over-The-Air software updates are supported with the RW61x all-clusters example. The process to follow in order to perform a software update is described in the dedicated guide -['Matter Over-The-Air Software Update with NXP RW61x example applications'](../../../../../docs/guides/nxp_rw61x_ota_software_update.md). +['Matter Over-The-Air Software Update with NXP RW61x example applications'](../../../../../docs/guides/nxp/nxp_rw61x_ota_software_update.md). diff --git a/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md b/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md index 9a90a11e0dccc4..e20ff1065d3dfb 100644 --- a/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md +++ b/examples/all-clusters-minimal-app/nxp/linux-imx/imx8m/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp_imx8m_linux_examples.md) for -details. +[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +for details. diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md index b7ec329d7650d1..5ad31921b665ae 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md @@ -348,7 +348,7 @@ Please use the following build args: ## Manufacturing data See -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). There are factory data generated binaries available in examples/platform/nxp/k32w/k32w0/scripts/demo_generated_factory_data folder. diff --git a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md b/examples/contact-sensor-app/nxp/k32w/k32w1/README.md index 5079e01c6e2400..f3896a01b8362e 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w1/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w1/README.md @@ -185,7 +185,7 @@ using Fibonacci backoff for retries pacing. Use `chip_with_factory_data=1` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). ## Flashing diff --git a/examples/dishwasher-app/linux/README.md b/examples/dishwasher-app/linux/README.md index 3c8df646ecd060..2d3b461386395d 100644 --- a/examples/dishwasher-app/linux/README.md +++ b/examples/dishwasher-app/linux/README.md @@ -7,7 +7,8 @@ for Raspberry Pi Desktop 20.10 (aarch64)** To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details. +[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +details.
diff --git a/examples/energy-management-app/linux/README.md b/examples/energy-management-app/linux/README.md index 424ef46d58e259..f91d341915ccd8 100644 --- a/examples/energy-management-app/linux/README.md +++ b/examples/energy-management-app/linux/README.md @@ -7,7 +7,8 @@ for Raspberry Pi Desktop 20.10 (aarch64)** To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details. +[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +details.
diff --git a/examples/lighting-app/linux/README.md b/examples/lighting-app/linux/README.md index ff2c9b1bf50611..e41799a70dc60d 100644 --- a/examples/lighting-app/linux/README.md +++ b/examples/lighting-app/linux/README.md @@ -7,7 +7,8 @@ Raspberry Pi Desktop 20.10 (aarch64)** To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details. +[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +details.
diff --git a/examples/lighting-app/nxp/k32w/k32w0/README.md b/examples/lighting-app/nxp/k32w/k32w0/README.md index af43002f21c65a..106a614191c5f0 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w/k32w0/README.md @@ -323,7 +323,7 @@ Please use the following build args: ## Manufacturing data See -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). There are factory data generated binaries available in examples/platform/nxp/k32w/k32w0/scripts/demo_generated_factory_data folder. diff --git a/examples/lighting-app/nxp/k32w/k32w1/README.md b/examples/lighting-app/nxp/k32w/k32w1/README.md index c44c73a1ecc946..3bf2ab8105481b 100644 --- a/examples/lighting-app/nxp/k32w/k32w1/README.md +++ b/examples/lighting-app/nxp/k32w/k32w1/README.md @@ -187,7 +187,7 @@ control** cluster Use `chip_with_factory_data=1` in the gn build command to enable factory data. For a full guide on manufacturing flow, please see -[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp/nxp_manufacturing_flow.md). ## Flashing diff --git a/examples/lighting-app/nxp/linux-imx/imx8m/README.md b/examples/lighting-app/nxp/linux-imx/imx8m/README.md index 9a90a11e0dccc4..e20ff1065d3dfb 100644 --- a/examples/lighting-app/nxp/linux-imx/imx8m/README.md +++ b/examples/lighting-app/nxp/linux-imx/imx8m/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp_imx8m_linux_examples.md) for -details. +[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +for details. diff --git a/examples/refrigerator-app/linux/README.md b/examples/refrigerator-app/linux/README.md index fc51f2fc39d6d6..a8adfe03a792fb 100644 --- a/examples/refrigerator-app/linux/README.md +++ b/examples/refrigerator-app/linux/README.md @@ -7,7 +7,8 @@ for Raspberry Pi Desktop 20.10 (aarch64)** To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../docs/guides/nxp_imx8m_linux_examples.md) for details. +[README document](../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) for +details.
diff --git a/examples/thermostat/nxp/linux-imx/imx8m/README.md b/examples/thermostat/nxp/linux-imx/imx8m/README.md index 9a90a11e0dccc4..e20ff1065d3dfb 100644 --- a/examples/thermostat/nxp/linux-imx/imx8m/README.md +++ b/examples/thermostat/nxp/linux-imx/imx8m/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp_imx8m_linux_examples.md) for -details. +[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +for details. diff --git a/examples/thermostat/nxp/linux-se05x/README.md b/examples/thermostat/nxp/linux-se05x/README.md index 9a90a11e0dccc4..e20ff1065d3dfb 100644 --- a/examples/thermostat/nxp/linux-se05x/README.md +++ b/examples/thermostat/nxp/linux-se05x/README.md @@ -1,4 +1,4 @@ To cross-compile this example on x64 host and run on **NXP i.MX 8M Mini** **EVK**, see the associated -[README document](../../../../../docs/guides/nxp_imx8m_linux_examples.md) for -details. +[README document](../../../../../docs/guides/nxp/nxp_imx8m_linux_examples.md) +for details. diff --git a/scripts/tools/nxp/factory_data_generator/README.md b/scripts/tools/nxp/factory_data_generator/README.md index 38f65d4b7cbaef..0aacaeb81a29b6 100644 --- a/scripts/tools/nxp/factory_data_generator/README.md +++ b/scripts/tools/nxp/factory_data_generator/README.md @@ -1,7 +1,7 @@ # NXP Factory Data Generator For usage of the tool, please see -[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp_manufacturing_flow.md). +[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp/nxp_manufacturing_flow.md). ## Tool implementation From 91f362efb3f00e9a34cd50b7df6d6b198dbe7cd0 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Thu, 25 Apr 2024 13:47:27 +0200 Subject: [PATCH 02/40] pw_unit_test migration: lib support batch 2 (#33144) * pw_unit_test migration: lib support batch 2 * restyle --- src/lib/support/tests/BUILD.gn | 14 +- src/lib/support/tests/TestBytesToHex.cpp | 237 ++++++------- src/lib/support/tests/TestSafeString.cpp | 40 +-- src/lib/support/tests/TestScoped.cpp | 65 ++-- src/lib/support/tests/TestSpan.cpp | 321 ++++++++---------- .../tests/TestStaticSupportSmartPtr.cpp | 63 ++-- .../TestTestPersistentStorageDelegate.cpp | 213 ++++++------ src/lib/support/tests/TestUtf8.cpp | 87 ++--- 8 files changed, 438 insertions(+), 602 deletions(-) diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 2a9c1ac81fe6a8..585233b1e6667d 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -25,11 +25,18 @@ chip_test_suite("tests") { test_sources = [ "TestBitMask.cpp", "TestBufferReader.cpp", + "TestBytesToHex.cpp", "TestDefer.cpp", "TestFixedBufferAllocator.cpp", "TestFold.cpp", "TestIniEscaping.cpp", "TestSafeInt.cpp", + "TestSafeString.cpp", + "TestScoped.cpp", + "TestSpan.cpp", + "TestStaticSupportSmartPtr.cpp", + "TestTestPersistentStorageDelegate.cpp", + "TestUtf8.cpp", ] sources = [] @@ -59,7 +66,6 @@ chip_test_suite_using_nltest("tests_nltest") { test_sources = [ "TestBufferWriter.cpp", "TestBytesCircularBuffer.cpp", - "TestBytesToHex.cpp", "TestCHIPCounter.cpp", "TestCHIPMem.cpp", "TestCHIPMemString.cpp", @@ -70,21 +76,15 @@ chip_test_suite_using_nltest("tests_nltest") { "TestPersistedCounter.cpp", "TestPool.cpp", "TestPrivateHeap.cpp", - "TestSafeString.cpp", - "TestScoped.cpp", "TestScopedBuffer.cpp", "TestSorting.cpp", - "TestSpan.cpp", "TestStateMachine.cpp", - "TestStaticSupportSmartPtr.cpp", "TestStringBuilder.cpp", "TestStringSplitter.cpp", - "TestTestPersistentStorageDelegate.cpp", "TestThreadOperationalDataset.cpp", "TestTimeUtils.cpp", "TestTlvJson.cpp", "TestTlvToJson.cpp", - "TestUtf8.cpp", "TestVariant.cpp", "TestZclString.cpp", ] diff --git a/src/lib/support/tests/TestBytesToHex.cpp b/src/lib/support/tests/TestBytesToHex.cpp index f5ac6eff27feb1..1e304811b5e42b 100644 --- a/src/lib/support/tests/TestBytesToHex.cpp +++ b/src/lib/support/tests/TestBytesToHex.cpp @@ -20,15 +20,13 @@ #include #include +#include + #include #include #include #include -#include #include - -#include - namespace { using namespace chip; @@ -37,7 +35,7 @@ using namespace chip::Encoding; // To accumulate redirected logs for some tests std::vector gRedirectedLogLines; -void TestBytesToHexNotNullTerminated(nlTestSuite * inSuite, void * inContext) +TEST(TestBytesToHex, TestBytesToHexNotNullTerminated) { // Uppercase { @@ -45,12 +43,11 @@ void TestBytesToHexNotNullTerminated(nlTestSuite * inSuite, void * inContext) char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char dest2[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { 'F', 'E', 'D', 'C', 'B', 'A', '9', '8', '7', '6', '5', '4', '3', '2', '1', '0', '!', '@' }; - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], sizeof(src), &dest[0], sizeof(src) * 2u, HexFlags::kUppercase) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], sizeof(src) * 2u, HexFlags::kUppercase), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); - NL_TEST_ASSERT(inSuite, BytesToUppercaseHexBuffer(&src[0], sizeof(src), &dest2[0], sizeof(src) * 2u) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest2[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(BytesToUppercaseHexBuffer(&src[0], sizeof(src), &dest2[0], sizeof(src) * 2u), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest2[0], &expected[0], sizeof(expected)), 0); } // Lowercase @@ -59,12 +56,12 @@ void TestBytesToHexNotNullTerminated(nlTestSuite * inSuite, void * inContext) char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char dest2[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { 'f', 'e', 'd', 'c', 'b', 'a', '9', '8', '7', '6', '5', '4', '3', '2', '1', '0', '!', '@' }; - NL_TEST_ASSERT(inSuite, BytesToHex(&src[0], sizeof(src), &dest[0], sizeof(src) * 2u, HexFlags::kNone) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], sizeof(src) * 2u, HexFlags::kNone), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); // Test Alias - NL_TEST_ASSERT(inSuite, BytesToLowercaseHexBuffer(&src[0], sizeof(src), &dest2[0], sizeof(src) * 2u) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest2[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(BytesToLowercaseHexBuffer(&src[0], sizeof(src), &dest2[0], sizeof(src) * 2u), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest2[0], &expected[0], sizeof(expected)), 0); } // Trivial: Zero size input @@ -72,28 +69,28 @@ void TestBytesToHexNotNullTerminated(nlTestSuite * inSuite, void * inContext) uint8_t src[] = { 0x00 }; char dest[2] = { '!', '@' }; char expected[2] = { '!', '@' }; - NL_TEST_ASSERT(inSuite, BytesToHex(&src[0], 0, &dest[0], sizeof(src) * 2u, HexFlags::kNone) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToHex(&src[0], 0, &dest[0], sizeof(src) * 2u, HexFlags::kNone), CHIP_NO_ERROR); // Nothing should have been touched. - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); } // Trivial: Zero size input with null buffer { char dest[2] = { '!', '@' }; char expected[2] = { '!', '@' }; - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, &dest[0], sizeof(dest), HexFlags::kNone) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToHex(nullptr, 0, &dest[0], sizeof(dest), HexFlags::kNone), CHIP_NO_ERROR); // Nothing should have been touched. - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, nullptr, 0, HexFlags::kNone) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToHex(nullptr, 0, nullptr, 0, HexFlags::kNone), CHIP_NO_ERROR); // Nothing should have been touched. - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, nullptr, 1, HexFlags::kNone) == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(BytesToHex(nullptr, 0, nullptr, 1, HexFlags::kNone), CHIP_ERROR_INVALID_ARGUMENT); } } -void TestBytesToHexNullTerminated(nlTestSuite * inSuite, void * inContext) +TEST(TestBytesToHex, TestBytesToHexNullTerminated) { // Uppercase { @@ -101,17 +98,16 @@ void TestBytesToHexNullTerminated(nlTestSuite * inSuite, void * inContext) char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char dest2[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', '\0', '@' }; - NL_TEST_ASSERT(inSuite, ((sizeof(src) * 2u) + 1u) <= sizeof(dest)); - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u) + 1, HexFlags::kUppercaseAndNullTerminate) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_LE(((sizeof(src) * 2u) + 1u), sizeof(dest)); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u) + 1, HexFlags::kUppercaseAndNullTerminate), + CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); // Test Alias CHIP_ERROR retval = BytesToUppercaseHexString(&src[0], sizeof(src), &dest2[0], sizeof(dest2)); printf("retval=%" CHIP_ERROR_FORMAT "\n", retval.Format()); - NL_TEST_ASSERT(inSuite, retval == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest2[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(retval, CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest2[0], &expected[0], sizeof(expected)), 0); } // Lowercase @@ -120,15 +116,14 @@ void TestBytesToHexNullTerminated(nlTestSuite * inSuite, void * inContext) char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char dest2[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', '\0', '@' }; - NL_TEST_ASSERT(inSuite, ((sizeof(src) * 2u) + 1u) <= sizeof(dest)); - NL_TEST_ASSERT( - inSuite, BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u) + 1, HexFlags::kNullTerminate) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_LE(((sizeof(src) * 2u) + 1u), sizeof(dest)); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u) + 1, HexFlags::kNullTerminate), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); // Test Alias - NL_TEST_ASSERT(inSuite, BytesToLowercaseHexString(&src[0], sizeof(src), &dest2[0], sizeof(dest2)) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToLowercaseHexString(&src[0], sizeof(src), &dest2[0], sizeof(dest2)), CHIP_NO_ERROR); printf("->%s\n", dest2); - NL_TEST_ASSERT(inSuite, memcmp(&dest2[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest2[0], &expected[0], sizeof(expected)), 0); } // Trivial: Zero size input @@ -136,36 +131,36 @@ void TestBytesToHexNullTerminated(nlTestSuite * inSuite, void * inContext) uint8_t src[] = { 0x00 }; char dest[2] = { '!', '@' }; char expected[2] = { '\0', '@' }; - NL_TEST_ASSERT(inSuite, BytesToHex(&src[0], 0, &dest[0], sizeof(dest), HexFlags::kNullTerminate) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToHex(&src[0], 0, &dest[0], sizeof(dest), HexFlags::kNullTerminate), CHIP_NO_ERROR); // Expect nul termination - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); } // Trivial: Zero size input with null buffer { char dest[2] = { '!', '@' }; char expected[2] = { '\0', '@' }; - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, &dest[0], sizeof(dest), HexFlags::kNullTerminate) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToHex(nullptr, 0, &dest[0], sizeof(dest), HexFlags::kNullTerminate), CHIP_NO_ERROR); // Nothing should have been touched. - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, nullptr, 0, HexFlags::kNullTerminate) == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(BytesToHex(nullptr, 0, nullptr, 0, HexFlags::kNullTerminate), CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, &dest[0], 1, HexFlags::kNullTerminate) == CHIP_NO_ERROR); + EXPECT_EQ(BytesToHex(nullptr, 0, &dest[0], 1, HexFlags::kNullTerminate), CHIP_NO_ERROR); // Nothing should have been touched. - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); - NL_TEST_ASSERT(inSuite, BytesToHex(nullptr, 0, nullptr, 1, HexFlags::kNullTerminate) == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(BytesToHex(nullptr, 0, nullptr, 1, HexFlags::kNullTerminate), CHIP_ERROR_INVALID_ARGUMENT); } } -void TestBytesToHexErrors(nlTestSuite * inSuite, void * inContext) +TEST(TestBytesToHex, TestBytesToHexErrors) { // NULL destination { uint8_t src[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; char * dest = nullptr; - NL_TEST_ASSERT(inSuite, BytesToHex(&src[0], 0, dest, sizeof(src) * 2u, HexFlags::kNone) == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(BytesToHex(&src[0], 0, dest, sizeof(src) * 2u, HexFlags::kNone), CHIP_ERROR_INVALID_ARGUMENT); } // Destination buffer too small for non-null-terminated @@ -173,12 +168,10 @@ void TestBytesToHexErrors(nlTestSuite * inSuite, void * inContext) uint8_t src[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; - NL_TEST_ASSERT(inSuite, ((sizeof(src) * 2u) + 1u) <= sizeof(dest)); - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u) - 1, HexFlags::kNone) == - CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_LE(((sizeof(src) * 2u) + 1u), sizeof(dest)); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u) - 1, HexFlags::kNone), CHIP_ERROR_BUFFER_TOO_SMALL); // Ensure output not touched - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); } // Destination buffer too small for null-terminated @@ -186,12 +179,11 @@ void TestBytesToHexErrors(nlTestSuite * inSuite, void * inContext) uint8_t src[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; - NL_TEST_ASSERT(inSuite, ((sizeof(src) * 2u) + 1u) <= sizeof(dest)); - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u), HexFlags::kNullTerminate) == - CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_LE(((sizeof(src) * 2u) + 1u), sizeof(dest)); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], (sizeof(src) * 2u), HexFlags::kNullTerminate), + CHIP_ERROR_BUFFER_TOO_SMALL); // Ensure output not touched - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); } // Writing in a larger buffer is fine, bytes past the nul terminator (when requested) are untouched. @@ -199,10 +191,9 @@ void TestBytesToHexErrors(nlTestSuite * inSuite, void * inContext) uint8_t src[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', '\0', '@' }; - NL_TEST_ASSERT(inSuite, ((sizeof(src) * 2u) + 1u) < sizeof(dest)); - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], sizeof(src), &dest[0], sizeof(dest), HexFlags::kNullTerminate) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_LT(((sizeof(src) * 2u) + 1u), sizeof(dest)); + EXPECT_EQ(BytesToHex(&src[0], sizeof(src), &dest[0], sizeof(dest), HexFlags::kNullTerminate), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); } // Source size that would not fit in any output using size_t @@ -210,18 +201,16 @@ void TestBytesToHexErrors(nlTestSuite * inSuite, void * inContext) uint8_t src[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF }; char dest[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; char expected[18] = { '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '!', '@' }; - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], SIZE_MAX / 2u, &dest[0], sizeof(dest), HexFlags::kNullTerminate) == - CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); - - NL_TEST_ASSERT(inSuite, - BytesToHex(&src[0], SIZE_MAX / 2u, &dest[0], sizeof(dest), HexFlags::kNone) == CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, memcmp(&dest[0], &expected[0], sizeof(expected)) == 0); + EXPECT_EQ(BytesToHex(&src[0], SIZE_MAX / 2u, &dest[0], sizeof(dest), HexFlags::kNullTerminate), + CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); + + EXPECT_EQ(BytesToHex(&src[0], SIZE_MAX / 2u, &dest[0], sizeof(dest), HexFlags::kNone), CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(memcmp(&dest[0], &expected[0], sizeof(expected)), 0); } } -void TestBytesToHexUint64(nlTestSuite * inSuite, void * inContext) +TEST(TestBytesToHex, TestBytesToHexUint64) { // Different values in each byte and each nibble should let us know if the conversion is correct. uint64_t test = 0x0123456789ABCDEF; @@ -237,62 +226,54 @@ void TestBytesToHexUint64(nlTestSuite * inSuite, void * inContext) // Lower case - uint64_t. memset(buf, 1, sizeof(buf)); - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf), HexFlags::kNone) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(buf, lowerExpected, strlen(lowerExpected)) == 0); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf), HexFlags::kNone), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(buf, lowerExpected, strlen(lowerExpected)), 0); // No null termination. - NL_TEST_ASSERT(inSuite, buf[16] == 1); + EXPECT_EQ(buf[16], 1); // Lower case - uint32_t. memset(buf, 1, sizeof(buf)); - NL_TEST_ASSERT(inSuite, Uint32ToHex(test32_0, buf, sizeof(uint32_t) * 2, HexFlags::kNone) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - Uint32ToHex(test32_1, &buf[sizeof(uint32_t) * 2], sizeof(uint32_t) * 2, HexFlags::kNone) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(buf, lowerExpected, strlen(lowerExpected)) == 0); + EXPECT_EQ(Uint32ToHex(test32_0, buf, sizeof(uint32_t) * 2, HexFlags::kNone), CHIP_NO_ERROR); + EXPECT_EQ(Uint32ToHex(test32_1, &buf[sizeof(uint32_t) * 2], sizeof(uint32_t) * 2, HexFlags::kNone), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(buf, lowerExpected, strlen(lowerExpected)), 0); // No null termination. - NL_TEST_ASSERT(inSuite, buf[16] == 1); + EXPECT_EQ(buf[16], 1); // Upper case - uint64_t. memset(buf, 1, sizeof(buf)); - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf), HexFlags::kUppercase) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(buf, upperExpected, strlen(upperExpected)) == 0); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf), HexFlags::kUppercase), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(buf, upperExpected, strlen(upperExpected)), 0); // No null termination. - NL_TEST_ASSERT(inSuite, buf[16] == 1); + EXPECT_EQ(buf[16], 1); // Upper case - uint16_t. memset(buf, 1, sizeof(buf)); - NL_TEST_ASSERT(inSuite, Uint16ToHex(test16_0, buf, sizeof(uint16_t) * 2, HexFlags::kUppercase) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - Uint16ToHex(test16_1, &buf[sizeof(uint16_t) * 2 * 1], sizeof(uint16_t) * 2, HexFlags::kUppercase) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - Uint16ToHex(test16_2, &buf[sizeof(uint16_t) * 2 * 2], sizeof(uint16_t) * 2, HexFlags::kUppercase) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, - Uint16ToHex(test16_3, &buf[sizeof(uint16_t) * 2 * 3], sizeof(uint16_t) * 2, HexFlags::kUppercase) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(buf, upperExpected, strlen(upperExpected)) == 0); + EXPECT_EQ(Uint16ToHex(test16_0, buf, sizeof(uint16_t) * 2, HexFlags::kUppercase), CHIP_NO_ERROR); + EXPECT_EQ(Uint16ToHex(test16_1, &buf[sizeof(uint16_t) * 2 * 1], sizeof(uint16_t) * 2, HexFlags::kUppercase), CHIP_NO_ERROR); + EXPECT_EQ(Uint16ToHex(test16_2, &buf[sizeof(uint16_t) * 2 * 2], sizeof(uint16_t) * 2, HexFlags::kUppercase), CHIP_NO_ERROR); + EXPECT_EQ(Uint16ToHex(test16_3, &buf[sizeof(uint16_t) * 2 * 3], sizeof(uint16_t) * 2, HexFlags::kUppercase), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(buf, upperExpected, strlen(upperExpected)), 0); // No null termination. - NL_TEST_ASSERT(inSuite, buf[16] == 1); + EXPECT_EQ(buf[16], 1); // Lower case with null termination. memset(buf, 1, sizeof(buf)); - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf), HexFlags::kNullTerminate) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(buf, lowerExpected, sizeof(lowerExpected)) == 0); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf), HexFlags::kNullTerminate), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(buf, lowerExpected, sizeof(lowerExpected)), 0); // Upper case with null termination. memset(buf, 1, sizeof(buf)); - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf), HexFlags::kUppercaseAndNullTerminate) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(buf, upperExpected, sizeof(upperExpected)) == 0); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf), HexFlags::kUppercaseAndNullTerminate), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(buf, upperExpected, sizeof(upperExpected)), 0); // Too small buffer - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf) - 2, HexFlags::kNone) == CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf) - 2, HexFlags::kUppercase) == CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, Uint64ToHex(test, buf, sizeof(buf) - 1, HexFlags::kNullTerminate) == CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, - Uint64ToHex(test, buf, sizeof(buf) - 1, HexFlags::kUppercaseAndNullTerminate) == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf) - 2, HexFlags::kNone), CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf) - 2, HexFlags::kUppercase), CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf) - 1, HexFlags::kNullTerminate), CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(Uint64ToHex(test, buf, sizeof(buf) - 1, HexFlags::kUppercaseAndNullTerminate), CHIP_ERROR_BUFFER_TOO_SMALL); } -void TestHexToBytesAndUint(nlTestSuite * inSuite, void * inContext) +TEST(TestBytesToHex, TestHexToBytesAndUint) { // Different values in each byte and each nibble should let us know if the conversion is correct. char hexInLowercase[] = "0123456789abcdef"; @@ -310,32 +291,32 @@ void TestHexToBytesAndUint(nlTestSuite * inSuite, void * inContext) // Lower case - bytes. memset(buf, 0, sizeof(buf)); - NL_TEST_ASSERT(inSuite, HexToBytes(hexInLowercase, strlen(hexInLowercase), buf, sizeof(buf)) == sizeof(buf)); - NL_TEST_ASSERT(inSuite, memcmp(buf, bytesOutExpected, sizeof(buf)) == 0); + EXPECT_EQ(HexToBytes(hexInLowercase, strlen(hexInLowercase), buf, sizeof(buf)), sizeof(buf)); + EXPECT_EQ(memcmp(buf, bytesOutExpected, sizeof(buf)), 0); // Upper case - bytes. memset(buf, 0, sizeof(buf)); - NL_TEST_ASSERT(inSuite, HexToBytes(hexInUppercase, strlen(hexInUppercase), buf, sizeof(buf)) == sizeof(buf)); - NL_TEST_ASSERT(inSuite, memcmp(buf, bytesOutExpected, sizeof(buf)) == 0); + EXPECT_EQ(HexToBytes(hexInUppercase, strlen(hexInUppercase), buf, sizeof(buf)), sizeof(buf)); + EXPECT_EQ(memcmp(buf, bytesOutExpected, sizeof(buf)), 0); // Lower case - uint64_t. test64Out = 0; - NL_TEST_ASSERT(inSuite, UppercaseHexToUint64(hexInLowercase, strlen(hexInLowercase), test64Out) == 0); + EXPECT_EQ(UppercaseHexToUint64(hexInLowercase, strlen(hexInLowercase), test64Out), 0u); // Upper case - uint64_t. test64Out = 0; - NL_TEST_ASSERT(inSuite, UppercaseHexToUint64(hexInUppercase, strlen(hexInUppercase), test64Out) == sizeof(uint64_t)); - NL_TEST_ASSERT(inSuite, test64Out == test64OutExpected); + EXPECT_EQ(UppercaseHexToUint64(hexInUppercase, strlen(hexInUppercase), test64Out), sizeof(uint64_t)); + EXPECT_EQ(test64Out, test64OutExpected); // Upper case - uint32_t. test32Out = 0; - NL_TEST_ASSERT(inSuite, UppercaseHexToUint32(hexInUppercase32, strlen(hexInUppercase32), test32Out) == sizeof(uint32_t)); - NL_TEST_ASSERT(inSuite, test32Out == test32OutExpected); + EXPECT_EQ(UppercaseHexToUint32(hexInUppercase32, strlen(hexInUppercase32), test32Out), sizeof(uint32_t)); + EXPECT_EQ(test32Out, test32OutExpected); // Upper case - uint16_t. test16Out = 0; - NL_TEST_ASSERT(inSuite, UppercaseHexToUint16(hexInUppercase16, strlen(hexInUppercase16), test16Out) == sizeof(uint16_t)); - NL_TEST_ASSERT(inSuite, test16Out == test16OutExpected); + EXPECT_EQ(UppercaseHexToUint16(hexInUppercase16, strlen(hexInUppercase16), test16Out), sizeof(uint16_t)); + EXPECT_EQ(test16Out, test16OutExpected); } #if CHIP_PROGRESS_LOGGING @@ -351,9 +332,9 @@ ENFORCE_FORMAT(3, 0) void AccumulateLogLineCallback(const char * module, uint8_t gRedirectedLogLines.push_back(std::string(line)); } -void ValidateTextMatches(nlTestSuite * inSuite, const char ** expected, size_t numLines, const std::vector & candidate) +void ValidateTextMatches(const char ** expected, size_t numLines, const std::vector & candidate) { - NL_TEST_ASSERT(inSuite, candidate.size() == numLines); + EXPECT_EQ(candidate.size(), numLines); if (candidate.size() != numLines) { return; @@ -361,7 +342,7 @@ void ValidateTextMatches(nlTestSuite * inSuite, const char ** expected, size_t n for (size_t idx = 0; idx < numLines; idx++) { printf("Checking '%s' against '%s'\n", candidate.at(idx).c_str(), expected[idx]); - NL_TEST_ASSERT(inSuite, candidate.at(idx) == expected[idx]); + EXPECT_EQ(candidate.at(idx), expected[idx]); if (candidate.at(idx) != expected[idx]) { return; @@ -369,7 +350,7 @@ void ValidateTextMatches(nlTestSuite * inSuite, const char ** expected, size_t n } } -void TestLogBufferAsHex(nlTestSuite * inSuite, void * inContext) +TEST(TestBytesToHex, TestLogBufferAsHex) { const char * kExpectedText1[] = { ">>>A54A39294B28886E8BFC15B44105A3FD22745225983A753E6BB82DA7C62493BF", @@ -425,31 +406,9 @@ void TestLogBufferAsHex(nlTestSuite * inSuite, void * inContext) LogBufferAsHex(testCase.label, testCase.buffer); } chip::Logging::SetLogRedirectCallback(nullptr); - ValidateTextMatches(inSuite, testCase.expectedText, testCase.numLines, gRedirectedLogLines); + ValidateTextMatches(testCase.expectedText, testCase.numLines, gRedirectedLogLines); } } #endif - -const nlTest sTests[] = { - NL_TEST_DEF("TestBytesToHexNotNullTerminated", TestBytesToHexNotNullTerminated), // - NL_TEST_DEF("TestBytesToHexNullTerminated", TestBytesToHexNullTerminated), // - NL_TEST_DEF("TestBytesToHexErrors", TestBytesToHexErrors), // - NL_TEST_DEF("TestBytesToHexUint64", TestBytesToHexUint64), // - NL_TEST_DEF("TestHexToBytesAndUint", TestHexToBytesAndUint), // -#if CHIP_PROGRESS_LOGGING - NL_TEST_DEF("TestLogBufferAsHex", TestLogBufferAsHex), // -#endif - NL_TEST_SENTINEL() // -}; - } // namespace - -int TestBytesToHex() -{ - nlTestSuite theSuite = { "BytesToHex", sTests, nullptr, nullptr }; - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestBytesToHex) diff --git a/src/lib/support/tests/TestSafeString.cpp b/src/lib/support/tests/TestSafeString.cpp index 2dc52d38a6754e..09e7d89e4054f7 100644 --- a/src/lib/support/tests/TestSafeString.cpp +++ b/src/lib/support/tests/TestSafeString.cpp @@ -22,45 +22,27 @@ * */ -#include -#include +#include -#include +#include using namespace chip; -static void TestMaxStringLength(nlTestSuite * inSuite, void * inContext) +TEST(TestSafeString, TestMaxStringLength) { constexpr size_t len = MaxStringLength("a", "bc", "def"); - NL_TEST_ASSERT(inSuite, len == 3); + EXPECT_EQ(len, 3u); - NL_TEST_ASSERT(inSuite, MaxStringLength("bc") == 2); + EXPECT_EQ(MaxStringLength("bc"), 2u); - NL_TEST_ASSERT(inSuite, MaxStringLength("def", "bc", "a") == 3); + EXPECT_EQ(MaxStringLength("def", "bc", "a"), 3u); - NL_TEST_ASSERT(inSuite, MaxStringLength("") == 0); -} - -static void TestTotalStringLength(nlTestSuite * inSuite, void * inContext) -{ - NL_TEST_ASSERT(inSuite, TotalStringLength("") == 0); - NL_TEST_ASSERT(inSuite, TotalStringLength("a") == 1); - NL_TEST_ASSERT(inSuite, TotalStringLength("def", "bc", "a") == 6); + EXPECT_EQ(MaxStringLength(""), 0u); } -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { NL_TEST_DEF_FN(TestMaxStringLength), NL_TEST_DEF_FN(TestTotalStringLength), NL_TEST_SENTINEL() }; - -int TestSafeString() +TEST(TestSafeString, TestTotalStringLength) { - nlTestSuite theSuite = { "CHIP SafeString tests", &sTests[0], nullptr, nullptr }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); + EXPECT_EQ(TotalStringLength(""), 0u); + EXPECT_EQ(TotalStringLength("a"), 1u); + EXPECT_EQ(TotalStringLength("def", "bc", "a"), 6u); } - -CHIP_REGISTER_TEST_SUITE(TestSafeString) diff --git a/src/lib/support/tests/TestScoped.cpp b/src/lib/support/tests/TestScoped.cpp index 90cdd62b0acf4a..fef70a443dcfb1 100644 --- a/src/lib/support/tests/TestScoped.cpp +++ b/src/lib/support/tests/TestScoped.cpp @@ -16,87 +16,66 @@ * limitations under the License. */ -#include -#include - -#include #include +#include + +#include + namespace { using namespace chip; -void TestScopedVariableChange(nlTestSuite * inSuite, void * inContext) +TEST(TestScoped, TestScopedVariableChange) { int x = 123; { ScopedChange change1(x, 10); - NL_TEST_ASSERT(inSuite, x == 10); + EXPECT_EQ(x, 10); x = 15; { ScopedChange change2(x, 20); - NL_TEST_ASSERT(inSuite, x == 20); + EXPECT_EQ(x, 20); } - NL_TEST_ASSERT(inSuite, x == 15); + EXPECT_EQ(x, 15); } - NL_TEST_ASSERT(inSuite, x == 123); + EXPECT_EQ(x, 123); } -void TestScopedChangeOnly(nlTestSuite * inSuite, void * inContext) +TEST(TestScoped, TestScopedChangeOnly) { ScopedChangeOnly intValue(123); ScopedChangeOnly strValue("abc"); - NL_TEST_ASSERT(inSuite, intValue == 123); - NL_TEST_ASSERT(inSuite, strcmp(strValue, "abc") == 0); + EXPECT_EQ(intValue, 123); + EXPECT_STREQ(strValue, "abc"); { ScopedChange change1(intValue, 234); - NL_TEST_ASSERT(inSuite, intValue == 234); - NL_TEST_ASSERT(inSuite, strcmp(strValue, "abc") == 0); + EXPECT_EQ(intValue, 234); + EXPECT_STREQ(strValue, "abc"); ScopedChange change2(strValue, "xyz"); - NL_TEST_ASSERT(inSuite, intValue == 234); - NL_TEST_ASSERT(inSuite, strcmp(strValue, "xyz") == 0); + EXPECT_EQ(intValue, 234); + EXPECT_STREQ(strValue, "xyz"); { ScopedChange change3(intValue, 10); ScopedChange change4(strValue, "test"); - NL_TEST_ASSERT(inSuite, intValue == 10); - NL_TEST_ASSERT(inSuite, strcmp(strValue, "test") == 0); + EXPECT_EQ(intValue, 10); + EXPECT_STREQ(strValue, "test"); } - NL_TEST_ASSERT(inSuite, intValue == 234); - NL_TEST_ASSERT(inSuite, strcmp(strValue, "xyz") == 0); + EXPECT_EQ(intValue, 234); + EXPECT_STREQ(strValue, "xyz"); } - NL_TEST_ASSERT(inSuite, intValue == 123); - NL_TEST_ASSERT(inSuite, strcmp(strValue, "abc") == 0); + EXPECT_EQ(intValue, 123); + EXPECT_STREQ(strValue, "abc"); } } // namespace - -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { - NL_TEST_DEF_FN(TestScopedVariableChange), // - NL_TEST_DEF_FN(TestScopedChangeOnly), // - NL_TEST_SENTINEL() // -}; - -int TestScoped() -{ - nlTestSuite theSuite = { "CHIP Scoped tests", &sTests[0], nullptr, nullptr }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestScoped) diff --git a/src/lib/support/tests/TestSpan.cpp b/src/lib/support/tests/TestSpan.cpp index 87f52ae9bec4d2..6849138861065c 100644 --- a/src/lib/support/tests/TestSpan.cpp +++ b/src/lib/support/tests/TestSpan.cpp @@ -22,256 +22,255 @@ * */ -#include -#include +#include -#include +#include -#include +#include using namespace chip; -static void TestByteSpan(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestByteSpan) { uint8_t arr[] = { 1, 2, 3 }; ByteSpan s0 = ByteSpan(); - NL_TEST_ASSERT(inSuite, s0.size() == 0); - NL_TEST_ASSERT(inSuite, s0.empty()); - NL_TEST_ASSERT(inSuite, s0.data_equal(s0)); + EXPECT_EQ(s0.size(), 0u); + EXPECT_TRUE(s0.empty()); + EXPECT_TRUE(s0.data_equal(s0)); ByteSpan s1(arr, 2); - NL_TEST_ASSERT(inSuite, s1.data() == arr); - NL_TEST_ASSERT(inSuite, s1.size() == 2); - NL_TEST_ASSERT(inSuite, !s1.empty()); - NL_TEST_ASSERT(inSuite, s1.data_equal(s1)); - NL_TEST_ASSERT(inSuite, !s1.data_equal(s0)); + EXPECT_EQ(s1.data(), arr); + EXPECT_EQ(s1.size(), 2u); + EXPECT_FALSE(s1.empty()); + EXPECT_TRUE(s1.data_equal(s1)); + EXPECT_FALSE(s1.data_equal(s0)); ByteSpan s2(arr); - NL_TEST_ASSERT(inSuite, s2.data() == arr); - NL_TEST_ASSERT(inSuite, s2.size() == 3); - NL_TEST_ASSERT(inSuite, s2.data()[2] == 3); - NL_TEST_ASSERT(inSuite, !s2.empty()); - NL_TEST_ASSERT(inSuite, s2.data_equal(s2)); - NL_TEST_ASSERT(inSuite, !s2.data_equal(s1)); - NL_TEST_ASSERT(inSuite, s2.front() == 1); - NL_TEST_ASSERT(inSuite, s2.back() == 3); - NL_TEST_ASSERT(inSuite, s2[0] == 1); - NL_TEST_ASSERT(inSuite, s2[1] == 2); - NL_TEST_ASSERT(inSuite, s2[2] == 3); + EXPECT_EQ(s2.data(), arr); + EXPECT_EQ(s2.size(), 3u); + EXPECT_EQ(s2.data()[2], 3u); + EXPECT_FALSE(s2.empty()); + EXPECT_TRUE(s2.data_equal(s2)); + EXPECT_FALSE(s2.data_equal(s1)); + EXPECT_EQ(s2.front(), 1u); + EXPECT_EQ(s2.back(), 3u); + EXPECT_EQ(s2[0], 1u); + EXPECT_EQ(s2[1], 2u); + EXPECT_EQ(s2[2], 3u); ByteSpan s3 = s2; - NL_TEST_ASSERT(inSuite, s3.data() == arr); - NL_TEST_ASSERT(inSuite, s3.size() == 3); - NL_TEST_ASSERT(inSuite, s3.data()[2] == 3); - NL_TEST_ASSERT(inSuite, !s3.empty()); - NL_TEST_ASSERT(inSuite, s3.data_equal(s2)); + EXPECT_EQ(s3.data(), arr); + EXPECT_EQ(s3.size(), 3u); + EXPECT_EQ(s3.data()[2], 3u); + EXPECT_FALSE(s3.empty()); + EXPECT_TRUE(s3.data_equal(s2)); uint8_t arr2[] = { 3, 2, 1 }; ByteSpan s4(arr2); - NL_TEST_ASSERT(inSuite, !s4.data_equal(s2)); + EXPECT_FALSE(s4.data_equal(s2)); ByteSpan s5(arr2, 0); - NL_TEST_ASSERT(inSuite, s5.data() != nullptr); - NL_TEST_ASSERT(inSuite, !s5.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s5.data_equal(s0)); - NL_TEST_ASSERT(inSuite, s0.data_equal(s5)); + EXPECT_NE(s5.data(), nullptr); + EXPECT_FALSE(s5.data_equal(s4)); + EXPECT_TRUE(s5.data_equal(s0)); + EXPECT_TRUE(s0.data_equal(s5)); ByteSpan s6(arr2); s6.reduce_size(2); - NL_TEST_ASSERT(inSuite, s6.size() == 2); + EXPECT_EQ(s6.size(), 2u); ByteSpan s7(arr2, 2); - NL_TEST_ASSERT(inSuite, s6.data_equal(s7)); - NL_TEST_ASSERT(inSuite, s7.data_equal(s6)); + EXPECT_TRUE(s6.data_equal(s7)); + EXPECT_TRUE(s7.data_equal(s6)); } -static void TestMutableByteSpan(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestMutableByteSpan) { uint8_t arr[] = { 1, 2, 3 }; MutableByteSpan s0 = MutableByteSpan(); - NL_TEST_ASSERT(inSuite, s0.size() == 0); - NL_TEST_ASSERT(inSuite, s0.empty()); - NL_TEST_ASSERT(inSuite, s0.data_equal(s0)); + EXPECT_EQ(s0.size(), 0u); + EXPECT_TRUE(s0.empty()); + EXPECT_TRUE(s0.data_equal(s0)); MutableByteSpan s1(arr, 2); - NL_TEST_ASSERT(inSuite, s1.data() == arr); - NL_TEST_ASSERT(inSuite, s1.size() == 2); - NL_TEST_ASSERT(inSuite, !s1.empty()); - NL_TEST_ASSERT(inSuite, s1.data_equal(s1)); - NL_TEST_ASSERT(inSuite, !s1.data_equal(s0)); + EXPECT_EQ(s1.data(), arr); + EXPECT_EQ(s1.size(), 2u); + EXPECT_FALSE(s1.empty()); + EXPECT_TRUE(s1.data_equal(s1)); + EXPECT_FALSE(s1.data_equal(s0)); MutableByteSpan s2(arr); - NL_TEST_ASSERT(inSuite, s2.data() == arr); - NL_TEST_ASSERT(inSuite, s2.size() == 3); - NL_TEST_ASSERT(inSuite, s2.data()[2] == 3); - NL_TEST_ASSERT(inSuite, !s2.empty()); - NL_TEST_ASSERT(inSuite, s2.data_equal(s2)); - NL_TEST_ASSERT(inSuite, !s2.data_equal(s1)); + EXPECT_EQ(s2.data(), arr); + EXPECT_EQ(s2.size(), 3u); + EXPECT_EQ(s2.data()[2], 3u); + EXPECT_FALSE(s2.empty()); + EXPECT_TRUE(s2.data_equal(s2)); + EXPECT_FALSE(s2.data_equal(s1)); MutableByteSpan s3 = s2; - NL_TEST_ASSERT(inSuite, s3.data() == arr); - NL_TEST_ASSERT(inSuite, s3.size() == 3); - NL_TEST_ASSERT(inSuite, s3.data()[2] == 3); - NL_TEST_ASSERT(inSuite, !s3.empty()); - NL_TEST_ASSERT(inSuite, s3.data_equal(s2)); + EXPECT_EQ(s3.data(), arr); + EXPECT_EQ(s3.size(), 3u); + EXPECT_EQ(s3.data()[2], 3u); + EXPECT_FALSE(s3.empty()); + EXPECT_TRUE(s3.data_equal(s2)); uint8_t arr2[] = { 3, 2, 1 }; MutableByteSpan s4(arr2); - NL_TEST_ASSERT(inSuite, !s4.data_equal(s2)); + EXPECT_FALSE(s4.data_equal(s2)); MutableByteSpan s5(arr2, 0); - NL_TEST_ASSERT(inSuite, s5.data() != nullptr); - NL_TEST_ASSERT(inSuite, !s5.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s5.data_equal(s0)); - NL_TEST_ASSERT(inSuite, s0.data_equal(s5)); + EXPECT_NE(s5.data(), nullptr); + EXPECT_FALSE(s5.data_equal(s4)); + EXPECT_TRUE(s5.data_equal(s0)); + EXPECT_TRUE(s0.data_equal(s5)); MutableByteSpan s6(arr2); s6.reduce_size(2); - NL_TEST_ASSERT(inSuite, s6.size() == 2); + EXPECT_EQ(s6.size(), 2u); MutableByteSpan s7(arr2, 2); - NL_TEST_ASSERT(inSuite, s6.data_equal(s7)); - NL_TEST_ASSERT(inSuite, s7.data_equal(s6)); + EXPECT_TRUE(s6.data_equal(s7)); + EXPECT_TRUE(s7.data_equal(s6)); uint8_t arr3[] = { 1, 2, 3 }; MutableByteSpan s8(arr3); - NL_TEST_ASSERT(inSuite, arr3[1] == 2); + EXPECT_EQ(arr3[1], 2u); s8.data()[1] = 3; - NL_TEST_ASSERT(inSuite, arr3[1] == 3); + EXPECT_EQ(arr3[1], 3u); // Not mutable span on purpose, to test conversion. ByteSpan s9 = s8; - NL_TEST_ASSERT(inSuite, s9.data_equal(s8)); - NL_TEST_ASSERT(inSuite, s8.data_equal(s9)); + EXPECT_TRUE(s9.data_equal(s8)); + EXPECT_TRUE(s8.data_equal(s9)); // Not mutable span on purpose. ByteSpan s10(s8); - NL_TEST_ASSERT(inSuite, s10.data_equal(s8)); - NL_TEST_ASSERT(inSuite, s8.data_equal(s10)); + EXPECT_TRUE(s10.data_equal(s8)); + EXPECT_TRUE(s8.data_equal(s10)); } -static void TestFixedByteSpan(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestFixedByteSpan) { uint8_t arr[] = { 1, 2, 3 }; FixedByteSpan<3> s0 = FixedByteSpan<3>(); - NL_TEST_ASSERT(inSuite, s0.data() != nullptr); - NL_TEST_ASSERT(inSuite, s0.size() == 3); - NL_TEST_ASSERT(inSuite, s0.data_equal(s0)); - NL_TEST_ASSERT(inSuite, s0[0] == 0); - NL_TEST_ASSERT(inSuite, s0[1] == 0); - NL_TEST_ASSERT(inSuite, s0[2] == 0); + EXPECT_NE(s0.data(), nullptr); + EXPECT_EQ(s0.size(), 3u); + EXPECT_TRUE(s0.data_equal(s0)); + EXPECT_EQ(s0[0], 0u); + EXPECT_EQ(s0[1], 0u); + EXPECT_EQ(s0[2], 0u); FixedByteSpan<2> s1(arr); - NL_TEST_ASSERT(inSuite, s1.data() == arr); - NL_TEST_ASSERT(inSuite, s1.size() == 2); - NL_TEST_ASSERT(inSuite, s1.data_equal(s1)); + EXPECT_EQ(s1.data(), arr); + EXPECT_EQ(s1.size(), 2u); + EXPECT_TRUE(s1.data_equal(s1)); FixedByteSpan<3> s2(arr); - NL_TEST_ASSERT(inSuite, s2.data() == arr); - NL_TEST_ASSERT(inSuite, s2.size() == 3); - NL_TEST_ASSERT(inSuite, s2.data()[2] == 3); - NL_TEST_ASSERT(inSuite, s2.data_equal(s2)); - NL_TEST_ASSERT(inSuite, s2.front() == 1); - NL_TEST_ASSERT(inSuite, s2.back() == 3); - NL_TEST_ASSERT(inSuite, s2[0] == 1); - NL_TEST_ASSERT(inSuite, s2[1] == 2); - NL_TEST_ASSERT(inSuite, s2[2] == 3); + EXPECT_EQ(s2.data(), arr); + EXPECT_EQ(s2.size(), 3u); + EXPECT_EQ(s2.data()[2], 3u); + EXPECT_TRUE(s2.data_equal(s2)); + EXPECT_EQ(s2.front(), 1u); + EXPECT_EQ(s2.back(), 3u); + EXPECT_EQ(s2[0], 1u); + EXPECT_EQ(s2[1], 2u); + EXPECT_EQ(s2[2], 3u); FixedByteSpan<3> s3 = s2; - NL_TEST_ASSERT(inSuite, s3.data() == arr); - NL_TEST_ASSERT(inSuite, s3.size() == 3); - NL_TEST_ASSERT(inSuite, s3.data()[2] == 3); - NL_TEST_ASSERT(inSuite, s3.data_equal(s2)); + EXPECT_EQ(s3.data(), arr); + EXPECT_EQ(s3.size(), 3u); + EXPECT_EQ(s3.data()[2], 3u); + EXPECT_TRUE(s3.data_equal(s2)); uint8_t arr2[] = { 3, 2, 1 }; FixedSpan s4(arr2); - NL_TEST_ASSERT(inSuite, !s4.data_equal(s2)); + EXPECT_FALSE(s4.data_equal(s2)); size_t idx = 0; for (auto & entry : s4) { - NL_TEST_ASSERT(inSuite, entry == arr2[idx++]); + EXPECT_EQ(entry, arr2[idx++]); } - NL_TEST_ASSERT(inSuite, idx == 3); + EXPECT_EQ(idx, 3u); FixedByteSpan<3> s5(arr2); - NL_TEST_ASSERT(inSuite, s5.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s4.data_equal(s5)); + EXPECT_TRUE(s5.data_equal(s4)); + EXPECT_TRUE(s4.data_equal(s5)); FixedByteSpan<2> s6(s4); idx = 0; for (auto & entry : s6) { - NL_TEST_ASSERT(inSuite, entry == arr2[idx++]); + EXPECT_EQ(entry, arr2[idx++]); } - NL_TEST_ASSERT(inSuite, idx == 2); + EXPECT_EQ(idx, 2u); // Not fixed, to test conversion. ByteSpan s7(s4); - NL_TEST_ASSERT(inSuite, s7.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s4.data_equal(s7)); + EXPECT_TRUE(s7.data_equal(s4)); + EXPECT_TRUE(s4.data_equal(s7)); MutableByteSpan s8(s4); - NL_TEST_ASSERT(inSuite, s8.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s4.data_equal(s8)); + EXPECT_TRUE(s8.data_equal(s4)); + EXPECT_TRUE(s4.data_equal(s8)); } -static void TestSpanOfPointers(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestSpanOfPointers) { uint8_t x = 5; uint8_t * ptrs[] = { &x, &x }; Span s1(ptrs); Span s2(s1); - NL_TEST_ASSERT(inSuite, s1.data_equal(s2)); - NL_TEST_ASSERT(inSuite, s2.data_equal(s1)); + EXPECT_TRUE(s1.data_equal(s2)); + EXPECT_TRUE(s2.data_equal(s1)); FixedSpan s3(ptrs); FixedSpan s4(s3); - NL_TEST_ASSERT(inSuite, s1.data_equal(s3)); - NL_TEST_ASSERT(inSuite, s3.data_equal(s1)); + EXPECT_TRUE(s1.data_equal(s3)); + EXPECT_TRUE(s3.data_equal(s1)); - NL_TEST_ASSERT(inSuite, s2.data_equal(s3)); - NL_TEST_ASSERT(inSuite, s3.data_equal(s2)); + EXPECT_TRUE(s2.data_equal(s3)); + EXPECT_TRUE(s3.data_equal(s2)); - NL_TEST_ASSERT(inSuite, s1.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s4.data_equal(s1)); + EXPECT_TRUE(s1.data_equal(s4)); + EXPECT_TRUE(s4.data_equal(s1)); - NL_TEST_ASSERT(inSuite, s2.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s4.data_equal(s2)); + EXPECT_TRUE(s2.data_equal(s4)); + EXPECT_TRUE(s4.data_equal(s2)); - NL_TEST_ASSERT(inSuite, s3.data_equal(s4)); - NL_TEST_ASSERT(inSuite, s4.data_equal(s3)); + EXPECT_TRUE(s3.data_equal(s4)); + EXPECT_TRUE(s4.data_equal(s3)); Span s5(s3); - NL_TEST_ASSERT(inSuite, s5.data_equal(s3)); - NL_TEST_ASSERT(inSuite, s3.data_equal(s5)); + EXPECT_TRUE(s5.data_equal(s3)); + EXPECT_TRUE(s3.data_equal(s5)); } -static void TestSubSpan(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestSubSpan) { uint8_t array[16]; ByteSpan span(array); - NL_TEST_ASSERT(inSuite, span.data() == &array[0]); - NL_TEST_ASSERT(inSuite, span.size() == 16); + EXPECT_EQ(span.data(), &array[0]); + EXPECT_EQ(span.size(), 16u); ByteSpan subspan = span.SubSpan(1, 14); - NL_TEST_ASSERT(inSuite, subspan.data() == &array[1]); - NL_TEST_ASSERT(inSuite, subspan.size() == 14); + EXPECT_EQ(subspan.data(), &array[1]); + EXPECT_EQ(subspan.size(), 14u); subspan = span.SubSpan(1, 0); - NL_TEST_ASSERT(inSuite, subspan.size() == 0); + EXPECT_EQ(subspan.size(), 0u); subspan = span.SubSpan(10); - NL_TEST_ASSERT(inSuite, subspan.data() == &array[10]); - NL_TEST_ASSERT(inSuite, subspan.size() == 6); + EXPECT_EQ(subspan.data(), &array[10]); + EXPECT_EQ(subspan.size(), 6u); subspan = span.SubSpan(16); - NL_TEST_ASSERT(inSuite, subspan.size() == 0); + EXPECT_EQ(subspan.size(), 0u); } -static void TestFromZclString(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestFromZclString) { // Purposefully larger size than data. constexpr uint8_t array[16] = { 3, 0x41, 0x63, 0x45 }; @@ -279,26 +278,26 @@ static void TestFromZclString(nlTestSuite * inSuite, void * inContext) static constexpr char str[] = "AcE"; ByteSpan s1 = ByteSpan::fromZclString(array); - NL_TEST_ASSERT(inSuite, s1.data_equal(ByteSpan(&array[1], 3))); + EXPECT_TRUE(s1.data_equal(ByteSpan(&array[1], 3u))); CharSpan s2 = CharSpan::fromZclString(array); - NL_TEST_ASSERT(inSuite, s2.data_equal(CharSpan(str, 3))); + EXPECT_TRUE(s2.data_equal(CharSpan(str, 3))); } -static void TestFromCharString(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestFromCharString) { static constexpr char str[] = "AcE"; CharSpan s1 = CharSpan::fromCharString(str); - NL_TEST_ASSERT(inSuite, s1.data_equal(CharSpan(str, 3))); + EXPECT_TRUE(s1.data_equal(CharSpan(str, 3))); } -static void TestLiteral(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestLiteral) { constexpr CharSpan literal = "HI!"_span; - NL_TEST_ASSERT(inSuite, literal.size() == 3); - NL_TEST_ASSERT(inSuite, literal.data_equal(CharSpan::fromCharString("HI!"))); - NL_TEST_ASSERT(inSuite, ""_span.size() == 0); + EXPECT_EQ(literal.size(), 3u); + EXPECT_TRUE(literal.data_equal(CharSpan::fromCharString("HI!"))); + EXPECT_EQ(""_span.size(), 0u); // These should be compile errors -- if they were allowed they would produce // a CharSpan that includes the trailing '\0' byte in the value. @@ -306,7 +305,7 @@ static void TestLiteral(nlTestSuite * inSuite, void * inContext) // constexpr CharSpan disallowed2{ "abcd" }; } -static void TestConversionConstructors(nlTestSuite * inSuite, void * inContext) +TEST(TestSpan, TestConversionConstructors) { struct Foo { @@ -345,43 +344,15 @@ static void TestConversionConstructors(nlTestSuite * inSuite, void * inContext) ([](FixedSpan f) {})(constArray); ([](Span f) {})(constArray); - NL_TEST_ASSERT(inSuite, span10.data_equal(span10)); - NL_TEST_ASSERT(inSuite, span10.data_equal(span9)); - NL_TEST_ASSERT(inSuite, span10.data_equal(array)); - NL_TEST_ASSERT(inSuite, span10.data_equal(constArray)); - NL_TEST_ASSERT(inSuite, span9.data_equal(span9)); - NL_TEST_ASSERT(inSuite, span9.data_equal(span10)); - NL_TEST_ASSERT(inSuite, span9.data_equal(array)); - NL_TEST_ASSERT(inSuite, span9.data_equal(constArray)); + EXPECT_TRUE(span10.data_equal(span10)); + EXPECT_TRUE(span10.data_equal(span9)); + EXPECT_TRUE(span10.data_equal(array)); + EXPECT_TRUE(span10.data_equal(constArray)); + EXPECT_TRUE(span9.data_equal(span9)); + EXPECT_TRUE(span9.data_equal(span10)); + EXPECT_TRUE(span9.data_equal(array)); + EXPECT_TRUE(span9.data_equal(constArray)); // The following should not compile // Span error1 = std::array(); // Span would point into a temporary value } - -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { - NL_TEST_DEF_FN(TestByteSpan), - NL_TEST_DEF_FN(TestMutableByteSpan), - NL_TEST_DEF_FN(TestFixedByteSpan), - NL_TEST_DEF_FN(TestSpanOfPointers), - NL_TEST_DEF_FN(TestSubSpan), - NL_TEST_DEF_FN(TestFromZclString), - NL_TEST_DEF_FN(TestFromCharString), - NL_TEST_DEF_FN(TestLiteral), - NL_TEST_DEF_FN(TestConversionConstructors), - NL_TEST_SENTINEL(), -}; - -int TestSpan() -{ - nlTestSuite theSuite = { "CHIP Span tests", &sTests[0], nullptr, nullptr }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestSpan) diff --git a/src/lib/support/tests/TestStaticSupportSmartPtr.cpp b/src/lib/support/tests/TestStaticSupportSmartPtr.cpp index 809c2e4887969c..b51afc15729ad8 100644 --- a/src/lib/support/tests/TestStaticSupportSmartPtr.cpp +++ b/src/lib/support/tests/TestStaticSupportSmartPtr.cpp @@ -15,14 +15,13 @@ * 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; namespace { @@ -50,42 +49,42 @@ TestClass * GlobalInstanceProvider::InstancePointer() namespace { -void TestCheckedGlobalInstanceReference(nlTestSuite * inSuite, void * inContext) +TEST(TestStaticSupportSmartPtr, TestCheckedGlobalInstanceReference) { CheckedGlobalInstanceReference ref(&gTestClass); // We expect that sizes of global references is minimal - NL_TEST_ASSERT(inSuite, sizeof(ref) == 1); + EXPECT_EQ(sizeof(ref), 1u); - NL_TEST_ASSERT(inSuite, ref->num == 123); - NL_TEST_ASSERT(inSuite, strcmp(ref->str, "abc") == 0); + EXPECT_EQ(ref->num, 123); + EXPECT_STREQ(ref->str, "abc"); { ScopedChange change1(gTestClass.num, 100); ScopedChange change2(ref->str, "xyz"); - NL_TEST_ASSERT(inSuite, ref->num == 100); - NL_TEST_ASSERT(inSuite, strcmp(gTestClass.str, "xyz") == 0); + EXPECT_EQ(ref->num, 100); + EXPECT_STREQ(gTestClass.str, "xyz"); } CheckedGlobalInstanceReference ref2(&gTestClass); - NL_TEST_ASSERT(inSuite, ref->num == ref2->num); - NL_TEST_ASSERT(inSuite, strcmp(ref->str, ref2->str) == 0); + EXPECT_EQ(ref->num, ref2->num); + EXPECT_STREQ(ref->str, ref2->str); { ScopedChange change1(gTestClass.num, 321); ScopedChange change2(ref->str, "test"); - NL_TEST_ASSERT(inSuite, ref->num == ref2->num); - NL_TEST_ASSERT(inSuite, strcmp(ref->str, ref2->str) == 0); + EXPECT_EQ(ref->num, ref2->num); + EXPECT_STREQ(ref->str, ref2->str); - NL_TEST_ASSERT(inSuite, ref2->num == 321); - NL_TEST_ASSERT(inSuite, strcmp(ref2->str, "test") == 0); + EXPECT_EQ(ref2->num, 321); + EXPECT_STREQ(ref2->str, "test"); } } -void TestSimpleInstanceReference(nlTestSuite * inSuite, void * inContext) +TEST(TestStaticSupportSmartPtr, TestSimpleInstanceReference) { TestClass a("abc", 123); TestClass b("xyz", 100); @@ -94,34 +93,16 @@ void TestSimpleInstanceReference(nlTestSuite * inSuite, void * inContext) SimpleInstanceReference ref_b(&b); // overhead of simple references should be a simple pointer - NL_TEST_ASSERT(inSuite, sizeof(ref_a) <= sizeof(void *)); + EXPECT_LE(sizeof(ref_a), sizeof(void *)); - NL_TEST_ASSERT(inSuite, ref_a->num == 123); - NL_TEST_ASSERT(inSuite, ref_b->num == 100); + EXPECT_EQ(ref_a->num, 123); + EXPECT_EQ(ref_b->num, 100); ref_a->num = 99; b.num = 30; - NL_TEST_ASSERT(inSuite, a.num == 99); - NL_TEST_ASSERT(inSuite, ref_b->num == 30); + EXPECT_EQ(a.num, 99); + EXPECT_EQ(ref_b->num, 30); } -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -const nlTest sTests[] = { - NL_TEST_DEF_FN(TestCheckedGlobalInstanceReference), - NL_TEST_DEF_FN(TestSimpleInstanceReference), - NL_TEST_SENTINEL(), -}; - } // namespace - -int TestStaticSupportSmartPtr() -{ - nlTestSuite theSuite = { "CHIP Static support smart pointers", &sTests[0], nullptr, nullptr }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestStaticSupportSmartPtr) diff --git a/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp b/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp index 05ef383f248b14..a53f43c0febaaa 100644 --- a/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp +++ b/src/lib/support/tests/TestTestPersistentStorageDelegate.cpp @@ -18,14 +18,13 @@ #include #include -#include #include #include #include #include -#include +#include using namespace chip; @@ -50,7 +49,7 @@ bool SetMatches(const std::set & set, const std::array expectedContents return true; } -void TestBasicApi(nlTestSuite * inSuite, void * inContext) +TEST(TestTestPersistentStorageDelegate, TestBasicApi) { TestPersistentStorageDelegate storage; @@ -63,49 +62,49 @@ void TestBasicApi(nlTestSuite * inSuite, void * inContext) memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("roboto", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, size == actualSizeOfBuf); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(size, actualSizeOfBuf); - NL_TEST_ASSERT(inSuite, storage.GetNumKeys() == 0); + EXPECT_EQ(storage.GetNumKeys(), 0u); err = storage.SyncDeleteKeyValue("roboto"); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); // Add basic key, read it back, erase it static const char kStringValue1[] = "abcd"; err = storage.SyncSetKeyValue("roboto", kStringValue1, static_cast(strlen(kStringValue1))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("roboto", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == strlen(kStringValue1)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kStringValue1, strlen(kStringValue1))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, strlen(kStringValue1)); + EXPECT_EQ(0, memcmp(&buf[0], kStringValue1, strlen(kStringValue1))); err = storage.SyncDeleteKeyValue("roboto"); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("roboto", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, size == actualSizeOfBuf); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(size, actualSizeOfBuf); // Validate adding 2 different keys static const char kStringValue2[] = "0123abcd"; static const char kStringValue3[] = "cdef89"; err = storage.SyncSetKeyValue("key2", kStringValue2, static_cast(strlen(kStringValue2))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = storage.SyncSetKeyValue("key3", kStringValue3, static_cast(strlen(kStringValue3))); - NL_TEST_ASSERT(inSuite, storage.SyncDoesKeyExist("key3")); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_TRUE(storage.SyncDoesKeyExist("key3")); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, storage.GetNumKeys() == 2); + EXPECT_EQ(storage.GetNumKeys(), 2u); auto keys = storage.GetKeys(); std::array kExpectedKeys{ "key2", "key3" }; - NL_TEST_ASSERT(inSuite, SetMatches(keys, kExpectedKeys) == true); + EXPECT_EQ(SetMatches(keys, kExpectedKeys), true); // Read them back @@ -115,164 +114,164 @@ void TestBasicApi(nlTestSuite * inSuite, void * inContext) memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("key2", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == strlen(kStringValue2)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kStringValue2, strlen(kStringValue2))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, strlen(kStringValue2)); + EXPECT_EQ(0, memcmp(&buf[0], kStringValue2, strlen(kStringValue2))); // Make sure that there was no buffer overflow during SyncGetKeyValue - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); + EXPECT_EQ(0, memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("key3", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == strlen(kStringValue3)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kStringValue3, strlen(kStringValue3))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, strlen(kStringValue3)); + EXPECT_EQ(0, memcmp(&buf[0], kStringValue3, strlen(kStringValue3))); // Make sure that there was no buffer overflow during SyncGetKeyValue - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); + EXPECT_EQ(0, memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); // Read providing too small a buffer. Data read up to `size` and nothing more. memset(&buf[0], 0, sizeof(buf)); size = static_cast(strlen(kStringValue2) - 1); uint16_t sizeBeforeGetKeyValueCall = size; err = storage.SyncGetKeyValue("key2", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, size == sizeBeforeGetKeyValueCall); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kStringValue2, size)); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(size, sizeBeforeGetKeyValueCall); + EXPECT_EQ(0, memcmp(&buf[0], kStringValue2, size)); // Make sure that there was no buffer overflow during SyncGetKeyValue - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); + EXPECT_EQ(0, memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); // Read in too small a buffer, which is nullptr and size == 0: check CHIP_ERROR_BUFFER_TOO_SMALL is given. memset(&buf[0], 0, sizeof(buf)); size = 0; sizeBeforeGetKeyValueCall = size; err = storage.SyncGetKeyValue("key2", nullptr, size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); - NL_TEST_ASSERT(inSuite, size != strlen(kStringValue2)); - NL_TEST_ASSERT(inSuite, size == sizeBeforeGetKeyValueCall); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_NE(size, strlen(kStringValue2)); + EXPECT_EQ(size, sizeBeforeGetKeyValueCall); // Just making sure that implementation doesn't hold onto reference of previous destination buffer when // nullptr is provided. - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); + EXPECT_EQ(0, memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); // Read in too small a buffer, which is nullptr and size != 0: error size = static_cast(strlen(kStringValue2) - 1); sizeBeforeGetKeyValueCall = size; err = storage.SyncGetKeyValue("key2", nullptr, size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, size == sizeBeforeGetKeyValueCall); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(size, sizeBeforeGetKeyValueCall); // Just making sure that implementation doesn't hold onto reference of previous destination buffer when // nullptr is provided. - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); + EXPECT_EQ(0, memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); // When key not found, size is not touched. size = actualSizeOfBuf; err = storage.SyncGetKeyValue("keyDOES_NOT_EXIST", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, actualSizeOfBuf == size); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(actualSizeOfBuf, size); + EXPECT_EQ(0, memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); size = 0; err = storage.SyncGetKeyValue("keyDOES_NOT_EXIST", nullptr, size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, 0 == size); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(0, size); + EXPECT_EQ(0, memcmp(&buf[0], &all_zeroes[0], sizeof(buf))); // Even when key not found, cannot pass nullptr with size != 0. size = actualSizeOfBuf; err = storage.SyncGetKeyValue("keyDOES_NOT_EXIST", nullptr, size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, actualSizeOfBuf == size); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], &all_zeroes[0], size)); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(actualSizeOfBuf, size); + EXPECT_EQ(0, memcmp(&buf[0], &all_zeroes[0], size)); // Attempt an empty key write with either nullptr or zero size works err = storage.SyncSetKeyValue("key2", kStringValue2, 0); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, storage.SyncDoesKeyExist("key2")); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(storage.SyncDoesKeyExist("key2")); size = 0; err = storage.SyncGetKeyValue("key2", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == 0); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, 0u); size = 0; err = storage.SyncGetKeyValue("key2", nullptr, size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == 0); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, 0u); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("key2", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == 0); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, 0u); err = storage.SyncSetKeyValue("key2", nullptr, 0); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, storage.SyncDoesKeyExist("key2")); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_TRUE(storage.SyncDoesKeyExist("key2")); size = 0; err = storage.SyncGetKeyValue("key2", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == 0); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, 0u); // Failure to set key if buffer is nullptr and size != 0 size = 10; err = storage.SyncSetKeyValue("key4", nullptr, size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, !storage.SyncDoesKeyExist("key4")); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_FALSE(storage.SyncDoesKeyExist("key4")); // Can delete empty key err = storage.SyncDeleteKeyValue("key2"); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !storage.SyncDoesKeyExist("key2")); + EXPECT_FALSE(storage.SyncDoesKeyExist("key2")); size = actualSizeOfBuf; err = storage.SyncGetKeyValue("key2", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, size == actualSizeOfBuf); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], &all_zeroes[0], size)); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(size, actualSizeOfBuf); + EXPECT_EQ(0, memcmp(&buf[0], &all_zeroes[0], size)); // Using key and value with base64 symbols static const char kBase64SymbolsKey[] = "key+/="; static const char kBase64SymbolValues[] = "value+/="; err = storage.SyncSetKeyValue(kBase64SymbolsKey, kBase64SymbolValues, static_cast(strlen(kBase64SymbolValues))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue(kBase64SymbolsKey, &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == strlen(kBase64SymbolValues)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kBase64SymbolValues, strlen(kBase64SymbolValues))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, strlen(kBase64SymbolValues)); + EXPECT_EQ(0, memcmp(&buf[0], kBase64SymbolValues, strlen(kBase64SymbolValues))); // Make sure that there was no buffer overflow during SyncGetKeyValue - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); + EXPECT_EQ(0, memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); err = storage.SyncDeleteKeyValue(kBase64SymbolsKey); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !storage.SyncDoesKeyExist(kBase64SymbolsKey)); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_FALSE(storage.SyncDoesKeyExist(kBase64SymbolsKey)); // Try using key that is a size that equals PersistentStorageDelegate::kKeyLengthMax char longKeyString[PersistentStorageDelegate::kKeyLengthMax + 1]; memset(&longKeyString, 'X', PersistentStorageDelegate::kKeyLengthMax); longKeyString[sizeof(longKeyString) - 1] = '\0'; // strlen() is not compile time so we just have this runtime assert that should aways pass as a sanity check. - NL_TEST_ASSERT(inSuite, strlen(longKeyString) == PersistentStorageDelegate::kKeyLengthMax); + EXPECT_EQ(strlen(longKeyString), PersistentStorageDelegate::kKeyLengthMax); err = storage.SyncSetKeyValue(longKeyString, kStringValue2, static_cast(strlen(kStringValue2))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); memset(&buf[0], 0, sizeof(buf)); size = actualSizeOfBuf; err = storage.SyncGetKeyValue(longKeyString, &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == strlen(kStringValue2)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kStringValue2, strlen(kStringValue2))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, strlen(kStringValue2)); + EXPECT_EQ(0, memcmp(&buf[0], kStringValue2, strlen(kStringValue2))); // Make sure that there was no buffer overflow during SyncGetKeyValue - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); + EXPECT_EQ(0, memcmp(&buf[size], &all_zeroes[0], sizeof(buf) - size)); - NL_TEST_ASSERT(inSuite, storage.SyncDoesKeyExist(longKeyString)); + EXPECT_TRUE(storage.SyncDoesKeyExist(longKeyString)); err = storage.SyncDeleteKeyValue(longKeyString); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !storage.SyncDoesKeyExist(longKeyString)); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_FALSE(storage.SyncDoesKeyExist(longKeyString)); constexpr size_t kMaxCHIPCertLength = 400; // From credentials/CHIPCert.h and spec uint8_t largeBuffer[kMaxCHIPCertLength]; @@ -281,26 +280,26 @@ void TestBasicApi(nlTestSuite * inSuite, void * inContext) memcpy(largeBufferForCheck, largeBuffer, sizeof(largeBuffer)); err = storage.SyncSetKeyValue(longKeyString, largeBuffer, static_cast(sizeof(largeBuffer))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); memset(&largeBuffer, 0, sizeof(largeBuffer)); size = static_cast(sizeof(largeBuffer)); err = storage.SyncGetKeyValue(longKeyString, &largeBuffer[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == static_cast(sizeof(largeBuffer))); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&largeBuffer, largeBufferForCheck, sizeof(largeBuffer))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, static_cast(sizeof(largeBuffer))); + EXPECT_EQ(0, memcmp(&largeBuffer, largeBufferForCheck, sizeof(largeBuffer))); err = storage.SyncDeleteKeyValue(longKeyString); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Cleaning up err = storage.SyncDeleteKeyValue("key3"); - NL_TEST_ASSERT(inSuite, storage.GetNumKeys() == 0); + EXPECT_EQ(storage.GetNumKeys(), 0u); } // ClearStorage is not a PersistentStorageDelegate base class method, it only // appears in the TestPersistentStorageDelegate. -void TestClearStorage(nlTestSuite * inSuite, void * inContext) +TEST(TestTestPersistentStorageDelegate, TestClearStorage) { TestPersistentStorageDelegate storage; @@ -308,51 +307,37 @@ void TestClearStorage(nlTestSuite * inSuite, void * inContext) uint16_t size = sizeof(buf); // Key not there - NL_TEST_ASSERT(inSuite, storage.GetNumKeys() == 0); + EXPECT_EQ(storage.GetNumKeys(), 0u); CHIP_ERROR err; memset(&buf[0], 0, sizeof(buf)); size = sizeof(buf); err = storage.SyncGetKeyValue("roboto", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, size == sizeof(buf)); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(size, sizeof(buf)); // Add basic key, read it back static const char kStringValue1[] = "abcd"; err = storage.SyncSetKeyValue("roboto", kStringValue1, static_cast(strlen(kStringValue1))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, storage.GetNumKeys() == 1); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(storage.GetNumKeys(), 1u); memset(&buf[0], 0, sizeof(buf)); size = sizeof(buf); err = storage.SyncGetKeyValue("roboto", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, size == strlen(kStringValue1)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(&buf[0], kStringValue1, strlen(kStringValue1))); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(size, strlen(kStringValue1)); + EXPECT_EQ(0, memcmp(&buf[0], kStringValue1, strlen(kStringValue1))); // Clear storage, make sure it's gone storage.ClearStorage(); - NL_TEST_ASSERT(inSuite, storage.GetNumKeys() == 0); + EXPECT_EQ(storage.GetNumKeys(), 0u); memset(&buf[0], 0, sizeof(buf)); size = sizeof(buf); err = storage.SyncGetKeyValue("roboto", &buf[0], size); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); - NL_TEST_ASSERT(inSuite, size == sizeof(buf)); + EXPECT_EQ(err, CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND); + EXPECT_EQ(size, sizeof(buf)); } -const nlTest sTests[] = { NL_TEST_DEF("Test basic API", TestBasicApi), - NL_TEST_DEF("Test ClearStorage method of TestPersistentStorageDelegate", TestClearStorage), - NL_TEST_SENTINEL() }; - } // namespace - -int TestTestPersistentStorageDelegate() -{ - nlTestSuite theSuite = { "TestPersistentStorageDelegate tests", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestTestPersistentStorageDelegate); diff --git a/src/lib/support/tests/TestUtf8.cpp b/src/lib/support/tests/TestUtf8.cpp index a18ed74f65c8ae..dd078804c1ed5d 100644 --- a/src/lib/support/tests/TestUtf8.cpp +++ b/src/lib/support/tests/TestUtf8.cpp @@ -17,12 +17,10 @@ * limitations under the License. */ -#include - -#include #include -#include +#include +#include namespace { @@ -33,7 +31,7 @@ using namespace chip; { \ uint8_t _buff[] = { __VA_ARGS__ }; \ CharSpan _span(reinterpret_cast(_buff), sizeof(_buff)); \ - NL_TEST_ASSERT(inSuite, Utf8::IsValid(_span)); \ + EXPECT_TRUE(Utf8::IsValid(_span)); \ } while (0) #define TEST_INVALID_BYTES(...) \ @@ -41,42 +39,42 @@ using namespace chip; { \ uint8_t _buff[] = { __VA_ARGS__ }; \ CharSpan _span(reinterpret_cast(_buff), sizeof(_buff)); \ - NL_TEST_ASSERT(inSuite, !Utf8::IsValid(_span)); \ + EXPECT_FALSE(Utf8::IsValid(_span)); \ } while (0) -void TestValidStrings(nlTestSuite * inSuite, void * inContext) +TEST(TestUtf8, TestValidStrings) { - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan())); // empty span ok + EXPECT_TRUE(Utf8::IsValid(CharSpan())); // empty span ok - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString(""))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("abc"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString(""))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("abc"))); // Various tests from https://www.w3.org/2001/06/utf-8-wrong/UTF-8-test.html // Generic UTF8 - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("κόσμε"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("κόσμε"))); // First possible sequence of a certain length - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("€"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("ࠀ"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("𐀀"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("�����"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("������"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("€"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("ࠀ"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("𐀀"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("�����"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("������"))); // Last possible sequence of a certain length - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString(""))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("߿"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("￿"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("����"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("�����"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("������"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString(""))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("߿"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("￿"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("����"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("�����"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("������"))); // Other boundary conditions - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("퟿"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString(""))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("�"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("􏿿"))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan::fromCharString("����"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("퟿"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString(""))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("�"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("􏿿"))); + EXPECT_TRUE(Utf8::IsValid(CharSpan::fromCharString("����"))); // NOTE: UTF8 allows embeded NULLs // even though strings like that are probably not ideal for handling @@ -84,17 +82,17 @@ void TestValidStrings(nlTestSuite * inSuite, void * inContext) // completely if the spec is updated as such { char zero[16] = { 0 }; - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(zero, 0))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(zero, 1))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(zero, 2))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(zero, 3))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(zero, 4))); - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(zero, 16))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(zero, 0))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(zero, 1))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(zero, 2))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(zero, 3))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(zero, 4))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(zero, 16))); } { char insideZero[] = "test\0zero"; - NL_TEST_ASSERT(inSuite, Utf8::IsValid(CharSpan(insideZero))); + EXPECT_TRUE(Utf8::IsValid(CharSpan(insideZero))); } // Test around forbidden 0xD800..0xDFFF UTF-16 surrogate pairs. @@ -102,7 +100,7 @@ void TestValidStrings(nlTestSuite * inSuite, void * inContext) TEST_VALID_BYTES(0b1110'1110, 0b10'000000, 0b10'000000); } -void TestInvalidStrings(nlTestSuite * inSuite, void * inContext) +TEST(TestUtf8, TestInvalidStrings) { // Overly long sequences TEST_INVALID_BYTES(0xc0, 0b10'111111); @@ -169,22 +167,3 @@ void TestInvalidStrings(nlTestSuite * inSuite, void * inContext) } } // namespace - -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestValidStrings", TestValidStrings), - NL_TEST_DEF("TestInvalidStrings", TestInvalidStrings), - NL_TEST_SENTINEL() -}; -// clang-format on - -int TestUtf8() -{ - nlTestSuite theSuite = { "UTF8 validator tests", &sTests[0], nullptr, nullptr }; - - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestUtf8); From be15c9b92a974dce45890a83ce24805443a7a8a5 Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Thu, 25 Apr 2024 13:49:58 +0200 Subject: [PATCH 03/40] Interaction model to PW (#33160) --- .../interaction_model/tests/BUILD.gn | 5 +- .../tests/TestStatusCode.cpp | 104 +++++++----------- 2 files changed, 40 insertions(+), 69 deletions(-) diff --git a/src/protocols/interaction_model/tests/BUILD.gn b/src/protocols/interaction_model/tests/BUILD.gn index 0abd3a7fa595a9..875146e3958ec6 100644 --- a/src/protocols/interaction_model/tests/BUILD.gn +++ b/src/protocols/interaction_model/tests/BUILD.gn @@ -14,11 +14,10 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") -chip_test_suite_using_nltest("tests") { +chip_test_suite("tests") { output_name = "libInteractionModelTests" test_sources = [ "TestStatusCode.cpp" ] @@ -26,9 +25,7 @@ chip_test_suite_using_nltest("tests") { public_deps = [ "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", - "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/protocols/interaction_model", - "${nlunit_test_root}:nlunit-test", ] cflags = [ "-Wconversion" ] diff --git a/src/protocols/interaction_model/tests/TestStatusCode.cpp b/src/protocols/interaction_model/tests/TestStatusCode.cpp index 4b89e0f4b1acfb..2be78c4f3ac418 100644 --- a/src/protocols/interaction_model/tests/TestStatusCode.cpp +++ b/src/protocols/interaction_model/tests/TestStatusCode.cpp @@ -18,54 +18,51 @@ #include +#include #include -#include -#include #include -#include - using namespace ::chip; using namespace ::chip::Protocols::InteractionModel; namespace { -void TestStatusBasicValues(nlTestSuite * inSuite, void * inContext) +TEST(TestStatusCode, TestStatusBasicValues) { - NL_TEST_ASSERT_EQUALS(inSuite, static_cast(Status::Success), 0); - NL_TEST_ASSERT_EQUALS(inSuite, static_cast(Status::Failure), 1); - NL_TEST_ASSERT_EQUALS(inSuite, static_cast(Status::UnsupportedEndpoint), 0x7f); - NL_TEST_ASSERT_EQUALS(inSuite, static_cast(Status::InvalidInState), 0xcb); + EXPECT_EQ(static_cast(Status::Success), 0); + EXPECT_EQ(static_cast(Status::Failure), 1); + EXPECT_EQ(static_cast(Status::UnsupportedEndpoint), 0x7f); + EXPECT_EQ(static_cast(Status::InvalidInState), 0xcb); } -void TestClusterStatusCode(nlTestSuite * inSuite, void * inContext) +TEST(TestStatusCode, TestClusterStatusCode) { // Basic usage as a Status. { ClusterStatusCode status_code_success{ Status::Success }; - NL_TEST_ASSERT_EQUALS(inSuite, status_code_success, Status::Success); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_success.GetStatus(), Status::Success); - NL_TEST_ASSERT(inSuite, !status_code_success.HasClusterSpecificCode()); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_success.GetClusterSpecificCode(), chip::NullOptional); - NL_TEST_ASSERT(inSuite, status_code_success.IsSuccess()); + EXPECT_EQ(status_code_success, Status::Success); + EXPECT_EQ(status_code_success.GetStatus(), Status::Success); + EXPECT_FALSE(status_code_success.HasClusterSpecificCode()); + EXPECT_EQ(status_code_success.GetClusterSpecificCode(), chip::NullOptional); + EXPECT_TRUE(status_code_success.IsSuccess()); ClusterStatusCode status_code_failure{ Status::Failure }; - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure, Status::Failure); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure.GetStatus(), Status::Failure); - NL_TEST_ASSERT(inSuite, !status_code_failure.HasClusterSpecificCode()); - NL_TEST_ASSERT(inSuite, !status_code_failure.IsSuccess()); + EXPECT_EQ(status_code_failure, Status::Failure); + EXPECT_EQ(status_code_failure.GetStatus(), Status::Failure); + EXPECT_FALSE(status_code_failure.HasClusterSpecificCode()); + EXPECT_FALSE(status_code_failure.IsSuccess()); ClusterStatusCode status_code_unsupported_ep{ Status::UnsupportedEndpoint }; - NL_TEST_ASSERT_EQUALS(inSuite, status_code_unsupported_ep, Status::UnsupportedEndpoint); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_unsupported_ep.GetStatus(), Status::UnsupportedEndpoint); - NL_TEST_ASSERT(inSuite, !status_code_unsupported_ep.HasClusterSpecificCode()); - NL_TEST_ASSERT(inSuite, !status_code_unsupported_ep.IsSuccess()); + EXPECT_EQ(status_code_unsupported_ep, Status::UnsupportedEndpoint); + EXPECT_EQ(status_code_unsupported_ep.GetStatus(), Status::UnsupportedEndpoint); + EXPECT_FALSE(status_code_unsupported_ep.HasClusterSpecificCode()); + EXPECT_FALSE(status_code_unsupported_ep.IsSuccess()); ClusterStatusCode status_code_invalid_in_state{ Status::InvalidInState }; - NL_TEST_ASSERT_EQUALS(inSuite, status_code_invalid_in_state, Status::InvalidInState); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_invalid_in_state.GetStatus(), Status::InvalidInState); - NL_TEST_ASSERT(inSuite, !status_code_invalid_in_state.HasClusterSpecificCode()); - NL_TEST_ASSERT(inSuite, !status_code_invalid_in_state.IsSuccess()); + EXPECT_EQ(status_code_invalid_in_state, Status::InvalidInState); + EXPECT_EQ(status_code_invalid_in_state.GetStatus(), Status::InvalidInState); + EXPECT_FALSE(status_code_invalid_in_state.HasClusterSpecificCode()); + EXPECT_FALSE(status_code_invalid_in_state.IsSuccess()); } enum RobotoClusterStatus : uint8_t @@ -77,18 +74,16 @@ void TestClusterStatusCode(nlTestSuite * inSuite, void * inContext) // Cluster-specific usage. { ClusterStatusCode status_code_success = ClusterStatusCode::ClusterSpecificSuccess(RobotoClusterStatus::kSauceSuccess); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_success, Status::Success); - NL_TEST_ASSERT(inSuite, status_code_success.HasClusterSpecificCode()); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_success.GetClusterSpecificCode(), - static_cast(RobotoClusterStatus::kSauceSuccess)); - NL_TEST_ASSERT(inSuite, status_code_success.IsSuccess()); + EXPECT_EQ(status_code_success, Status::Success); + EXPECT_TRUE(status_code_success.HasClusterSpecificCode()); + EXPECT_EQ(status_code_success.GetClusterSpecificCode(), static_cast(RobotoClusterStatus::kSauceSuccess)); + EXPECT_TRUE(status_code_success.IsSuccess()); ClusterStatusCode status_code_failure = ClusterStatusCode::ClusterSpecificFailure(RobotoClusterStatus::kSandwichError); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure, Status::Failure); - NL_TEST_ASSERT(inSuite, status_code_failure.HasClusterSpecificCode()); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure.GetClusterSpecificCode(), - static_cast(RobotoClusterStatus::kSandwichError)); - NL_TEST_ASSERT(inSuite, !status_code_failure.IsSuccess()); + EXPECT_EQ(status_code_failure, Status::Failure); + EXPECT_TRUE(status_code_failure.HasClusterSpecificCode()); + EXPECT_EQ(status_code_failure.GetClusterSpecificCode(), static_cast(RobotoClusterStatus::kSandwichError)); + EXPECT_FALSE(status_code_failure.IsSuccess()); } // Copy/Assignment @@ -96,40 +91,19 @@ void TestClusterStatusCode(nlTestSuite * inSuite, void * inContext) ClusterStatusCode status_code_failure1 = ClusterStatusCode::ClusterSpecificFailure(RobotoClusterStatus::kSandwichError); ClusterStatusCode status_code_failure2(status_code_failure1); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure1, status_code_failure2); - NL_TEST_ASSERT(inSuite, status_code_failure1.HasClusterSpecificCode()); - NL_TEST_ASSERT(inSuite, status_code_failure2.HasClusterSpecificCode()); + EXPECT_EQ(status_code_failure1, status_code_failure2); + EXPECT_TRUE(status_code_failure1.HasClusterSpecificCode()); + EXPECT_TRUE(status_code_failure2.HasClusterSpecificCode()); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure1.GetClusterSpecificCode(), - static_cast(RobotoClusterStatus::kSandwichError)); - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure2.GetClusterSpecificCode(), - static_cast(RobotoClusterStatus::kSandwichError)); + EXPECT_EQ(status_code_failure1.GetClusterSpecificCode(), static_cast(RobotoClusterStatus::kSandwichError)); + EXPECT_EQ(status_code_failure2.GetClusterSpecificCode(), static_cast(RobotoClusterStatus::kSandwichError)); ClusterStatusCode status_code_failure3{ Status::InvalidCommand }; - NL_TEST_ASSERT(inSuite, status_code_failure2 != status_code_failure3); + EXPECT_NE(status_code_failure2, status_code_failure3); status_code_failure3 = status_code_failure2; - NL_TEST_ASSERT_EQUALS(inSuite, status_code_failure2, status_code_failure3); + EXPECT_EQ(status_code_failure2, status_code_failure3); } } -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestStatusBasicValues", TestStatusBasicValues), - NL_TEST_DEF("TestClusterStatusCode", TestClusterStatusCode), - NL_TEST_SENTINEL() -}; -// clang-format on - -nlTestSuite sSuite = { "Test IM Status Code abstractions", &sTests[0], nullptr, nullptr }; } // namespace - -int TestClusterStatusCode() -{ - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestClusterStatusCode) From b68f1b1f30ba6c75874eb965b2b9e47734df811c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Thu, 25 Apr 2024 14:08:03 +0200 Subject: [PATCH 04/40] [Inet] Fix setting for CLOEXEC flag at socket creation (#33164) * [Inet] Fix setting for SOCK_CLOEXEC The linux kernel allows to set the flag SOCK_CLOEXEC through the parameter type[1]. The implementation sets the flag through the parameter protocol and causes the call to socket()[2] to return -1 with EINVAL. This fixes the behaviour by OR-ing the flag SOCK_CLOEXEC to type instead of protocol. [1]: https://github.com/torvalds/linux/blob/v6.8/net/socket.c#L1655 [2]: https://man7.org/linux/man-pages/man2/socket.2.html * [Inet] Fix setting for O_CLOEXEC The macro O_CLOEXEC is a filedescriptor flag. The implemention sets the flag O_CLOEXEC as the parameter command given to function fcntl[1] and causes the call to fcntl to return -1 with EINVAL. The flag O_CLOEXEC intends to be set using the command F_SETFD. This fixes the behaviour by adding the missing command paramete F_SETFD before the optional argument O_CLOEXEC. [1]: https://man7.org/linux/man-pages/man2/fcntl.2.html --- src/inet/InetInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/inet/InetInterface.cpp b/src/inet/InetInterface.cpp index db10bdba3ed769..af89de8cb96822 100644 --- a/src/inet/InetInterface.cpp +++ b/src/inet/InetInterface.cpp @@ -500,12 +500,12 @@ int GetIOCTLSocket() { int s; #ifdef SOCK_CLOEXEC - s = socket(AF_INET, SOCK_STREAM, SOCK_CLOEXEC); + s = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0); if (s < 0) #endif { s = socket(AF_INET, SOCK_STREAM, 0); - fcntl(s, O_CLOEXEC); + fcntl(s, F_SETFD, O_CLOEXEC); } if (!__sync_bool_compare_and_swap(&sIOCTLSocket, -1, s)) From 8e27412a6de6a66388f2c0a66c17a4bd8e999810 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20Kr=C3=B3lik?= <66667989+Damian-Nordic@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:39:48 +0200 Subject: [PATCH 05/40] [nrfconnect] Optimize packet buffer size (#33137) Matter requires that regular Matter messages fit in IPv6 MTU of 1280 bytes so the default packet buffer size of 1583 bytes seems excessively large for some configurations. Especially that the buffers only hold the UDP payload in the case of non-LWIP transports. There are two exceptions to the above though: 1. Minimal mDNS uses the same packet buffer pool and mDNS message size is not limited to 1280 bytes, so shrinking the buffer size below MTU might have a negative impact on the mDNS behavior. 2. Matter allows definining so called large messages that can be bigger than 1280 bytes and sent over TCP, but that is not implemented yet and will likely require a different allocation mechanism. Signed-off-by: Damian Krolik --- src/platform/nrfconnect/SystemPlatformConfig.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/platform/nrfconnect/SystemPlatformConfig.h b/src/platform/nrfconnect/SystemPlatformConfig.h index ce0df4d5f69ff5..60d9c354d01ab1 100644 --- a/src/platform/nrfconnect/SystemPlatformConfig.h +++ b/src/platform/nrfconnect/SystemPlatformConfig.h @@ -51,4 +51,18 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 #endif +#ifndef CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX +#ifdef CONFIG_WIFI_NRF700X +// Minimal mDNS uses Matter packet buffers, so as long as minimal mDNS is used +// in Nordic's Wi-Fi solution, the packet buffers must be a bit bigger than what +// is required by Matter. +#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX CONFIG_NRF_WIFI_IFACE_MTU +#else +// Matter specification requires that Matter messages fit in IPV6 MTU of 1280B +// unless for large messages that can be sent over BTP or TCP. But those will +// likely require a separate buffer pool or employ chained buffers. +#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX 1280 +#endif // CONFIG_WIFI_NRF700X +#endif // CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX + // ========== Platform-specific Configuration Overrides ========= From c24edd38fe85cb3285fd6f5c361d2df12ae574e8 Mon Sep 17 00:00:00 2001 From: Florian Burtscher <97540177+bufl-blum@users.noreply.github.com> Date: Thu, 25 Apr 2024 14:40:39 +0200 Subject: [PATCH 06/40] added documentation to disable the BlueZ battery plugin (#33133) --- docs/guides/BUILDING.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/guides/BUILDING.md b/docs/guides/BUILDING.md index 3a7ecdd800924b..7cd660227ed165 100644 --- a/docs/guides/BUILDING.md +++ b/docs/guides/BUILDING.md @@ -135,13 +135,20 @@ Complete the following steps: 1. Reboot your Raspberry Pi after installing `pi-bluetooth`. -#### Enable experimental Bluetooth support in BlueZ +#### Enable experimental Bluetooth support and disable battery plugin in BlueZ The Matter application on Linux uses BlueZ to communicate with the Bluetooth controller. The BlueZ version that comes with Ubuntu 22.04 does not support all the features required by the Matter application by default. To enable these features, you need to enable experimental Bluetooth support in BlueZ. +Also disable the battery plugin from BlueZ, because iOS devices advertises a +battery service via BLE, which requires pairing if accessed. BlueZ includes a +battery plugin by default which tries to connect to the battery service. The +authentication fails, because in this case no BLE pairing has been done. If the +BlueZ battery plugin is not disabled, the BLE connection will be terminated +during the Matter commissioning process. + 1. Edit the `bluetooth.service` unit by running the following command: ```sh @@ -153,7 +160,7 @@ features, you need to enable experimental Bluetooth support in BlueZ. ```ini [Service] ExecStart= - ExecStart=/usr/lib/bluetooth/bluetoothd -E + ExecStart=/usr/lib/bluetooth/bluetoothd -E -P battery ``` 1. Restart the Bluetooth service by running the following command: From c4699cf63d68857653bf4b5af8c99eab4eec8096 Mon Sep 17 00:00:00 2001 From: achaulk-goog <107196446+achaulk-goog@users.noreply.github.com> Date: Thu, 25 Apr 2024 08:55:56 -0400 Subject: [PATCH 07/40] More IWYU across app/ & src/ (#32952) * More IWYU across app/ & src/ * Fix bad path --- src/app/util/util.h | 1 + src/lib/dnssd/platform/DnssdBrowseDelegate.h | 3 +++ src/lib/support/CommonIterator.h | 2 ++ src/protocols/bdx/DiagnosticLogs.h | 2 ++ src/transport/TracingStructs.h | 1 + 5 files changed, 9 insertions(+) diff --git a/src/app/util/util.h b/src/app/util/util.h index 6d84a7c0ee947f..d79b63612dd1b0 100644 --- a/src/app/util/util.h +++ b/src/app/util/util.h @@ -21,6 +21,7 @@ #include #include +#include void emberAfInit(); diff --git a/src/lib/dnssd/platform/DnssdBrowseDelegate.h b/src/lib/dnssd/platform/DnssdBrowseDelegate.h index 8d95a03b8d020e..bb0e6e51867a87 100644 --- a/src/lib/dnssd/platform/DnssdBrowseDelegate.h +++ b/src/lib/dnssd/platform/DnssdBrowseDelegate.h @@ -17,6 +17,9 @@ #pragma once +#include +#include + namespace chip { namespace Dnssd { diff --git a/src/lib/support/CommonIterator.h b/src/lib/support/CommonIterator.h index 689625aa292a94..fc799c33b233eb 100644 --- a/src/lib/support/CommonIterator.h +++ b/src/lib/support/CommonIterator.h @@ -22,6 +22,8 @@ #pragma once +#include + namespace chip { /** diff --git a/src/protocols/bdx/DiagnosticLogs.h b/src/protocols/bdx/DiagnosticLogs.h index 60ec2a33080c9c..a3bf0428186705 100644 --- a/src/protocols/bdx/DiagnosticLogs.h +++ b/src/protocols/bdx/DiagnosticLogs.h @@ -18,6 +18,8 @@ #pragma once +#include + namespace chip { namespace bdx { namespace DiagnosticLogs { diff --git a/src/transport/TracingStructs.h b/src/transport/TracingStructs.h index 5f57663e46dba2..987e2311950dc9 100644 --- a/src/transport/TracingStructs.h +++ b/src/transport/TracingStructs.h @@ -19,6 +19,7 @@ #include #include #include +#include namespace chip { namespace Tracing { From f4dbc23d6e7e259ac0bba6ce2558db44b15711bf Mon Sep 17 00:00:00 2001 From: Suhas Shankar <118879678+su-shanka@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:48:49 +0530 Subject: [PATCH 08/40] [Dnssd] Refactored DiscoveredNodeData definition and usage (#33025) * Refactored DiscoveredNodeData definition and usage * Restyled by whitespace * Restyled by clang-format * updates based on review feedback * Restyled by whitespace * Restyled by clang-format * fix for build failure * Updates as per feedback * Restyled by clang-format --------- Co-authored-by: Restyled.io --- .../commands/common/DeviceScanner.cpp | 7 +- .../commands/common/RemoteDataModelLogger.cpp | 6 +- .../commands/common/RemoteDataModelLogger.h | 2 +- .../DiscoverCommissionablesCommand.cpp | 2 +- .../discover/DiscoverCommissionablesCommand.h | 2 +- .../discover/DiscoverCommissionersCommand.cpp | 2 +- .../commands/pairing/PairingCommand.cpp | 6 +- .../commands/pairing/PairingCommand.h | 2 +- .../linux/ControllerShellCommands.cpp | 5 +- .../app/src/main/jni/cpp/ConversionUtils.cpp | 55 ++- .../app/src/main/jni/cpp/ConversionUtils.h | 2 +- .../app/src/main/jni/cpp/TvCastingApp-JNI.cpp | 2 +- .../CastingServerBridge.mm | 4 +- .../CommissionerDiscoveryDelegateImpl.h | 4 +- .../MatterTvCastingBridge/ConversionUtils.hpp | 4 +- .../MatterTvCastingBridge/ConversionUtils.mm | 70 +-- .../tv-casting-app/linux/CastingUtils.cpp | 8 +- examples/tv-casting-app/linux/CastingUtils.h | 2 +- .../core/CastingPlayerDiscovery.cpp | 27 +- .../core/CastingPlayerDiscovery.h | 2 +- .../tv-casting-common/include/CastingServer.h | 4 +- .../include/TargetVideoPlayerInfo.h | 2 +- .../tv-casting-common/src/CastingServer.cpp | 32 +- .../tv-casting-common/src/ConversionUtils.cpp | 21 +- .../src/TargetVideoPlayerInfo.cpp | 6 +- .../AbstractDnssdDiscoveryController.cpp | 21 +- .../AbstractDnssdDiscoveryController.h | 4 +- .../CHIPCommissionableNodeController.cpp | 2 +- .../CHIPCommissionableNodeController.h | 4 +- src/controller/CHIPDeviceController.cpp | 2 +- src/controller/CHIPDeviceController.h | 4 +- src/controller/DeviceDiscoveryDelegate.h | 2 +- src/controller/SetUpCodePairer.cpp | 21 +- .../java/CHIPDeviceController-JNI.cpp | 28 +- ...issionableNodeController-ScriptBinding.cpp | 48 +- .../python/ChipDeviceController-Discovery.cpp | 105 +++-- ...r-ScriptPairingDeviceDiscoveryDelegate.cpp | 13 +- ...ler-ScriptPairingDeviceDiscoveryDelegate.h | 2 +- .../TestCommissionableNodeController.cpp | 75 ++-- .../CHIP/MTRCommissionableBrowser.mm | 9 +- src/lib/dnssd/ActiveResolveAttempts.h | 13 +- src/lib/dnssd/Discovery_ImplPlatform.cpp | 24 +- src/lib/dnssd/IncrementalResolve.cpp | 15 +- src/lib/dnssd/IncrementalResolve.h | 4 +- src/lib/dnssd/Resolver_ImplMinimalMdns.cpp | 2 - src/lib/dnssd/TxtFields.cpp | 2 +- src/lib/dnssd/TxtFields.h | 2 +- src/lib/dnssd/Types.h | 34 +- .../dnssd/tests/TestActiveResolveAttempts.cpp | 6 +- .../dnssd/tests/TestIncrementalResolve.cpp | 31 +- src/lib/dnssd/tests/TestTxtFields.cpp | 423 +++++++++++++++--- src/lib/shell/commands/Dns.cpp | 55 +-- .../UserDirectedCommissioningServer.cpp | 52 +-- .../tests/TestUdcMessages.cpp | 42 +- 54 files changed, 822 insertions(+), 502 deletions(-) diff --git a/examples/chip-tool/commands/common/DeviceScanner.cpp b/examples/chip-tool/commands/common/DeviceScanner.cpp index 9d3dbca98f8db9..548e461f96ca8e 100644 --- a/examples/chip-tool/commands/common/DeviceScanner.cpp +++ b/examples/chip-tool/commands/common/DeviceScanner.cpp @@ -55,7 +55,8 @@ CHIP_ERROR DeviceScanner::Stop() void DeviceScanner::OnNodeDiscovered(const DiscoveredNodeData & nodeData) { - auto & commissionData = nodeData.nodeData; + VerifyOrReturn(nodeData.Is()); + auto & commissionData = nodeData.Get(); auto discriminator = commissionData.longDiscriminator; auto vendorId = static_cast(commissionData.vendorId); @@ -64,7 +65,7 @@ void DeviceScanner::OnNodeDiscovered(const DiscoveredNodeData & nodeData) ChipLogProgress(chipTool, "OnNodeDiscovered (MDNS): discriminator: %u, vendorId: %u, productId: %u", discriminator, vendorId, productId); - auto & resolutionData = nodeData.resolutionData; + const CommonResolutionData & resolutionData = commissionData; auto & instanceData = mDiscoveredResults[commissionData.instanceName]; auto & interfaceData = instanceData[resolutionData.interfaceId.GetPlatformInterface()]; @@ -76,7 +77,7 @@ void DeviceScanner::OnNodeDiscovered(const DiscoveredNodeData & nodeData) interfaceData.push_back(result); } - nodeData.LogDetail(); + commissionData.LogDetail(); } void DeviceScanner::OnBrowseAdd(chip::Dnssd::DnssdService service) diff --git a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp index 9e3026262db97d..9a996051957ccf 100644 --- a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp +++ b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp @@ -204,12 +204,12 @@ CHIP_ERROR LogIssueNOCChain(const char * noc, const char * icac, const char * rc return gDelegate->LogJSON(valueStr.c_str()); } -CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::DiscoveredNodeData & nodeData) +CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::CommissionNodeData & nodeData) { VerifyOrReturnError(gDelegate != nullptr, CHIP_NO_ERROR); - auto & resolutionData = nodeData.resolutionData; - auto & commissionData = nodeData.nodeData; + auto & commissionData = nodeData; + auto & resolutionData = commissionData; if (!chip::CanCastTo(resolutionData.numIPs)) { diff --git a/examples/chip-tool/commands/common/RemoteDataModelLogger.h b/examples/chip-tool/commands/common/RemoteDataModelLogger.h index 7c93a50aa1f191..215433588e3ae6 100644 --- a/examples/chip-tool/commands/common/RemoteDataModelLogger.h +++ b/examples/chip-tool/commands/common/RemoteDataModelLogger.h @@ -43,6 +43,6 @@ CHIP_ERROR LogErrorAsJSON(const CHIP_ERROR & error); CHIP_ERROR LogGetCommissionerNodeId(chip::NodeId value); CHIP_ERROR LogGetCommissionerRootCertificate(const char * value); CHIP_ERROR LogIssueNOCChain(const char * noc, const char * icac, const char * rcac, const char * ipk); -CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::DiscoveredNodeData & nodeData); +CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::CommissionNodeData & nodeData); void SetDelegate(RemoteDataModelLoggerDelegate * delegate); }; // namespace RemoteDataModelLogger diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp b/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp index 9e65a87b16bac7..ad5e7feaf7f948 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp +++ b/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.cpp @@ -23,7 +23,7 @@ using namespace ::chip; -void DiscoverCommissionablesCommandBase::OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) +void DiscoverCommissionablesCommandBase::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) { nodeData.LogDetail(); LogErrorOnFailure(RemoteDataModelLogger::LogDiscoveredNodeData(nodeData)); diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.h b/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.h index bac24634152823..d1fec307eac19e 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.h +++ b/examples/chip-tool/commands/discover/DiscoverCommissionablesCommand.h @@ -31,7 +31,7 @@ class DiscoverCommissionablesCommandBase : public CHIPCommand, public chip::Cont } /////////// DeviceDiscoveryDelegate Interface ///////// - void OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) override; + void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; /////////// CHIPCommand Interface ///////// chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(30); } diff --git a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp index 57c7574c4ea2e3..30de62b9329173 100644 --- a/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp +++ b/examples/chip-tool/commands/discover/DiscoverCommissionersCommand.cpp @@ -32,7 +32,7 @@ void DiscoverCommissionersCommand::Shutdown() [[maybe_unused]] int commissionerCount = 0; for (int i = 0; i < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES; i++) { - const Dnssd::DiscoveredNodeData * commissioner = mCommissionableNodeController.GetDiscoveredCommissioner(i); + const Dnssd::CommissionNodeData * commissioner = mCommissionableNodeController.GetDiscoveredCommissioner(i); if (commissioner != nullptr) { ChipLogProgress(chipTool, "Discovered Commissioner #%d", commissionerCount); diff --git a/examples/chip-tool/commands/pairing/PairingCommand.cpp b/examples/chip-tool/commands/pairing/PairingCommand.cpp index 5ec206c25b7ea0..31da1329308c5b 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.cpp +++ b/examples/chip-tool/commands/pairing/PairingCommand.cpp @@ -479,12 +479,12 @@ void PairingCommand::OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedA ChipLogValueX64(deviceId), promisedActiveDuration); } -void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) +void PairingCommand::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) { // Ignore nodes with closed commissioning window - VerifyOrReturn(nodeData.nodeData.commissioningMode != 0); + VerifyOrReturn(nodeData.commissioningMode != 0); - auto & resolutionData = nodeData.resolutionData; + auto & resolutionData = nodeData; const uint16_t port = resolutionData.port; char buf[chip::Inet::IPAddress::kMaxStringLength]; diff --git a/examples/chip-tool/commands/pairing/PairingCommand.h b/examples/chip-tool/commands/pairing/PairingCommand.h index 0baf70128531b8..4df17f7dee40b5 100644 --- a/examples/chip-tool/commands/pairing/PairingCommand.h +++ b/examples/chip-tool/commands/pairing/PairingCommand.h @@ -201,7 +201,7 @@ class PairingCommand : public CHIPCommand, void OnICDStayActiveComplete(NodeId deviceId, uint32_t promisedActiveDuration) override; /////////// DeviceDiscoveryDelegate Interface ///////// - void OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) override; + void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; /////////// DeviceAttestationDelegate ///////// chip::Optional FailSafeExpiryTimeoutSecs() const override; diff --git a/examples/platform/linux/ControllerShellCommands.cpp b/examples/platform/linux/ControllerShellCommands.cpp index aefbb3fafa4353..b2bc8af2d8f92b 100644 --- a/examples/platform/linux/ControllerShellCommands.cpp +++ b/examples/platform/linux/ControllerShellCommands.cpp @@ -116,7 +116,7 @@ static CHIP_ERROR display(bool printHeader) for (int i = 0; i < 10; i++) { - const Dnssd::DiscoveredNodeData * next = GetDeviceCommissioner()->GetDiscoveredDevice(i); + const Dnssd::CommissionNodeData * next = GetDeviceCommissioner()->GetDiscoveredDevice(i); if (next == nullptr) { streamer_printf(sout, " Entry %d null\r\n", i); @@ -124,8 +124,7 @@ static CHIP_ERROR display(bool printHeader) else { streamer_printf(sout, " Entry %d instanceName=%s host=%s longDiscriminator=%d vendorId=%d productId=%d\r\n", i, - next->nodeData.instanceName, next->resolutionData.hostName, next->nodeData.longDiscriminator, - next->nodeData.vendorId, next->nodeData.productId); + next->instanceName, next->hostName, next->longDiscriminator, next->vendorId, next->productId); } } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp index fd66ba44649cea..c8a38942e60234 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.cpp @@ -301,7 +301,7 @@ CHIP_ERROR convertTargetVideoPlayerInfoToJVideoPlayer(TargetVideoPlayerInfo * ta } CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscoveredNodeData, - chip::Dnssd::DiscoveredNodeData & outCppDiscoveredNodeData) + chip::Dnssd::CommissionNodeData & outCppDiscoveredNodeData) { ChipLogProgress(AppServer, "convertJDiscoveredNodeDataToCppDiscoveredNodeData called"); VerifyOrReturnError(jDiscoveredNodeData != nullptr, CHIP_ERROR_INVALID_ARGUMENT); @@ -316,7 +316,7 @@ CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscovered jstring jHostName = static_cast(env->GetObjectField(jDiscoveredNodeData, getHostNameField)); if (jHostName != nullptr) { - chip::Platform::CopyString(outCppDiscoveredNodeData.resolutionData.hostName, chip::Dnssd::kHostNameMaxLength + 1, + chip::Platform::CopyString(outCppDiscoveredNodeData.hostName, chip::Dnssd::kHostNameMaxLength + 1, env->GetStringUTFChars(jHostName, 0)); } @@ -324,61 +324,58 @@ CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscovered jstring jInstanceName = static_cast(env->GetObjectField(jDiscoveredNodeData, getInstanceNameField)); if (jInstanceName != nullptr) { - chip::Platform::CopyString(outCppDiscoveredNodeData.nodeData.instanceName, - chip::Dnssd::Commission::kInstanceNameMaxLength + 1, env->GetStringUTFChars(jInstanceName, 0)); + chip::Platform::CopyString(outCppDiscoveredNodeData.instanceName, chip::Dnssd::Commission::kInstanceNameMaxLength + 1, + env->GetStringUTFChars(jInstanceName, 0)); } - jfieldID jLongDiscriminatorField = env->GetFieldID(jDiscoveredNodeDataClass, "longDiscriminator", "J"); - outCppDiscoveredNodeData.nodeData.vendorId = - static_cast(env->GetLongField(jDiscoveredNodeData, jLongDiscriminatorField)); + jfieldID jLongDiscriminatorField = env->GetFieldID(jDiscoveredNodeDataClass, "longDiscriminator", "J"); + outCppDiscoveredNodeData.vendorId = static_cast(env->GetLongField(jDiscoveredNodeData, jLongDiscriminatorField)); - jfieldID jVendorIdField = env->GetFieldID(jDiscoveredNodeDataClass, "vendorId", "J"); - outCppDiscoveredNodeData.nodeData.vendorId = static_cast(env->GetLongField(jDiscoveredNodeData, jVendorIdField)); + jfieldID jVendorIdField = env->GetFieldID(jDiscoveredNodeDataClass, "vendorId", "J"); + outCppDiscoveredNodeData.vendorId = static_cast(env->GetLongField(jDiscoveredNodeData, jVendorIdField)); - jfieldID jProductIdField = env->GetFieldID(jDiscoveredNodeDataClass, "productId", "J"); - outCppDiscoveredNodeData.nodeData.productId = static_cast(env->GetLongField(jDiscoveredNodeData, jProductIdField)); + jfieldID jProductIdField = env->GetFieldID(jDiscoveredNodeDataClass, "productId", "J"); + outCppDiscoveredNodeData.productId = static_cast(env->GetLongField(jDiscoveredNodeData, jProductIdField)); jfieldID jCommissioningModeField = env->GetFieldID(jDiscoveredNodeDataClass, "commissioningMode", "B"); - outCppDiscoveredNodeData.nodeData.commissioningMode = + outCppDiscoveredNodeData.commissioningMode = static_cast(env->GetByteField(jDiscoveredNodeData, jCommissioningModeField)); - jfieldID jDeviceTypeField = env->GetFieldID(jDiscoveredNodeDataClass, "deviceType", "J"); - outCppDiscoveredNodeData.nodeData.deviceType = static_cast(env->GetLongField(jDiscoveredNodeData, jDeviceTypeField)); + jfieldID jDeviceTypeField = env->GetFieldID(jDiscoveredNodeDataClass, "deviceType", "J"); + outCppDiscoveredNodeData.deviceType = static_cast(env->GetLongField(jDiscoveredNodeData, jDeviceTypeField)); jfieldID getDeviceNameField = env->GetFieldID(jDiscoveredNodeDataClass, "deviceName", "Ljava/lang/String;"); jstring jDeviceName = static_cast(env->GetObjectField(jDiscoveredNodeData, getDeviceNameField)); if (jDeviceName != nullptr) { - chip::Platform::CopyString(outCppDiscoveredNodeData.nodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, + chip::Platform::CopyString(outCppDiscoveredNodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, env->GetStringUTFChars(jDeviceName, 0)); } // TODO: map rotating ID - jfieldID jRotatingIdLenField = env->GetFieldID(jDiscoveredNodeDataClass, "rotatingIdLen", "I"); - outCppDiscoveredNodeData.nodeData.rotatingIdLen = - static_cast(env->GetIntField(jDiscoveredNodeData, jRotatingIdLenField)); + jfieldID jRotatingIdLenField = env->GetFieldID(jDiscoveredNodeDataClass, "rotatingIdLen", "I"); + outCppDiscoveredNodeData.rotatingIdLen = static_cast(env->GetIntField(jDiscoveredNodeData, jRotatingIdLenField)); - jfieldID jPairingHintField = env->GetFieldID(jDiscoveredNodeDataClass, "pairingHint", "S"); - outCppDiscoveredNodeData.nodeData.pairingHint = - static_cast(env->GetShortField(jDiscoveredNodeData, jPairingHintField)); + jfieldID jPairingHintField = env->GetFieldID(jDiscoveredNodeDataClass, "pairingHint", "S"); + outCppDiscoveredNodeData.pairingHint = static_cast(env->GetShortField(jDiscoveredNodeData, jPairingHintField)); jfieldID getPairingInstructionField = env->GetFieldID(jDiscoveredNodeDataClass, "pairingInstruction", "Ljava/lang/String;"); jstring jPairingInstruction = static_cast(env->GetObjectField(jDiscoveredNodeData, getPairingInstructionField)); if (jPairingInstruction != nullptr) { - chip::Platform::CopyString(outCppDiscoveredNodeData.nodeData.pairingInstruction, chip::Dnssd::kMaxPairingInstructionLen + 1, + chip::Platform::CopyString(outCppDiscoveredNodeData.pairingInstruction, chip::Dnssd::kMaxPairingInstructionLen + 1, env->GetStringUTFChars(jPairingInstruction, 0)); } - jfieldID jPortField = env->GetFieldID(jDiscoveredNodeDataClass, "port", "I"); - outCppDiscoveredNodeData.resolutionData.port = static_cast(env->GetIntField(jDiscoveredNodeData, jPortField)); + jfieldID jPortField = env->GetFieldID(jDiscoveredNodeDataClass, "port", "I"); + outCppDiscoveredNodeData.port = static_cast(env->GetIntField(jDiscoveredNodeData, jPortField)); - jfieldID jNumIpsField = env->GetFieldID(jDiscoveredNodeDataClass, "numIPs", "I"); - outCppDiscoveredNodeData.resolutionData.numIPs = static_cast(env->GetIntField(jDiscoveredNodeData, jNumIpsField)); + jfieldID jNumIpsField = env->GetFieldID(jDiscoveredNodeDataClass, "numIPs", "I"); + outCppDiscoveredNodeData.numIPs = static_cast(env->GetIntField(jDiscoveredNodeData, jNumIpsField)); jfieldID jIPAddressesField = env->GetFieldID(jDiscoveredNodeDataClass, "ipAddresses", "Ljava/util/List;"); jobject jIPAddresses = env->GetObjectField(jDiscoveredNodeData, jIPAddressesField); - if (jIPAddresses == nullptr && outCppDiscoveredNodeData.resolutionData.numIPs > 0) + if (jIPAddresses == nullptr && outCppDiscoveredNodeData.numIPs > 0) { return CHIP_ERROR_INVALID_ARGUMENT; } @@ -400,11 +397,11 @@ CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscovered chip::Inet::IPAddress addressInet; chip::JniUtfString addressJniString(env, jIPAddressStr); VerifyOrReturnError(chip::Inet::IPAddress::FromString(addressJniString.c_str(), addressInet), CHIP_ERROR_INVALID_ARGUMENT); - outCppDiscoveredNodeData.resolutionData.ipAddress[ipAddressCount] = addressInet; + outCppDiscoveredNodeData.ipAddress[ipAddressCount] = addressInet; if (ipAddressCount == 0) { - outCppDiscoveredNodeData.resolutionData.interfaceId = chip::Inet::InterfaceId::FromIPAddress(addressInet); + outCppDiscoveredNodeData.interfaceId = chip::Inet::InterfaceId::FromIPAddress(addressInet); } ipAddressCount++; } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h index a2c59596d9e9e5..28f5a1abd28c5a 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/ConversionUtils.h @@ -33,4 +33,4 @@ CHIP_ERROR convertJVideoPlayerToTargetVideoPlayerInfo(jobject videoPlayer, Targe CHIP_ERROR convertTargetVideoPlayerInfoToJVideoPlayer(TargetVideoPlayerInfo * targetVideoPlayerInfo, jobject & outVideoPlayer); CHIP_ERROR convertJDiscoveredNodeDataToCppDiscoveredNodeData(jobject jDiscoveredNodeData, - chip::Dnssd::DiscoveredNodeData & cppDiscoveredNodeData); + chip::Dnssd::CommissionNodeData & cppDiscoveredNodeData); diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp index 6dbdfba9c83449..f2e0d5b79fc53c 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp @@ -372,7 +372,7 @@ JNI_METHOD(jboolean, sendCommissioningRequest)(JNIEnv * env, jobject, jobject jD chip::DeviceLayer::StackLock lock; ChipLogProgress(AppServer, "JNI_METHOD sendCommissioningRequest called"); - chip::Dnssd::DiscoveredNodeData commissioner; + chip::Dnssd::CommissionNodeData commissioner; CHIP_ERROR err = convertJDiscoveredNodeDataToCppDiscoveredNodeData(jDiscoveredNodeData, commissioner); VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(AppServer, diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm index 86a1976aed7d18..f199ba96b7a5a5 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CastingServerBridge.mm @@ -456,7 +456,7 @@ - (void)getDiscoveredCommissioner:(int)index block:^{ chip::Optional associatedConnectableVideoPlayer; DiscoveredNodeData * commissioner = nil; - const chip::Dnssd::DiscoveredNodeData * cppDiscoveredNodeData + const chip::Dnssd::CommissionNodeData * cppDiscoveredNodeData = CastingServer::GetInstance()->GetDiscoveredCommissioner( index, associatedConnectableVideoPlayer); if (cppDiscoveredNodeData != nullptr) { @@ -530,7 +530,7 @@ - (void)sendUserDirectedCommissioningRequest:(DiscoveredNodeData * _Nonnull)comm block:^{ bool udcRequestStatus; - chip::Dnssd::DiscoveredNodeData cppCommissioner; + chip::Dnssd::CommissionNodeData cppCommissioner; if ([ConversionUtils convertToCppDiscoveredNodeDataFrom:commissioner outDiscoveredNodeData:cppCommissioner] != CHIP_NO_ERROR) { diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionerDiscoveryDelegateImpl.h b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionerDiscoveryDelegateImpl.h index 07c1f5c68fc893..8f55e33e27402a 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionerDiscoveryDelegateImpl.h +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/CommissionerDiscoveryDelegateImpl.h @@ -61,10 +61,10 @@ class CommissionerDiscoveryDelegateImpl : public chip::Controller::DeviceDiscove } } - void OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) + void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) { ChipLogProgress(AppServer, "CommissionerDiscoveryDelegateImpl().OnDiscoveredDevice() called"); - __block const chip::Dnssd::DiscoveredNodeData cppNodeData = nodeData; + __block const chip::Dnssd::CommissionNodeData cppNodeData = nodeData; dispatch_async(mClientQueue, ^{ DiscoveredNodeData * objCDiscoveredNodeData = [ConversionUtils convertToObjCDiscoveredNodeDataFrom:&cppNodeData]; mDiscoveredCommissioners.push_back(objCDiscoveredNodeData); // add to the list of discovered commissioners diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.hpp b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.hpp index d60b442c03c7a5..597b3728e3f6c5 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.hpp +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.hpp @@ -43,7 +43,7 @@ outTargetVideoPlayerInfo:(TargetVideoPlayerInfo &)outTargetVideoPlayerInfo; + (CHIP_ERROR)convertToCppDiscoveredNodeDataFrom:(DiscoveredNodeData * _Nonnull)objCDiscoveredNodeData - outDiscoveredNodeData:(chip::Dnssd::DiscoveredNodeData &)outDiscoveredNodeData; + outDiscoveredNodeData:(chip::Dnssd::CommissionNodeData &)outDiscoveredNodeData; /** * @brief C++ to Objective C converters @@ -51,7 +51,7 @@ + (ContentApp * _Nonnull)convertToObjCContentAppFrom:(TargetEndpointInfo * _Nonnull)cppTargetEndpointInfo; + (DiscoveredNodeData * _Nonnull)convertToObjCDiscoveredNodeDataFrom: - (const chip::Dnssd::DiscoveredNodeData * _Nonnull)cppDiscoveredNodedata; + (const chip::Dnssd::CommissionNodeData * _Nonnull)cppDiscoveredNodedata; + (VideoPlayer * _Nonnull)convertToObjCVideoPlayerFrom:(TargetVideoPlayerInfo * _Nonnull)cppTargetVideoPlayerInfo; diff --git a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm index 902e386ae551e1..5cce096756bfa0 100644 --- a/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm +++ b/examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge/ConversionUtils.mm @@ -45,36 +45,36 @@ + (CHIP_ERROR)convertToCppTargetEndpointInfoFrom:(ContentApp * _Nonnull)objCCont } + (CHIP_ERROR)convertToCppDiscoveredNodeDataFrom:(DiscoveredNodeData * _Nonnull)objCDiscoveredNodeData - outDiscoveredNodeData:(chip::Dnssd::DiscoveredNodeData &)outDiscoveredNodeData + outDiscoveredNodeData:(chip::Dnssd::CommissionNodeData &)outDiscoveredNodeData { // setting CommissionNodeData - outDiscoveredNodeData.nodeData.deviceType = objCDiscoveredNodeData.deviceType; - outDiscoveredNodeData.nodeData.vendorId = objCDiscoveredNodeData.vendorId; - outDiscoveredNodeData.nodeData.productId = objCDiscoveredNodeData.productId; - outDiscoveredNodeData.nodeData.longDiscriminator = objCDiscoveredNodeData.longDiscriminator; - outDiscoveredNodeData.nodeData.commissioningMode = objCDiscoveredNodeData.commissioningMode; - outDiscoveredNodeData.nodeData.pairingHint = objCDiscoveredNodeData.pairingHint; - memset(outDiscoveredNodeData.nodeData.deviceName, '\0', sizeof(outDiscoveredNodeData.nodeData.deviceName)); + outDiscoveredNodeData.deviceType = objCDiscoveredNodeData.deviceType; + outDiscoveredNodeData.vendorId = objCDiscoveredNodeData.vendorId; + outDiscoveredNodeData.productId = objCDiscoveredNodeData.productId; + outDiscoveredNodeData.longDiscriminator = objCDiscoveredNodeData.longDiscriminator; + outDiscoveredNodeData.commissioningMode = objCDiscoveredNodeData.commissioningMode; + outDiscoveredNodeData.pairingHint = objCDiscoveredNodeData.pairingHint; + memset(outDiscoveredNodeData.deviceName, '\0', sizeof(outDiscoveredNodeData.deviceName)); if (objCDiscoveredNodeData.deviceName != nullptr) { - chip::Platform::CopyString(outDiscoveredNodeData.nodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, + chip::Platform::CopyString(outDiscoveredNodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, [objCDiscoveredNodeData.deviceName UTF8String]); } - outDiscoveredNodeData.nodeData.rotatingIdLen = objCDiscoveredNodeData.rotatingIdLen; + outDiscoveredNodeData.rotatingIdLen = objCDiscoveredNodeData.rotatingIdLen; memcpy( - outDiscoveredNodeData.nodeData.rotatingId, objCDiscoveredNodeData.rotatingId, objCDiscoveredNodeData.rotatingIdLen); + outDiscoveredNodeData.rotatingId, objCDiscoveredNodeData.rotatingId, objCDiscoveredNodeData.rotatingIdLen); // setting CommonResolutionData - outDiscoveredNodeData.resolutionData.port = objCDiscoveredNodeData.port; - memset(outDiscoveredNodeData.resolutionData.hostName, '\0', sizeof(outDiscoveredNodeData.resolutionData.hostName)); + outDiscoveredNodeData.port = objCDiscoveredNodeData.port; + memset(outDiscoveredNodeData.hostName, '\0', sizeof(outDiscoveredNodeData.hostName)); if (objCDiscoveredNodeData.hostName != nullptr) { - chip::Platform::CopyString(outDiscoveredNodeData.resolutionData.hostName, chip::Dnssd::kHostNameMaxLength + 1, + chip::Platform::CopyString(outDiscoveredNodeData.hostName, chip::Dnssd::kHostNameMaxLength + 1, [objCDiscoveredNodeData.hostName UTF8String]); } - outDiscoveredNodeData.resolutionData.interfaceId = chip::Inet::InterfaceId(objCDiscoveredNodeData.platformInterface); - outDiscoveredNodeData.resolutionData.numIPs = objCDiscoveredNodeData.numIPs; + outDiscoveredNodeData.interfaceId = chip::Inet::InterfaceId(objCDiscoveredNodeData.platformInterface); + outDiscoveredNodeData.numIPs = objCDiscoveredNodeData.numIPs; for (size_t i = 0; i < objCDiscoveredNodeData.numIPs; i++) { chip::Inet::IPAddress::FromString( - [objCDiscoveredNodeData.ipAddresses[i] UTF8String], outDiscoveredNodeData.resolutionData.ipAddress[i]); + [objCDiscoveredNodeData.ipAddresses[i] UTF8String], outDiscoveredNodeData.ipAddress[i]); } return CHIP_NO_ERROR; } @@ -116,36 +116,36 @@ + (ContentApp *)convertToObjCContentAppFrom:(TargetEndpointInfo * _Nonnull)cppTa return objCContentApp; } -+ (DiscoveredNodeData *)convertToObjCDiscoveredNodeDataFrom:(const chip::Dnssd::DiscoveredNodeData * _Nonnull)cppDiscoveredNodedata ++ (DiscoveredNodeData *)convertToObjCDiscoveredNodeDataFrom:(const chip::Dnssd::CommissionNodeData * _Nonnull)cppDiscoveredNodedata { DiscoveredNodeData * objCDiscoveredNodeData = [DiscoveredNodeData new]; // from CommissionNodeData - objCDiscoveredNodeData.deviceType = cppDiscoveredNodedata->nodeData.deviceType; - objCDiscoveredNodeData.vendorId = cppDiscoveredNodedata->nodeData.vendorId; - objCDiscoveredNodeData.productId = cppDiscoveredNodedata->nodeData.productId; - objCDiscoveredNodeData.longDiscriminator = cppDiscoveredNodedata->nodeData.longDiscriminator; - objCDiscoveredNodeData.commissioningMode = cppDiscoveredNodedata->nodeData.commissioningMode; - objCDiscoveredNodeData.pairingHint = cppDiscoveredNodedata->nodeData.pairingHint; - objCDiscoveredNodeData.deviceName = [NSString stringWithCString:cppDiscoveredNodedata->nodeData.deviceName + objCDiscoveredNodeData.deviceType = cppDiscoveredNodedata->deviceType; + objCDiscoveredNodeData.vendorId = cppDiscoveredNodedata->vendorId; + objCDiscoveredNodeData.productId = cppDiscoveredNodedata->productId; + objCDiscoveredNodeData.longDiscriminator = cppDiscoveredNodedata->longDiscriminator; + objCDiscoveredNodeData.commissioningMode = cppDiscoveredNodedata->commissioningMode; + objCDiscoveredNodeData.pairingHint = cppDiscoveredNodedata->pairingHint; + objCDiscoveredNodeData.deviceName = [NSString stringWithCString:cppDiscoveredNodedata->deviceName encoding:NSUTF8StringEncoding]; - objCDiscoveredNodeData.rotatingIdLen = cppDiscoveredNodedata->nodeData.rotatingIdLen; - objCDiscoveredNodeData.rotatingId = cppDiscoveredNodedata->nodeData.rotatingId; - objCDiscoveredNodeData.instanceName = [NSString stringWithCString:cppDiscoveredNodedata->nodeData.instanceName + objCDiscoveredNodeData.rotatingIdLen = cppDiscoveredNodedata->rotatingIdLen; + objCDiscoveredNodeData.rotatingId = cppDiscoveredNodedata->rotatingId; + objCDiscoveredNodeData.instanceName = [NSString stringWithCString:cppDiscoveredNodedata->instanceName encoding:NSUTF8StringEncoding]; // from CommonResolutionData - objCDiscoveredNodeData.port = cppDiscoveredNodedata->resolutionData.port; - objCDiscoveredNodeData.hostName = [NSString stringWithCString:cppDiscoveredNodedata->resolutionData.hostName + objCDiscoveredNodeData.port = cppDiscoveredNodedata->port; + objCDiscoveredNodeData.hostName = [NSString stringWithCString:cppDiscoveredNodedata->hostName encoding:NSUTF8StringEncoding]; - objCDiscoveredNodeData.platformInterface = cppDiscoveredNodedata->resolutionData.interfaceId.GetPlatformInterface(); - objCDiscoveredNodeData.numIPs = cppDiscoveredNodedata->resolutionData.numIPs; - if (cppDiscoveredNodedata->resolutionData.numIPs > 0) { + objCDiscoveredNodeData.platformInterface = cppDiscoveredNodedata->interfaceId.GetPlatformInterface(); + objCDiscoveredNodeData.numIPs = cppDiscoveredNodedata->numIPs; + if (cppDiscoveredNodedata->numIPs > 0) { objCDiscoveredNodeData.ipAddresses = [NSMutableArray new]; } - for (size_t i = 0; i < cppDiscoveredNodedata->resolutionData.numIPs; i++) { + for (size_t i = 0; i < cppDiscoveredNodedata->numIPs; i++) { char addrCString[chip::Inet::IPAddress::kMaxStringLength]; - cppDiscoveredNodedata->resolutionData.ipAddress[i].ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength); + cppDiscoveredNodedata->ipAddress[i].ToString(addrCString, chip::Inet::IPAddress::kMaxStringLength); objCDiscoveredNodeData.ipAddresses[i] = [NSString stringWithCString:addrCString encoding:NSASCIIStringEncoding]; } return objCDiscoveredNodeData; diff --git a/examples/tv-casting-app/linux/CastingUtils.cpp b/examples/tv-casting-app/linux/CastingUtils.cpp index d4d71b5dd2c0ae..4a89d5bbbe851a 100644 --- a/examples/tv-casting-app/linux/CastingUtils.cpp +++ b/examples/tv-casting-app/linux/CastingUtils.cpp @@ -44,7 +44,7 @@ CHIP_ERROR DiscoverCommissioners() CHIP_ERROR RequestCommissioning(int index) { chip::Optional associatedConnectableVideoPlayer; - const Dnssd::DiscoveredNodeData * selectedCommissioner = + const Dnssd::CommissionNodeData * selectedCommissioner = CastingServer::GetInstance()->GetDiscoveredCommissioner(index, associatedConnectableVideoPlayer); if (selectedCommissioner == nullptr) { @@ -60,7 +60,7 @@ CHIP_ERROR RequestCommissioning(int index) * If non-null selectedCommissioner is provided, sends user directed commissioning * request to the selectedCommissioner and advertises self as commissionable node over DNS-SD */ -void PrepareForCommissioning(const Dnssd::DiscoveredNodeData * selectedCommissioner) +void PrepareForCommissioning(const Dnssd::CommissionNodeData * selectedCommissioner) { CastingServer::GetInstance()->Init(); @@ -96,7 +96,7 @@ void InitCommissioningFlow(intptr_t commandArg) for (int i = 0; i < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES; i++) { chip::Optional associatedConnectableVideoPlayer; - const Dnssd::DiscoveredNodeData * commissioner = + const Dnssd::CommissionNodeData * commissioner = CastingServer::GetInstance()->GetDiscoveredCommissioner(i, associatedConnectableVideoPlayer); if (commissioner != nullptr) { @@ -286,7 +286,7 @@ void HandleCommissioningCompleteCallback(CHIP_ERROR err) #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT void HandleUDCSendExpiration(System::Layer * aSystemLayer, void * context) { - Dnssd::DiscoveredNodeData * selectedCommissioner = (Dnssd::DiscoveredNodeData *) context; + Dnssd::CommissionNodeData * selectedCommissioner = (Dnssd::CommissionNodeData *) context; // Send User Directed commissioning request ReturnOnFailure(CastingServer::GetInstance()->SendUserDirectedCommissioningRequest(selectedCommissioner)); diff --git a/examples/tv-casting-app/linux/CastingUtils.h b/examples/tv-casting-app/linux/CastingUtils.h index d87a8318948c76..1d780da8ebfeaf 100644 --- a/examples/tv-casting-app/linux/CastingUtils.h +++ b/examples/tv-casting-app/linux/CastingUtils.h @@ -34,7 +34,7 @@ CHIP_ERROR DiscoverCommissioners(); CHIP_ERROR RequestCommissioning(int index); -void PrepareForCommissioning(const chip::Dnssd::DiscoveredNodeData * selectedCommissioner = nullptr); +void PrepareForCommissioning(const chip::Dnssd::CommissionNodeData * selectedCommissioner = nullptr); void InitCommissioningFlow(intptr_t commandArg); diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp b/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp index 9dd365d8db559f..531de966810163 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.cpp @@ -73,7 +73,7 @@ CHIP_ERROR CastingPlayerDiscovery::StopDiscovery() return CHIP_NO_ERROR; } -void DeviceDiscoveryDelegateImpl::OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) +void DeviceDiscoveryDelegateImpl::OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) { ChipLogProgress(Discovery, "DeviceDiscoveryDelegateImpl::OnDiscoveredDevice() called"); VerifyOrReturn(mClientDelegate != nullptr, @@ -81,24 +81,23 @@ void DeviceDiscoveryDelegateImpl::OnDiscoveredDevice(const chip::Dnssd::Discover // convert nodeData to CastingPlayer CastingPlayerAttributes attributes; - snprintf(attributes.id, kIdMaxLength + 1, "%s%u", nodeData.resolutionData.hostName, nodeData.resolutionData.port); + snprintf(attributes.id, kIdMaxLength + 1, "%s%u", nodeData.hostName, nodeData.port); - chip::Platform::CopyString(attributes.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, nodeData.nodeData.deviceName); - chip::Platform::CopyString(attributes.hostName, chip::Dnssd::kHostNameMaxLength + 1, nodeData.resolutionData.hostName); - chip::Platform::CopyString(attributes.instanceName, chip::Dnssd::Commission::kInstanceNameMaxLength + 1, - nodeData.nodeData.instanceName); + chip::Platform::CopyString(attributes.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, nodeData.deviceName); + chip::Platform::CopyString(attributes.hostName, chip::Dnssd::kHostNameMaxLength + 1, nodeData.hostName); + chip::Platform::CopyString(attributes.instanceName, chip::Dnssd::Commission::kInstanceNameMaxLength + 1, nodeData.instanceName); - attributes.numIPs = (unsigned int) nodeData.resolutionData.numIPs; + attributes.numIPs = (unsigned int) nodeData.numIPs; for (unsigned j = 0; j < attributes.numIPs; j++) { - attributes.ipAddresses[j] = nodeData.resolutionData.ipAddress[j]; + attributes.ipAddresses[j] = nodeData.ipAddress[j]; } - attributes.interfaceId = nodeData.resolutionData.interfaceId; - attributes.port = nodeData.resolutionData.port; - attributes.productId = nodeData.nodeData.productId; - attributes.vendorId = nodeData.nodeData.vendorId; - attributes.deviceType = nodeData.nodeData.deviceType; - attributes.supportsCommissionerGeneratedPasscode = nodeData.nodeData.supportsCommissionerGeneratedPasscode; + attributes.interfaceId = nodeData.interfaceId; + attributes.port = nodeData.port; + attributes.productId = nodeData.productId; + attributes.vendorId = nodeData.vendorId; + attributes.deviceType = nodeData.deviceType; + attributes.supportsCommissionerGeneratedPasscode = nodeData.supportsCommissionerGeneratedPasscode; memory::Strong player = std::make_shared(attributes); diff --git a/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.h b/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.h index 86886ac71be30f..24bbb00ce4907b 100644 --- a/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.h +++ b/examples/tv-casting-app/tv-casting-common/core/CastingPlayerDiscovery.h @@ -68,7 +68,7 @@ class DeviceDiscoveryDelegateImpl : public chip::Controller::DeviceDiscoveryDele DeviceDiscoveryDelegateImpl() {} DeviceDiscoveryDelegateImpl(DiscoveryDelegate * delegate) { mClientDelegate = delegate; } - void OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) override; + void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) override; }; /** diff --git a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h index 49eb65d13786fb..da497a3d00c543 100644 --- a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h +++ b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h @@ -73,7 +73,7 @@ class CastingServer : public AppDelegate #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT CHIP_ERROR DiscoverCommissioners(chip::Controller::DeviceDiscoveryDelegate * deviceDiscoveryDelegate = nullptr); - const chip::Dnssd::DiscoveredNodeData * + const chip::Dnssd::CommissionNodeData * GetDiscoveredCommissioner(int index, chip::Optional & outAssociatedConnectableVideoPlayer); CHIP_ERROR OpenBasicCommissioningWindow(CommissioningCallbacks commissioningCallbacks, std::function onConnectionSuccess, @@ -82,7 +82,7 @@ class CastingServer : public AppDelegate #if CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT CHIP_ERROR SendUserDirectedCommissioningRequest(chip::Transport::PeerAddress commissioner); - CHIP_ERROR SendUserDirectedCommissioningRequest(chip::Dnssd::DiscoveredNodeData * selectedCommissioner); + CHIP_ERROR SendUserDirectedCommissioningRequest(chip::Dnssd::CommissionNodeData * selectedCommissioner); #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT TargetVideoPlayerInfo * GetActiveTargetVideoPlayer() { return &mActiveTargetVideoPlayerInfo; } diff --git a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h index dd799bdf8c776d..9fa0a139bf3d6c 100644 --- a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h +++ b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h @@ -85,7 +85,7 @@ class TargetVideoPlayerInfo const char * GetHostName() const { return mHostName; } size_t GetNumIPs() const { return mNumIPs; } const chip::Inet::IPAddress * GetIpAddresses() const { return mIpAddress; } - bool IsSameAs(const chip::Dnssd::DiscoveredNodeData * discoveredNodeData); + bool IsSameAs(const chip::Dnssd::CommissionNodeData * discoveredNodeData); bool IsSameAs(const char * hostName, const char * deviceName, size_t numIPs, const chip::Inet::IPAddress * ipAddresses); uint16_t GetPort() const { return mPort; } diff --git a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp index ef56d3f1144644..f97db446d8783d 100644 --- a/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/CastingServer.cpp @@ -253,37 +253,35 @@ chip::Inet::IPAddress * CastingServer::getIpAddressForUDCRequest(chip::Inet::IPA return &ipAddresses[ipIndexToUse]; } -CHIP_ERROR CastingServer::SendUserDirectedCommissioningRequest(Dnssd::DiscoveredNodeData * selectedCommissioner) +CHIP_ERROR CastingServer::SendUserDirectedCommissioningRequest(Dnssd::CommissionNodeData * selectedCommissioner) { mUdcInProgress = true; // Send User Directed commissioning request chip::Inet::IPAddress * ipAddressToUse = - getIpAddressForUDCRequest(selectedCommissioner->resolutionData.ipAddress, selectedCommissioner->resolutionData.numIPs); - ReturnErrorOnFailure(SendUserDirectedCommissioningRequest(chip::Transport::PeerAddress::UDP( - *ipAddressToUse, selectedCommissioner->resolutionData.port, selectedCommissioner->resolutionData.interfaceId))); - mTargetVideoPlayerVendorId = selectedCommissioner->nodeData.vendorId; - mTargetVideoPlayerProductId = selectedCommissioner->nodeData.productId; - mTargetVideoPlayerDeviceType = selectedCommissioner->nodeData.deviceType; - mTargetVideoPlayerNumIPs = selectedCommissioner->resolutionData.numIPs; + getIpAddressForUDCRequest(selectedCommissioner->ipAddress, selectedCommissioner->numIPs); + ReturnErrorOnFailure(SendUserDirectedCommissioningRequest( + chip::Transport::PeerAddress::UDP(*ipAddressToUse, selectedCommissioner->port, selectedCommissioner->interfaceId))); + mTargetVideoPlayerVendorId = selectedCommissioner->vendorId; + mTargetVideoPlayerProductId = selectedCommissioner->productId; + mTargetVideoPlayerDeviceType = selectedCommissioner->deviceType; + mTargetVideoPlayerNumIPs = selectedCommissioner->numIPs; for (size_t i = 0; i < mTargetVideoPlayerNumIPs && i < chip::Dnssd::CommonResolutionData::kMaxIPAddresses; i++) { - mTargetVideoPlayerIpAddress[i] = selectedCommissioner->resolutionData.ipAddress[i]; + mTargetVideoPlayerIpAddress[i] = selectedCommissioner->ipAddress[i]; } - chip::Platform::CopyString(mTargetVideoPlayerDeviceName, chip::Dnssd::kMaxDeviceNameLen + 1, - selectedCommissioner->nodeData.deviceName); - chip::Platform::CopyString(mTargetVideoPlayerHostName, chip::Dnssd::kHostNameMaxLength + 1, - selectedCommissioner->resolutionData.hostName); + chip::Platform::CopyString(mTargetVideoPlayerDeviceName, chip::Dnssd::kMaxDeviceNameLen + 1, selectedCommissioner->deviceName); + chip::Platform::CopyString(mTargetVideoPlayerHostName, chip::Dnssd::kHostNameMaxLength + 1, selectedCommissioner->hostName); chip::Platform::CopyString(mTargetVideoPlayerInstanceName, chip::Dnssd::Commission::kInstanceNameMaxLength + 1, - selectedCommissioner->nodeData.instanceName); - mTargetVideoPlayerPort = selectedCommissioner->resolutionData.port; + selectedCommissioner->instanceName); + mTargetVideoPlayerPort = selectedCommissioner->port; return CHIP_NO_ERROR; } #endif // CHIP_DEVICE_CONFIG_ENABLE_COMMISSIONER_DISCOVERY_CLIENT -const Dnssd::DiscoveredNodeData * +const Dnssd::CommissionNodeData * CastingServer::GetDiscoveredCommissioner(int index, chip::Optional & outAssociatedConnectableVideoPlayer) { - const Dnssd::DiscoveredNodeData * discoveredNodeData = mCommissionableNodeController.GetDiscoveredCommissioner(index); + const Dnssd::CommissionNodeData * discoveredNodeData = mCommissionableNodeController.GetDiscoveredCommissioner(index); if (discoveredNodeData != nullptr) { for (size_t i = 0; i < kMaxCachedVideoPlayers && mCachedTargetVideoPlayerInfo[i].IsInitialized(); i++) diff --git a/examples/tv-casting-app/tv-casting-common/src/ConversionUtils.cpp b/examples/tv-casting-app/tv-casting-common/src/ConversionUtils.cpp index a57e2548009ada..3c098aa9b4fbf3 100644 --- a/examples/tv-casting-app/tv-casting-common/src/ConversionUtils.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/ConversionUtils.cpp @@ -18,27 +18,30 @@ #include "ConversionUtils.h" -CHIP_ERROR ConvertToDiscoveredNodeData(TargetVideoPlayerInfo * inPlayer, chip::Dnssd::DiscoveredNodeData & outNodeData) +CHIP_ERROR ConvertToDiscoveredNodeData(TargetVideoPlayerInfo * inPlayer, chip::Dnssd::DiscoveredNodeData & outDiscNodeData) { if (inPlayer == nullptr) return CHIP_ERROR_INVALID_ARGUMENT; - outNodeData.nodeData.vendorId = inPlayer->GetVendorId(); - outNodeData.nodeData.productId = static_cast(inPlayer->GetProductId()); - outNodeData.nodeData.deviceType = inPlayer->GetDeviceType(); - outNodeData.resolutionData.numIPs = inPlayer->GetNumIPs(); + outDiscNodeData.Set(); + auto & outNodeData = outDiscNodeData.Get(); + + outNodeData.vendorId = inPlayer->GetVendorId(); + outNodeData.productId = static_cast(inPlayer->GetProductId()); + outNodeData.deviceType = inPlayer->GetDeviceType(); + outNodeData.numIPs = inPlayer->GetNumIPs(); const chip::Inet::IPAddress * ipAddresses = inPlayer->GetIpAddresses(); if (ipAddresses != nullptr) { - for (size_t i = 0; i < outNodeData.resolutionData.numIPs && i < chip::Dnssd::CommonResolutionData::kMaxIPAddresses; i++) + for (size_t i = 0; i < outNodeData.numIPs && i < chip::Dnssd::CommonResolutionData::kMaxIPAddresses; i++) { - outNodeData.resolutionData.ipAddress[i] = ipAddresses[i]; + outNodeData.ipAddress[i] = ipAddresses[i]; } } - chip::Platform::CopyString(outNodeData.nodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, inPlayer->GetDeviceName()); - chip::Platform::CopyString(outNodeData.resolutionData.hostName, chip::Dnssd::kHostNameMaxLength + 1, inPlayer->GetHostName()); + chip::Platform::CopyString(outNodeData.deviceName, chip::Dnssd::kMaxDeviceNameLen + 1, inPlayer->GetDeviceName()); + chip::Platform::CopyString(outNodeData.hostName, chip::Dnssd::kHostNameMaxLength + 1, inPlayer->GetHostName()); return CHIP_NO_ERROR; } diff --git a/examples/tv-casting-app/tv-casting-common/src/TargetVideoPlayerInfo.cpp b/examples/tv-casting-app/tv-casting-common/src/TargetVideoPlayerInfo.cpp index c182856039975a..a3ded0d7db8f26 100644 --- a/examples/tv-casting-app/tv-casting-common/src/TargetVideoPlayerInfo.cpp +++ b/examples/tv-casting-app/tv-casting-common/src/TargetVideoPlayerInfo.cpp @@ -224,7 +224,7 @@ bool TargetVideoPlayerInfo::IsSameAs(const char * hostName, const char * deviceN return true; } -bool TargetVideoPlayerInfo::IsSameAs(const chip::Dnssd::DiscoveredNodeData * discoveredNodeData) +bool TargetVideoPlayerInfo::IsSameAs(const chip::Dnssd::CommissionNodeData * discoveredNodeData) { // return false because 'this' VideoPlayer is not null if (discoveredNodeData == nullptr) @@ -232,6 +232,6 @@ bool TargetVideoPlayerInfo::IsSameAs(const chip::Dnssd::DiscoveredNodeData * dis return false; } - return IsSameAs(discoveredNodeData->resolutionData.hostName, discoveredNodeData->nodeData.deviceName, - discoveredNodeData->resolutionData.numIPs, discoveredNodeData->resolutionData.ipAddress); + return IsSameAs(discoveredNodeData->hostName, discoveredNodeData->deviceName, discoveredNodeData->numIPs, + discoveredNodeData->ipAddress); } diff --git a/src/controller/AbstractDnssdDiscoveryController.cpp b/src/controller/AbstractDnssdDiscoveryController.cpp index 4d916e068ddbe6..3d3ca4c8097955 100644 --- a/src/controller/AbstractDnssdDiscoveryController.cpp +++ b/src/controller/AbstractDnssdDiscoveryController.cpp @@ -25,20 +25,23 @@ namespace chip { namespace Controller { -void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & nodeData) +void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::DiscoveredNodeData & discNodeData) { + VerifyOrReturn(discNodeData.Is()); + auto discoveredNodes = GetDiscoveredNodes(); + auto & nodeData = discNodeData.Get(); for (auto & discoveredNode : discoveredNodes) { - if (!discoveredNode.resolutionData.IsValid()) + + if (!discoveredNode.IsValid()) { continue; } // TODO(#32576) Check if IP address are the same. Must account for `numIPs` in the list of `ipAddress`. // Additionally, must NOT assume that the ordering is consistent. - if (strcmp(discoveredNode.resolutionData.hostName, nodeData.resolutionData.hostName) == 0 && - discoveredNode.resolutionData.port == nodeData.resolutionData.port && - discoveredNode.resolutionData.numIPs == nodeData.resolutionData.numIPs) + if (strcmp(discoveredNode.hostName, nodeData.hostName) == 0 && discoveredNode.port == nodeData.port && + discoveredNode.numIPs == nodeData.numIPs) { discoveredNode = nodeData; if (mDeviceDiscoveryDelegate != nullptr) @@ -51,7 +54,7 @@ void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::Disco // Node not yet in the list for (auto & discoveredNode : discoveredNodes) { - if (!discoveredNode.resolutionData.IsValid()) + if (!discoveredNode.IsValid()) { discoveredNode = nodeData; if (mDeviceDiscoveryDelegate != nullptr) @@ -61,7 +64,7 @@ void AbstractDnssdDiscoveryController::OnNodeDiscovered(const chip::Dnssd::Disco return; } } - ChipLogError(Discovery, "Failed to add discovered node with hostname %s- Insufficient space", nodeData.resolutionData.hostName); + ChipLogError(Discovery, "Failed to add discovered node with hostname %s- Insufficient space", nodeData.hostName); } CHIP_ERROR AbstractDnssdDiscoveryController::SetUpNodeDiscovery() @@ -74,11 +77,11 @@ CHIP_ERROR AbstractDnssdDiscoveryController::SetUpNodeDiscovery() return CHIP_NO_ERROR; } -const Dnssd::DiscoveredNodeData * AbstractDnssdDiscoveryController::GetDiscoveredNode(int idx) +const Dnssd::CommissionNodeData * AbstractDnssdDiscoveryController::GetDiscoveredNode(int idx) { // TODO(cecille): Add assertion about main loop. auto discoveredNodes = GetDiscoveredNodes(); - if (0 <= idx && idx < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES && discoveredNodes.data()[idx].resolutionData.IsValid()) + if (0 <= idx && idx < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES && discoveredNodes.data()[idx].IsValid()) { return discoveredNodes.data() + idx; } diff --git a/src/controller/AbstractDnssdDiscoveryController.h b/src/controller/AbstractDnssdDiscoveryController.h index c8c9053f878ff3..8aeaece1bb521b 100644 --- a/src/controller/AbstractDnssdDiscoveryController.h +++ b/src/controller/AbstractDnssdDiscoveryController.h @@ -45,9 +45,9 @@ class DLL_EXPORT AbstractDnssdDiscoveryController : public Dnssd::DiscoverNodeDe CHIP_ERROR StopDiscovery() { return mDNSResolver.StopDiscovery(); }; protected: - using DiscoveredNodeList = FixedSpan; + using DiscoveredNodeList = FixedSpan; CHIP_ERROR SetUpNodeDiscovery(); - const Dnssd::DiscoveredNodeData * GetDiscoveredNode(int idx); + const Dnssd::CommissionNodeData * GetDiscoveredNode(int idx); virtual DiscoveredNodeList GetDiscoveredNodes() = 0; DeviceDiscoveryDelegate * mDeviceDiscoveryDelegate = nullptr; Dnssd::ResolverProxy mDNSResolver; diff --git a/src/controller/CHIPCommissionableNodeController.cpp b/src/controller/CHIPCommissionableNodeController.cpp index f116928b585d82..eaf212e90693c7 100644 --- a/src/controller/CHIPCommissionableNodeController.cpp +++ b/src/controller/CHIPCommissionableNodeController.cpp @@ -45,7 +45,7 @@ CommissionableNodeController::~CommissionableNodeController() mDNSResolver.SetDiscoveryDelegate(nullptr); } -const Dnssd::DiscoveredNodeData * CommissionableNodeController::GetDiscoveredCommissioner(int idx) +const Dnssd::CommissionNodeData * CommissionableNodeController::GetDiscoveredCommissioner(int idx) { return GetDiscoveredNode(idx); } diff --git a/src/controller/CHIPCommissionableNodeController.h b/src/controller/CHIPCommissionableNodeController.h index 5c9f57919a2897..9605653cbb87d6 100644 --- a/src/controller/CHIPCommissionableNodeController.h +++ b/src/controller/CHIPCommissionableNodeController.h @@ -49,13 +49,13 @@ class DLL_EXPORT CommissionableNodeController : public AbstractDnssdDiscoveryCon * Otherwise, returns nullptr * See Resolver.h IsValid() */ - const Dnssd::DiscoveredNodeData * GetDiscoveredCommissioner(int idx); + const Dnssd::CommissionNodeData * GetDiscoveredCommissioner(int idx); protected: DiscoveredNodeList GetDiscoveredNodes() override { return DiscoveredNodeList(mDiscoveredCommissioners); } private: - Dnssd::DiscoveredNodeData mDiscoveredCommissioners[CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES]; + Dnssd::CommissionNodeData mDiscoveredCommissioners[CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES]; }; } // namespace Controller diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 9103a0ba728156..bb1143265945c2 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -1706,7 +1706,7 @@ CHIP_ERROR DeviceCommissioner::StopCommissionableDiscovery() return mDNSResolver.StopDiscovery(); } -const Dnssd::DiscoveredNodeData * DeviceCommissioner::GetDiscoveredDevice(int idx) +const Dnssd::CommissionNodeData * DeviceCommissioner::GetDiscoveredDevice(int idx) { return GetDiscoveredNode(idx); } diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index 5290a26fdfbc47..42b8a7e2481541 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -412,7 +412,7 @@ class DLL_EXPORT DeviceController : public AbstractDnssdDiscoveryController // TODO(cecille): Make this configuarable. static constexpr int kMaxCommissionableNodes = 10; - Dnssd::DiscoveredNodeData mCommissionableNodes[kMaxCommissionableNodes]; + Dnssd::CommissionNodeData mCommissionableNodes[kMaxCommissionableNodes]; DeviceControllerSystemState * mSystemState = nullptr; ControllerDeviceInitParams GetControllerDeviceInitParams(); @@ -730,7 +730,7 @@ class DLL_EXPORT DeviceCommissioner : public DeviceController, * Should be called on main loop thread. * @return const DiscoveredNodeData* info about the selected device. May be nullptr if no information has been returned yet. */ - const Dnssd::DiscoveredNodeData * GetDiscoveredDevice(int idx); + const Dnssd::CommissionNodeData * GetDiscoveredDevice(int idx); /** * @brief diff --git a/src/controller/DeviceDiscoveryDelegate.h b/src/controller/DeviceDiscoveryDelegate.h index a15acaa53cd0eb..8e82f6d32d404e 100644 --- a/src/controller/DeviceDiscoveryDelegate.h +++ b/src/controller/DeviceDiscoveryDelegate.h @@ -29,7 +29,7 @@ class DLL_EXPORT DeviceDiscoveryDelegate { public: virtual ~DeviceDiscoveryDelegate() {} - virtual void OnDiscoveredDevice(const chip::Dnssd::DiscoveredNodeData & nodeData) = 0; + virtual void OnDiscoveredDevice(const chip::Dnssd::CommissionNodeData & nodeData) = 0; }; } // namespace Controller diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index 3a995a6e93579a..c3aecbfdd36f66 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -330,24 +330,29 @@ bool SetUpCodePairer::IdIsPresent(uint16_t vendorOrProductID) return vendorOrProductID != kNotAvailable; } -bool SetUpCodePairer::NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & nodeData) const +bool SetUpCodePairer::NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & discNodeData) const { - if (nodeData.nodeData.commissioningMode == 0) + if (!discNodeData.Is()) + { + return false; + } + + const Dnssd::CommissionNodeData & nodeData = discNodeData.Get(); + if (nodeData.commissioningMode == 0) { ChipLogProgress(Controller, "Discovered device does not have an open commissioning window."); return false; } // The advertisement may not include a vendor id. - if (IdIsPresent(mPayloadVendorID) && IdIsPresent(nodeData.nodeData.vendorId) && mPayloadVendorID != nodeData.nodeData.vendorId) + if (IdIsPresent(mPayloadVendorID) && IdIsPresent(nodeData.vendorId) && mPayloadVendorID != nodeData.vendorId) { ChipLogProgress(Controller, "Discovered device does not match our vendor id."); return false; } // The advertisement may not include a product id. - if (IdIsPresent(mPayloadProductID) && IdIsPresent(nodeData.nodeData.productId) && - mPayloadProductID != nodeData.nodeData.productId) + if (IdIsPresent(mPayloadProductID) && IdIsPresent(nodeData.productId) && mPayloadProductID != nodeData.productId) { ChipLogProgress(Controller, "Discovered device does not match our product id."); return false; @@ -357,10 +362,10 @@ bool SetUpCodePairer::NodeMatchesCurrentFilter(const Dnssd::DiscoveredNodeData & switch (mCurrentFilter.type) { case Dnssd::DiscoveryFilterType::kShortDiscriminator: - discriminatorMatches = (((nodeData.nodeData.longDiscriminator >> 8) & 0x0F) == mCurrentFilter.code); + discriminatorMatches = (((nodeData.longDiscriminator >> 8) & 0x0F) == mCurrentFilter.code); break; case Dnssd::DiscoveryFilterType::kLongDiscriminator: - discriminatorMatches = (nodeData.nodeData.longDiscriminator == mCurrentFilter.code); + discriminatorMatches = (nodeData.longDiscriminator == mCurrentFilter.code); break; default: ChipLogError(Controller, "Unknown filter type; all matches will fail"); @@ -382,7 +387,7 @@ void SetUpCodePairer::NotifyCommissionableDeviceDiscovered(const Dnssd::Discover ChipLogProgress(Controller, "Discovered device to be commissioned over DNS-SD"); - NotifyCommissionableDeviceDiscovered(nodeData.resolutionData); + NotifyCommissionableDeviceDiscovered(nodeData.Get()); } void SetUpCodePairer::NotifyCommissionableDeviceDiscovered(const Dnssd::CommonResolutionData & resolutionData) diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 83c0d029d8ddb7..dd034caf2007ba 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -1839,7 +1839,7 @@ JNI_METHOD(jobject, getDiscoveredDevice)(JNIEnv * env, jobject self, jlong handl chip::DeviceLayer::StackLock lock; AndroidDeviceControllerWrapper * wrapper = AndroidDeviceControllerWrapper::FromJNIHandle(handle); - const Dnssd::DiscoveredNodeData * data = wrapper->Controller()->GetDiscoveredDevice(idx); + const Dnssd::CommissionNodeData * data = wrapper->Controller()->GetDiscoveredDevice(idx); if (data == nullptr) { @@ -1866,21 +1866,21 @@ JNI_METHOD(jobject, getDiscoveredDevice)(JNIEnv * env, jobject self, jlong handl jobject discoveredObj = env->NewObject(discoveredDeviceCls, constructor); - env->SetLongField(discoveredObj, discrminatorID, data->nodeData.longDiscriminator); + env->SetLongField(discoveredObj, discrminatorID, data->longDiscriminator); char ipAddress[100]; - data->resolutionData.ipAddress[0].ToString(ipAddress, 100); + data->ipAddress[0].ToString(ipAddress, 100); jstring jniipAdress = env->NewStringUTF(ipAddress); env->SetObjectField(discoveredObj, ipAddressID, jniipAdress); - env->SetIntField(discoveredObj, portID, static_cast(data->resolutionData.port)); - env->SetLongField(discoveredObj, deviceTypeID, static_cast(data->nodeData.deviceType)); - env->SetIntField(discoveredObj, vendorIdID, static_cast(data->nodeData.vendorId)); - env->SetIntField(discoveredObj, productIdID, static_cast(data->nodeData.productId)); + env->SetIntField(discoveredObj, portID, static_cast(data->port)); + env->SetLongField(discoveredObj, deviceTypeID, static_cast(data->deviceType)); + env->SetIntField(discoveredObj, vendorIdID, static_cast(data->vendorId)); + env->SetIntField(discoveredObj, productIdID, static_cast(data->productId)); jbyteArray jRotatingId; - CHIP_ERROR err = JniReferences::GetInstance().N2J_ByteArray(env, data->nodeData.rotatingId, - static_cast(data->nodeData.rotatingIdLen), jRotatingId); + CHIP_ERROR err = + JniReferences::GetInstance().N2J_ByteArray(env, data->rotatingId, static_cast(data->rotatingIdLen), jRotatingId); if (err != CHIP_NO_ERROR) { @@ -1888,12 +1888,12 @@ JNI_METHOD(jobject, getDiscoveredDevice)(JNIEnv * env, jobject self, jlong handl return nullptr; } env->SetObjectField(discoveredObj, rotatingIdID, static_cast(jRotatingId)); - env->SetObjectField(discoveredObj, instanceNameID, env->NewStringUTF(data->nodeData.instanceName)); - env->SetObjectField(discoveredObj, deviceNameID, env->NewStringUTF(data->nodeData.deviceName)); - env->SetObjectField(discoveredObj, pairingInstructionID, env->NewStringUTF(data->nodeData.pairingInstruction)); + env->SetObjectField(discoveredObj, instanceNameID, env->NewStringUTF(data->instanceName)); + env->SetObjectField(discoveredObj, deviceNameID, env->NewStringUTF(data->deviceName)); + env->SetObjectField(discoveredObj, pairingInstructionID, env->NewStringUTF(data->pairingInstruction)); - env->CallVoidMethod(discoveredObj, setCommissioningModeID, static_cast(data->nodeData.commissioningMode)); - env->CallVoidMethod(discoveredObj, setPairingHintID, static_cast(data->nodeData.pairingHint)); + env->CallVoidMethod(discoveredObj, setCommissioningModeID, static_cast(data->commissioningMode)); + env->CallVoidMethod(discoveredObj, setPairingHintID, static_cast(data->pairingHint)); return discoveredObj; } diff --git a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp index 39d70e350ae4db..6df32c6940667a 100644 --- a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp +++ b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp @@ -76,58 +76,54 @@ void pychip_CommissionableNodeController_PrintDiscoveredCommissioners( { for (int i = 0; i < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES; ++i) { - const chip::Dnssd::DiscoveredNodeData * dnsSdInfo = commissionableNodeCtrl->GetDiscoveredCommissioner(i); + const chip::Dnssd::CommissionNodeData * dnsSdInfo = commissionableNodeCtrl->GetDiscoveredCommissioner(i); if (dnsSdInfo == nullptr) { continue; } char rotatingId[chip::Dnssd::kMaxRotatingIdLen * 2 + 1] = ""; - Encoding::BytesToUppercaseHexString(dnsSdInfo->nodeData.rotatingId, dnsSdInfo->nodeData.rotatingIdLen, rotatingId, - sizeof(rotatingId)); + Encoding::BytesToUppercaseHexString(dnsSdInfo->rotatingId, dnsSdInfo->rotatingIdLen, rotatingId, sizeof(rotatingId)); ChipLogProgress(Discovery, "Commissioner %d", i); - ChipLogProgress(Discovery, "\tInstance name:\t\t%s", dnsSdInfo->nodeData.instanceName); - ChipLogProgress(Discovery, "\tHost name:\t\t%s", dnsSdInfo->resolutionData.hostName); - ChipLogProgress(Discovery, "\tPort:\t\t\t%u", dnsSdInfo->resolutionData.port); - ChipLogProgress(Discovery, "\tLong discriminator:\t%u", dnsSdInfo->nodeData.longDiscriminator); - ChipLogProgress(Discovery, "\tVendor ID:\t\t%u", dnsSdInfo->nodeData.vendorId); - ChipLogProgress(Discovery, "\tProduct ID:\t\t%u", dnsSdInfo->nodeData.productId); - ChipLogProgress(Discovery, "\tCommissioning Mode\t%u", dnsSdInfo->nodeData.commissioningMode); - ChipLogProgress(Discovery, "\tDevice Type\t\t%u", dnsSdInfo->nodeData.deviceType); - ChipLogProgress(Discovery, "\tDevice Name\t\t%s", dnsSdInfo->nodeData.deviceName); + ChipLogProgress(Discovery, "\tInstance name:\t\t%s", dnsSdInfo->instanceName); + ChipLogProgress(Discovery, "\tHost name:\t\t%s", dnsSdInfo->hostName); + ChipLogProgress(Discovery, "\tPort:\t\t\t%u", dnsSdInfo->port); + ChipLogProgress(Discovery, "\tLong discriminator:\t%u", dnsSdInfo->longDiscriminator); + ChipLogProgress(Discovery, "\tVendor ID:\t\t%u", dnsSdInfo->vendorId); + ChipLogProgress(Discovery, "\tProduct ID:\t\t%u", dnsSdInfo->productId); + ChipLogProgress(Discovery, "\tCommissioning Mode\t%u", dnsSdInfo->commissioningMode); + ChipLogProgress(Discovery, "\tDevice Type\t\t%u", dnsSdInfo->deviceType); + ChipLogProgress(Discovery, "\tDevice Name\t\t%s", dnsSdInfo->deviceName); ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); - ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->nodeData.pairingInstruction); - ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->nodeData.pairingHint); - if (dnsSdInfo->resolutionData.GetMrpRetryIntervalIdle().HasValue()) + ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->pairingInstruction); + ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->pairingHint); + if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) { - ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", - dnsSdInfo->resolutionData.GetMrpRetryIntervalIdle().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", dnsSdInfo->GetMrpRetryIntervalIdle().Value().count()); } else { ChipLogProgress(Discovery, "\tMrp Interval idle\tNot present"); } - if (dnsSdInfo->resolutionData.GetMrpRetryIntervalActive().HasValue()) + if (dnsSdInfo->GetMrpRetryIntervalActive().HasValue()) { - ChipLogProgress(Discovery, "\tMrp Interval active\t%u", - dnsSdInfo->resolutionData.GetMrpRetryIntervalActive().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval active\t%u", dnsSdInfo->GetMrpRetryIntervalActive().Value().count()); } else { ChipLogProgress(Discovery, "\tMrp Interval active\tNot present"); } - ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->resolutionData.supportsTcp); + ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->supportsTcp); - if (dnsSdInfo->resolutionData.isICDOperatingAsLIT.HasValue()) + if (dnsSdInfo->isICDOperatingAsLIT.HasValue()) { - ChipLogProgress(Discovery, "\tICD is operating as a\t%s", - dnsSdInfo->resolutionData.isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + ChipLogProgress(Discovery, "\tICD is operating as a\t%s", dnsSdInfo->isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); } - for (unsigned j = 0; j < dnsSdInfo->resolutionData.numIPs; ++j) + for (unsigned j = 0; j < dnsSdInfo->numIPs; ++j) { char buf[chip::Inet::IPAddress::kMaxStringLength]; - dnsSdInfo->resolutionData.ipAddress[j].ToString(buf); + dnsSdInfo->ipAddress[j].ToString(buf); ChipLogProgress(Discovery, "\tAddress %d:\t\t%s", j, buf); } } diff --git a/src/controller/python/ChipDeviceController-Discovery.cpp b/src/controller/python/ChipDeviceController-Discovery.cpp index a8896628680a8f..b7589791b41eab 100644 --- a/src/controller/python/ChipDeviceController-Discovery.cpp +++ b/src/controller/python/ChipDeviceController-Discovery.cpp @@ -40,7 +40,7 @@ bool pychip_DeviceController_HasDiscoveredCommissionableNode(Controller::DeviceC { for (int i = 0; i < devCtrl->GetMaxCommissionableNodesSupported(); ++i) { - const Dnssd::DiscoveredNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(i); + const Dnssd::CommissionNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(i); if (dnsSdInfo == nullptr) { continue; @@ -101,7 +101,7 @@ void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::De for (int i = 0; i < devCtrl->GetMaxCommissionableNodesSupported(); ++i) { - const Dnssd::DiscoveredNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(i); + const Dnssd::CommissionNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(i); if (dnsSdInfo == nullptr) { continue; @@ -110,49 +110,48 @@ void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::De Json::Value jsonVal; char rotatingId[Dnssd::kMaxRotatingIdLen * 2 + 1] = ""; - Encoding::BytesToUppercaseHexString(dnsSdInfo->nodeData.rotatingId, dnsSdInfo->nodeData.rotatingIdLen, rotatingId, - sizeof(rotatingId)); + Encoding::BytesToUppercaseHexString(dnsSdInfo->rotatingId, dnsSdInfo->rotatingIdLen, rotatingId, sizeof(rotatingId)); ChipLogProgress(Discovery, "Commissionable Node %d", i); - jsonVal["instanceName"] = dnsSdInfo->nodeData.instanceName; - jsonVal["hostName"] = dnsSdInfo->resolutionData.hostName; - jsonVal["port"] = dnsSdInfo->resolutionData.port; - jsonVal["longDiscriminator"] = dnsSdInfo->nodeData.longDiscriminator; - jsonVal["vendorId"] = dnsSdInfo->nodeData.vendorId; - jsonVal["productId"] = dnsSdInfo->nodeData.productId; - jsonVal["commissioningMode"] = dnsSdInfo->nodeData.commissioningMode; - jsonVal["deviceType"] = dnsSdInfo->nodeData.deviceType; - jsonVal["deviceName"] = dnsSdInfo->nodeData.deviceName; - jsonVal["pairingInstruction"] = dnsSdInfo->nodeData.pairingInstruction; - jsonVal["pairingHint"] = dnsSdInfo->nodeData.pairingHint; - if (dnsSdInfo->resolutionData.GetMrpRetryIntervalIdle().HasValue()) + jsonVal["instanceName"] = dnsSdInfo->instanceName; + jsonVal["hostName"] = dnsSdInfo->hostName; + jsonVal["port"] = dnsSdInfo->port; + jsonVal["longDiscriminator"] = dnsSdInfo->longDiscriminator; + jsonVal["vendorId"] = dnsSdInfo->vendorId; + jsonVal["productId"] = dnsSdInfo->productId; + jsonVal["commissioningMode"] = dnsSdInfo->commissioningMode; + jsonVal["deviceType"] = dnsSdInfo->deviceType; + jsonVal["deviceName"] = dnsSdInfo->deviceName; + jsonVal["pairingInstruction"] = dnsSdInfo->pairingInstruction; + jsonVal["pairingHint"] = dnsSdInfo->pairingHint; + if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) { - jsonVal["mrpRetryIntervalIdle"] = dnsSdInfo->resolutionData.GetMrpRetryIntervalIdle().Value().count(); + jsonVal["mrpRetryIntervalIdle"] = dnsSdInfo->GetMrpRetryIntervalIdle().Value().count(); } - if (dnsSdInfo->resolutionData.GetMrpRetryIntervalActive().HasValue()) + if (dnsSdInfo->GetMrpRetryIntervalActive().HasValue()) { - jsonVal["mrpRetryIntervalActive"] = dnsSdInfo->resolutionData.GetMrpRetryIntervalActive().Value().count(); + jsonVal["mrpRetryIntervalActive"] = dnsSdInfo->GetMrpRetryIntervalActive().Value().count(); } - if (dnsSdInfo->resolutionData.GetMrpRetryActiveThreshold().HasValue()) + if (dnsSdInfo->GetMrpRetryActiveThreshold().HasValue()) { - jsonVal["mrpRetryActiveThreshold"] = dnsSdInfo->resolutionData.GetMrpRetryActiveThreshold().Value().count(); + jsonVal["mrpRetryActiveThreshold"] = dnsSdInfo->GetMrpRetryActiveThreshold().Value().count(); } - jsonVal["supportsTcp"] = dnsSdInfo->resolutionData.supportsTcp; + jsonVal["supportsTcp"] = dnsSdInfo->supportsTcp; { Json::Value addresses; - for (unsigned j = 0; j < dnsSdInfo->resolutionData.numIPs; ++j) + for (unsigned j = 0; j < dnsSdInfo->numIPs; ++j) { char buf[Inet::IPAddress::kMaxStringLength]; - dnsSdInfo->resolutionData.ipAddress[j].ToString(buf); + dnsSdInfo->ipAddress[j].ToString(buf); addresses[j] = buf; } jsonVal["addresses"] = addresses; } - if (dnsSdInfo->resolutionData.isICDOperatingAsLIT.HasValue()) + if (dnsSdInfo->isICDOperatingAsLIT.HasValue()) { - jsonVal["isICDOperatingAsLIT"] = dnsSdInfo->resolutionData.isICDOperatingAsLIT.Value(); + jsonVal["isICDOperatingAsLIT"] = dnsSdInfo->isICDOperatingAsLIT.Value(); } - if (dnsSdInfo->nodeData.rotatingIdLen > 0) + if (dnsSdInfo->rotatingIdLen > 0) { jsonVal["rotatingId"] = rotatingId; } @@ -168,56 +167,52 @@ void pychip_DeviceController_PrintDiscoveredDevices(Controller::DeviceCommission { for (int i = 0; i < devCtrl->GetMaxCommissionableNodesSupported(); ++i) { - const Dnssd::DiscoveredNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(i); + const Dnssd::CommissionNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(i); if (dnsSdInfo == nullptr) { continue; } char rotatingId[Dnssd::kMaxRotatingIdLen * 2 + 1] = ""; - Encoding::BytesToUppercaseHexString(dnsSdInfo->nodeData.rotatingId, dnsSdInfo->nodeData.rotatingIdLen, rotatingId, - sizeof(rotatingId)); + Encoding::BytesToUppercaseHexString(dnsSdInfo->rotatingId, dnsSdInfo->rotatingIdLen, rotatingId, sizeof(rotatingId)); ChipLogProgress(Discovery, "Commissionable Node %d", i); - ChipLogProgress(Discovery, "\tInstance name:\t\t%s", dnsSdInfo->nodeData.instanceName); - ChipLogProgress(Discovery, "\tHost name:\t\t%s", dnsSdInfo->resolutionData.hostName); - ChipLogProgress(Discovery, "\tPort:\t\t\t%u", dnsSdInfo->resolutionData.port); - ChipLogProgress(Discovery, "\tLong discriminator:\t%u", dnsSdInfo->nodeData.longDiscriminator); - ChipLogProgress(Discovery, "\tVendor ID:\t\t%u", dnsSdInfo->nodeData.vendorId); - ChipLogProgress(Discovery, "\tProduct ID:\t\t%u", dnsSdInfo->nodeData.productId); - ChipLogProgress(Discovery, "\tCommissioning Mode\t%u", dnsSdInfo->nodeData.commissioningMode); - ChipLogProgress(Discovery, "\tDevice Type\t\t%u", dnsSdInfo->nodeData.deviceType); - ChipLogProgress(Discovery, "\tDevice Name\t\t%s", dnsSdInfo->nodeData.deviceName); + ChipLogProgress(Discovery, "\tInstance name:\t\t%s", dnsSdInfo->instanceName); + ChipLogProgress(Discovery, "\tHost name:\t\t%s", dnsSdInfo->hostName); + ChipLogProgress(Discovery, "\tPort:\t\t\t%u", dnsSdInfo->port); + ChipLogProgress(Discovery, "\tLong discriminator:\t%u", dnsSdInfo->longDiscriminator); + ChipLogProgress(Discovery, "\tVendor ID:\t\t%u", dnsSdInfo->vendorId); + ChipLogProgress(Discovery, "\tProduct ID:\t\t%u", dnsSdInfo->productId); + ChipLogProgress(Discovery, "\tCommissioning Mode\t%u", dnsSdInfo->commissioningMode); + ChipLogProgress(Discovery, "\tDevice Type\t\t%u", dnsSdInfo->deviceType); + ChipLogProgress(Discovery, "\tDevice Name\t\t%s", dnsSdInfo->deviceName); ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); - ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->nodeData.pairingInstruction); - ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->nodeData.pairingHint); - if (dnsSdInfo->resolutionData.GetMrpRetryIntervalIdle().HasValue()) + ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->pairingInstruction); + ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->pairingHint); + if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) { - ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", - dnsSdInfo->resolutionData.GetMrpRetryIntervalIdle().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", dnsSdInfo->GetMrpRetryIntervalIdle().Value().count()); } else { ChipLogProgress(Discovery, "\tMrp Interval idle\tNot present"); } - if (dnsSdInfo->resolutionData.GetMrpRetryIntervalActive().HasValue()) + if (dnsSdInfo->GetMrpRetryIntervalActive().HasValue()) { - ChipLogProgress(Discovery, "\tMrp Interval active\t%u", - dnsSdInfo->resolutionData.GetMrpRetryIntervalActive().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval active\t%u", dnsSdInfo->GetMrpRetryIntervalActive().Value().count()); } else { ChipLogProgress(Discovery, "\tMrp Interval active\tNot present"); } - ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->resolutionData.supportsTcp); - if (dnsSdInfo->resolutionData.isICDOperatingAsLIT.HasValue()) + ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->supportsTcp); + if (dnsSdInfo->isICDOperatingAsLIT.HasValue()) { - ChipLogProgress(Discovery, "\tICD is operating as a\t%s", - dnsSdInfo->resolutionData.isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + ChipLogProgress(Discovery, "\tICD is operating as a\t%s", dnsSdInfo->isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); } - for (unsigned j = 0; j < dnsSdInfo->resolutionData.numIPs; ++j) + for (unsigned j = 0; j < dnsSdInfo->numIPs; ++j) { char buf[Inet::IPAddress::kMaxStringLength]; - dnsSdInfo->resolutionData.ipAddress[j].ToString(buf); + dnsSdInfo->ipAddress[j].ToString(buf); ChipLogProgress(Discovery, "\tAddress %d:\t\t%s", j, buf); } } @@ -226,13 +221,13 @@ void pychip_DeviceController_PrintDiscoveredDevices(Controller::DeviceCommission bool pychip_DeviceController_GetIPForDiscoveredDevice(Controller::DeviceCommissioner * devCtrl, int idx, char * addrStr, uint32_t len) { - const Dnssd::DiscoveredNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(idx); + const Dnssd::CommissionNodeData * dnsSdInfo = devCtrl->GetDiscoveredDevice(idx); if (dnsSdInfo == nullptr) { return false; } // TODO(cecille): Select which one we actually want. - if (dnsSdInfo->resolutionData.ipAddress[0].ToString(addrStr, len) == addrStr) + if (dnsSdInfo->ipAddress[0].ToString(addrStr, len) == addrStr) { return true; } diff --git a/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.cpp b/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.cpp index a83a56c1b813f9..56b4932e9a8988 100644 --- a/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.cpp +++ b/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.cpp @@ -21,15 +21,15 @@ namespace chip { namespace Controller { -void ScriptPairingDeviceDiscoveryDelegate::OnDiscoveredDevice(const Dnssd::DiscoveredNodeData & nodeData) +void ScriptPairingDeviceDiscoveryDelegate::OnDiscoveredDevice(const Dnssd::CommissionNodeData & nodeData) { // Ignore nodes with closed comissioning window - VerifyOrReturn(nodeData.nodeData.commissioningMode != 0); + VerifyOrReturn(nodeData.commissioningMode != 0); VerifyOrReturn(mActiveDeviceCommissioner != nullptr); - const uint16_t port = nodeData.resolutionData.port; + const uint16_t port = nodeData.port; char buf[chip::Inet::IPAddress::kMaxStringLength]; - nodeData.resolutionData.ipAddress[0].ToString(buf); + nodeData.ipAddress[0].ToString(buf); ChipLogProgress(chipTool, "Discovered Device: %s:%u", buf, port); // Cancel discovery timer. @@ -38,9 +38,8 @@ void ScriptPairingDeviceDiscoveryDelegate::OnDiscoveredDevice(const Dnssd::Disco // Stop Mdns discovery. mActiveDeviceCommissioner->RegisterDeviceDiscoveryDelegate(nullptr); - Inet::InterfaceId interfaceId = - nodeData.resolutionData.ipAddress[0].IsIPv6LinkLocal() ? nodeData.resolutionData.interfaceId : Inet::InterfaceId::Null(); - auto peerAddress = Transport::PeerAddress::UDP(nodeData.resolutionData.ipAddress[0], port, interfaceId); + Inet::InterfaceId interfaceId = nodeData.ipAddress[0].IsIPv6LinkLocal() ? nodeData.interfaceId : Inet::InterfaceId::Null(); + auto peerAddress = Transport::PeerAddress::UDP(nodeData.ipAddress[0], port, interfaceId); RendezvousParameters keyExchangeParams = RendezvousParameters().SetSetupPINCode(mSetupPasscode).SetPeerAddress(peerAddress); diff --git a/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.h b/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.h index 7745bb13de4c15..944e0a0a047851 100644 --- a/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.h +++ b/src/controller/python/ChipDeviceController-ScriptPairingDeviceDiscoveryDelegate.h @@ -44,7 +44,7 @@ class ScriptPairingDeviceDiscoveryDelegate : public DeviceDiscoveryDelegate return chip::DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(discoveryTimeoutMsec), OnDiscoveredTimeout, this); } - void OnDiscoveredDevice(const Dnssd::DiscoveredNodeData & nodeData); + void OnDiscoveredDevice(const Dnssd::CommissionNodeData & nodeData); private: static void OnDiscoveredTimeout(System::Layer * layer, void * context) diff --git a/src/controller/tests/TestCommissionableNodeController.cpp b/src/controller/tests/TestCommissionableNodeController.cpp index 760b62e97386b0..5e866b4b25ea72 100644 --- a/src/controller/tests/TestCommissionableNodeController.cpp +++ b/src/controller/tests/TestCommissionableNodeController.cpp @@ -66,33 +66,35 @@ void TestGetDiscoveredCommissioner_HappyCase(nlTestSuite * inSuite, void * inCon { MockResolver resolver; CommissionableNodeController controller(&resolver); - chip::Dnssd::DiscoveredNodeData inNodeData; - Platform::CopyString(inNodeData.resolutionData.hostName, "mockHostName"); - Inet::IPAddress::FromString("192.168.1.10", inNodeData.resolutionData.ipAddress[0]); - inNodeData.resolutionData.numIPs++; - inNodeData.resolutionData.port = 5540; + chip::Dnssd::DiscoveredNodeData discNodeData; + discNodeData.Set(); + chip::Dnssd::CommissionNodeData & inNodeData = discNodeData.Get(); + Platform::CopyString(inNodeData.hostName, "mockHostName"); + Inet::IPAddress::FromString("192.168.1.10", inNodeData.ipAddress[0]); + inNodeData.numIPs++; + inNodeData.port = 5540; - controller.OnNodeDiscovered(inNodeData); + controller.OnNodeDiscovered(discNodeData); NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0) != nullptr); - NL_TEST_ASSERT( - inSuite, strcmp(inNodeData.resolutionData.hostName, controller.GetDiscoveredCommissioner(0)->resolutionData.hostName) == 0); - NL_TEST_ASSERT(inSuite, - inNodeData.resolutionData.ipAddress[0] == controller.GetDiscoveredCommissioner(0)->resolutionData.ipAddress[0]); - NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->resolutionData.port == 5540); - NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->resolutionData.numIPs == 1); + NL_TEST_ASSERT(inSuite, strcmp(inNodeData.hostName, controller.GetDiscoveredCommissioner(0)->hostName) == 0); + NL_TEST_ASSERT(inSuite, inNodeData.ipAddress[0] == controller.GetDiscoveredCommissioner(0)->ipAddress[0]); + NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->port == 5540); + NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->numIPs == 1); } void TestGetDiscoveredCommissioner_InvalidNodeDiscovered_ReturnsNullptr(nlTestSuite * inSuite, void * inContext) { MockResolver resolver; CommissionableNodeController controller(&resolver); - chip::Dnssd::DiscoveredNodeData inNodeData; - Inet::IPAddress::FromString("192.168.1.10", inNodeData.resolutionData.ipAddress[0]); - inNodeData.resolutionData.numIPs++; - inNodeData.resolutionData.port = 5540; + chip::Dnssd::DiscoveredNodeData discNodeData; + discNodeData.Set(); + chip::Dnssd::CommissionNodeData & inNodeData = discNodeData.Get(); + Inet::IPAddress::FromString("192.168.1.10", inNodeData.ipAddress[0]); + inNodeData.numIPs++; + inNodeData.port = 5540; - controller.OnNodeDiscovered(inNodeData); + controller.OnNodeDiscovered(discNodeData); for (int i = 0; i < CHIP_DEVICE_CONFIG_MAX_DISCOVERED_NODES; i++) { @@ -104,27 +106,28 @@ void TestGetDiscoveredCommissioner_HappyCase_OneValidOneInvalidNode(nlTestSuite { MockResolver resolver; CommissionableNodeController controller(&resolver); - chip::Dnssd::DiscoveredNodeData invalidNodeData, validNodeData; - Inet::IPAddress::FromString("192.168.1.10", invalidNodeData.resolutionData.ipAddress[0]); - invalidNodeData.resolutionData.numIPs++; - invalidNodeData.resolutionData.port = 5540; - - Platform::CopyString(validNodeData.resolutionData.hostName, "mockHostName2"); - Inet::IPAddress::FromString("192.168.1.11", validNodeData.resolutionData.ipAddress[0]); - validNodeData.resolutionData.numIPs++; - validNodeData.resolutionData.port = 5540; - - controller.OnNodeDiscovered(validNodeData); - controller.OnNodeDiscovered(invalidNodeData); + chip::Dnssd::DiscoveredNodeData invalidDiscNodeData, validDiscNodeData; + invalidDiscNodeData.Set(); + validDiscNodeData.Set(); + chip::Dnssd::CommissionNodeData & invalidNodeData = invalidDiscNodeData.Get(); + chip::Dnssd::CommissionNodeData & validNodeData = validDiscNodeData.Get(); + Inet::IPAddress::FromString("192.168.1.10", invalidNodeData.ipAddress[0]); + invalidNodeData.numIPs++; + invalidNodeData.port = 5540; + + Platform::CopyString(validNodeData.hostName, "mockHostName2"); + Inet::IPAddress::FromString("192.168.1.11", validNodeData.ipAddress[0]); + validNodeData.numIPs++; + validNodeData.port = 5540; + + controller.OnNodeDiscovered(validDiscNodeData); + controller.OnNodeDiscovered(invalidDiscNodeData); NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0) != nullptr); - NL_TEST_ASSERT( - inSuite, - strcmp(validNodeData.resolutionData.hostName, controller.GetDiscoveredCommissioner(0)->resolutionData.hostName) == 0); - NL_TEST_ASSERT( - inSuite, validNodeData.resolutionData.ipAddress[0] == controller.GetDiscoveredCommissioner(0)->resolutionData.ipAddress[0]); - NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->resolutionData.port == 5540); - NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->resolutionData.numIPs == 1); + NL_TEST_ASSERT(inSuite, strcmp(validNodeData.hostName, controller.GetDiscoveredCommissioner(0)->hostName) == 0); + NL_TEST_ASSERT(inSuite, validNodeData.ipAddress[0] == controller.GetDiscoveredCommissioner(0)->ipAddress[0]); + NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->port == 5540); + NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(0)->numIPs == 1); NL_TEST_ASSERT(inSuite, controller.GetDiscoveredCommissioner(1) == nullptr); } diff --git a/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm b/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm index bf975b672decd5..2b3e2814ecd220 100644 --- a/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm +++ b/src/darwin/Framework/CHIP/MTRCommissionableBrowser.mm @@ -161,7 +161,12 @@ void OnNodeDiscovered(const DiscoveredNodeData & nodeData) override { assertChipStackLockedByCurrentThread(); - auto & commissionData = nodeData.nodeData; + if (!nodeData.Is()) { + // not commissionable/commissioners node + return; + } + + auto & commissionData = nodeData.Get(); auto key = [NSString stringWithUTF8String:commissionData.instanceName]; if ([mDiscoveredResults objectForKey:key] == nil) { // It should not happens. @@ -175,7 +180,7 @@ void OnNodeDiscovered(const DiscoveredNodeData & nodeData) override result.discriminator = @(commissionData.longDiscriminator); result.commissioningMode = commissionData.commissioningMode != 0; - auto & resolutionData = nodeData.resolutionData; + const CommonResolutionData & resolutionData = commissionData; auto * interfaces = result.interfaces; interfaces[@(resolutionData.interfaceId.GetPlatformInterface())].resolutionData = chip::MakeOptional(resolutionData); diff --git a/src/lib/dnssd/ActiveResolveAttempts.h b/src/lib/dnssd/ActiveResolveAttempts.h index 1d87bbbba49cbc..55790bd1e3821e 100644 --- a/src/lib/dnssd/ActiveResolveAttempts.h +++ b/src/lib/dnssd/ActiveResolveAttempts.h @@ -153,23 +153,24 @@ class ActiveResolveAttempts { return false; } + auto & nodeData = data.Get(); switch (browse.filter.type) { case chip::Dnssd::DiscoveryFilterType::kNone: return true; case chip::Dnssd::DiscoveryFilterType::kShortDiscriminator: - return browse.filter.code == static_cast((data.nodeData.longDiscriminator >> 8) & 0x0F); + return browse.filter.code == static_cast((nodeData.longDiscriminator >> 8) & 0x0F); case chip::Dnssd::DiscoveryFilterType::kLongDiscriminator: - return browse.filter.code == data.nodeData.longDiscriminator; + return browse.filter.code == nodeData.longDiscriminator; case chip::Dnssd::DiscoveryFilterType::kVendorId: - return browse.filter.code == data.nodeData.vendorId; + return browse.filter.code == nodeData.vendorId; case chip::Dnssd::DiscoveryFilterType::kDeviceType: - return browse.filter.code == data.nodeData.deviceType; + return browse.filter.code == nodeData.deviceType; case chip::Dnssd::DiscoveryFilterType::kCommissioningMode: - return browse.filter.code == data.nodeData.commissioningMode; + return browse.filter.code == nodeData.commissioningMode; case chip::Dnssd::DiscoveryFilterType::kInstanceName: - return strncmp(browse.filter.instanceName, data.nodeData.instanceName, + return strncmp(browse.filter.instanceName, nodeData.instanceName, chip::Dnssd::Commission::kInstanceNameMaxLength + 1) == 0; case chip::Dnssd::DiscoveryFilterType::kCommissioner: case chip::Dnssd::DiscoveryFilterType::kCompressedFabricId: diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index c12019ca60b5fd..2b6b6cd470c618 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -51,7 +51,7 @@ static void HandleNodeResolve(void * context, DnssdService * result, const Span< DiscoveredNodeData nodeData; result->ToDiscoveredNodeData(addresses, nodeData); - nodeData.LogDetail(); + nodeData.Get().LogDetail(); discoveryContext->OnNodeDiscovered(nodeData); discoveryContext->Release(); } @@ -339,37 +339,37 @@ void DiscoveryImplPlatform::HandleNodeIdResolve(void * context, DnssdService * r void DnssdService::ToDiscoveredNodeData(const Span & addresses, DiscoveredNodeData & nodeData) { - auto & resolutionData = nodeData.resolutionData; - auto & commissionData = nodeData.nodeData; + nodeData.Set(); + auto & discoveredData = nodeData.Get(); - Platform::CopyString(resolutionData.hostName, mHostName); - Platform::CopyString(commissionData.instanceName, mName); + Platform::CopyString(discoveredData.hostName, mHostName); + Platform::CopyString(discoveredData.instanceName, mName); IPAddressSorter::Sort(addresses, mInterface); size_t addressesFound = 0; for (auto & ip : addresses) { - if (addressesFound == ArraySize(resolutionData.ipAddress)) + if (addressesFound == ArraySize(discoveredData.ipAddress)) { // Out of space. ChipLogProgress(Discovery, "Can't add more IPs to DiscoveredNodeData"); break; } - resolutionData.ipAddress[addressesFound] = ip; + discoveredData.ipAddress[addressesFound] = ip; ++addressesFound; } - resolutionData.interfaceId = mInterface; - resolutionData.numIPs = addressesFound; - resolutionData.port = mPort; + discoveredData.interfaceId = mInterface; + discoveredData.numIPs = addressesFound; + discoveredData.port = mPort; for (size_t i = 0; i < mTextEntrySize; ++i) { ByteSpan key(reinterpret_cast(mTextEntries[i].mKey), strlen(mTextEntries[i].mKey)); ByteSpan val(mTextEntries[i].mData, mTextEntries[i].mDataSize); - FillNodeDataFromTxt(key, val, resolutionData); - FillNodeDataFromTxt(key, val, commissionData); + FillNodeDataFromTxt(key, val, discoveredData); + FillNodeDataFromTxt(key, val, discoveredData); } } diff --git a/src/lib/dnssd/IncrementalResolve.cpp b/src/lib/dnssd/IncrementalResolve.cpp index 766d979e33a4ba..f083f852d7402f 100644 --- a/src/lib/dnssd/IncrementalResolve.cpp +++ b/src/lib/dnssd/IncrementalResolve.cpp @@ -189,7 +189,7 @@ CHIP_ERROR IncrementalResolver::InitializeParsing(mdns::Minimal::SerializedQName break; case ServiceNameType::kCommissioner: case ServiceNameType::kCommissionable: - mSpecificResolutionData.Set(); + mSpecificResolutionData.Set(); { // Commission addresses start with instance name @@ -199,10 +199,10 @@ CHIP_ERROR IncrementalResolver::InitializeParsing(mdns::Minimal::SerializedQName return CHIP_ERROR_INVALID_ARGUMENT; } - Platform::CopyString(mSpecificResolutionData.Get().instanceName, nameCopy.Value()); + Platform::CopyString(mSpecificResolutionData.Get().instanceName, nameCopy.Value()); } - LogFoundCommissionSrvRecord(mSpecificResolutionData.Get().instanceName, mTargetHostName.Get()); + LogFoundCommissionSrvRecord(mSpecificResolutionData.Get().instanceName, mTargetHostName.Get()); break; default: return CHIP_ERROR_INVALID_ARGUMENT; @@ -306,7 +306,7 @@ CHIP_ERROR IncrementalResolver::OnTxtRecord(const ResourceData & data, BytesRang if (IsActiveBrowseParse()) { - TxtParser delegate(mSpecificResolutionData.Get()); + TxtParser delegate(mSpecificResolutionData.Get()); if (!ParseTxtRecord(data.GetData(), &delegate)) { return CHIP_ERROR_INVALID_ARGUMENT; @@ -347,8 +347,11 @@ CHIP_ERROR IncrementalResolver::Take(DiscoveredNodeData & outputData) IPAddressSorter::Sort(mCommonResolutionData.ipAddress, mCommonResolutionData.numIPs, mCommonResolutionData.interfaceId); - outputData.resolutionData = mCommonResolutionData; - outputData.nodeData = mSpecificResolutionData.Get(); + outputData.Set(); + CommissionNodeData & nodeData = outputData.Get(); + nodeData = mSpecificResolutionData.Get(); + CommonResolutionData & resolutionData = nodeData; + resolutionData = mCommonResolutionData; ResetToInactive(); diff --git a/src/lib/dnssd/IncrementalResolve.h b/src/lib/dnssd/IncrementalResolve.h index 17790b6f9f5fe0..4a8bc0c5792ee3 100644 --- a/src/lib/dnssd/IncrementalResolve.h +++ b/src/lib/dnssd/IncrementalResolve.h @@ -100,7 +100,7 @@ class IncrementalResolver /// method. bool IsActive() const { return mSpecificResolutionData.Valid(); } - bool IsActiveBrowseParse() const { return mSpecificResolutionData.Is(); } + bool IsActiveBrowseParse() const { return mSpecificResolutionData.Is(); } bool IsActiveOperationalParse() const { return mSpecificResolutionData.Is(); } ServiceNameType GetCurrentType() const { return mServiceNameType; } @@ -185,7 +185,7 @@ class IncrementalResolver /// Prerequisite: IP address belongs to the right nost name CHIP_ERROR OnIpAddress(Inet::InterfaceId interface, const Inet::IPAddress & addr); - using ParsedRecordSpecificData = Variant; + using ParsedRecordSpecificData = Variant; StoredServerName mRecordName; // Record name for what is parsed (SRV/PTR/TXT) StoredServerName mTargetHostName; // `Target` for the SRV record diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 3abc11ac659cf8..403da6effcd36c 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -425,12 +425,10 @@ void MinMdnsResolver::AdvancePendingResolverStates() case IncrementalResolver::ServiceNameType::kCommissioner: discoveredNodeIsRelevant = mActiveResolves.HasBrowseFor(chip::Dnssd::DiscoveryType::kCommissionerNode); mActiveResolves.CompleteCommissioner(nodeData); - nodeData.nodeType = DiscoveryType::kCommissionerNode; break; case IncrementalResolver::ServiceNameType::kCommissionable: discoveredNodeIsRelevant = mActiveResolves.HasBrowseFor(chip::Dnssd::DiscoveryType::kCommissionableNode); mActiveResolves.CompleteCommissionable(nodeData); - nodeData.nodeType = DiscoveryType::kCommissionableNode; break; default: ChipLogError(Discovery, "Unexpected type for browse data parsing"); diff --git a/src/lib/dnssd/TxtFields.cpp b/src/lib/dnssd/TxtFields.cpp index c4ec70e342d41a..88a116871ca017 100644 --- a/src/lib/dnssd/TxtFields.cpp +++ b/src/lib/dnssd/TxtFields.cpp @@ -225,7 +225,7 @@ TxtFieldKey GetTxtFieldKey(const ByteSpan & key) } // namespace Internal -void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & val, DnssdNodeData & nodeData) +void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & val, CommissionNodeData & nodeData) { TxtFieldKey keyType = Internal::GetTxtFieldKey(key); switch (keyType) diff --git a/src/lib/dnssd/TxtFields.h b/src/lib/dnssd/TxtFields.h index 194750451289a4..5546493624119d 100644 --- a/src/lib/dnssd/TxtFields.h +++ b/src/lib/dnssd/TxtFields.h @@ -192,7 +192,7 @@ constexpr size_t ValSize(TxtFieldKey key) } void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & value, CommonResolutionData & nodeData); -void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & value, DnssdNodeData & nodeData); +void FillNodeDataFromTxt(const ByteSpan & key, const ByteSpan & value, CommissionNodeData & nodeData); } // namespace Dnssd } // namespace chip diff --git a/src/lib/dnssd/Types.h b/src/lib/dnssd/Types.h index 43e55bfbc65e0e..e62c9a52418efe 100644 --- a/src/lib/dnssd/Types.h +++ b/src/lib/dnssd/Types.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -205,7 +206,7 @@ inline constexpr size_t kMaxRotatingIdLen = 50; inline constexpr size_t kMaxPairingInstructionLen = 128; /// Data that is specific to commisionable/commissioning node discovery -struct DnssdNodeData +struct CommissionNodeData : public CommonResolutionData { size_t rotatingIdLen = 0; uint32_t deviceType = 0; @@ -220,19 +221,22 @@ struct DnssdNodeData char deviceName[kMaxDeviceNameLen + 1] = {}; char pairingInstruction[kMaxPairingInstructionLen + 1] = {}; - DnssdNodeData() {} + CommissionNodeData() {} void Reset() { // Let constructor clear things as default - this->~DnssdNodeData(); - new (this) DnssdNodeData(); + this->~CommissionNodeData(); + new (this) CommissionNodeData(); } bool IsInstanceName(const char * instance) const { return strcmp(instance, instanceName) == 0; } void LogDetail() const { + ChipLogDetail(Discovery, "Discovered commissionable/commissioner node:"); + CommonResolutionData::LogDetail(); + if (rotatingIdLen > 0) { char rotatingIdString[chip::Dnssd::kMaxRotatingIdLen * 2 + 1] = ""; @@ -293,27 +297,7 @@ struct ResolvedNodeData } }; -struct DiscoveredNodeData -{ - CommonResolutionData resolutionData; - DnssdNodeData nodeData; - DiscoveryType nodeType; - - void Reset() - { - resolutionData.Reset(); - nodeData.Reset(); - nodeType = DiscoveryType::kUnknown; - } - DiscoveredNodeData() { Reset(); } - - void LogDetail() const - { - ChipLogDetail(Discovery, "Discovered node:"); - resolutionData.LogDetail(); - nodeData.LogDetail(); - } -}; +using DiscoveredNodeData = Variant; /// Callbacks for discovering nodes advertising non-operational status: /// - Commissioners diff --git a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp index 58c1cf86dab511..4c2665658f3493 100644 --- a/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp +++ b/src/lib/dnssd/tests/TestActiveResolveAttempts.cpp @@ -124,7 +124,8 @@ TEST(TestActiveResolveAttempts, TestSingleBrowseAddRemove) // once complete, nothing to schedule Dnssd::DiscoveredNodeData data; - data.nodeData.longDiscriminator = 1234; + data.Set(); + data.Get().longDiscriminator = 1234; attempts.CompleteCommissionable(data); EXPECT_FALSE(attempts.GetTimeUntilNextExpectedResponse().HasValue()); EXPECT_FALSE(attempts.NextScheduled().HasValue()); @@ -372,7 +373,8 @@ TEST(TestActiveResolveAttempts, TestCombination) attempts.Complete(MakePeerId(2)); attempts.Complete(MakePeerId(1)); Dnssd::DiscoveredNodeData data; - data.nodeData.longDiscriminator = 1234; + data.Set(); + data.Get().longDiscriminator = 1234; attempts.CompleteCommissionable(data); EXPECT_FALSE(attempts.GetTimeUntilNextExpectedResponse().HasValue()); diff --git a/src/lib/dnssd/tests/TestIncrementalResolve.cpp b/src/lib/dnssd/tests/TestIncrementalResolve.cpp index 646e4abfe38303..5ed4191319e824 100644 --- a/src/lib/dnssd/tests/TestIncrementalResolve.cpp +++ b/src/lib/dnssd/tests/TestIncrementalResolve.cpp @@ -385,28 +385,31 @@ TEST(TestIncrementalResolve, TestParseCommissionable) EXPECT_FALSE(resolver.GetMissingRequiredInformation().HasAny()); // At this point taking value should work. Once taken, the resolver is reset. - DiscoveredNodeData nodeData; - EXPECT_EQ(resolver.Take(nodeData), CHIP_NO_ERROR); + DiscoveredNodeData discoveredNodeData; + EXPECT_TRUE(resolver.Take(discoveredNodeData) == CHIP_NO_ERROR); EXPECT_FALSE(resolver.IsActive()); + EXPECT_TRUE(discoveredNodeData.Is()); + CommissionNodeData nodeData = discoveredNodeData.Get(); + // validate data as it was passed in - EXPECT_EQ(nodeData.resolutionData.numIPs, 2u); - EXPECT_EQ(nodeData.resolutionData.port, 0x1234); - EXPECT_FALSE(nodeData.resolutionData.supportsTcp); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalActive().Value(), chip::System::Clock::Milliseconds32(321)); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_EQ(nodeData.numIPs, 2u); + EXPECT_EQ(nodeData.port, 0x1234); + EXPECT_FALSE(nodeData.supportsTcp); + EXPECT_TRUE(nodeData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_EQ(nodeData.GetMrpRetryIntervalActive().Value(), chip::System::Clock::Milliseconds32(321)); + EXPECT_FALSE(nodeData.GetMrpRetryIntervalIdle().HasValue()); Inet::IPAddress addr; EXPECT_TRUE(Inet::IPAddress::FromString("fe80::abcd:ef11:2233:4455", addr)); - EXPECT_EQ(nodeData.resolutionData.ipAddress[0], addr); + EXPECT_EQ(nodeData.ipAddress[0], addr); EXPECT_TRUE(Inet::IPAddress::FromString("fe80::f0f1:f2f3:f4f5:1234", addr)); - EXPECT_EQ(nodeData.resolutionData.ipAddress[1], addr); + EXPECT_EQ(nodeData.ipAddress[1], addr); // parsed txt data for discovered nodes - EXPECT_EQ(nodeData.nodeData.longDiscriminator, 22345); - EXPECT_EQ(nodeData.nodeData.vendorId, 321); - EXPECT_EQ(nodeData.nodeData.productId, 654); - EXPECT_STREQ(nodeData.nodeData.deviceName, "mytest"); + EXPECT_EQ(nodeData.longDiscriminator, 22345); + EXPECT_EQ(nodeData.vendorId, 321); + EXPECT_EQ(nodeData.productId, 654); + EXPECT_STREQ(nodeData.deviceName, "mytest"); } } // namespace diff --git a/src/lib/dnssd/tests/TestTxtFields.cpp b/src/lib/dnssd/tests/TestTxtFields.cpp index d487c261346c05..ce206e34ae46aa 100644 --- a/src/lib/dnssd/tests/TestTxtFields.cpp +++ b/src/lib/dnssd/tests/TestTxtFields.cpp @@ -300,23 +300,21 @@ TEST(TestTxtFields, TestGetCommissionerPasscode) EXPECT_EQ(GetCommissionerPasscode(GetSpan(cm)), 0); } -bool NodeDataIsEmpty(const DiscoveredNodeData & node) +bool NodeDataIsEmpty(const CommissionNodeData & node) { - if (node.nodeData.longDiscriminator != 0 || node.nodeData.vendorId != 0 || node.nodeData.productId != 0 || - node.nodeData.commissioningMode != 0 || node.nodeData.deviceType != 0 || node.nodeData.rotatingIdLen != 0 || - node.nodeData.pairingHint != 0 || node.resolutionData.mrpRetryIntervalIdle.HasValue() || - node.resolutionData.mrpRetryIntervalActive.HasValue() || node.resolutionData.mrpRetryActiveThreshold.HasValue() || - node.resolutionData.isICDOperatingAsLIT.HasValue() || node.resolutionData.supportsTcp || - node.nodeData.supportsCommissionerGeneratedPasscode != 0) + if (node.longDiscriminator != 0 || node.vendorId != 0 || node.productId != 0 || node.commissioningMode != 0 || + node.deviceType != 0 || node.rotatingIdLen != 0 || node.pairingHint != 0 || node.mrpRetryIntervalIdle.HasValue() || + node.mrpRetryIntervalActive.HasValue() || node.mrpRetryActiveThreshold.HasValue() || node.isICDOperatingAsLIT.HasValue() || + node.supportsTcp || node.supportsCommissionerGeneratedPasscode != 0) { return false; } - if (strcmp(node.nodeData.deviceName, "") != 0 || strcmp(node.nodeData.pairingInstruction, "") != 0) + if (strcmp(node.deviceName, "") != 0 || strcmp(node.pairingInstruction, "") != 0) { return false; } - for (uint8_t id : node.nodeData.rotatingId) + for (uint8_t id : node.rotatingId) { if (id != 0) { @@ -331,83 +329,82 @@ TEST(TestTxtFields, TestFillDiscoveredNodeDataFromTxt) { char key[3]; char val[16]; - DiscoveredNodeData filled; + CommissionNodeData filled; // Long discriminator strcpy(key, "D"); strcpy(val, "840"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_EQ(filled.nodeData.longDiscriminator, 840); - filled.nodeData.longDiscriminator = 0; + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_EQ(filled.longDiscriminator, 840); + filled.longDiscriminator = 0; EXPECT_TRUE(NodeDataIsEmpty(filled)); // vendor and product strcpy(key, "VP"); strcpy(val, "123+456"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_EQ(filled.nodeData.vendorId, 123); - EXPECT_EQ(filled.nodeData.productId, 456); - filled.nodeData.vendorId = 0; - filled.nodeData.productId = 0; + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_EQ(filled.vendorId, 123); + EXPECT_EQ(filled.productId, 456); + filled.vendorId = 0; + filled.productId = 0; EXPECT_TRUE(NodeDataIsEmpty(filled)); // Commissioning mode strcpy(key, "CM"); strcpy(val, "1"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_EQ(filled.nodeData.commissioningMode, 1); - filled.nodeData.commissioningMode = 0; + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_EQ(filled.commissioningMode, 1); + filled.commissioningMode = 0; EXPECT_TRUE(NodeDataIsEmpty(filled)); - // Supports Commissioner Generated Passcode strcpy(key, "CP"); strcpy(val, "1"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_TRUE(filled.nodeData.supportsCommissionerGeneratedPasscode); - filled.nodeData.supportsCommissionerGeneratedPasscode = false; + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_TRUE(filled.supportsCommissionerGeneratedPasscode); + filled.supportsCommissionerGeneratedPasscode = false; EXPECT_TRUE(NodeDataIsEmpty(filled)); // Device type strcpy(key, "DT"); strcpy(val, "1"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_EQ(filled.nodeData.deviceType, 1u); - filled.nodeData.deviceType = 0; + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_EQ(filled.deviceType, 1u); + filled.deviceType = 0; EXPECT_TRUE(NodeDataIsEmpty(filled)); // Device name strcpy(key, "DN"); strcpy(val, "abc"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_STREQ(filled.nodeData.deviceName, "abc"); - memset(filled.nodeData.deviceName, 0, sizeof(filled.nodeData.deviceName)); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_STREQ(filled.deviceName, "abc"); + memset(filled.deviceName, 0, sizeof(filled.deviceName)); EXPECT_TRUE(NodeDataIsEmpty(filled)); // Rotating device id strcpy(key, "RI"); strcpy(val, "1A2B"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_EQ(filled.nodeData.rotatingId[0], 0x1A); - EXPECT_EQ(filled.nodeData.rotatingId[1], 0x2B); - EXPECT_EQ(filled.nodeData.rotatingIdLen, 2u); - filled.nodeData.rotatingIdLen = 0; - memset(filled.nodeData.rotatingId, 0, sizeof(filled.nodeData.rotatingId)); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_EQ(filled.rotatingId[0], 0x1A); + EXPECT_EQ(filled.rotatingId[1], 0x2B); + EXPECT_EQ(filled.rotatingIdLen, 2u); + filled.rotatingIdLen = 0; + memset(filled.rotatingId, 0, sizeof(filled.rotatingId)); EXPECT_TRUE(NodeDataIsEmpty(filled)); // Pairing instruction strcpy(key, "PI"); strcpy(val, "hint"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_STREQ(filled.nodeData.pairingInstruction, "hint"); - memset(filled.nodeData.pairingInstruction, 0, sizeof(filled.nodeData.pairingInstruction)); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_STREQ(filled.pairingInstruction, "hint"); + memset(filled.pairingInstruction, 0, sizeof(filled.pairingInstruction)); EXPECT_TRUE(NodeDataIsEmpty(filled)); // Pairing hint strcpy(key, "PH"); strcpy(val, "1"); - FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled.nodeData); - EXPECT_EQ(filled.nodeData.pairingHint, 1); - filled.nodeData.pairingHint = 0; + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), filled); + EXPECT_EQ(filled.pairingHint, 1); + filled.pairingHint = 0; EXPECT_TRUE(NodeDataIsEmpty(filled)); } @@ -421,7 +418,7 @@ bool NodeDataIsEmpty(const ResolvedNodeData & nodeData) void ResetRetryIntervalIdle(DiscoveredNodeData & nodeData) { - nodeData.resolutionData.mrpRetryIntervalIdle.ClearValue(); + nodeData.Get().mrpRetryIntervalIdle.ClearValue(); } void ResetRetryIntervalIdle(ResolvedNodeData & nodeData) @@ -431,7 +428,7 @@ void ResetRetryIntervalIdle(ResolvedNodeData & nodeData) void ResetRetryIntervalActive(DiscoveredNodeData & nodeData) { - nodeData.resolutionData.mrpRetryIntervalActive.ClearValue(); + nodeData.Get().mrpRetryIntervalActive.ClearValue(); } void ResetRetryIntervalActive(ResolvedNodeData & nodeData) @@ -441,7 +438,7 @@ void ResetRetryIntervalActive(ResolvedNodeData & nodeData) void ResetRetryActiveThreshold(DiscoveredNodeData & nodeData) { - nodeData.resolutionData.mrpRetryActiveThreshold.ClearValue(); + nodeData.Get().mrpRetryActiveThreshold.ClearValue(); } void ResetRetryActiveThreshold(ResolvedNodeData & nodeData) @@ -449,6 +446,326 @@ void ResetRetryActiveThreshold(ResolvedNodeData & nodeData) nodeData.resolutionData.mrpRetryActiveThreshold.ClearValue(); } +template +void DiscoveredTxtFieldSessionIdleInterval() +{ + char key[4]; + char val[16]; + DiscoveredNodeData nodeData; + nodeData.Set(); + CommonResolutionData & resolutionData = nodeData.Get(); + + // Minimum + strcpy(key, "SII"); + strcpy(val, "1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().Value() == 1_ms32); + + // Maximum + strcpy(key, "SII"); + strcpy(val, "3600000"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().Value() == 3600000_ms32); + + // Test no other fields were populated + ResetRetryIntervalIdle(nodeData); + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + + // Invalid SII - negative value + strcpy(key, "SII"); + strcpy(val, "-1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + + // Invalid SII - greater than maximum + strcpy(key, "SII"); + strcpy(val, "3600001"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + + // Invalid SII - much greater than maximum + strcpy(key, "SII"); + strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + + // Invalid SII - hexadecimal value + strcpy(key, "SII"); + strcpy(val, "0x20"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + + // Invalid SII - leading zeros + strcpy(key, "SII"); + strcpy(val, "0700"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + + // Invalid SII - text at the end + strcpy(key, "SII"); + strcpy(val, "123abc"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); +} + +// Test SAI (formerly CRA) +template +void DiscoveredTxtFieldSessionActiveInterval() +{ + char key[4]; + char val[16]; + DiscoveredNodeData nodeData; + nodeData.Set(); + CommonResolutionData & resolutionData = nodeData.Get(); + + // Minimum + strcpy(key, "SAI"); + strcpy(val, "1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().Value() == 1_ms32); + + // Maximum + strcpy(key, "SAI"); + strcpy(val, "3600000"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().Value() == 3600000_ms32); + + // Test no other fields were populated + ResetRetryIntervalActive(nodeData); + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + + // Invalid SAI - negative value + strcpy(key, "SAI"); + strcpy(val, "-1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + + // Invalid SAI - greater than maximum + strcpy(key, "SAI"); + strcpy(val, "3600001"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + + // Invalid SAI - much greater than maximum + strcpy(key, "SAI"); + strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + + // Invalid SAI - hexadecimal value + strcpy(key, "SAI"); + strcpy(val, "0x20"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + + // Invalid SAI - leading zeros + strcpy(key, "SAI"); + strcpy(val, "0700"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + + // Invalid SAI - text at the end + strcpy(key, "SAI"); + strcpy(val, "123abc"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); +} + +// Test SAT (Session Active Threshold) +template +void DiscoveredTxtFieldSessionActiveThreshold() +{ + char key[4]; + char val[16]; + DiscoveredNodeData nodeData; + nodeData.Set(); + CommonResolutionData & resolutionData = nodeData.Get(); + + // Minimum + strcpy(key, "SAT"); + strcpy(val, "1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().Value() == 1_ms16); + + // Maximum + strcpy(key, "SAT"); + strcpy(val, "65535"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().Value() == 65535_ms16); + + // Test no other fields were populated + ResetRetryActiveThreshold(nodeData); + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + + // Invalid SAI - negative value + strcpy(key, "SAT"); + strcpy(val, "-1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + + // Invalid SAI - greater than maximum + strcpy(key, "SAT"); + strcpy(val, "65536"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + + // Invalid SAT - much greater than maximum + strcpy(key, "SAT"); + strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + + // Invalid SAT - hexadecimal value + strcpy(key, "SAT"); + strcpy(val, "0x20"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + + // Invalid SAT - leading zeros + strcpy(key, "SAT"); + strcpy(val, "0700"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + + // Invalid SAT - text at the end + strcpy(key, "SAT"); + strcpy(val, "123abc"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); +} + +// Test T (TCP support) +template +void DiscoveredTxtFieldTcpSupport() +{ + char key[4]; + char val[8]; + DiscoveredNodeData nodeData; + nodeData.Set(); + CommonResolutionData & resolutionData = nodeData.Get(); + + // True + strcpy(key, "T"); + strcpy(val, "1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcp); + + // Test no other fields were populated + nodeData.Get().supportsTcp = false; + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + + // False + strcpy(key, "T"); + strcpy(val, "0"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcp == false); + + // Invalid value, stil false + strcpy(key, "T"); + strcpy(val, "asdf"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().supportsTcp == false); +} + +// Test ICD (ICD operation Mode) +template +void DiscoveredTxtFieldICDoperatesAsLIT() +{ + char key[4]; + char val[16]; + DiscoveredNodeData nodeData; + nodeData.Set(); + CommonResolutionData & resolutionData = nodeData.Get(); + + // ICD is operating as a LIT device + strcpy(key, "ICD"); + strcpy(val, "1"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.HasValue()); + EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.Value()); + + // Test no other fields were populated + nodeData.Get().isICDOperatingAsLIT.ClearValue(); + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + + // ICD is operating as a SIT device + strcpy(key, "ICD"); + strcpy(val, "0"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.HasValue()); + EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.Value() == false); + + nodeData.Get().isICDOperatingAsLIT.ClearValue(); + EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); + // Invalid value, No key set + strcpy(key, "ICD"); + strcpy(val, "asdf"); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.HasValue() == false); +} + +// Test IsDeviceTreatedAsSleepy() with CRI +template +void DiscoveredTestIsDeviceSessionIdle() +{ + char key[4]; + char val[32]; + DiscoveredNodeData nodeData; + nodeData.Set(); + const ReliableMessageProtocolConfig defaultMRPConfig(CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL, + CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL); + CommonResolutionData & resolutionData = nodeData.Get(); + + // No key/val set, so the device can't be sleepy + EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + + // If the interval is the default value, the device is not sleepy + strcpy(key, "SII"); + sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL.count())); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + + // If the interval is greater than the default value, the device is sleepy + sprintf(key, "SII"); + sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL.count() + 1)); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); +} + +// Test IsDeviceTreatedAsSleepy() with CRA +template +void DiscoveredTestIsDeviceSessionActive() +{ + char key[4]; + char val[32]; + DiscoveredNodeData nodeData; + nodeData.Set(); + const ReliableMessageProtocolConfig defaultMRPConfig(CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL, + CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL); + CommonResolutionData & resolutionData = nodeData.Get(); + + // No key/val set, so the device can't be sleepy + EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + + // If the interval is the default value, the device is not sleepy + sprintf(key, "SAI"); + sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL.count())); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + + // If the interval is greater than the default value, the device is sleepy + strcpy(key, "SAI"); + sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL.count() + 1)); + FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); + EXPECT_TRUE(nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); +} + // Test SAI (formally CRI) template void TxtFieldSessionIdleInterval() @@ -514,7 +831,7 @@ void TxtFieldSessionIdleInterval() TEST(TestTxtFields, TxtDiscoveredFieldMrpRetryIntervalIdle) { - TxtFieldSessionIdleInterval(); + DiscoveredTxtFieldSessionIdleInterval(); } TEST(TestTxtFields, TxtResolvedFieldMrpRetryIntervalIdle) @@ -587,7 +904,7 @@ void TxtFieldSessionActiveInterval() TEST(TestTxtFields, TxtDiscoveredFieldMrpRetryIntervalActive) { - TxtFieldSessionActiveInterval(); + DiscoveredTxtFieldSessionActiveInterval(); } TEST(TestTxtFields, TxtResolvedFieldMrpRetryIntervalActive) @@ -660,7 +977,7 @@ void TxtFieldSessionActiveThreshold() TEST(TestTxtFields, TxtDiscoveredFieldMrpRetryActiveThreshold) { - TxtFieldSessionActiveThreshold(); + DiscoveredTxtFieldSessionActiveThreshold(); } TEST(TestTxtFields, TxtResolvedFieldMrpRetryActiveThreshold) @@ -701,7 +1018,7 @@ void TxtFieldTcpSupport() TEST(TestTxtFields, TxtDiscoveredFieldTcpSupport) { - TxtFieldTcpSupport(); + DiscoveredTxtFieldTcpSupport(); } TEST(TestTxtFields, TxtResolvedFieldTcpSupport) @@ -746,7 +1063,7 @@ void TxtFieldICDoperatesAsLIT() TEST(TestTxtFields, TxtDiscoveredIsICDoperatingAsLIT) { - TxtFieldICDoperatesAsLIT(); + DiscoveredTxtFieldICDoperatesAsLIT(); } TEST(TestTxtFields, TxtResolvedFieldICDoperatingAsLIT) @@ -782,7 +1099,7 @@ void TestIsDeviceSessionIdle() TEST(TestTxtFields, TxtDiscoveredIsDeviceSessionIdle) { - TestIsDeviceSessionIdle(); + DiscoveredTestIsDeviceSessionIdle(); } TEST(TestTxtFields, TxtResolvedIsDeviceSessionIdle) @@ -818,7 +1135,7 @@ void TestIsDeviceSessionActive() TEST(TestTxtFields, TxtDiscoveredIsDeviceSessionActive) { - TestIsDeviceSessionActive(); + DiscoveredTestIsDeviceSessionActive(); } TEST(TestTxtFields, TxtResolvedIsDeviceSessionActive) diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index ff9edad52445a5..04d82313d7d3d4 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -83,61 +83,66 @@ class DnsShellResolverDelegate : public Dnssd::DiscoverNodeDelegate, public Addr AddressResolve::NodeLookupHandle & Handle() { return mSelfHandle; } - void OnNodeDiscovered(const Dnssd::DiscoveredNodeData & nodeData) override + void OnNodeDiscovered(const Dnssd::DiscoveredNodeData & discNodeData) override { - if (!nodeData.resolutionData.IsValid()) + if (!discNodeData.Is()) + { + streamer_printf(streamer_get(), "DNS browse failed - not commission type node \r\n"); + return; + } + + Dnssd::CommissionNodeData nodeData = discNodeData.Get(); + if (!nodeData.IsValid()) { streamer_printf(streamer_get(), "DNS browse failed - not found valid services \r\n"); return; } char rotatingId[Dnssd::kMaxRotatingIdLen * 2 + 1]; - Encoding::BytesToUppercaseHexString(nodeData.nodeData.rotatingId, nodeData.nodeData.rotatingIdLen, rotatingId, - sizeof(rotatingId)); + Encoding::BytesToUppercaseHexString(nodeData.rotatingId, nodeData.rotatingIdLen, rotatingId, sizeof(rotatingId)); streamer_printf(streamer_get(), "DNS browse succeeded: \r\n"); - streamer_printf(streamer_get(), " Node Type: %u\r\n", nodeData.nodeType); - streamer_printf(streamer_get(), " Hostname: %s\r\n", nodeData.resolutionData.hostName); - streamer_printf(streamer_get(), " Vendor ID: %u\r\n", nodeData.nodeData.vendorId); - streamer_printf(streamer_get(), " Product ID: %u\r\n", nodeData.nodeData.productId); - streamer_printf(streamer_get(), " Long discriminator: %u\r\n", nodeData.nodeData.longDiscriminator); - streamer_printf(streamer_get(), " Device type: %u\r\n", nodeData.nodeData.deviceType); - streamer_printf(streamer_get(), " Device name: %s\n", nodeData.nodeData.deviceName); - streamer_printf(streamer_get(), " Commissioning mode: %d\r\n", static_cast(nodeData.nodeData.commissioningMode)); - streamer_printf(streamer_get(), " Pairing hint: %u\r\n", nodeData.nodeData.pairingHint); - streamer_printf(streamer_get(), " Pairing instruction: %s\r\n", nodeData.nodeData.pairingInstruction); + streamer_printf(streamer_get(), " Hostname: %s\r\n", nodeData.hostName); + streamer_printf(streamer_get(), " Vendor ID: %u\r\n", nodeData.vendorId); + streamer_printf(streamer_get(), " Product ID: %u\r\n", nodeData.productId); + streamer_printf(streamer_get(), " Long discriminator: %u\r\n", nodeData.longDiscriminator); + streamer_printf(streamer_get(), " Device type: %u\r\n", nodeData.deviceType); + streamer_printf(streamer_get(), " Device name: %s\n", nodeData.deviceName); + streamer_printf(streamer_get(), " Commissioning mode: %d\r\n", static_cast(nodeData.commissioningMode)); + streamer_printf(streamer_get(), " Pairing hint: %u\r\n", nodeData.pairingHint); + streamer_printf(streamer_get(), " Pairing instruction: %s\r\n", nodeData.pairingInstruction); streamer_printf(streamer_get(), " Rotating ID %s\r\n", rotatingId); - auto retryInterval = nodeData.resolutionData.GetMrpRetryIntervalIdle(); + auto retryInterval = nodeData.GetMrpRetryIntervalIdle(); if (retryInterval.HasValue()) streamer_printf(streamer_get(), " MRP retry interval (idle): %" PRIu32 "ms\r\n", retryInterval.Value()); - retryInterval = nodeData.resolutionData.GetMrpRetryIntervalActive(); + retryInterval = nodeData.GetMrpRetryIntervalActive(); if (retryInterval.HasValue()) streamer_printf(streamer_get(), " MRP retry interval (active): %" PRIu32 "ms\r\n", retryInterval.Value()); - if (nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()) + if (nodeData.GetMrpRetryActiveThreshold().HasValue()) { streamer_printf(streamer_get(), " MRP retry active threshold time: %" PRIu32 "ms\r\n", - nodeData.resolutionData.GetMrpRetryActiveThreshold().Value()); + nodeData.GetMrpRetryActiveThreshold().Value()); } - streamer_printf(streamer_get(), " Supports TCP: %s\r\n", nodeData.resolutionData.supportsTcp ? "yes" : "no"); + streamer_printf(streamer_get(), " Supports TCP: %s\r\n", nodeData.supportsTcp ? "yes" : "no"); - if (nodeData.resolutionData.isICDOperatingAsLIT.HasValue()) + if (nodeData.isICDOperatingAsLIT.HasValue()) { streamer_printf(streamer_get(), " ICD is operating as a: %s\r\n", - nodeData.resolutionData.isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + nodeData.isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); } streamer_printf(streamer_get(), " IP addresses:\r\n"); - for (size_t i = 0; i < nodeData.resolutionData.numIPs; i++) + for (size_t i = 0; i < nodeData.numIPs; i++) { - streamer_printf(streamer_get(), " %s\r\n", nodeData.resolutionData.ipAddress[i].ToString(ipAddressBuf)); + streamer_printf(streamer_get(), " %s\r\n", nodeData.ipAddress[i].ToString(ipAddressBuf)); } - if (nodeData.resolutionData.port > 0) + if (nodeData.port > 0) { - streamer_printf(streamer_get(), " Port: %u\r\n", nodeData.resolutionData.port); + streamer_printf(streamer_get(), " Port: %u\r\n", nodeData.port); } } diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp b/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp index b96c45630166fa..cb953c8a60e5ca 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp @@ -466,21 +466,26 @@ void UserDirectedCommissioningServer::SetUDCClientProcessingState(char * instanc mUdcClients.MarkUDCClientActive(client); } -void UserDirectedCommissioningServer::OnCommissionableNodeFound(const Dnssd::DiscoveredNodeData & nodeData) +void UserDirectedCommissioningServer::OnCommissionableNodeFound(const Dnssd::DiscoveredNodeData & discNodeData) { - if (nodeData.resolutionData.numIPs == 0) + if (!discNodeData.Is()) { - ChipLogError(AppServer, "OnCommissionableNodeFound no IP addresses returned for instance name=%s", - nodeData.nodeData.instanceName); return; } - if (nodeData.resolutionData.port == 0) + + const Dnssd::CommissionNodeData & nodeData = discNodeData.Get(); + if (nodeData.numIPs == 0) + { + ChipLogError(AppServer, "OnCommissionableNodeFound no IP addresses returned for instance name=%s", nodeData.instanceName); + return; + } + if (nodeData.port == 0) { - ChipLogError(AppServer, "OnCommissionableNodeFound no port returned for instance name=%s", nodeData.nodeData.instanceName); + ChipLogError(AppServer, "OnCommissionableNodeFound no port returned for instance name=%s", nodeData.instanceName); return; } - UDCClientState * client = mUdcClients.FindUDCClientState(nodeData.nodeData.instanceName); + UDCClientState * client = mUdcClients.FindUDCClientState(nodeData.instanceName); if (client != nullptr && client->GetUDCClientProcessingState() == UDCClientProcessingState::kDiscoveringNode) { ChipLogDetail(AppServer, "OnCommissionableNodeFound instance: name=%s old_state=%d new_state=%d", client->GetInstanceName(), @@ -490,50 +495,45 @@ void UserDirectedCommissioningServer::OnCommissionableNodeFound(const Dnssd::Dis #if INET_CONFIG_ENABLE_IPV4 // prefer IPv4 if its an option bool foundV4 = false; - for (unsigned i = 0; i < nodeData.resolutionData.numIPs; ++i) + for (unsigned i = 0; i < nodeData.numIPs; ++i) { - if (nodeData.resolutionData.ipAddress[i].IsIPv4()) + if (nodeData.ipAddress[i].IsIPv4()) { foundV4 = true; - client->SetPeerAddress( - chip::Transport::PeerAddress::UDP(nodeData.resolutionData.ipAddress[i], nodeData.resolutionData.port)); + client->SetPeerAddress(chip::Transport::PeerAddress::UDP(nodeData.ipAddress[i], nodeData.port)); break; } } // use IPv6 as last resort if (!foundV4) { - client->SetPeerAddress( - chip::Transport::PeerAddress::UDP(nodeData.resolutionData.ipAddress[0], nodeData.resolutionData.port)); + client->SetPeerAddress(chip::Transport::PeerAddress::UDP(nodeData.ipAddress[0], nodeData.port)); } #else // INET_CONFIG_ENABLE_IPV4 // if we only support V6, then try to find a v6 address bool foundV6 = false; - for (unsigned i = 0; i < nodeData.resolutionData.numIPs; ++i) + for (unsigned i = 0; i < nodeData.numIPs; ++i) { - if (nodeData.resolutionData.ipAddress[i].IsIPv6()) + if (nodeData.ipAddress[i].IsIPv6()) { foundV6 = true; - client->SetPeerAddress( - chip::Transport::PeerAddress::UDP(nodeData.resolutionData.ipAddress[i], nodeData.resolutionData.port)); + client->SetPeerAddress(chip::Transport::PeerAddress::UDP(nodeData.ipAddress[i], nodeData.port)); break; } } // last resort, try with what we have if (!foundV6) { - ChipLogError(AppServer, "OnCommissionableNodeFound no v6 returned for instance name=%s", - nodeData.nodeData.instanceName); - client->SetPeerAddress( - chip::Transport::PeerAddress::UDP(nodeData.resolutionData.ipAddress[0], nodeData.resolutionData.port)); + ChipLogError(AppServer, "OnCommissionableNodeFound no v6 returned for instance name=%s", nodeData.instanceName); + client->SetPeerAddress(chip::Transport::PeerAddress::UDP(nodeData.ipAddress[0], nodeData.port)); } #endif // INET_CONFIG_ENABLE_IPV4 - client->SetDeviceName(nodeData.nodeData.deviceName); - client->SetLongDiscriminator(nodeData.nodeData.longDiscriminator); - client->SetVendorId(nodeData.nodeData.vendorId); - client->SetProductId(nodeData.nodeData.productId); - client->SetRotatingId(nodeData.nodeData.rotatingId, nodeData.nodeData.rotatingIdLen); + client->SetDeviceName(nodeData.deviceName); + client->SetLongDiscriminator(nodeData.longDiscriminator); + client->SetVendorId(nodeData.vendorId); + client->SetProductId(nodeData.productId); + client->SetRotatingId(nodeData.rotatingId, nodeData.rotatingIdLen); // Call the registered mUserConfirmationProvider, if any. if (mUserConfirmationProvider != nullptr) diff --git a/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp b/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp index a62aa52b94a2e3..3d50682dee5dcf 100644 --- a/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp +++ b/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp @@ -86,23 +86,27 @@ void TestUDCServerUserConfirmationProvider(nlTestSuite * inSuite, void * inConte // setup for tests udcServer.SetUDCClientProcessingState((char *) instanceName1, UDCClientProcessingState::kUserDeclined); - Dnssd::DiscoveredNodeData nodeData1; - nodeData1.resolutionData.port = 5540; - nodeData1.resolutionData.ipAddress[0] = address; - nodeData1.resolutionData.numIPs = 1; - Platform::CopyString(nodeData1.nodeData.instanceName, instanceName1); - - Dnssd::DiscoveredNodeData nodeData2; - nodeData2.resolutionData.port = 5540; - nodeData2.resolutionData.ipAddress[0] = address; - nodeData2.resolutionData.numIPs = 1; - nodeData2.nodeData.longDiscriminator = disc2; - Platform::CopyString(nodeData2.nodeData.instanceName, instanceName2); - Platform::CopyString(nodeData2.nodeData.deviceName, deviceName2); + Dnssd::DiscoveredNodeData discNodeData1; + discNodeData1.Set(); + Dnssd::CommissionNodeData & nodeData1 = discNodeData1.Get(); + nodeData1.port = 5540; + nodeData1.ipAddress[0] = address; + nodeData1.numIPs = 1; + Platform::CopyString(nodeData1.instanceName, instanceName1); + + Dnssd::DiscoveredNodeData discNodeData2; + discNodeData2.Set(); + Dnssd::CommissionNodeData & nodeData2 = discNodeData2.Get(); + nodeData2.port = 5540; + nodeData2.ipAddress[0] = address; + nodeData2.numIPs = 1; + nodeData2.longDiscriminator = disc2; + Platform::CopyString(nodeData2.instanceName, instanceName2); + Platform::CopyString(nodeData2.deviceName, deviceName2); // test empty UserConfirmationProvider - udcServer.OnCommissionableNodeFound(nodeData2); - udcServer.OnCommissionableNodeFound(nodeData1); + udcServer.OnCommissionableNodeFound(discNodeData2); + udcServer.OnCommissionableNodeFound(discNodeData1); state = udcServer.GetUDCClients().FindUDCClientState(instanceName1); NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kUserDeclined == state->GetUDCClientProcessingState()); @@ -115,8 +119,8 @@ void TestUDCServerUserConfirmationProvider(nlTestSuite * inSuite, void * inConte // test current state check udcServer.SetUDCClientProcessingState((char *) instanceName1, UDCClientProcessingState::kUserDeclined); udcServer.SetUDCClientProcessingState((char *) instanceName2, UDCClientProcessingState::kDiscoveringNode); - udcServer.OnCommissionableNodeFound(nodeData2); - udcServer.OnCommissionableNodeFound(nodeData1); + udcServer.OnCommissionableNodeFound(discNodeData2); + udcServer.OnCommissionableNodeFound(discNodeData1); state = udcServer.GetUDCClients().FindUDCClientState(instanceName1); NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kUserDeclined == state->GetUDCClientProcessingState()); @@ -132,9 +136,9 @@ void TestUDCServerUserConfirmationProvider(nlTestSuite * inSuite, void * inConte udcServer.SetUserConfirmationProvider(&testCallback); udcServer.SetUDCClientProcessingState((char *) instanceName1, UDCClientProcessingState::kUserDeclined); udcServer.SetUDCClientProcessingState((char *) instanceName2, UDCClientProcessingState::kDiscoveringNode); - udcServer.OnCommissionableNodeFound(nodeData1); + udcServer.OnCommissionableNodeFound(discNodeData1); NL_TEST_ASSERT(inSuite, !testCallback.mOnUserDirectedCommissioningRequestCalled); - udcServer.OnCommissionableNodeFound(nodeData2); + udcServer.OnCommissionableNodeFound(discNodeData2); NL_TEST_ASSERT(inSuite, testCallback.mOnUserDirectedCommissioningRequestCalled); NL_TEST_ASSERT(inSuite, 0 == strcmp(testCallback.mState.GetInstanceName(), instanceName2)); } From d905835a6a4b2659b1052dd0fdba3660f07ff733 Mon Sep 17 00:00:00 2001 From: feasel <120589145+feasel0@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:44:51 -0400 Subject: [PATCH 09/40] Updated unit tests in src/protocols/bdx/tests/ to use PW instead of NL. (#33084) * Updated unit tests in src/protocols/bdx/tests/ to use PW instead of NL. * Fixed clang and GN formatting. Moved BDXTests from test_components_nl.txt to test_components.txt. * Used ASSERT_* in places where tests should be stopped immediately. Refactored to get rid of else branches that did nothing but ASSERT_TRUE(false). * Simplified TestBdxTransfersession::SetUpTestSuite as per PR suggestion. * Undid the accidental reformatting of the comments at the top. * Semicolon fix. --------- Co-authored-by: Andrei Litvin --- src/protocols/bdx/tests/BUILD.gn | 7 +- src/protocols/bdx/tests/TestBdxMessages.cpp | 114 ++--- .../bdx/tests/TestBdxTransferSession.cpp | 424 +++++++----------- src/protocols/bdx/tests/TestBdxUri.cpp | 63 +-- .../openiotsdk/unit-tests/test_components.txt | 1 + .../unit-tests/test_components_nl.txt | 3 +- 6 files changed, 223 insertions(+), 389 deletions(-) diff --git a/src/protocols/bdx/tests/BUILD.gn b/src/protocols/bdx/tests/BUILD.gn index 59d5f01d35a9c1..055301b3432916 100644 --- a/src/protocols/bdx/tests/BUILD.gn +++ b/src/protocols/bdx/tests/BUILD.gn @@ -14,11 +14,10 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlunit_test.gni") +import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") - -chip_test_suite_using_nltest("tests") { +chip_test_suite("tests") { output_name = "libBDXTests" test_sources = [ @@ -30,9 +29,7 @@ chip_test_suite_using_nltest("tests") { public_deps = [ "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", - "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/protocols/bdx", - "${nlunit_test_root}:nlunit-test", ] cflags = [ "-Wconversion" ] diff --git a/src/protocols/bdx/tests/TestBdxMessages.cpp b/src/protocols/bdx/tests/TestBdxMessages.cpp index 1a6d2c4643fb2e..6475cbd89c14c2 100644 --- a/src/protocols/bdx/tests/TestBdxMessages.cpp +++ b/src/protocols/bdx/tests/TestBdxMessages.cpp @@ -1,11 +1,10 @@ #include -#include +#include #include #include #include -#include #include @@ -17,29 +16,40 @@ using namespace chip::bdx; * is identical to the origianl. */ template -void TestHelperWrittenAndParsedMatch(nlTestSuite * inSuite, void * inContext, MsgType & testMsg) +void TestHelperWrittenAndParsedMatch(MsgType & testMsg) { CHIP_ERROR err = CHIP_NO_ERROR; size_t msgSize = testMsg.MessageSize(); Encoding::LittleEndian::PacketBufferWriter bbuf(System::PacketBufferHandle::New(msgSize)); - NL_TEST_ASSERT(inSuite, !bbuf.IsNull()); + ASSERT_FALSE(bbuf.IsNull()); testMsg.WriteToBuffer(bbuf); - NL_TEST_ASSERT(inSuite, bbuf.Fit()); + EXPECT_TRUE(bbuf.Fit()); System::PacketBufferHandle msgBuf = bbuf.Finalize(); - NL_TEST_ASSERT(inSuite, !msgBuf.IsNull()); + ASSERT_FALSE(msgBuf.IsNull()); System::PacketBufferHandle rcvBuf = System::PacketBufferHandle::NewWithData(msgBuf->Start(), msgSize); - NL_TEST_ASSERT(inSuite, !rcvBuf.IsNull()); + ASSERT_FALSE(rcvBuf.IsNull()); MsgType testMsgRcvd; err = testMsgRcvd.Parse(std::move(rcvBuf)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, testMsgRcvd == testMsg); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(testMsgRcvd, testMsg); } -void TestTransferInitMessage(nlTestSuite * inSuite, void * inContext) +struct TestBdxMessages : public ::testing::Test +{ + static void SetUpTestSuite() + { + CHIP_ERROR error = chip::Platform::MemoryInit(); + ASSERT_EQ(error, CHIP_NO_ERROR); + } + + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestBdxMessages, TestTransferInitMessage) { TransferInit testMsg; @@ -60,10 +70,10 @@ void TestTransferInitMessage(nlTestSuite * inSuite, void * inContext) testMsg.MetadataLength = 5; testMsg.Metadata = reinterpret_cast(fakeData); - TestHelperWrittenAndParsedMatch(inSuite, inContext, testMsg); + TestHelperWrittenAndParsedMatch(testMsg); } -void TestSendAcceptMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxMessages, TestSendAcceptMessage) { SendAccept testMsg; @@ -75,10 +85,10 @@ void TestSendAcceptMessage(nlTestSuite * inSuite, void * inContext) testMsg.MetadataLength = 5; testMsg.Metadata = reinterpret_cast(fakeData); - TestHelperWrittenAndParsedMatch(inSuite, inContext, testMsg); + TestHelperWrittenAndParsedMatch(testMsg); } -void TestReceiveAcceptMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxMessages, TestReceiveAcceptMessage) { ReceiveAccept testMsg; @@ -95,19 +105,19 @@ void TestReceiveAcceptMessage(nlTestSuite * inSuite, void * inContext) testMsg.MetadataLength = 5; testMsg.Metadata = reinterpret_cast(fakeData); - TestHelperWrittenAndParsedMatch(inSuite, inContext, testMsg); + TestHelperWrittenAndParsedMatch(testMsg); } -void TestCounterMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxMessages, TestCounterMessage) { CounterMessage testMsg; testMsg.BlockCounter = 4; - TestHelperWrittenAndParsedMatch(inSuite, inContext, testMsg); + TestHelperWrittenAndParsedMatch(testMsg); } -void TestDataBlockMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxMessages, TestDataBlockMessage) { DataBlock testMsg; @@ -116,77 +126,15 @@ void TestDataBlockMessage(nlTestSuite * inSuite, void * inContext) testMsg.DataLength = 5; testMsg.Data = reinterpret_cast(fakeData); - TestHelperWrittenAndParsedMatch(inSuite, inContext, testMsg); + TestHelperWrittenAndParsedMatch(testMsg); } -void TestBlockQueryWithSkipMessage(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxMessages, TestBlockQueryWithSkipMessage) { BlockQueryWithSkip testMsg; testMsg.BlockCounter = 5; testMsg.BytesToSkip = 16; - TestHelperWrittenAndParsedMatch(inSuite, inContext, testMsg); -} - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestTransferInitMessage", TestTransferInitMessage), - NL_TEST_DEF("TestSendAcceptMessage", TestSendAcceptMessage), - NL_TEST_DEF("TestReceiveAcceptMessage", TestReceiveAcceptMessage), - NL_TEST_DEF("TestCounterMessage", TestCounterMessage), - NL_TEST_DEF("TestDataBlockMessage", TestDataBlockMessage), - NL_TEST_DEF("TestBlockQueryWithSkipMessage", TestBlockQueryWithSkipMessage), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; + TestHelperWrittenAndParsedMatch(testMsg); } - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-BdxMessages", - &sTests[0], - TestSetup, - TestTeardown, -}; -// clang-format on - -/** - * Main - */ -int TestBdxMessages() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBdxMessages) diff --git a/src/protocols/bdx/tests/TestBdxTransferSession.cpp b/src/protocols/bdx/tests/TestBdxTransferSession.cpp index 9be2d7f5ffc885..a3a76df6bddf67 100644 --- a/src/protocols/bdx/tests/TestBdxTransferSession.cpp +++ b/src/protocols/bdx/tests/TestBdxTransferSession.cpp @@ -4,13 +4,12 @@ #include -#include +#include #include #include #include #include -#include #include #include #include @@ -48,8 +47,7 @@ CHIP_ERROR WriteTLVString(uint8_t * buf, uint32_t bufLen, const char * data, uin } // Helper method: read a TLV structure with a single tag and string and verify it matches expected string. -CHIP_ERROR ReadAndVerifyTLVString(nlTestSuite * inSuite, void * inContext, const uint8_t * dataStart, uint32_t len, - const char * expected, size_t expectedLen) +CHIP_ERROR ReadAndVerifyTLVString(const uint8_t * dataStart, uint32_t len, const char * expected, size_t expectedLen) { TLV::TLVReader reader; char tmp[64] = { 0 }; @@ -91,55 +89,45 @@ CHIP_ERROR AttachHeaderAndSend(TransferSession::MessageTypeData typeData, chip:: } // Helper method for verifying that a PacketBufferHandle contains a valid BDX header and message type matches expected. -void VerifyBdxMessageToSend(nlTestSuite * inSuite, void * inContext, const TransferSession::OutputEvent & outEvent, - MessageType expected) +void VerifyBdxMessageToSend(const TransferSession::OutputEvent & outEvent, MessageType expected) { static_assert(std::is_same, uint8_t>::value, "Cast is not safe"); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); - NL_TEST_ASSERT(inSuite, !outEvent.MsgData.IsNull()); - NL_TEST_ASSERT(inSuite, outEvent.msgTypeData.ProtocolId == Protocols::BDX::Id); - NL_TEST_ASSERT(inSuite, outEvent.msgTypeData.MessageType == static_cast(expected)); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + EXPECT_FALSE(outEvent.MsgData.IsNull()); + EXPECT_EQ(outEvent.msgTypeData.ProtocolId, Protocols::BDX::Id); + EXPECT_EQ(outEvent.msgTypeData.MessageType, static_cast(expected)); } // Helper method for verifying that a PacketBufferHandle contains a valid StatusReport message and contains a specific StatusCode. // The msg argument is expected to begin at the message data start, not at the PayloadHeader. -void VerifyStatusReport(nlTestSuite * inSuite, void * inContext, const System::PacketBufferHandle & msg, StatusCode expectedCode) +void VerifyStatusReport(const System::PacketBufferHandle & msg, StatusCode expectedCode) { CHIP_ERROR err = CHIP_NO_ERROR; - if (msg.IsNull()) - { - NL_TEST_ASSERT(inSuite, false); - return; - } + ASSERT_FALSE(msg.IsNull()); System::PacketBufferHandle msgCopy = msg.CloneData(); - if (msgCopy.IsNull()) - { - NL_TEST_ASSERT(inSuite, false); - return; - } + ASSERT_FALSE(msgCopy.IsNull()); SecureChannel::StatusReport report; err = report.Parse(std::move(msgCopy)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, report.GetGeneralCode() == SecureChannel::GeneralStatusCode::kFailure); - NL_TEST_ASSERT(inSuite, report.GetProtocolId() == Protocols::BDX::Id); - NL_TEST_ASSERT(inSuite, report.GetProtocolCode() == static_cast(expectedCode)); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(report.GetGeneralCode(), SecureChannel::GeneralStatusCode::kFailure); + EXPECT_EQ(report.GetProtocolId(), Protocols::BDX::Id); + EXPECT_EQ(report.GetProtocolCode(), static_cast(expectedCode)); } -void VerifyNoMoreOutput(nlTestSuite * inSuite, void * inContext, TransferSession & transferSession) +void VerifyNoMoreOutput(TransferSession & transferSession) { TransferSession::OutputEvent event; transferSession.PollOutput(event, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, event.EventType == TransferSession::OutputEventType::kNone); + EXPECT_EQ(event.EventType, TransferSession::OutputEventType::kNone); } // Helper method for initializing two TransferSession objects, generating a TransferInit message, and passing it to a responding // TransferSession. -void SendAndVerifyTransferInit(nlTestSuite * inSuite, void * inContext, TransferSession::OutputEvent & outEvent, - System::Clock::Timeout timeout, TransferSession & initiator, TransferRole initiatorRole, - TransferSession::TransferInitData initData, TransferSession & responder, +void SendAndVerifyTransferInit(TransferSession::OutputEvent & outEvent, System::Clock::Timeout timeout, TransferSession & initiator, + TransferRole initiatorRole, TransferSession::TransferInitData initData, TransferSession & responder, BitFlags & responderControlOpts, uint16_t responderMaxBlock) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -148,55 +136,45 @@ void SendAndVerifyTransferInit(nlTestSuite * inSuite, void * inContext, Transfer // Initializer responder to wait for transfer err = responder.WaitForTransfer(responderRole, responderControlOpts, responderMaxBlock, timeout); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - VerifyNoMoreOutput(inSuite, inContext, responder); + EXPECT_EQ(err, CHIP_NO_ERROR); + VerifyNoMoreOutput(responder); // Verify initiator outputs respective Init message (depending on role) after StartTransfer() err = initiator.StartTransfer(initiatorRole, initData, timeout); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); initiator.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); - VerifyBdxMessageToSend(inSuite, inContext, outEvent, expectedInitMsg); - VerifyNoMoreOutput(inSuite, inContext, initiator); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + VerifyBdxMessageToSend(outEvent, expectedInitMsg); + VerifyNoMoreOutput(initiator); // Verify that all parsed TransferInit fields match what was sent by the initiator err = AttachHeaderAndSend(outEvent.msgTypeData, std::move(outEvent.MsgData), responder); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); responder.PollOutput(outEvent, kNoAdvanceTime); - VerifyNoMoreOutput(inSuite, inContext, responder); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kInitReceived); - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.TransferCtlFlags == initData.TransferCtlFlags); - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.MaxBlockSize == initData.MaxBlockSize); - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.StartOffset == initData.StartOffset); - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.Length == initData.Length); - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.FileDesignator != nullptr); - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.FileDesLength == initData.FileDesLength); + VerifyNoMoreOutput(responder); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kInitReceived); + EXPECT_EQ(outEvent.transferInitData.TransferCtlFlags, initData.TransferCtlFlags); + EXPECT_EQ(outEvent.transferInitData.MaxBlockSize, initData.MaxBlockSize); + EXPECT_EQ(outEvent.transferInitData.StartOffset, initData.StartOffset); + EXPECT_EQ(outEvent.transferInitData.Length, initData.Length); + EXPECT_NE(outEvent.transferInitData.FileDesignator, nullptr); + EXPECT_EQ(outEvent.transferInitData.FileDesLength, initData.FileDesLength); if (outEvent.EventType == TransferSession::OutputEventType::kInitReceived && outEvent.transferInitData.FileDesignator != nullptr) { - NL_TEST_ASSERT( - inSuite, - !memcmp(initData.FileDesignator, outEvent.transferInitData.FileDesignator, outEvent.transferInitData.FileDesLength)); + EXPECT_EQ( + 0, memcmp(initData.FileDesignator, outEvent.transferInitData.FileDesignator, outEvent.transferInitData.FileDesLength)); } if (outEvent.transferInitData.Metadata != nullptr) { - NL_TEST_ASSERT(inSuite, outEvent.transferInitData.MetadataLength == initData.MetadataLength); - if (outEvent.transferInitData.MetadataLength == initData.MetadataLength) + ASSERT_EQ(outEvent.transferInitData.MetadataLength, initData.MetadataLength); + // Even if initData.MetadataLength is 0, it is still technically undefined behaviour to call memcmp with a null + bool isNullAndLengthZero = initData.Metadata == nullptr && initData.MetadataLength == 0; + if (!isNullAndLengthZero) { - // Even if initData.MetadataLength is 0, it is still technically undefined behaviour to call memcmp with a null - bool isNullAndLengthZero = initData.Metadata == nullptr && initData.MetadataLength == 0; - if (!isNullAndLengthZero) - { - // Only check that metadata buffers match. The OutputEvent can still be inspected when this function returns to - // parse the metadata and verify that it matches. - NL_TEST_ASSERT( - inSuite, - !memcmp(initData.Metadata, outEvent.transferInitData.Metadata, outEvent.transferInitData.MetadataLength)); - } - } - else - { - NL_TEST_ASSERT(inSuite, false); // Metadata length mismatch + // Only check that metadata buffers match. The OutputEvent can still be inspected when this function returns to + // parse the metadata and verify that it matches. + EXPECT_EQ(0, memcmp(initData.Metadata, outEvent.transferInitData.Metadata, outEvent.transferInitData.MetadataLength)); } } } @@ -207,8 +185,7 @@ void SendAndVerifyTransferInit(nlTestSuite * inSuite, void * inContext, Transfer // receiver should emit a StatusCode event instead. // // The acceptSender is the node that is sending the Accept message (not necessarily the same node that will send Blocks). -void SendAndVerifyAcceptMsg(nlTestSuite * inSuite, void * inContext, TransferSession::OutputEvent & outEvent, - TransferSession & acceptSender, TransferRole acceptSenderRole, +void SendAndVerifyAcceptMsg(TransferSession::OutputEvent & outEvent, TransferSession & acceptSender, TransferRole acceptSenderRole, TransferSession::TransferAcceptData acceptData, TransferSession & acceptReceiver, TransferSession::TransferInitData initData) { @@ -218,90 +195,77 @@ void SendAndVerifyAcceptMsg(nlTestSuite * inSuite, void * inContext, TransferSes MessageType expectedMsg = (acceptSenderRole == TransferRole::kSender) ? MessageType::ReceiveAccept : MessageType::SendAccept; err = acceptSender.AcceptTransfer(acceptData); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Verify Sender emits ReceiveAccept message for sending acceptSender.PollOutput(outEvent, kNoAdvanceTime); - VerifyNoMoreOutput(inSuite, inContext, acceptSender); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); - VerifyBdxMessageToSend(inSuite, inContext, outEvent, expectedMsg); + VerifyNoMoreOutput(acceptSender); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + VerifyBdxMessageToSend(outEvent, expectedMsg); // Pass Accept message to acceptReceiver err = AttachHeaderAndSend(outEvent.msgTypeData, std::move(outEvent.MsgData), acceptReceiver); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Verify received ReceiveAccept. // Client may want to inspect TransferControl, MaxBlockSize, StartOffset, Length, and Metadata, and may choose to reject the // Transfer at this point. acceptReceiver.PollOutput(outEvent, kNoAdvanceTime); - VerifyNoMoreOutput(inSuite, inContext, acceptReceiver); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kAcceptReceived); - NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.ControlMode == acceptData.ControlMode); - NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.MaxBlockSize == acceptData.MaxBlockSize); - NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.StartOffset == acceptData.StartOffset); - NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.Length == acceptData.Length); + VerifyNoMoreOutput(acceptReceiver); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kAcceptReceived); + EXPECT_EQ(outEvent.transferAcceptData.ControlMode, acceptData.ControlMode); + EXPECT_EQ(outEvent.transferAcceptData.MaxBlockSize, acceptData.MaxBlockSize); + EXPECT_EQ(outEvent.transferAcceptData.StartOffset, acceptData.StartOffset); + EXPECT_EQ(outEvent.transferAcceptData.Length, acceptData.Length); if (outEvent.transferAcceptData.Metadata != nullptr) { - NL_TEST_ASSERT(inSuite, outEvent.transferAcceptData.MetadataLength == acceptData.MetadataLength); - if (outEvent.transferAcceptData.MetadataLength == acceptData.MetadataLength) - { - // Even if acceptData.MetadataLength is 0, it is still technically undefined behaviour to call memcmp with a null - bool isNullAndLengthZero = acceptData.Metadata == nullptr && acceptData.MetadataLength == 0; - if (!isNullAndLengthZero) - { - // Only check that metadata buffers match. The OutputEvent can still be inspected when this function returns to - // parse the metadata and verify that it matches. - NL_TEST_ASSERT( - inSuite, - !memcmp(acceptData.Metadata, outEvent.transferAcceptData.Metadata, outEvent.transferAcceptData.MetadataLength)); - } - } - else + ASSERT_EQ(outEvent.transferAcceptData.MetadataLength, acceptData.MetadataLength); + // Even if acceptData.MetadataLength is 0, it is still technically undefined behaviour to call memcmp with a null + bool isNullAndLengthZero = acceptData.Metadata == nullptr && acceptData.MetadataLength == 0; + if (!isNullAndLengthZero) { - NL_TEST_ASSERT(inSuite, false); // Metadata length mismatch + // Only check that metadata buffers match. The OutputEvent can still be inspected when this function returns to + // parse the metadata and verify that it matches. + EXPECT_EQ( + 0, memcmp(acceptData.Metadata, outEvent.transferAcceptData.Metadata, outEvent.transferAcceptData.MetadataLength)); } } // Verify that MaxBlockSize was set appropriately - NL_TEST_ASSERT(inSuite, acceptReceiver.GetTransferBlockSize() <= initData.MaxBlockSize); + EXPECT_LE(acceptReceiver.GetTransferBlockSize(), initData.MaxBlockSize); } // Helper method for preparing a sending a BlockQuery message between two TransferSession objects. -void SendAndVerifyQuery(nlTestSuite * inSuite, void * inContext, TransferSession & queryReceiver, TransferSession & querySender, - TransferSession::OutputEvent & outEvent) +void SendAndVerifyQuery(TransferSession & queryReceiver, TransferSession & querySender, TransferSession::OutputEvent & outEvent) { // Verify that querySender emits BlockQuery message CHIP_ERROR err = querySender.PrepareBlockQuery(); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); querySender.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); - VerifyBdxMessageToSend(inSuite, inContext, outEvent, MessageType::BlockQuery); - VerifyNoMoreOutput(inSuite, inContext, querySender); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + VerifyBdxMessageToSend(outEvent, MessageType::BlockQuery); + VerifyNoMoreOutput(querySender); // Pass BlockQuery to queryReceiver and verify queryReceiver emits QueryReceived event err = AttachHeaderAndSend(outEvent.msgTypeData, std::move(outEvent.MsgData), queryReceiver); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); queryReceiver.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kQueryReceived); - VerifyNoMoreOutput(inSuite, inContext, queryReceiver); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kQueryReceived); + VerifyNoMoreOutput(queryReceiver); } // Helper method for preparing a sending a Block message between two TransferSession objects. The sender refers to the node that is // sending Blocks. Uses a static counter incremented with each call. Also verifies that block data received matches what was sent. -void SendAndVerifyArbitraryBlock(nlTestSuite * inSuite, void * inContext, TransferSession & sender, TransferSession & receiver, - TransferSession::OutputEvent & outEvent, bool isEof, uint32_t inBlockCounter) +void SendAndVerifyArbitraryBlock(TransferSession & sender, TransferSession & receiver, TransferSession::OutputEvent & outEvent, + bool isEof, uint32_t inBlockCounter) { CHIP_ERROR err = CHIP_NO_ERROR; static uint8_t dataCount = 0; uint16_t maxBlockSize = sender.GetTransferBlockSize(); - NL_TEST_ASSERT(inSuite, maxBlockSize > 0); + EXPECT_GT(maxBlockSize, 0); System::PacketBufferHandle fakeDataBuf = System::PacketBufferHandle::New(maxBlockSize); - if (fakeDataBuf.IsNull()) - { - NL_TEST_ASSERT(inSuite, false); - return; - } + ASSERT_FALSE(fakeDataBuf.IsNull()); uint8_t * fakeBlockData = fakeDataBuf->Start(); fakeBlockData[0] = dataCount++; @@ -315,29 +279,29 @@ void SendAndVerifyArbitraryBlock(nlTestSuite * inSuite, void * inContext, Transf // Provide Block data and verify sender emits Block message err = sender.PrepareBlock(blockData); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); sender.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); - VerifyBdxMessageToSend(inSuite, inContext, outEvent, expected); - VerifyNoMoreOutput(inSuite, inContext, sender); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + VerifyBdxMessageToSend(outEvent, expected); + VerifyNoMoreOutput(sender); // Pass Block message to receiver and verify matching Block is received err = AttachHeaderAndSend(outEvent.msgTypeData, std::move(outEvent.MsgData), receiver); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); receiver.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kBlockReceived); - NL_TEST_ASSERT(inSuite, outEvent.blockdata.Data != nullptr); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kBlockReceived); + EXPECT_NE(outEvent.blockdata.Data, nullptr); if (outEvent.EventType == TransferSession::OutputEventType::kBlockReceived && outEvent.blockdata.Data != nullptr) { - NL_TEST_ASSERT(inSuite, !memcmp(fakeBlockData, outEvent.blockdata.Data, outEvent.blockdata.Length)); - NL_TEST_ASSERT(inSuite, outEvent.blockdata.BlockCounter == inBlockCounter); + EXPECT_EQ(0, memcmp(fakeBlockData, outEvent.blockdata.Data, outEvent.blockdata.Length)); + EXPECT_EQ(outEvent.blockdata.BlockCounter, inBlockCounter); } - VerifyNoMoreOutput(inSuite, inContext, receiver); + VerifyNoMoreOutput(receiver); } // Helper method for sending a BlockAck or BlockAckEOF, depending on the state of the receiver. -void SendAndVerifyBlockAck(nlTestSuite * inSuite, void * inContext, TransferSession & ackReceiver, TransferSession & ackSender, - TransferSession::OutputEvent & outEvent, bool expectEOF) +void SendAndVerifyBlockAck(TransferSession & ackReceiver, TransferSession & ackSender, TransferSession::OutputEvent & outEvent, + bool expectEOF) { TransferSession::OutputEventType expectedEventType = expectEOF ? TransferSession::OutputEventType::kAckEOFReceived : TransferSession::OutputEventType::kAckReceived; @@ -345,22 +309,29 @@ void SendAndVerifyBlockAck(nlTestSuite * inSuite, void * inContext, TransferSess // Verify PrepareBlockAck() outputs message to send CHIP_ERROR err = ackSender.PrepareBlockAck(); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); ackSender.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); - VerifyBdxMessageToSend(inSuite, inContext, outEvent, expectedMsgType); - VerifyNoMoreOutput(inSuite, inContext, ackSender); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); + VerifyBdxMessageToSend(outEvent, expectedMsgType); + VerifyNoMoreOutput(ackSender); // Pass BlockAck to ackReceiver and verify it was received err = AttachHeaderAndSend(outEvent.msgTypeData, std::move(outEvent.MsgData), ackReceiver); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); ackReceiver.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == expectedEventType); - VerifyNoMoreOutput(inSuite, inContext, ackReceiver); + EXPECT_EQ(outEvent.EventType, expectedEventType); + VerifyNoMoreOutput(ackReceiver); } +struct TestBdxTransferSession : public ::testing::Test +{ + static void SetUpTestSuite() { EXPECT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + // Test a full transfer using a responding receiver and an initiating sender, receiver drive. -void TestInitiatingReceiverReceiverDrive(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxTransferSession, TestInitiatingReceiverReceiverDrive) { CHIP_ERROR err = CHIP_NO_ERROR; TransferSession::OutputEvent outEvent; @@ -391,15 +362,15 @@ void TestInitiatingReceiverReceiverDrive(nlTestSuite * inSuite, void * inContext BitFlags senderOpts; senderOpts.Set(driveMode); - SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, - respondingSender, senderOpts, proposedBlockSize); + SendAndVerifyTransferInit(outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, respondingSender, + senderOpts, proposedBlockSize); // Test metadata for Accept message uint8_t tlvBuf[64] = { 0 }; char metadataStr[11] = { "hi_dad.txt" }; uint32_t bytesWritten = 0; err = WriteTLVString(tlvBuf, sizeof(tlvBuf), metadataStr, bytesWritten); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint16_t metadataSize = static_cast(bytesWritten & 0x0000FFFF); // Compose ReceiveAccept parameters struct and give to respondingSender @@ -411,60 +382,55 @@ void TestInitiatingReceiverReceiverDrive(nlTestSuite * inSuite, void * inContext acceptData.Metadata = tlvBuf; acceptData.MetadataLength = metadataSize; - SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingSender, TransferRole::kSender, acceptData, initiatingReceiver, - initOptions); + SendAndVerifyAcceptMsg(outEvent, respondingSender, TransferRole::kSender, acceptData, initiatingReceiver, initOptions); // Verify that MaxBlockSize was chosen correctly - NL_TEST_ASSERT(inSuite, respondingSender.GetTransferBlockSize() == testSmallerBlockSize); - NL_TEST_ASSERT(inSuite, respondingSender.GetTransferBlockSize() == initiatingReceiver.GetTransferBlockSize()); + EXPECT_EQ(respondingSender.GetTransferBlockSize(), testSmallerBlockSize); + EXPECT_EQ(respondingSender.GetTransferBlockSize(), initiatingReceiver.GetTransferBlockSize()); // Verify parsed TLV metadata matches the original - err = ReadAndVerifyTLVString(inSuite, inContext, outEvent.transferAcceptData.Metadata, + err = ReadAndVerifyTLVString(outEvent.transferAcceptData.Metadata, static_cast(outEvent.transferAcceptData.MetadataLength), metadataStr, static_cast(strlen(metadataStr))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // Test BlockQuery -> Block -> BlockAck - SendAndVerifyQuery(inSuite, inContext, respondingSender, initiatingReceiver, outEvent); - SendAndVerifyArbitraryBlock(inSuite, inContext, respondingSender, initiatingReceiver, outEvent, false, numBlocksSent); + SendAndVerifyQuery(respondingSender, initiatingReceiver, outEvent); + SendAndVerifyArbitraryBlock(respondingSender, initiatingReceiver, outEvent, false, numBlocksSent); numBlocksSent++; // Test only one block can be prepared at a time, without receiving a response to the first System::PacketBufferHandle fakeBuf = System::PacketBufferHandle::New(testSmallerBlockSize); TransferSession::BlockData prematureBlock; - if (fakeBuf.IsNull()) - { - NL_TEST_ASSERT(inSuite, false); - return; - } + ASSERT_FALSE(fakeBuf.IsNull()); prematureBlock.Data = fakeBuf->Start(); prematureBlock.Length = testSmallerBlockSize; prematureBlock.IsEof = false; err = respondingSender.PrepareBlock(prematureBlock); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); - VerifyNoMoreOutput(inSuite, inContext, respondingSender); + EXPECT_NE(err, CHIP_NO_ERROR); + VerifyNoMoreOutput(respondingSender); // Test Ack -> Query -> Block - SendAndVerifyBlockAck(inSuite, inContext, respondingSender, initiatingReceiver, outEvent, false); + SendAndVerifyBlockAck(respondingSender, initiatingReceiver, outEvent, false); // Test multiple Blocks sent and received (last Block is BlockEOF) while (numBlocksSent < numBlockSends) { bool isEof = (numBlocksSent == numBlockSends - 1); - SendAndVerifyQuery(inSuite, inContext, respondingSender, initiatingReceiver, outEvent); - SendAndVerifyArbitraryBlock(inSuite, inContext, respondingSender, initiatingReceiver, outEvent, isEof, numBlocksSent); + SendAndVerifyQuery(respondingSender, initiatingReceiver, outEvent); + SendAndVerifyArbitraryBlock(respondingSender, initiatingReceiver, outEvent, isEof, numBlocksSent); numBlocksSent++; } // Verify last block was BlockEOF, then verify response BlockAckEOF message - NL_TEST_ASSERT(inSuite, outEvent.blockdata.IsEof == true); - SendAndVerifyBlockAck(inSuite, inContext, respondingSender, initiatingReceiver, outEvent, true); + EXPECT_TRUE(outEvent.blockdata.IsEof); + SendAndVerifyBlockAck(respondingSender, initiatingReceiver, outEvent, true); } // Partial transfer test using Sender Drive to specifically test Block -> BlockAck -> Block sequence -void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxTransferSession, TestInitiatingSenderSenderDrive) { CHIP_ERROR err = CHIP_NO_ERROR; TransferSession::OutputEvent outEvent; @@ -486,7 +452,7 @@ void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext) char metadataStr[11] = { "hi_dad.txt" }; uint32_t bytesWritten = 0; err = WriteTLVString(tlvBuf, sizeof(tlvBuf), metadataStr, bytesWritten); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); uint16_t metadataSize = static_cast(bytesWritten & 0x0000FFFF); // Initialize struct with TransferInit parameters @@ -499,14 +465,14 @@ void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext) initOptions.Metadata = tlvBuf; initOptions.MetadataLength = metadataSize; - SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeout, initiatingSender, TransferRole::kSender, initOptions, - respondingReceiver, receiverOpts, transferBlockSize); + SendAndVerifyTransferInit(outEvent, timeout, initiatingSender, TransferRole::kSender, initOptions, respondingReceiver, + receiverOpts, transferBlockSize); // Verify parsed TLV metadata matches the original - err = ReadAndVerifyTLVString(inSuite, inContext, outEvent.transferInitData.Metadata, - static_cast(outEvent.transferInitData.MetadataLength), metadataStr, - static_cast(strlen(metadataStr))); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + err = + ReadAndVerifyTLVString(outEvent.transferInitData.Metadata, static_cast(outEvent.transferInitData.MetadataLength), + metadataStr, static_cast(strlen(metadataStr))); + EXPECT_EQ(err, CHIP_NO_ERROR); // Compose SendAccept parameters struct and give to respondingSender uint16_t proposedBlockSize = transferBlockSize; @@ -518,24 +484,23 @@ void TestInitiatingSenderSenderDrive(nlTestSuite * inSuite, void * inContext) acceptData.Metadata = nullptr; acceptData.MetadataLength = 0; - SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingReceiver, TransferRole::kReceiver, acceptData, initiatingSender, - initOptions); + SendAndVerifyAcceptMsg(outEvent, respondingReceiver, TransferRole::kReceiver, acceptData, initiatingSender, initOptions); uint32_t numBlocksSent = 0; // Test multiple Block -> BlockAck -> Block for (int i = 0; i < 3; i++) { - SendAndVerifyArbitraryBlock(inSuite, inContext, initiatingSender, respondingReceiver, outEvent, false, numBlocksSent); - SendAndVerifyBlockAck(inSuite, inContext, initiatingSender, respondingReceiver, outEvent, false); + SendAndVerifyArbitraryBlock(initiatingSender, respondingReceiver, outEvent, false, numBlocksSent); + SendAndVerifyBlockAck(initiatingSender, respondingReceiver, outEvent, false); numBlocksSent++; } - SendAndVerifyArbitraryBlock(inSuite, inContext, initiatingSender, respondingReceiver, outEvent, true, numBlocksSent); - SendAndVerifyBlockAck(inSuite, inContext, initiatingSender, respondingReceiver, outEvent, true); + SendAndVerifyArbitraryBlock(initiatingSender, respondingReceiver, outEvent, true, numBlocksSent); + SendAndVerifyBlockAck(initiatingSender, respondingReceiver, outEvent, true); } // Test that calls to AcceptTransfer() with bad parameters result in an error. -void TestBadAcceptMessageFields(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxTransferSession, TestBadAcceptMessageFields) { CHIP_ERROR err = CHIP_NO_ERROR; TransferSession::OutputEvent outEvent; @@ -564,8 +529,8 @@ void TestBadAcceptMessageFields(nlTestSuite * inSuite, void * inContext) BitFlags responderControl; responderControl.Set(driveMode); - SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, - respondingSender, responderControl, maxBlockSize); + SendAndVerifyTransferInit(outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, respondingSender, + responderControl, maxBlockSize); // Verify AcceptTransfer() returns error for choosing larger max block size TransferSession::TransferAcceptData acceptData; @@ -574,7 +539,7 @@ void TestBadAcceptMessageFields(nlTestSuite * inSuite, void * inContext) acceptData.StartOffset = commonOffset; acceptData.Length = commonLength; err = respondingSender.AcceptTransfer(acceptData); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); // Verify AcceptTransfer() returns error for choosing unsupported transfer control mode TransferSession::TransferAcceptData acceptData2; @@ -584,11 +549,11 @@ void TestBadAcceptMessageFields(nlTestSuite * inSuite, void * inContext) acceptData2.StartOffset = commonOffset; acceptData2.Length = commonLength; err = respondingSender.AcceptTransfer(acceptData2); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); } // Test that a TransferSession will emit kTransferTimeout if the specified timeout is exceeded while waiting for a response. -void TestTimeout(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxTransferSession, TestTimeout) { CHIP_ERROR err = CHIP_NO_ERROR; TransferSession initiator; @@ -614,22 +579,22 @@ void TestTimeout(nlTestSuite * inSuite, void * inContext) // Verify initiator outputs respective Init message (depending on role) after StartTransfer() err = initiator.StartTransfer(role, initOptions, timeout); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); // First PollOutput() should output the TransferInit message initiator.PollOutput(outEvent, startTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); MessageType expectedInitMsg = (role == TransferRole::kSender) ? MessageType::SendInit : MessageType::ReceiveInit; - VerifyBdxMessageToSend(inSuite, inContext, outEvent, expectedInitMsg); + VerifyBdxMessageToSend(outEvent, expectedInitMsg); // Second PollOutput() with no call to HandleMessageReceived() should result in a timeout. initiator.PollOutput(outEvent, endTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kTransferTimeout); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kTransferTimeout); } // Test that sending the same block twice (with same block counter) results in a StatusReport message with BadBlockCounter. Also // test that receiving the StatusReport ends the transfer on the other node. -void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBdxTransferSession, TestDuplicateBlockError) { CHIP_ERROR err = CHIP_NO_ERROR; TransferSession::OutputEvent outEvent; @@ -661,8 +626,8 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext) BitFlags senderOpts; senderOpts.Set(driveMode); - SendAndVerifyTransferInit(inSuite, inContext, outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, - respondingSender, senderOpts, blockSize); + SendAndVerifyTransferInit(outEvent, timeout, initiatingReceiver, TransferRole::kReceiver, initOptions, respondingSender, + senderOpts, blockSize); // Compose ReceiveAccept parameters struct and give to respondingSender TransferSession::TransferAcceptData acceptData; @@ -673,10 +638,9 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext) acceptData.Metadata = nullptr; acceptData.MetadataLength = 0; - SendAndVerifyAcceptMsg(inSuite, inContext, outEvent, respondingSender, TransferRole::kSender, acceptData, initiatingReceiver, - initOptions); + SendAndVerifyAcceptMsg(outEvent, respondingSender, TransferRole::kSender, acceptData, initiatingReceiver, initOptions); - SendAndVerifyQuery(inSuite, inContext, respondingSender, initiatingReceiver, outEvent); + SendAndVerifyQuery(respondingSender, initiatingReceiver, outEvent); TransferSession::BlockData blockData; blockData.Data = fakeData; @@ -685,106 +649,52 @@ void TestDuplicateBlockError(nlTestSuite * inSuite, void * inContext) // Provide Block data and verify sender emits Block message err = respondingSender.PrepareBlock(blockData); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); respondingSender.PollOutput(eventWithBlock, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, eventWithBlock.EventType == TransferSession::OutputEventType::kMsgToSend); - VerifyBdxMessageToSend(inSuite, inContext, eventWithBlock, MessageType::Block); - VerifyNoMoreOutput(inSuite, inContext, respondingSender); + EXPECT_EQ(eventWithBlock.EventType, TransferSession::OutputEventType::kMsgToSend); + VerifyBdxMessageToSend(eventWithBlock, MessageType::Block); + VerifyNoMoreOutput(respondingSender); System::PacketBufferHandle blockCopy = System::PacketBufferHandle::NewWithData(eventWithBlock.MsgData->Start(), eventWithBlock.MsgData->DataLength()); // Pass Block message to receiver and verify matching Block is received err = AttachHeaderAndSend(eventWithBlock.msgTypeData, std::move(eventWithBlock.MsgData), initiatingReceiver); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); initiatingReceiver.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kBlockReceived); - NL_TEST_ASSERT(inSuite, outEvent.blockdata.Data != nullptr); - VerifyNoMoreOutput(inSuite, inContext, initiatingReceiver); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kBlockReceived); + EXPECT_NE(outEvent.blockdata.Data, nullptr); + VerifyNoMoreOutput(initiatingReceiver); - SendAndVerifyQuery(inSuite, inContext, respondingSender, initiatingReceiver, outEvent); + SendAndVerifyQuery(respondingSender, initiatingReceiver, outEvent); // Verify receiving same Block twice fails and results in StatusReport event, and then InternalError event err = AttachHeaderAndSend(eventWithBlock.msgTypeData, std::move(blockCopy), initiatingReceiver); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); initiatingReceiver.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kMsgToSend); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kMsgToSend); System::PacketBufferHandle statusReportMsg = outEvent.MsgData.Retain(); TransferSession::MessageTypeData statusReportMsgTypeData = outEvent.msgTypeData; - VerifyStatusReport(inSuite, inContext, std::move(outEvent.MsgData), StatusCode::kBadBlockCounter); + VerifyStatusReport(std::move(outEvent.MsgData), StatusCode::kBadBlockCounter); // All subsequent PollOutput() calls should return kInternalError for (int i = 0; i < 5; ++i) { initiatingReceiver.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kInternalError); - NL_TEST_ASSERT(inSuite, outEvent.statusData.statusCode == StatusCode::kBadBlockCounter); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kInternalError); + EXPECT_EQ(outEvent.statusData.statusCode, StatusCode::kBadBlockCounter); } err = AttachHeaderAndSend(statusReportMsgTypeData, std::move(statusReportMsg), respondingSender); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); respondingSender.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kStatusReceived); - NL_TEST_ASSERT(inSuite, outEvent.statusData.statusCode == StatusCode::kBadBlockCounter); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kStatusReceived); + EXPECT_EQ(outEvent.statusData.statusCode, StatusCode::kBadBlockCounter); // All subsequent PollOutput() calls should return kInternalError for (int i = 0; i < 5; ++i) { respondingSender.PollOutput(outEvent, kNoAdvanceTime); - NL_TEST_ASSERT(inSuite, outEvent.EventType == TransferSession::OutputEventType::kInternalError); - NL_TEST_ASSERT(inSuite, outEvent.statusData.statusCode == StatusCode::kBadBlockCounter); + EXPECT_EQ(outEvent.EventType, TransferSession::OutputEventType::kInternalError); + EXPECT_EQ(outEvent.statusData.statusCode, StatusCode::kBadBlockCounter); } } - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestInitiatingReceiverReceiverDrive", TestInitiatingReceiverReceiverDrive), - NL_TEST_DEF("TestInitiatingSenderSenderDrive", TestInitiatingSenderSenderDrive), - NL_TEST_DEF("TestBadAcceptMessageFields", TestBadAcceptMessageFields), - NL_TEST_DEF("TestTimeout", TestTimeout), - NL_TEST_DEF("TestDuplicateBlockError", TestDuplicateBlockError), - NL_TEST_SENTINEL() -}; -// clang-format on - -int TestBdxTransferSession_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -int TestBdxTransferSession_Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-TransferSession", - &sTests[0], - TestBdxTransferSession_Setup, - TestBdxTransferSession_Teardown -}; -// clang-format on - -/** - * Main - */ -int TestBdxTransferSession() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBdxTransferSession) diff --git a/src/protocols/bdx/tests/TestBdxUri.cpp b/src/protocols/bdx/tests/TestBdxUri.cpp index 8641ee1d4524a6..e94b88ec0d9f21 100644 --- a/src/protocols/bdx/tests/TestBdxUri.cpp +++ b/src/protocols/bdx/tests/TestBdxUri.cpp @@ -15,11 +15,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #include -#include +#include using namespace ::chip; @@ -30,7 +29,7 @@ CharSpan ToSpan(const char * str) return CharSpan::fromCharString(str); } -void TestParseURI(nlTestSuite * inSuite, void * inContext) +TEST(TestBdxUri, TestParseURI) { NodeId nodeId; CharSpan file; @@ -38,75 +37,55 @@ void TestParseURI(nlTestSuite * inSuite, void * inContext) const auto parse = [&](const char * uri) { return bdx::ParseURI(ToSpan(uri), nodeId, file); }; // Happy path - NL_TEST_ASSERT(inSuite, parse("bdx://1234567890ABCDEF/file_name") == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, nodeId == 0x1234567890ABCDEFULL); - NL_TEST_ASSERT(inSuite, file.data_equal(ToSpan("file_name"))); + EXPECT_EQ(parse("bdx://1234567890ABCDEF/file_name"), CHIP_NO_ERROR); + EXPECT_EQ(nodeId, 0x1234567890ABCDEFULL); + EXPECT_TRUE(file.data_equal(ToSpan("file_name"))); // File designator may contain slashes - NL_TEST_ASSERT(inSuite, parse("bdx://1234567890ABCDEF/file/na/me") == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, nodeId == 0x1234567890ABCDEFULL); - NL_TEST_ASSERT(inSuite, file.data_equal(ToSpan("file/na/me"))); + EXPECT_EQ(parse("bdx://1234567890ABCDEF/file/na/me"), CHIP_NO_ERROR); + EXPECT_EQ(nodeId, 0x1234567890ABCDEFULL); + EXPECT_TRUE(file.data_equal(ToSpan("file/na/me"))); // Wrong scheme - NL_TEST_ASSERT(inSuite, parse("bdy://1234567890ABCDEF/file_name") == CHIP_ERROR_INVALID_SCHEME_PREFIX); + EXPECT_EQ(parse("bdy://1234567890ABCDEF/file_name"), CHIP_ERROR_INVALID_SCHEME_PREFIX); // Node ID contains non-hex digit - NL_TEST_ASSERT(inSuite, parse("bdx://1234567890ABCDEG/file_name") == CHIP_ERROR_INVALID_DESTINATION_NODE_ID); + EXPECT_EQ(parse("bdx://1234567890ABCDEG/file_name"), CHIP_ERROR_INVALID_DESTINATION_NODE_ID); // Node ID too short - NL_TEST_ASSERT(inSuite, parse("bdx://1234567890ABCDE/file_name") == CHIP_ERROR_INVALID_DESTINATION_NODE_ID); + EXPECT_EQ(parse("bdx://1234567890ABCDE/file_name"), CHIP_ERROR_INVALID_DESTINATION_NODE_ID); // Node ID too long - NL_TEST_ASSERT(inSuite, parse("bdx://1234567890ABCDEFEF/file_name") == CHIP_ERROR_MISSING_URI_SEPARATOR); + EXPECT_EQ(parse("bdx://1234567890ABCDEFEF/file_name"), CHIP_ERROR_MISSING_URI_SEPARATOR); // Node ID to non-operational - NL_TEST_ASSERT(inSuite, parse("bdx://FFFFFFFFFFFFFFFF/file_name") == CHIP_ERROR_INVALID_DESTINATION_NODE_ID); + EXPECT_EQ(parse("bdx://FFFFFFFFFFFFFFFF/file_name"), CHIP_ERROR_INVALID_DESTINATION_NODE_ID); // No file designator - NL_TEST_ASSERT(inSuite, parse("bdx://1234567890ABCDEF/") == CHIP_ERROR_INVALID_STRING_LENGTH); + EXPECT_EQ(parse("bdx://1234567890ABCDEF/"), CHIP_ERROR_INVALID_STRING_LENGTH); } -void TestMakeURI(nlTestSuite * inSuite, void * inContext) +TEST(TestBdxUri, TestMakeURI) { char uriBuffer[128]; MutableCharSpan uri(uriBuffer); // Happy path - NL_TEST_ASSERT(inSuite, bdx::MakeURI(0xFEDCBA0987654321ULL, ToSpan("file_name"), uri) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, uri.data_equal(ToSpan("bdx://FEDCBA0987654321/file_name"))); + EXPECT_EQ(bdx::MakeURI(0xFEDCBA0987654321ULL, ToSpan("file_name"), uri), CHIP_NO_ERROR); + EXPECT_TRUE(uri.data_equal(ToSpan("bdx://FEDCBA0987654321/file_name"))); // File designator with slashes uri = MutableCharSpan(uriBuffer); - NL_TEST_ASSERT(inSuite, bdx::MakeURI(0xFEDCBA0987654321ULL, ToSpan("file/na/me"), uri) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, uri.data_equal(ToSpan("bdx://FEDCBA0987654321/file/na/me"))); + EXPECT_EQ(bdx::MakeURI(0xFEDCBA0987654321ULL, ToSpan("file/na/me"), uri), CHIP_NO_ERROR); + EXPECT_TRUE(uri.data_equal(ToSpan("bdx://FEDCBA0987654321/file/na/me"))); // Empty file designator uri = MutableCharSpan(uriBuffer); - NL_TEST_ASSERT(inSuite, bdx::MakeURI(0xFEDCBA0987654321ULL, CharSpan(), uri) != CHIP_NO_ERROR); + EXPECT_NE(bdx::MakeURI(0xFEDCBA0987654321ULL, CharSpan(), uri), CHIP_NO_ERROR); // Too small buffer uri = MutableCharSpan(uriBuffer, 31); - NL_TEST_ASSERT(inSuite, bdx::MakeURI(0xFEDCBA0987654321ULL, CharSpan(), uri) != CHIP_NO_ERROR); + EXPECT_NE(bdx::MakeURI(0xFEDCBA0987654321ULL, CharSpan(), uri), CHIP_NO_ERROR); } -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("TestParseURI", TestParseURI), - NL_TEST_DEF("TestMakeURI", TestMakeURI), - NL_TEST_SENTINEL() -}; -// clang-format on - -nlTestSuite sSuite = { "Test BDX URI", &sTests[0], nullptr, nullptr }; } // namespace - -int TestBdxUri() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestBdxUri) diff --git a/src/test_driver/openiotsdk/unit-tests/test_components.txt b/src/test_driver/openiotsdk/unit-tests/test_components.txt index 0471f70b7a1a55..c874d341b2d58c 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components.txt @@ -1,6 +1,7 @@ accesstest SystemLayerTests ASN1Tests +BDXTests MinimalMdnsCoreTests ChipCryptoTests MinimalMdnsRecordsTests diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index d9801e9f9cd305..2d1633c33228e7 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -1,5 +1,4 @@ AppTests -BDXTests DataModelTests InetLayerTests MessagingLayerTests @@ -9,4 +8,4 @@ SecureChannelTests SetupPayloadTestsNL SupportTestsNL TransportLayerTests -UserDirectedCommissioningTests +UserDirectedCommissioningTests \ No newline at end of file From f27b978f668c2c2c0f2cdf397c2d8b91deb310e7 Mon Sep 17 00:00:00 2001 From: feasel <120589145+feasel0@users.noreply.github.com> Date: Thu, 25 Apr 2024 09:45:16 -0400 Subject: [PATCH 10/40] Updated unit tests in src/transport/retransmit/tests/ to use PW instead of NL. (#33157) * Updated unit tests in src/transport/tests/ to use PW instead of NL. * Restyle --------- Co-authored-by: Andrei Litvin --- .../openiotsdk/unit-tests/test_components.txt | 1 + .../unit-tests/test_components_nl.txt | 1 - src/transport/retransmit/tests/BUILD.gn | 10 +- src/transport/retransmit/tests/TestCache.cpp | 195 ++++++++---------- 4 files changed, 88 insertions(+), 119 deletions(-) diff --git a/src/test_driver/openiotsdk/unit-tests/test_components.txt b/src/test_driver/openiotsdk/unit-tests/test_components.txt index c874d341b2d58c..4a61ab84fd3a60 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components.txt @@ -10,6 +10,7 @@ CoreTests MdnsTests CredentialsTest PlatformTests +RetransmitTests TestShell SetupPayloadTests SupportTests diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index 2d1633c33228e7..64f1862acfdf6a 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -3,7 +3,6 @@ DataModelTests InetLayerTests MessagingLayerTests RawTransportTests -RetransmitTests SecureChannelTests SetupPayloadTestsNL SupportTestsNL diff --git a/src/transport/retransmit/tests/BUILD.gn b/src/transport/retransmit/tests/BUILD.gn index a3e2333b4d6b7d..cd762b2c755571 100644 --- a/src/transport/retransmit/tests/BUILD.gn +++ b/src/transport/retransmit/tests/BUILD.gn @@ -14,20 +14,16 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlunit_test.gni") +import("//build_overrides/pigweed.gni") import("${chip_root}/build/chip/chip_test_suite.gni") -chip_test_suite_using_nltest("tests") { +chip_test_suite("tests") { output_name = "libRetransmitTests" cflags = [ "-Wconversion" ] test_sources = [ "TestCache.cpp" ] - public_deps = [ - "${chip_root}/src/lib/support:testing_nlunit", - "${chip_root}/src/transport/retransmit", - "${nlunit_test_root}:nlunit-test", - ] + public_deps = [ "${chip_root}/src/transport/retransmit" ] } diff --git a/src/transport/retransmit/tests/TestCache.cpp b/src/transport/retransmit/tests/TestCache.cpp index fefdbca67250ec..6142f4910dbf44 100644 --- a/src/transport/retransmit/tests/TestCache.cpp +++ b/src/transport/retransmit/tests/TestCache.cpp @@ -14,11 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #include -#include +#include // Helpers for simple payload management namespace { @@ -45,18 +44,16 @@ class TestableCache : public chip::Retransmit::Cache class IntPayloadTracker { public: - void Init(nlTestSuite * suite) { mSuite = suite; } - void Acquire(int value) { - NL_TEST_ASSERT(mSuite, (value > 0) && value < kMaxPayloadValue); + EXPECT_TRUE((value > 0) && value < kMaxPayloadValue); mAcquired.set(static_cast(value)); } void Release(int value) { - NL_TEST_ASSERT(mSuite, (value > 0) && value < kMaxPayloadValue); - NL_TEST_ASSERT(mSuite, mAcquired.test(static_cast(value))); + EXPECT_TRUE((value > 0) && value < kMaxPayloadValue); + EXPECT_TRUE(mAcquired.test(static_cast(value))); mAcquired.reset(static_cast(value)); } @@ -65,7 +62,6 @@ class IntPayloadTracker bool IsAcquired(int value) const { return mAcquired.test(static_cast(value)); } private: - nlTestSuite * mSuite; std::bitset mAcquired; }; @@ -104,176 +100,153 @@ void chip::Retransmit::Lifetime::Release(int & value) namespace { -void TestNoOp(nlTestSuite * inSuite, void * inContext) +TEST(TestCache, TestNoOp) { // unused address cache should not do any Acquire/release at any time - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); { TestableCache test; - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); } - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); } -void TestDestructorFree(nlTestSuite * inSuite, void * inContext) +TEST(TestCache, TestDestructorFree) { { TestableCache test; - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); - NL_TEST_ASSERT(inSuite, test.AddValue(1, 1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(2, 2) == CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(1, 1), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(2, 2), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 2); + EXPECT_EQ(gPayloadTracker.Count(), 2u); } // destructor should release the items - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); } -void OutOfSpace(nlTestSuite * inSuite, void * inContext) +TEST(TestCache, OutOfSpace) { { TestableCache test; - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); - NL_TEST_ASSERT(inSuite, test.AddValue(1, 1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(2, 2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(3, 4) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(4, 6) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 4); + EXPECT_EQ(test.AddValue(1, 1), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(2, 2), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(3, 4), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(4, 6), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 4u); - NL_TEST_ASSERT(inSuite, test.AddValue(5, 8) == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 4); + EXPECT_EQ(test.AddValue(5, 8), CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(gPayloadTracker.Count(), 4u); - NL_TEST_ASSERT(inSuite, test.AddValue(6, 10) == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 4); + EXPECT_EQ(test.AddValue(6, 10), CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(gPayloadTracker.Count(), 4u); } - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); } -void AddRemove(nlTestSuite * inSuite, void * inContext) +TEST(TestCache, AddRemove) { TestableCache test; - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); - NL_TEST_ASSERT(inSuite, test.AddValue(1, 1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(2, 2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(3, 4) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 3); + EXPECT_EQ(test.AddValue(1, 1), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(2, 2), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(3, 4), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 3u); - NL_TEST_ASSERT(inSuite, test.AddValue(10, 8) == CHIP_ERROR_NO_MEMORY); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 3); + EXPECT_EQ(test.AddValue(10, 8), CHIP_ERROR_NO_MEMORY); + EXPECT_EQ(gPayloadTracker.Count(), 3u); - NL_TEST_ASSERT(inSuite, test.Remove(2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 2); + EXPECT_EQ(test.Remove(2), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 2u); - NL_TEST_ASSERT(inSuite, test.AddValue(10, 8) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 3); + EXPECT_EQ(test.AddValue(10, 8), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 3u); - NL_TEST_ASSERT(inSuite, test.Remove(14) == CHIP_ERROR_KEY_NOT_FOUND); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 3); + EXPECT_EQ(test.Remove(14), CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(gPayloadTracker.Count(), 3u); - NL_TEST_ASSERT(inSuite, test.Remove(1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 2); + EXPECT_EQ(test.Remove(1), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 2u); - NL_TEST_ASSERT(inSuite, test.Remove(3) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 1); + EXPECT_EQ(test.Remove(3), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 1u); - NL_TEST_ASSERT(inSuite, test.Remove(3) == CHIP_ERROR_KEY_NOT_FOUND); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 1); + EXPECT_EQ(test.Remove(3), CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(gPayloadTracker.Count(), 1u); - NL_TEST_ASSERT(inSuite, test.Remove(10) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(test.Remove(10), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 0u); - NL_TEST_ASSERT(inSuite, test.Remove(10) == CHIP_ERROR_KEY_NOT_FOUND); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(test.Remove(10), CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(gPayloadTracker.Count(), 0u); } -void RemoveMatching(nlTestSuite * inSuite, void * inContext) +TEST(TestCache, RemoveMatching) { TestableCache test; - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); - NL_TEST_ASSERT(inSuite, test.AddValue(1, 1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(2, 2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(3, 4) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(4, 8) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 4); + EXPECT_EQ(test.AddValue(1, 1), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(2, 2), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(3, 4), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(4, 8), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 4u); test.RemoveMatching(DivisibleBy(2)); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 2); + EXPECT_EQ(gPayloadTracker.Count(), 2u); // keys 1 and 3 remain - NL_TEST_ASSERT(inSuite, gPayloadTracker.IsAcquired(1)); - NL_TEST_ASSERT(inSuite, gPayloadTracker.IsAcquired(4)); + EXPECT_TRUE(gPayloadTracker.IsAcquired(1)); + EXPECT_TRUE(gPayloadTracker.IsAcquired(4)); - NL_TEST_ASSERT(inSuite, test.Remove(3) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.IsAcquired(1)); - NL_TEST_ASSERT(inSuite, !gPayloadTracker.IsAcquired(4)); + EXPECT_EQ(test.Remove(3), CHIP_NO_ERROR); + EXPECT_TRUE(gPayloadTracker.IsAcquired(1)); + EXPECT_FALSE(gPayloadTracker.IsAcquired(4)); } -void FindMatching(nlTestSuite * inSuite, void * inContext) +TEST(TestCache, FindMatching) { TestableCache test; - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 0); + EXPECT_EQ(gPayloadTracker.Count(), 0u); - NL_TEST_ASSERT(inSuite, test.AddValue(1, 1) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(2, 2) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(3, 4) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.AddValue(4, 8) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, gPayloadTracker.Count() == 4); + EXPECT_EQ(test.AddValue(1, 1), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(2, 2), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(3, 4), CHIP_NO_ERROR); + EXPECT_EQ(test.AddValue(4, 8), CHIP_NO_ERROR); + EXPECT_EQ(gPayloadTracker.Count(), 4u); const int * key; const int * value; - NL_TEST_ASSERT(inSuite, test.Find(DivisibleBy(20), &key, &value) == false); - NL_TEST_ASSERT(inSuite, key == nullptr); - NL_TEST_ASSERT(inSuite, value == nullptr); + EXPECT_FALSE(test.Find(DivisibleBy(20), &key, &value)); + EXPECT_EQ(key, nullptr); + EXPECT_EQ(value, nullptr); // This relies on linear add. May need changing if implementation changes - NL_TEST_ASSERT(inSuite, test.Find(DivisibleBy(2), &key, &value) == true); - NL_TEST_ASSERT(inSuite, *key == 2); - NL_TEST_ASSERT(inSuite, *value == 2); + EXPECT_TRUE(test.Find(DivisibleBy(2), &key, &value)); + EXPECT_EQ(*key, 2); + EXPECT_EQ(*value, 2); - NL_TEST_ASSERT(inSuite, test.Remove(*key) == CHIP_NO_ERROR); + EXPECT_EQ(test.Remove(*key), CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.Find(DivisibleBy(2), &key, &value) == true); - NL_TEST_ASSERT(inSuite, *key == 4); - NL_TEST_ASSERT(inSuite, *value == 8); + EXPECT_TRUE(test.Find(DivisibleBy(2), &key, &value)); + EXPECT_EQ(*key, 4); + EXPECT_EQ(*value, 8); - NL_TEST_ASSERT(inSuite, test.Remove(*key) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, test.Find(DivisibleBy(2), &key, &value) == false); - NL_TEST_ASSERT(inSuite, key == nullptr); - NL_TEST_ASSERT(inSuite, value == nullptr); + EXPECT_EQ(test.Remove(*key), CHIP_NO_ERROR); + EXPECT_FALSE(test.Find(DivisibleBy(2), &key, &value)); + EXPECT_EQ(key, nullptr); + EXPECT_EQ(value, nullptr); } } // namespace - -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("NoOp", TestNoOp), - NL_TEST_DEF("DestructorFree", TestDestructorFree), - NL_TEST_DEF("OutOfSpace", OutOfSpace), - NL_TEST_DEF("AddRemove", AddRemove), - NL_TEST_DEF("RemoveMatching", RemoveMatching), - NL_TEST_DEF("FindMatching", FindMatching), - NL_TEST_SENTINEL() -}; -// clang-format on - -int TestCache() -{ - nlTestSuite theSuite = { "Retransmit-Cache", &sTests[0], nullptr, nullptr }; - gPayloadTracker.Init(&theSuite); - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestCache) From 59557f4d45da0b3de08f7ab0aad946ccd4446b87 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Thu, 25 Apr 2024 11:39:22 -0400 Subject: [PATCH 11/40] TC-DGGEN-3.2: Add (#32995) * TC-DGGEN-3.2: Add * Apply suggestions from code review * lint * move save out of expected outcome * Restyled by autopep8 * spelling * Apply suggestions from code review --------- Co-authored-by: Restyled.io --- src/python_testing/TC_DGGEN_3_2.py | 48 +++++++++++++ .../test_testing/MockTestRunner.py | 4 +- .../test_testing/test_TC_DGGEN_3_2.py | 71 +++++++++++++++++++ .../test_testing/test_TC_TMP_2_1.py | 2 +- 4 files changed, 122 insertions(+), 3 deletions(-) create mode 100644 src/python_testing/TC_DGGEN_3_2.py create mode 100644 src/python_testing/test_testing/test_TC_DGGEN_3_2.py diff --git a/src/python_testing/TC_DGGEN_3_2.py b/src/python_testing/TC_DGGEN_3_2.py new file mode 100644 index 00000000000000..7e5af6c7a5ea73 --- /dev/null +++ b/src/python_testing/TC_DGGEN_3_2.py @@ -0,0 +1,48 @@ +# +# Copyright (c) 2024 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. +# + +import chip.clusters as Clusters +from matter_testing_support import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_DGGEN_3_2(MatterBaseTest): + def steps_TC_DGGEN_3_2(self): + return [TestStep(0, "Commission DUT (already done)", is_commissioning=True), + TestStep(1, "TH reads the MaxPathsPerInvoke attribute from the Basic Information Cluster from DUT. Save the value as `max_paths_per_invoke", + "Read is successful"), + TestStep(2, "TH reads FeatureMap attribute from the General Diagnostics Cluster from DUT", + "Verify that the FeatureMap value has the DMTEST feature bit (0) set to 1 if `max_path_per_invoke` > 1") + ] + + @async_test_body + async def test_TC_DGGEN_3_2(self): + # commissioning - already done + self.step(0) + + self.step(1) + max_paths_per_invoke = await self.read_single_attribute_check_success(cluster=Clusters.BasicInformation, attribute=Clusters.BasicInformation.Attributes.MaxPathsPerInvoke) + + self.step(2) + feature_map = await self.read_single_attribute_check_success(cluster=Clusters.GeneralDiagnostics, attribute=Clusters.GeneralDiagnostics.Attributes.FeatureMap) + if max_paths_per_invoke > 1: + asserts.assert_true(feature_map & Clusters.GeneralDiagnostics.Bitmaps.Feature.kDataModelTest, + "DMTEST feature must be set if MaxPathsPerInvoke > 1") + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/test_testing/MockTestRunner.py b/src/python_testing/test_testing/MockTestRunner.py index 79f6e21e2b434e..451e38d4660ac6 100644 --- a/src/python_testing/test_testing/MockTestRunner.py +++ b/src/python_testing/test_testing/MockTestRunner.py @@ -37,9 +37,9 @@ async def __call__(self, *args, **kwargs): class MockTestRunner(): - def __init__(self, filename: str, classname: str, test: str): + def __init__(self, filename: str, classname: str, test: str, endpoint: int): self.config = MatterTestConfig( - tests=[test], endpoint=1, dut_node_ids=[1]) + tests=[test], endpoint=endpoint, dut_node_ids=[1]) self.stack = MatterStackState(self.config) self.default_controller = self.stack.certificate_authorities[0].adminList[0].NewController( nodeId=self.config.controller_node_id, diff --git a/src/python_testing/test_testing/test_TC_DGGEN_3_2.py b/src/python_testing/test_testing/test_TC_DGGEN_3_2.py new file mode 100644 index 00000000000000..34b80514035945 --- /dev/null +++ b/src/python_testing/test_testing/test_TC_DGGEN_3_2.py @@ -0,0 +1,71 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2024 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. +# + +import sys +from dataclasses import dataclass + +import chip.clusters as Clusters +from chip.clusters import Attribute +from MockTestRunner import MockTestRunner + + +@dataclass +class TestSpec(): + max_paths: int + dmtest_feature_map: int + expect_pass: bool + + +TEST_CASES = [ + TestSpec(1, 0, True), + TestSpec(1, 1, True), + TestSpec(2, 0, False), + TestSpec(2, 1, True), +] + + +def test_spec_to_attribute_cache(test_spec: TestSpec) -> Attribute.AsyncReadTransaction.ReadResponse: + bi = Clusters.BasicInformation + bi_attr = bi.Attributes + gd = Clusters.GeneralDiagnostics + gd_attr = gd.Attributes + resp = Attribute.AsyncReadTransaction.ReadResponse({}, [], {}) + resp.attributes = {0: {bi: {bi_attr.MaxPathsPerInvoke: test_spec.max_paths}, + gd: {gd_attr.FeatureMap: test_spec.dmtest_feature_map}}} + return resp + + +def main(): + test_runner = MockTestRunner('TC_DGGEN_3_2', 'TC_DGGEN_3_2', 'test_TC_DGGEN_3_2', 0) + failures = [] + for idx, t in enumerate(TEST_CASES): + ok = test_runner.run_test_with_mock_read(test_spec_to_attribute_cache(t)) == t.expect_pass + if not ok: + failures.append(f"Test case failure: {idx} {t}") + + test_runner.Shutdown() + print( + f"Test of tests: run {len(TEST_CASES)}, test response correct: {len(TEST_CASES) - len(failures)} test response incorrect: {len(failures)}") + for f in failures: + print(f) + + return 1 if failures else 0 + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/src/python_testing/test_testing/test_TC_TMP_2_1.py b/src/python_testing/test_testing/test_TC_TMP_2_1.py index 5693aced8ba505..fe888a4896cb28 100644 --- a/src/python_testing/test_testing/test_TC_TMP_2_1.py +++ b/src/python_testing/test_testing/test_TC_TMP_2_1.py @@ -160,7 +160,7 @@ def test_spec_to_attribute_cache(test_spec: TestSpec) -> Attribute.AsyncReadTran def main(): - test_runner = MockTestRunner('TC_TMP_2_1', 'TC_TMP_2_1', 'test_TC_TMP_2_1') + test_runner = MockTestRunner('TC_TMP_2_1', 'TC_TMP_2_1', 'test_TC_TMP_2_1', 1) failures = [] for idx, t in enumerate(TEST_CASES): ok = test_runner.run_test_with_mock_read(test_spec_to_attribute_cache(t)) == t.expect_pass From b3cc2700d974d97e06dbf7a571e417b775968dcd Mon Sep 17 00:00:00 2001 From: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:11:15 -0400 Subject: [PATCH 12/40] [Silabs] Bring Event queue based processing to wifi ncp apps (#33113) * Pull request #1754: MATTER-3434: Port 917c soc Event queue based processing to 9116/917 ncp Merge in WMN_TOOLS/matter from bugfix/ncp_commissioning to RC_2.3.0-1.3 Squashed commit of the following: commit 07682286ca70636224f45a8d9823101bddbee035 Author: Junior Martinez <67972863+jmartinez-silabs@users.noreply.github.com> Date: Sat Apr 13 13:44:11 2024 -0400 Port 917c soc Event queue based processing to 9116/917 ncp * Restyled by whitespace * Restyled by clang-format * Fix build by including a header earlier in the file (temp fix). --------- Co-authored-by: Restyled.io --- .../platform/silabs/efr32/rs911x/rsi_if.c | 451 +++++++++++------- .../silabs/efr32/rs911x/wfx_rsi_host.cpp | 36 +- examples/platform/silabs/wfx_rsi.h | 11 +- 3 files changed, 293 insertions(+), 205 deletions(-) diff --git a/examples/platform/silabs/efr32/rs911x/rsi_if.c b/examples/platform/silabs/efr32/rs911x/rsi_if.c index 00efeee09a4efb..3596b098b7a1ca 100644 --- a/examples/platform/silabs/efr32/rs911x/rsi_if.c +++ b/examples/platform/silabs/efr32/rs911x/rsi_if.c @@ -26,21 +26,14 @@ #include "em_usart.h" #include "sl_status.h" - -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" - -#include "silabs_utils.h" - +#include +// TODO Fix include order issue #33120 #include "wfx_host_events.h" -#include "rsi_driver.h" -#include "rsi_wlan_non_rom.h" - #include "rsi_bootup_config.h" #include "rsi_common_apis.h" #include "rsi_data_types.h" +#include "rsi_driver.h" #include "rsi_error.h" #include "rsi_nwk.h" #include "rsi_socket.h" @@ -48,10 +41,11 @@ #include "rsi_wlan.h" #include "rsi_wlan_apis.h" #include "rsi_wlan_config.h" +#include "rsi_wlan_non_rom.h" +#include "silabs_utils.h" #include "dhcp_client.h" #include "lwip/nd6.h" -#include "wfx_host_events.h" #include "wfx_rsi.h" // TODO convert this file to cpp and use CodeUtils.h @@ -59,6 +53,8 @@ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif +#define WFX_QUEUE_SIZE 10 + /* Rsi driver Task will use as its stack */ StackType_t driverRsiTaskStack[WFX_RSI_WLAN_TASK_SZ] = { 0 }; @@ -84,12 +80,54 @@ uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS; extern rsi_semaphore_handle_t sl_rs_ble_init_sem; #endif +// DHCP Poll timer +static osTimerId_t sDHCPTimer; +static osMessageQueueId_t sWifiEventQueue = NULL; /* * This file implements the interface to the RSI SAPIs */ static uint8_t wfx_rsi_drv_buf[WFX_RSI_BUF_SZ]; static wfx_wifi_scan_ext_t temp_reset; +static void DHCPTimerEventHandler(void * arg) +{ + WfxEvent_t event; + event.eventType = WFX_EVT_DHCP_POLL; + WfxPostEvent(&event); +} + +static void CancelDHCPTimer() +{ + osStatus_t status; + + // Check if timer started + if (!osTimerIsRunning(sDHCPTimer)) + { + SILABS_LOG("CancelDHCPTimer: timer not running"); + return; + } + + status = osTimerStop(sDHCPTimer); + if (status != osOK) + { + SILABS_LOG("CancelDHCPTimer: failed to stop timer with status: %d", status); + } +} + +static void StartDHCPTimer(uint32_t timeout) +{ + osStatus_t status; + + // Cancel timer if already started + CancelDHCPTimer(); + + status = osTimerStart(sDHCPTimer, pdMS_TO_TICKS(timeout)); + if (status != osOK) + { + SILABS_LOG("StartDHCPTimer: failed to start timer with status: %d", status); + } +} + /****************************************************************** * @fn int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t *ap) * @brief @@ -234,7 +272,7 @@ int32_t wfx_rsi_power_save() *********************************************************************/ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t len) { - SILABS_LOG("%s: status: %02x", __func__, status); + WfxEvent_t WfxEvent; wfx_rsi.dev_state &= ~WFX_RSI_ST_STA_CONNECTING; if (status != RSI_SUCCESS) { @@ -244,7 +282,10 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t SILABS_LOG("%s: failed. retry: %d", __func__, wfx_rsi.join_retries); wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries++); if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) - xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); + { + WfxEvent.eventType = WFX_EVT_STA_START_JOIN; + WfxPostEvent(&WfxEvent); + } } else { @@ -253,7 +294,8 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t */ memset(&temp_reset, 0, sizeof(wfx_wifi_scan_ext_t)); SILABS_LOG("%s: join completed.", __func__); - xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_CONN); + WfxEvent.eventType = WFX_EVT_STA_CONN; + WfxPostEvent(&WfxEvent); wfx_rsi.join_retries = 0; retryInterval = WLAN_MIN_RETRY_TIMER_MS; } @@ -272,10 +314,12 @@ static void wfx_rsi_join_cb(uint16_t status, const uint8_t * buf, const uint16_t static void wfx_rsi_join_fail_cb(uint16_t status, uint8_t * buf, uint32_t len) { SILABS_LOG("%s: error: failed status: %02x", __func__, status); + WfxEvent_t WfxEvent; wfx_rsi.join_retries += 1; wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); is_wifi_disconnection_event = true; - xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); + WfxEvent.eventType = WFX_EVT_STA_START_JOIN; + WfxPostEvent(&WfxEvent); } /************************************************************************************* * @fn wfx_rsi_wlan_pkt_cb(uint16_t status, uint8_t *buf, uint32_t len) @@ -380,7 +424,22 @@ static int32_t wfx_rsi_init(void) SILABS_LOG("%s: WLAN: MAC %02x:%02x:%02x %02x:%02x:%02x", __func__, wfx_rsi.sta_mac.octet[0], wfx_rsi.sta_mac.octet[1], wfx_rsi.sta_mac.octet[2], wfx_rsi.sta_mac.octet[3], wfx_rsi.sta_mac.octet[4], wfx_rsi.sta_mac.octet[5]); - wfx_rsi.events = xEventGroupCreateStatic(&rsiDriverEventGroup); + + // Create the message queue + sWifiEventQueue = osMessageQueueNew(WFX_QUEUE_SIZE, sizeof(WfxEvent_t), NULL); + if (sWifiEventQueue == NULL) + { + return SL_STATUS_ALLOCATION_FAILED; + } + + // Create timer for DHCP polling + // TODO: Use LWIP timer instead of creating a new one here + sDHCPTimer = osTimerNew(DHCPTimerEventHandler, osTimerPeriodic, NULL, NULL); + if (sDHCPTimer == NULL) + { + return SL_STATUS_ALLOCATION_FAILED; + } + /* * Register callbacks - We are only interested in the connectivity CBs */ @@ -552,6 +611,191 @@ static void wfx_rsi_do_join(void) } } +/** NotifyConnectivity + * @brief Notify the application about the connectivity status if it has not been notified yet. + * Helper function for HandleDHCPPolling. + */ +void NotifyConnectivity() +{ + if (!hasNotifiedWifiConnectivity) + { + wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac); + hasNotifiedWifiConnectivity = true; + } +} + +void HandleDHCPPolling() +{ + struct netif * sta_netif; + WfxEvent_t event; + + sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE); + if (sta_netif == NULL) + { + // TODO: Notify the application that the interface is not set up or Chipdie here because we are in an unkonwn state + SILABS_LOG("HandleDHCPPolling: failed to get STA netif"); + return; + } +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) + uint8_t dhcp_state = dhcpclient_poll(sta_netif); + if (dhcp_state == DHCP_ADDRESS_ASSIGNED && !hasNotifiedIPV4) + { + wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr); + hasNotifiedIPV4 = true; + NotifyConnectivity(); + } + else if (dhcp_state == DHCP_OFF) + { + wfx_ip_changed_notify(IP_STATUS_FAIL); + hasNotifiedIPV4 = false; + } +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + /* Checks if the assigned IPv6 address is preferred by evaluating + * the first block of IPv6 address ( block 0) + */ + if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && !hasNotifiedIPV6) + { + wfx_ipv6_notify(GET_IPV6_SUCCESS); + hasNotifiedIPV6 = true; + event.eventType = WFX_EVT_STA_DHCP_DONE; + WfxPostEvent(&event); + NotifyConnectivity(); + } +} + +/** ResetDHCPNotificationFlags + * @brief Reset the flags that are used to notify the application about DHCP connectivity + * and emits a WFX_EVT_STA_DO_DHCP event to trigger DHCP polling checks. Helper function for ProcessEvent. + */ +void ResetDHCPNotificationFlags() +{ + WfxEvent_t outEvent; + +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) + hasNotifiedIPV4 = false; +#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4 + hasNotifiedIPV6 = false; + hasNotifiedWifiConnectivity = false; + + outEvent.eventType = WFX_EVT_STA_DO_DHCP; + WfxPostEvent(&outEvent); +} + +/** + * @brief Post the WfxEvent to tue WiFiEventQueue to be process by the wfx_rsi_task + */ +void WfxPostEvent(WfxEvent_t * event) +{ + sl_status_t status = osMessageQueuePut(sWifiEventQueue, event, 0, 0); + + if (status != osOK) + { + SILABS_LOG("WfxPostEvent: failed to post event with status: %d", status); + // TODO: Handle error, requeue event depending on queue size or notify relevant task, Chipdie, etc. + } +} + +void ProcessEvent(WfxEvent_t inEvent) +{ + // Process event + switch (inEvent.eventType) + { + case WFX_EVT_STA_CONN: + SILABS_LOG("%s: starting LwIP STA", __func__); + wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED; + ResetDHCPNotificationFlags(); + wfx_lwip_set_sta_link_up(); + /* We need to get AP Mac - TODO */ + // Uncomment once the hook into MATTER is moved to IP connectivty instead + // of AP connectivity. + // wfx_connected_notify(0, &wfx_rsi.ap_mac); // This + // is independant of IP connectivity. + break; + case WFX_EVT_STA_DISCONN: + // TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something + wfx_rsi.dev_state &= + ~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE); + SILABS_LOG("%s: disconnect notify", __func__); + /* TODO: Implement disconnect notify */ + ResetDHCPNotificationFlags(); + wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) -> + // wfx_ip_changed_notify(0) for IPV4 +#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) + wfx_ip_changed_notify(IP_STATUS_FAIL); +#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + wfx_ipv6_notify(GET_IPV6_FAIL); + break; + case WFX_EVT_AP_START: + // TODO: Currently unimplemented + break; + case WFX_EVT_AP_STOP: + // TODO: Currently unimplemented + break; + case WFX_EVT_SCAN: +#ifdef SL_WFX_CONFIG_SCAN + rsi_rsp_scan_t scan_rsp = { 0 }; + int32_t status = rsi_wlan_bgscan_profile(1, &scan_rsp, sizeof(scan_rsp)); + + if (status) + { + SILABS_LOG("SSID scan failed: %02x ", status); + } + else + { + rsi_scan_info_t * scan; + wfx_wifi_scan_result_t ap; + for (int x = 0; x < scan_rsp.scan_count[0]; x++) + { + scan = &scan_rsp.scan_info[x]; + // is it a scan all or target scan + if (!wfx_rsi.scan_ssid || (wfx_rsi.scan_ssid && strcmp(wfx_rsi.scan_ssid, (char *) scan->ssid) == CMP_SUCCESS)) + { + strncpy(ap.ssid, (char *) scan->ssid, MIN(sizeof(ap.ssid), sizeof(scan->ssid))); + ap.security = scan->security_mode; + ap.rssi = (-1) * scan->rssi_val; + configASSERT(sizeof(ap.bssid) >= BSSID_MAX_STR_LEN); + configASSERT(sizeof(scan->bssid) >= BSSID_MAX_STR_LEN); + memcpy(ap.bssid, scan->bssid, BSSID_MAX_STR_LEN); + (*wfx_rsi.scan_cb)(&ap); + + if (wfx_rsi.scan_ssid) + { + break; // we found the targeted ssid. + } + } + } + } + + /* Terminate with end of scan which is no ap sent back */ + (*wfx_rsi.scan_cb)((wfx_wifi_scan_result_t *) 0); + wfx_rsi.scan_cb = (void (*)(wfx_wifi_scan_result_t *)) 0; + + if (wfx_rsi.scan_ssid) + { + vPortFree(wfx_rsi.scan_ssid); + wfx_rsi.scan_ssid = (char *) 0; + } + break; +#endif /* SL_WFX_CONFIG_SCAN */ + case WFX_EVT_STA_START_JOIN: + // saving the AP related info + wfx_rsi_save_ap_info(); + // Joining to the network + wfx_rsi_do_join(); + break; + case WFX_EVT_STA_DO_DHCP: + StartDHCPTimer(WFX_RSI_DHCP_POLL_INTERVAL); + break; + case WFX_EVT_STA_DHCP_DONE: + CancelDHCPTimer(); + break; + case WFX_EVT_DHCP_POLL: + HandleDHCPPolling(); + default: + break; + } +} + /********************************************************************************* * @fn void wfx_rsi_task(void *arg) * @brief @@ -565,9 +809,6 @@ static void wfx_rsi_do_join(void) /* ARGSUSED */ void wfx_rsi_task(void * arg) { - EventBits_t flags; - TickType_t last_dhcp_poll, now; - struct netif * sta_netif; (void) arg; uint32_t rsi_status = wfx_rsi_init(); if (rsi_status != RSI_SUCCESS) @@ -575,180 +816,22 @@ void wfx_rsi_task(void * arg) SILABS_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, rsi_status); return; } + WfxEvent_t wfxEvent; wfx_lwip_start(); - last_dhcp_poll = xTaskGetTickCount(); - sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE); wfx_started_notify(); - SILABS_LOG("%s: starting event wait", __func__); + SILABS_LOG("Starting event loop"); for (;;) { - /* - * This is the main job of this task. - * Wait for commands from the ConnectivityManager - * Make state changes (based on call backs) - */ - flags = xEventGroupWaitBits(wfx_rsi.events, - WFX_EVT_STA_CONN | WFX_EVT_STA_DISCONN | WFX_EVT_STA_START_JOIN -#ifdef SL_WFX_CONFIG_SOFTAP - | WFX_EVT_AP_START | WFX_EVT_AP_STOP -#endif /* SL_WFX_CONFIG_SOFTAP */ -#ifdef SL_WFX_CONFIG_SCAN - | WFX_EVT_SCAN -#endif /* SL_WFX_CONFIG_SCAN */ - | 0, - pdTRUE, /* Clear the bits */ - pdFALSE, /* Wait for any bit */ - pdMS_TO_TICKS(250)); /* 250 mSec */ - - if (flags) - { - SILABS_LOG("%s: wait event encountered: %x", __func__, flags); - } - /* - * Let's handle DHCP polling here - */ - if (wfx_rsi.dev_state & WFX_RSI_ST_STA_CONNECTED) - { - if ((now = xTaskGetTickCount()) > (last_dhcp_poll + pdMS_TO_TICKS(250))) - { -#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) - uint8_t dhcp_state = dhcpclient_poll(sta_netif); - if (dhcp_state == DHCP_ADDRESS_ASSIGNED && !hasNotifiedIPV4) - { - wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr); - hasNotifiedIPV4 = true; - if (!hasNotifiedWifiConnectivity) - { - wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac); - hasNotifiedWifiConnectivity = true; - } - } - else if (dhcp_state == DHCP_OFF) - { - wfx_ip_changed_notify(IP_STATUS_FAIL); - hasNotifiedIPV4 = false; - } -#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ - /* - * Checks if the assigned IPv6 address is preferred by evaluating - * the first block of IPv6 address ( block 0) - */ - if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && !hasNotifiedIPV6) - { - wfx_ipv6_notify(GET_IPV6_SUCCESS); - hasNotifiedIPV6 = true; - if (!hasNotifiedWifiConnectivity) - { - wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac); - hasNotifiedWifiConnectivity = true; - } - } - last_dhcp_poll = now; - } - } - if (flags & WFX_EVT_STA_START_JOIN) - { - // saving the AP related info - wfx_rsi_save_ap_info(); - // Joining to the network - wfx_rsi_do_join(); - } - if (flags & WFX_EVT_STA_CONN) - { - /* - * Initiate the Join command (assuming we have been provisioned) - */ - SILABS_LOG("%s: starting LwIP STA", __func__); - wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTED; - hasNotifiedWifiConnectivity = false; -#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) - hasNotifiedIPV4 = false; -#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4 - hasNotifiedIPV6 = false; - wfx_lwip_set_sta_link_up(); - /* We need to get AP Mac - TODO */ - // Uncomment once the hook into MATTER is moved to IP connectivty instead - // of AP connectivity. wfx_connected_notify(0, &wfx_rsi.ap_mac); // This - // is independant of IP connectivity. - } - if (flags & WFX_EVT_STA_DISCONN) - { - wfx_rsi.dev_state &= - ~(WFX_RSI_ST_STA_READY | WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED | WFX_RSI_ST_STA_DHCP_DONE); - SILABS_LOG("%s: disconnect notify", __func__); - /* TODO: Implement disconnect notify */ - wfx_lwip_set_sta_link_down(); // Internally dhcpclient_poll(netif) -> - // wfx_ip_changed_notify(0) for IPV4 -#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4) - wfx_ip_changed_notify(IP_STATUS_FAIL); - hasNotifiedIPV4 = false; -#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ - wfx_ipv6_notify(GET_IPV6_FAIL); - hasNotifiedIPV6 = false; - hasNotifiedWifiConnectivity = false; - } -#ifdef SL_WFX_CONFIG_SCAN - if (flags & WFX_EVT_SCAN) - { - if (!(wfx_rsi.dev_state & WFX_RSI_ST_SCANSTARTED)) - { - rsi_rsp_scan_t scan_rsp = { 0 }; - int32_t status = rsi_wlan_bgscan_profile(1, &scan_rsp, sizeof(scan_rsp)); - - if (status) - { - SILABS_LOG("SSID scan failed: %02x ", status); - } - else - { - rsi_scan_info_t * scan; - wfx_wifi_scan_result_t ap; - for (int x = 0; x < scan_rsp.scan_count[0]; x++) - { - scan = &scan_rsp.scan_info[x]; - // is it a scan all or target scan - if (!wfx_rsi.scan_ssid || - (wfx_rsi.scan_ssid && strcmp(wfx_rsi.scan_ssid, (char *) scan->ssid) == CMP_SUCCESS)) - { - strncpy(ap.ssid, (char *) scan->ssid, MIN(sizeof(ap.ssid), sizeof(scan->ssid))); - ap.security = scan->security_mode; - ap.rssi = (-1) * scan->rssi_val; - configASSERT(sizeof(ap.bssid) >= BSSID_MAX_STR_LEN); - configASSERT(sizeof(scan->bssid) >= BSSID_MAX_STR_LEN); - memcpy(ap.bssid, scan->bssid, BSSID_MAX_STR_LEN); - (*wfx_rsi.scan_cb)(&ap); - - if (wfx_rsi.scan_ssid) - { - break; // we found the targeted ssid. - } - } - } - } - - wfx_rsi.dev_state &= ~WFX_RSI_ST_SCANSTARTED; - /* Terminate with end of scan which is no ap sent back */ - (*wfx_rsi.scan_cb)((wfx_wifi_scan_result_t *) 0); - wfx_rsi.scan_cb = (void (*)(wfx_wifi_scan_result_t *)) 0; - - if (wfx_rsi.scan_ssid) - { - vPortFree(wfx_rsi.scan_ssid); - wfx_rsi.scan_ssid = (char *) 0; - } - } - } -#endif /* SL_WFX_CONFIG_SCAN */ -#ifdef SL_WFX_CONFIG_SOFTAP - /* TODO */ - if (flags & WFX_EVT_AP_START) + osStatus_t status = osMessageQueueGet(sWifiEventQueue, &wfxEvent, NULL, osWaitForever); + if (status == osOK) { + ProcessEvent(wfxEvent); } - if (flags & WFX_EVT_AP_STOP) + else { + SILABS_LOG("Failed to get event with status: %x", status); } -#endif /* SL_WFX_CONFIG_SOFTAP */ } } diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.cpp b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.cpp index 8764c0a9dda8bb..8d92c0e3dc5c3e 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.cpp +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.cpp @@ -31,6 +31,7 @@ #include "FreeRTOS.h" #include "event_groups.h" #include "task.h" + #include "wfx_host_events.h" #include "wfx_rsi.h" @@ -106,16 +107,14 @@ bool wfx_is_sta_mode_enabled(void) ***********************************************************************/ void wfx_get_wifi_mac_addr(sl_wfx_interface_t interface, sl_wfx_mac_address_t * addr) { - sl_wfx_mac_address_t * mac; - + if (addr) + { #ifdef SL_WFX_CONFIG_SOFTAP - mac = (interface == SL_WFX_SOFTAP_INTERFACE) ? &wfx_rsi.softap_mac : &wfx_rsi.sta_mac; + *addr = (interface == SL_WFX_SOFTAP_INTERFACE) ? wfx_rsi.softap_mac : wfx_rsi.sta_mac; #else - mac = &wfx_rsi.sta_mac; + *addr = wfx_rsi.sta_mac; #endif - *addr = *mac; - SILABS_LOG("%s: %02x:%02x:%02x:%02x:%02x:%02x", __func__, mac->octet[0], mac->octet[1], mac->octet[2], mac->octet[3], - mac->octet[4], mac->octet[5]); + } } /********************************************************************* @@ -128,10 +127,11 @@ void wfx_get_wifi_mac_addr(sl_wfx_interface_t interface, sl_wfx_mac_address_t * ***********************************************************************/ void wfx_set_wifi_provision(wfx_wifi_provision_t * cfg) { - SILABS_LOG("%s: SSID: %s", __func__, &wfx_rsi.sec.ssid[0]); - - wfx_rsi.sec = *cfg; - wfx_rsi.dev_state |= WFX_RSI_ST_STA_PROVISIONED; + if (cfg) + { + wfx_rsi.sec = *cfg; + wfx_rsi.dev_state |= WFX_RSI_ST_STA_PROVISIONED; + } } /********************************************************************* @@ -178,14 +178,16 @@ void wfx_clear_wifi_provision(void) ****************************************************************************/ sl_status_t wfx_connect_to_ap(void) { + WfxEvent_t event; if (wfx_rsi.dev_state & WFX_RSI_ST_STA_PROVISIONED) { - SILABS_LOG("%s: connecting to access point -> SSID: %s", __func__, &wfx_rsi.sec.ssid[0]); - xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); + SILABS_LOG("Connecting to access point -> SSID: %s", &wfx_rsi.sec.ssid[0]); + event.eventType = WFX_EVT_STA_START_JOIN; + WfxPostEvent(&event); } else { - SILABS_LOG("%s: error: access point not provisioned", __func__); + SILABS_LOG("Error: access point not provisioned."); return SL_STATUS_INVALID_CONFIGURATION; } return SL_STATUS_OK; @@ -392,7 +394,7 @@ int32_t wfx_reset_counts() bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *)) { int sz; - + WfxEvent_t event; if (wfx_rsi.scan_cb) return false; /* Already in progress */ if (ssid) @@ -405,7 +407,9 @@ bool wfx_start_scan(char * ssid, void (*callback)(wfx_wifi_scan_result_t *)) strcpy(wfx_rsi.scan_ssid, ssid); } wfx_rsi.scan_cb = callback; - xEventGroupSetBits(wfx_rsi.events, WFX_EVT_SCAN); + + event.eventType = WFX_EVT_SCAN; + WfxPostEvent(&event); return true; } diff --git a/examples/platform/silabs/wfx_rsi.h b/examples/platform/silabs/wfx_rsi.h index 445671f4566b49..acebe545c17d3d 100644 --- a/examples/platform/silabs/wfx_rsi.h +++ b/examples/platform/silabs/wfx_rsi.h @@ -17,6 +17,7 @@ #pragma once #include +#include #ifndef RSI_BLE_ENABLE #define RSI_BLE_ENABLE (1) @@ -69,11 +70,6 @@ typedef struct WfxEvent_s void * eventData; // event data TODO: confirm needed } WfxEvent_t; -/// WfxPostEvent -/// @brief Allows to allocate an event to the WFX task event queue from outside of sl_wifi_if.c -/// @param event The event that will be allocated to the event queue -void WfxPostEvent(WfxEvent_t * event); - typedef struct wfx_rsi_s { // TODO: Change tp WfxEventType_e once the event queue is implemented @@ -124,6 +120,11 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_ int32_t wfx_rsi_power_save(); #endif /* SLI_SI917 */ #endif /* SL_ICD_ENABLED */ + +/// WfxPostEvent +/// @brief Allows to allocate an event to the WFX task event queue from outside of sl_wifi_if.c +/// @param event The event that will be allocated to the event queue +void WfxPostEvent(WfxEvent_t * event); #ifdef __cplusplus } #endif From e12ace0fb042e307e9f35a207143cdd464fd1582 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 25 Apr 2024 18:21:20 +0200 Subject: [PATCH 13/40] Remove dead code from BLE layer class (#33171) * Remove OnChipBleConnectReceived from BleLayer class * Remove HandleReadReceived from BleLayer class * Restyled by clang-format --------- Co-authored-by: Restyled.io --- src/ble/BleLayer.h | 7 ------- src/platform/ESP32/BLEManagerImpl.h | 2 -- src/platform/ESP32/bluedroid/BLEManagerImpl.cpp | 7 ------- src/platform/ESP32/nimble/BLEManagerImpl.cpp | 12 +----------- src/platform/Linux/BLEManagerImpl.cpp | 7 ------- src/platform/Linux/BLEManagerImpl.h | 2 -- src/platform/cc13xx_26xx/BLEManagerImpl.cpp | 8 +------- .../cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h | 2 -- src/platform/webos/BLEManagerImpl.cpp | 7 ------- src/platform/webos/BLEManagerImpl.h | 2 -- src/transport/raw/BLE.cpp | 6 ++---- 11 files changed, 4 insertions(+), 58 deletions(-) diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h index d9480cbf74ff79..bad3ab3fd62fe7 100644 --- a/src/ble/BleLayer.h +++ b/src/ble/BleLayer.h @@ -229,9 +229,6 @@ class DLL_EXPORT BleLayer void * mAppState = nullptr; BleLayerDelegate * mBleTransport = nullptr; - typedef void (*BleConnectionReceivedFunct)(BLEEndPoint * newEndPoint); - BleConnectionReceivedFunct OnChipBleConnectReceived; - // Public functions: BleLayer(); @@ -302,10 +299,6 @@ class DLL_EXPORT BleLayer /// Call when an outstanding GATT indication receives a positive receipt confirmation. bool HandleIndicationConfirmation(BLE_CONNECTION_OBJECT connObj, const ChipBleUUID * svcId, const ChipBleUUID * charId); - /// Call when a GATT read request is received. - bool HandleReadReceived(BLE_CONNECTION_OBJECT connObj, BLE_READ_REQUEST_CONTEXT requestContext, const ChipBleUUID * svcId, - const ChipBleUUID * charId); - /**< Platform must call this function when any previous operation undertaken by the BleLayer via BleAdapter * fails, such as a characteristic write request or subscribe attempt, or when a BLE connection is closed. * diff --git a/src/platform/ESP32/BLEManagerImpl.h b/src/platform/ESP32/BLEManagerImpl.h index 9364ead642c525..3f466fc24ac97b 100644 --- a/src/platform/ESP32/BLEManagerImpl.h +++ b/src/platform/ESP32/BLEManagerImpl.h @@ -79,8 +79,6 @@ namespace DeviceLayer { namespace Internal { #if CONFIG_ENABLE_ESP32_BLE_CONTROLLER -void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP); - enum class BleScanState : uint8_t { kNotScanning, diff --git a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp index e5d9077ee63ae2..72d738df7e3293 100644 --- a/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp +++ b/src/platform/ESP32/bluedroid/BLEManagerImpl.cpp @@ -220,8 +220,6 @@ CHIP_ERROR BLEManagerImpl::_Init() #if CONFIG_ENABLE_ESP32_BLE_CONTROLLER mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART && !mIsCentral); mFlags.Set(Flags::kFastAdvertisingEnabled, !mIsCentral); - OnChipBleConnectReceived = HandleIncomingBleConnection; - #else mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART); mFlags.Set(Flags::kFastAdvertisingEnabled, true); @@ -741,11 +739,6 @@ void BLEManagerImpl::ConnectDevice(esp_bd_addr_t & addr, esp_ble_addr_type_t add ChipLogError(Ble, "Failed to connect to rc=%d", rc); } } - -void HandleIncomingBleConnection(BLEEndPoint * bleEP) -{ - ChipLogProgress(DeviceLayer, "CHIPoBLE connection received"); -} #endif bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index 67b5f9bc4b9530..a69bc169fe26ed 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -200,11 +200,6 @@ void BLEManagerImpl::ConnectDevice(const ble_addr_t & addr, uint16_t timeout) ChipLogError(Ble, "Failed to connect to rc=%d", rc); } } - -void HandleIncomingBleConnection(BLEEndPoint * bleEP) -{ - ChipLogProgress(DeviceLayer, "CHIPoBLE connection received"); -} #endif CHIP_ERROR BLEManagerImpl::_Init() @@ -237,12 +232,11 @@ CHIP_ERROR BLEManagerImpl::_Init() #if CONFIG_ENABLE_ESP32_BLE_CONTROLLER mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART && !mIsCentral); mFlags.Set(Flags::kFastAdvertisingEnabled, !mIsCentral); - OnChipBleConnectReceived = HandleIncomingBleConnection; #else mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART); mFlags.Set(Flags::kFastAdvertisingEnabled, true); - #endif + mNumGAPCons = 0; memset(reinterpret_cast(mCons), 0, sizeof(mCons)); mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; @@ -266,10 +260,6 @@ void BLEManagerImpl::_Shutdown() mFlags.ClearAll().Set(Flags::kGATTServiceStarted); mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; -#if CONFIG_ENABLE_ESP32_BLE_CONTROLLER - OnChipBleConnectReceived = nullptr; -#endif // CONFIG_ENABLE_ESP32_BLE_CONTROLLER - PlatformMgr().ScheduleWork(DriveBLEState, 0); } diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index d9025bdbd5a503..a5bd19f877a6a8 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -81,11 +81,6 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0 BLEManagerImpl BLEManagerImpl::sInstance; -void HandleIncomingBleConnection(BLEEndPoint * bleEP) -{ - ChipLogProgress(DeviceLayer, "CHIPoBluez con rcvd"); -} - CHIP_ERROR BLEManagerImpl::_Init() { CHIP_ERROR err; @@ -99,8 +94,6 @@ CHIP_ERROR BLEManagerImpl::_Init() memset(mDeviceName, 0, sizeof(mDeviceName)); - OnChipBleConnectReceived = HandleIncomingBleConnection; - DeviceLayer::SystemLayer().ScheduleLambda([this] { DriveBLEState(); }); exit: diff --git a/src/platform/Linux/BLEManagerImpl.h b/src/platform/Linux/BLEManagerImpl.h index e3f3e4186abb7e..200c987539c849 100644 --- a/src/platform/Linux/BLEManagerImpl.h +++ b/src/platform/Linux/BLEManagerImpl.h @@ -39,8 +39,6 @@ namespace chip { namespace DeviceLayer { namespace Internal { -void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP); - enum class BleScanState : uint8_t { kNotScanning, diff --git a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp index e733184a9314f0..e8bb817a5ad48c 100644 --- a/src/platform/cc13xx_26xx/BLEManagerImpl.cpp +++ b/src/platform/cc13xx_26xx/BLEManagerImpl.cpp @@ -118,8 +118,7 @@ CHIP_ERROR BLEManagerImpl::_Init(void) mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART); mFlags.Set(Flags::kFastAdvertisingEnabled, true); - mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; - OnChipBleConnectReceived = HandleIncomingBleConnection; + mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; err = CreateEventHandler(); return err; @@ -367,11 +366,6 @@ bool BLEManagerImpl::SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQU return false; } -void BLEManagerImpl::HandleIncomingBleConnection(BLEEndPoint * bleEP) -{ - BLEMGR_LOG("BLEMGR: HandleIncomingBleConnection"); -} - // ===== Helper Members that implement the Low level BLE Stack behavior. /********************************************************************* diff --git a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h index b4cf4e26766835..16512930e9fa88 100644 --- a/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h +++ b/src/platform/cc13xx_26xx/cc13x4_26x4/BLEManagerImpl.h @@ -317,8 +317,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla void ClearPendingBLEParamUpdate(uint16_t connHandle); void UpdateBLERPA(void); - static void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP); - /* Static helper function */ static void EventHandler(void * arg); static CHIP_ERROR DriveBLEState(void); diff --git a/src/platform/webos/BLEManagerImpl.cpp b/src/platform/webos/BLEManagerImpl.cpp index 6d9726c9c94742..786ded0d3f4029 100644 --- a/src/platform/webos/BLEManagerImpl.cpp +++ b/src/platform/webos/BLEManagerImpl.cpp @@ -68,11 +68,6 @@ const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0 BLEManagerImpl BLEManagerImpl::sInstance; -void HandleIncomingBleConnection(BLEEndPoint * bleEP) -{ - ChipLogProgress(DeviceLayer, "con rcvd"); -} - void BLEManagerImpl::InitConnectionData() { /* Initialize Hashmap */ @@ -115,8 +110,6 @@ CHIP_ERROR BLEManagerImpl::_Init() memset(mDeviceName, 0, sizeof(mDeviceName)); - OnChipBleConnectReceived = HandleIncomingBleConnection; - ret = MainLoop::Instance().Init(_BleInitialize); VerifyOrExit(ret != false, err = CHIP_ERROR_INTERNAL); diff --git a/src/platform/webos/BLEManagerImpl.h b/src/platform/webos/BLEManagerImpl.h index 7336f95c02409c..2bd4e6bcfd7adf 100644 --- a/src/platform/webos/BLEManagerImpl.h +++ b/src/platform/webos/BLEManagerImpl.h @@ -37,8 +37,6 @@ namespace chip { namespace DeviceLayer { namespace Internal { -void HandleIncomingBleConnection(Ble::BLEEndPoint * bleEP); - enum class BleScanState : uint8_t { kNotScanning, diff --git a/src/transport/raw/BLE.cpp b/src/transport/raw/BLE.cpp index 76123afd516415..811969ef0966ea 100644 --- a/src/transport/raw/BLE.cpp +++ b/src/transport/raw/BLE.cpp @@ -46,9 +46,8 @@ void BLEBase::ClearState() if (mBleLayer) { mBleLayer->CancelBleIncompleteConnection(); - mBleLayer->OnChipBleConnectReceived = nullptr; - mBleLayer->mBleTransport = nullptr; - mBleLayer = nullptr; + mBleLayer->mBleTransport = nullptr; + mBleLayer = nullptr; } if (mBleEndPoint) @@ -77,7 +76,6 @@ CHIP_ERROR BLEBase::Init(const BleListenParameters & param) { ChipLogDetail(Inet, "BLEBase::Init - not overriding transport"); } - mBleLayer->OnChipBleConnectReceived = nullptr; mState = State::kInitialized; From 8b21ecfa71c11012435e8d3ae8635581e5ab2a94 Mon Sep 17 00:00:00 2001 From: Wilbur - Schneider <82623798+wilbur-se@users.noreply.github.com> Date: Fri, 26 Apr 2024 01:03:43 +0800 Subject: [PATCH 14/40] set secs_since_valid_hangup larger than secs_since_valid_ping, otherwise the socket will be close directlly after 400s and no ping sent out (#33158) --- examples/common/websocket-server/WebSocketServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/common/websocket-server/WebSocketServer.cpp b/examples/common/websocket-server/WebSocketServer.cpp index 2f5fb9fd2bd0c9..402754d35d51f7 100644 --- a/examples/common/websocket-server/WebSocketServer.cpp +++ b/examples/common/websocket-server/WebSocketServer.cpp @@ -178,7 +178,7 @@ CHIP_ERROR WebSocketServer::Run(chip::Optional port, WebSocketServerDe info.protocols = protocols; static const lws_retry_bo_t retry = { .secs_since_valid_ping = 400, - .secs_since_valid_hangup = 400, + .secs_since_valid_hangup = 420, }; info.retry_and_idle_policy = &retry; From 6d9dfe98f89760fed33f209aef9b8668b147862c Mon Sep 17 00:00:00 2001 From: Jakub Latusek Date: Thu, 25 Apr 2024 20:22:21 +0200 Subject: [PATCH 15/40] Replace nl-unit-test with pigweed for system user_directed_commissioning (#33163) * user_directed_commissioning tests to pw * if 0 * update openiotsdk test list --------- Co-authored-by: Arkadiusz Bokowy --- .../tests/BUILD.gn | 5 +- .../tests/TestUdcMessages.cpp | 313 ++++++++---------- .../openiotsdk/unit-tests/test_components.txt | 1 + .../unit-tests/test_components_nl.txt | 1 - 4 files changed, 131 insertions(+), 189 deletions(-) diff --git a/src/protocols/user_directed_commissioning/tests/BUILD.gn b/src/protocols/user_directed_commissioning/tests/BUILD.gn index f536273f2e28ce..ee67f0492ece92 100644 --- a/src/protocols/user_directed_commissioning/tests/BUILD.gn +++ b/src/protocols/user_directed_commissioning/tests/BUILD.gn @@ -12,11 +12,10 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") -import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") -chip_test_suite_using_nltest("tests") { +chip_test_suite("tests") { output_name = "libUserDirectedCommissioningTests" test_sources = [ "TestUdcMessages.cpp" ] @@ -24,9 +23,7 @@ chip_test_suite_using_nltest("tests") { public_deps = [ "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", - "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/protocols", - "${nlunit_test_root}:nlunit-test", ] cflags = [ "-Wconversion" ] diff --git a/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp b/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp index 3d50682dee5dcf..9dd05083de6ced 100644 --- a/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp +++ b/src/protocols/user_directed_commissioning/tests/TestUdcMessages.cpp @@ -1,6 +1,6 @@ #include -#include +#include #include #include @@ -8,8 +8,6 @@ #include #include #include -#include -#include #include #include #include @@ -21,6 +19,13 @@ using namespace chip::Protocols::UserDirectedCommissioning; using namespace chip::Dnssd; using namespace chip::Dnssd::Internal; +struct TestUdcMessages : public ::testing::Test +{ + + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + ByteSpan GetSpan(char * key) { size_t len = strlen(key); @@ -57,20 +62,20 @@ class DLL_EXPORT TestCallback : public UserConfirmationProvider, public Instance using DeviceTransportMgr = TransportMgr; -void TestUDCServerClients(nlTestSuite * inSuite, void * inContext) +TEST_F(TestUdcMessages, TestUDCServerClients) { UserDirectedCommissioningServer udcServer; const char * instanceName1 = "servertest1"; // test setting UDC Clients - NL_TEST_ASSERT(inSuite, nullptr == udcServer.GetUDCClients().FindUDCClientState(instanceName1)); + EXPECT_EQ(nullptr, udcServer.GetUDCClients().FindUDCClientState(instanceName1)); udcServer.SetUDCClientProcessingState((char *) instanceName1, UDCClientProcessingState::kUserDeclined); UDCClientState * state = udcServer.GetUDCClients().FindUDCClientState(instanceName1); - NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); - NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kUserDeclined == state->GetUDCClientProcessingState()); + ASSERT_NE(nullptr, state); + EXPECT_EQ(UDCClientProcessingState::kUserDeclined, state->GetUDCClientProcessingState()); } -void TestUDCServerUserConfirmationProvider(nlTestSuite * inSuite, void * inContext) +TEST_F(TestUdcMessages, TestUDCServerUserConfirmationProvider) { UserDirectedCommissioningServer udcServer; TestCallback testCallback; @@ -108,13 +113,13 @@ void TestUDCServerUserConfirmationProvider(nlTestSuite * inSuite, void * inConte udcServer.OnCommissionableNodeFound(discNodeData2); udcServer.OnCommissionableNodeFound(discNodeData1); state = udcServer.GetUDCClients().FindUDCClientState(instanceName1); - NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); - NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kUserDeclined == state->GetUDCClientProcessingState()); + ASSERT_NE(nullptr, state); + EXPECT_EQ(UDCClientProcessingState::kUserDeclined, state->GetUDCClientProcessingState()); // test other fields on UDCClientState - NL_TEST_ASSERT(inSuite, 0 == strcmp(state->GetInstanceName(), instanceName1)); + EXPECT_STREQ(state->GetInstanceName(), instanceName1); // check that instance2 was found state = udcServer.GetUDCClients().FindUDCClientState(instanceName2); - NL_TEST_ASSERT(inSuite, nullptr == state); + EXPECT_EQ(nullptr, state); // test current state check udcServer.SetUDCClientProcessingState((char *) instanceName1, UDCClientProcessingState::kUserDeclined); @@ -122,28 +127,31 @@ void TestUDCServerUserConfirmationProvider(nlTestSuite * inSuite, void * inConte udcServer.OnCommissionableNodeFound(discNodeData2); udcServer.OnCommissionableNodeFound(discNodeData1); state = udcServer.GetUDCClients().FindUDCClientState(instanceName1); - NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); - NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kUserDeclined == state->GetUDCClientProcessingState()); + ASSERT_NE(nullptr, state); + EXPECT_EQ(UDCClientProcessingState::kUserDeclined, state->GetUDCClientProcessingState()); state = udcServer.GetUDCClients().FindUDCClientState(instanceName2); - NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); - NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kPromptingUser == state->GetUDCClientProcessingState()); + ASSERT_NE(nullptr, state); + EXPECT_EQ(UDCClientProcessingState::kPromptingUser, state->GetUDCClientProcessingState()); // test other fields on UDCClientState - NL_TEST_ASSERT(inSuite, 0 == strcmp(state->GetInstanceName(), instanceName2)); - NL_TEST_ASSERT(inSuite, 0 == strcmp(state->GetDeviceName(), deviceName2)); - NL_TEST_ASSERT(inSuite, state->GetLongDiscriminator() == disc2); + EXPECT_STREQ(state->GetInstanceName(), instanceName2); + EXPECT_STREQ(state->GetDeviceName(), deviceName2); + EXPECT_EQ(state->GetLongDiscriminator(), disc2); // test non-empty UserConfirmationProvider udcServer.SetUserConfirmationProvider(&testCallback); udcServer.SetUDCClientProcessingState((char *) instanceName1, UDCClientProcessingState::kUserDeclined); udcServer.SetUDCClientProcessingState((char *) instanceName2, UDCClientProcessingState::kDiscoveringNode); udcServer.OnCommissionableNodeFound(discNodeData1); - NL_TEST_ASSERT(inSuite, !testCallback.mOnUserDirectedCommissioningRequestCalled); + EXPECT_FALSE(testCallback.mOnUserDirectedCommissioningRequestCalled); udcServer.OnCommissionableNodeFound(discNodeData2); - NL_TEST_ASSERT(inSuite, testCallback.mOnUserDirectedCommissioningRequestCalled); - NL_TEST_ASSERT(inSuite, 0 == strcmp(testCallback.mState.GetInstanceName(), instanceName2)); + EXPECT_TRUE(testCallback.mOnUserDirectedCommissioningRequestCalled); + EXPECT_STREQ(testCallback.mState.GetInstanceName(), instanceName2); } -void TestUDCServerInstanceNameResolver(nlTestSuite * inSuite, void * inContext) +#if 0 +// TODO Fix test below +// the following test case is not reliable (fails on mac, clang platforms for example) +TEST_F(TestUdcMessages, TestUDCServerInstanceNameResolver) { UserDirectedCommissioningServer udcServer; UserDirectedCommissioningClient udcClient; @@ -175,11 +183,11 @@ void TestUDCServerInstanceNameResolver(nlTestSuite * inSuite, void * inContext) // check if the state is set for the instance name sent state = udcServer.GetUDCClients().FindUDCClientState(nameBuffer); - NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); - NL_TEST_ASSERT(inSuite, UDCClientProcessingState::kDiscoveringNode == state->GetUDCClientProcessingState()); + ASSERT_NE(nullptr, state); + EXPECT_EQ(UDCClientProcessingState::kDiscoveringNode, state->GetUDCClientProcessingState()); // check if a callback happened - NL_TEST_ASSERT(inSuite, testCallback.mFindCommissionableNodeCalled); + EXPECT_TRUE(testCallback.mFindCommissionableNodeCalled); // reset callback tracker so we can confirm that when the // same instance name is received, there is no callback @@ -194,7 +202,7 @@ void TestUDCServerInstanceNameResolver(nlTestSuite * inSuite, void * inContext) mUdcTransportMgr->HandleMessageReceived(peerAddress, std::move(payloadBuf)); // verify it was not called - NL_TEST_ASSERT(inSuite, !testCallback.mFindCommissionableNodeCalled); + EXPECT_FALSE(testCallback.mFindCommissionableNodeCalled); // next, reset the cache state and confirm the callback udcServer.ResetUDCClientProcessingStates(); @@ -208,10 +216,12 @@ void TestUDCServerInstanceNameResolver(nlTestSuite * inSuite, void * inContext) mUdcTransportMgr->HandleMessageReceived(peerAddress, std::move(payloadBuf)); // verify it was called - NL_TEST_ASSERT(inSuite, testCallback.mFindCommissionableNodeCalled); + EXPECT_TRUE(testCallback.mFindCommissionableNodeCalled); } -void TestUserDirectedCommissioningClientMessage(nlTestSuite * inSuite, void * inContext) +#endif + +TEST_F(TestUdcMessages, TestUserDirectedCommissioningClientMessage) { char nameBuffer[Dnssd::Commission::kInstanceNameMaxLength + 1] = "Chris"; System::PacketBufferHandle payloadBuf = MessagePacketBuffer::NewWithData(nameBuffer, strlen(nameBuffer)); @@ -223,15 +233,15 @@ void TestUserDirectedCommissioningClientMessage(nlTestSuite * inSuite, void * in // check the packet header fields PacketHeader packetHeader; packetHeader.DecodeAndConsume(payloadBuf); - NL_TEST_ASSERT(inSuite, !packetHeader.IsEncrypted()); + EXPECT_FALSE(packetHeader.IsEncrypted()); // check the payload header fields PayloadHeader payloadHeader; payloadHeader.DecodeAndConsume(payloadBuf); - NL_TEST_ASSERT(inSuite, payloadHeader.GetMessageType() == to_underlying(MsgType::IdentificationDeclaration)); - NL_TEST_ASSERT(inSuite, payloadHeader.GetProtocolID() == Protocols::UserDirectedCommissioning::Id); - NL_TEST_ASSERT(inSuite, !payloadHeader.NeedsAck()); - NL_TEST_ASSERT(inSuite, payloadHeader.IsInitiator()); + EXPECT_EQ(payloadHeader.GetMessageType(), to_underlying(MsgType::IdentificationDeclaration)); + EXPECT_EQ(payloadHeader.GetProtocolID(), Protocols::UserDirectedCommissioning::Id); + EXPECT_FALSE(payloadHeader.NeedsAck()); + EXPECT_TRUE(payloadHeader.IsInitiator()); // check the payload char instanceName[Dnssd::Commission::kInstanceNameMaxLength + 1]; @@ -239,13 +249,13 @@ void TestUserDirectedCommissioningClientMessage(nlTestSuite * inSuite, void * in payloadBuf->Read(Uint8::from_char(instanceName), instanceNameLength); instanceName[instanceNameLength] = '\0'; ChipLogProgress(Inet, "UDC instance=%s", instanceName); - NL_TEST_ASSERT(inSuite, strcmp(instanceName, nameBuffer) == 0); + EXPECT_STREQ(instanceName, nameBuffer); // verify no errors - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); } -void TestUDCClients(nlTestSuite * inSuite, void * inContext) +TEST_F(TestUdcMessages, TestUDCClients) { UDCClients<3> mUdcClients; const char * instanceName1 = "test1"; @@ -255,39 +265,39 @@ void TestUDCClients(nlTestSuite * inSuite, void * inContext) // test base case UDCClientState * state = mUdcClients.FindUDCClientState(instanceName1); - NL_TEST_ASSERT(inSuite, state == nullptr); + ASSERT_EQ(state, nullptr); // test max size - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == mUdcClients.CreateNewUDCClientState(instanceName1, &state)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == mUdcClients.CreateNewUDCClientState(instanceName2, &state)); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == mUdcClients.CreateNewUDCClientState(instanceName3, &state)); - NL_TEST_ASSERT(inSuite, CHIP_ERROR_NO_MEMORY == mUdcClients.CreateNewUDCClientState(instanceName4, &state)); + EXPECT_EQ(CHIP_NO_ERROR, mUdcClients.CreateNewUDCClientState(instanceName1, &state)); + EXPECT_EQ(CHIP_NO_ERROR, mUdcClients.CreateNewUDCClientState(instanceName2, &state)); + EXPECT_EQ(CHIP_NO_ERROR, mUdcClients.CreateNewUDCClientState(instanceName3, &state)); + EXPECT_EQ(CHIP_ERROR_NO_MEMORY, mUdcClients.CreateNewUDCClientState(instanceName4, &state)); // test reset mUdcClients.ResetUDCClientStates(); - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == mUdcClients.CreateNewUDCClientState(instanceName4, &state)); + EXPECT_EQ(CHIP_NO_ERROR, mUdcClients.CreateNewUDCClientState(instanceName4, &state)); // test find - NL_TEST_ASSERT(inSuite, nullptr == mUdcClients.FindUDCClientState(instanceName1)); - NL_TEST_ASSERT(inSuite, nullptr == mUdcClients.FindUDCClientState(instanceName2)); - NL_TEST_ASSERT(inSuite, nullptr == mUdcClients.FindUDCClientState(instanceName3)); + EXPECT_EQ(nullptr, mUdcClients.FindUDCClientState(instanceName1)); + EXPECT_EQ(nullptr, mUdcClients.FindUDCClientState(instanceName2)); + EXPECT_EQ(nullptr, mUdcClients.FindUDCClientState(instanceName3)); state = mUdcClients.FindUDCClientState(instanceName4); - NL_TEST_ASSERT(inSuite, nullptr != state); + ASSERT_NE(nullptr, state); // test expiry state->Reset(); - NL_TEST_ASSERT(inSuite, nullptr == mUdcClients.FindUDCClientState(instanceName4)); + EXPECT_EQ(nullptr, mUdcClients.FindUDCClientState(instanceName4)); // test re-activation - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == mUdcClients.CreateNewUDCClientState(instanceName4, &state)); + EXPECT_EQ(CHIP_NO_ERROR, mUdcClients.CreateNewUDCClientState(instanceName4, &state)); System::Clock::Timestamp expirationTime = state->GetExpirationTime(); state->SetExpirationTime(expirationTime - System::Clock::Milliseconds64(1)); - NL_TEST_ASSERT(inSuite, (expirationTime - System::Clock::Milliseconds64(1)) == state->GetExpirationTime()); + EXPECT_EQ((expirationTime - System::Clock::Milliseconds64(1)), state->GetExpirationTime()); mUdcClients.MarkUDCClientActive(state); - NL_TEST_ASSERT(inSuite, (expirationTime - System::Clock::Milliseconds64(1)) < state->GetExpirationTime()); + EXPECT_LT((expirationTime - System::Clock::Milliseconds64(1)), state->GetExpirationTime()); } -void TestUDCClientState(nlTestSuite * inSuite, void * inContext) +TEST_F(TestUdcMessages, TestUDCClientState) { UDCClients<3> mUdcClients; const char * instanceName1 = "test1"; @@ -318,56 +328,56 @@ void TestUDCClientState(nlTestSuite * inSuite, void * inContext) rotatingIdLongLen = Encoding::HexToBytes(reinterpret_cast(value.data()), value.size(), rotatingIdLong, chip::Dnssd::kMaxRotatingIdLen * 2); - NL_TEST_ASSERT(inSuite, rotatingIdLongLen > chip::Dnssd::kMaxRotatingIdLen); + EXPECT_GT(rotatingIdLongLen, chip::Dnssd::kMaxRotatingIdLen); // test base case UDCClientState * state = mUdcClients.FindUDCClientState(instanceName1); - NL_TEST_ASSERT(inSuite, state == nullptr); + ASSERT_EQ(state, nullptr); // add a default state - NL_TEST_ASSERT(inSuite, CHIP_NO_ERROR == mUdcClients.CreateNewUDCClientState(instanceName1, &state)); + EXPECT_EQ(CHIP_NO_ERROR, mUdcClients.CreateNewUDCClientState(instanceName1, &state)); // get the state state = mUdcClients.FindUDCClientState(instanceName1); - NL_TEST_EXIT_ON_FAILED_ASSERT(inSuite, nullptr != state); - NL_TEST_ASSERT(inSuite, strcmp(state->GetInstanceName(), instanceName1) == 0); + ASSERT_NE(nullptr, state); + EXPECT_STREQ(state->GetInstanceName(), instanceName1); state->SetPeerAddress(chip::Transport::PeerAddress::UDP(address, port)); - NL_TEST_ASSERT(inSuite, port == state->GetPeerAddress().GetPort()); + EXPECT_EQ(port, state->GetPeerAddress().GetPort()); state->SetDeviceName(deviceName); - NL_TEST_ASSERT(inSuite, strcmp(state->GetDeviceName(), deviceName) == 0); + EXPECT_STREQ(state->GetDeviceName(), deviceName); state->SetLongDiscriminator(longDiscriminator); - NL_TEST_ASSERT(inSuite, longDiscriminator == state->GetLongDiscriminator()); + EXPECT_EQ(longDiscriminator, state->GetLongDiscriminator()); state->SetVendorId(vendorId); - NL_TEST_ASSERT(inSuite, vendorId == state->GetVendorId()); + EXPECT_EQ(vendorId, state->GetVendorId()); state->SetProductId(productId); - NL_TEST_ASSERT(inSuite, productId == state->GetProductId()); + EXPECT_EQ(productId, state->GetProductId()); state->SetRotatingId(rotatingId, rotatingIdLen); - NL_TEST_ASSERT(inSuite, rotatingIdLen == state->GetRotatingIdLength()); + EXPECT_EQ(rotatingIdLen, state->GetRotatingIdLength()); const uint8_t * testRotatingId = state->GetRotatingId(); for (size_t i = 0; i < rotatingIdLen; i++) { - NL_TEST_ASSERT(inSuite, testRotatingId[i] == rotatingId[i]); + EXPECT_EQ(testRotatingId[i], rotatingId[i]); } state->SetRotatingId(rotatingIdLong, rotatingIdLongLen); - NL_TEST_ASSERT(inSuite, chip::Dnssd::kMaxRotatingIdLen == state->GetRotatingIdLength()); + EXPECT_EQ(chip::Dnssd::kMaxRotatingIdLen, state->GetRotatingIdLength()); const uint8_t * testRotatingIdLong = state->GetRotatingId(); for (size_t i = 0; i < chip::Dnssd::kMaxRotatingIdLen; i++) { - NL_TEST_ASSERT(inSuite, testRotatingIdLong[i] == rotatingIdLong[i]); + EXPECT_EQ(testRotatingIdLong[i], rotatingIdLong[i]); } } -void TestUDCIdentificationDeclaration(nlTestSuite * inSuite, void * inContext) +TEST_F(TestUdcMessages, TestUDCIdentificationDeclaration) { IdentificationDeclaration id; IdentificationDeclaration idOut; @@ -416,25 +426,25 @@ void TestUDCIdentificationDeclaration(nlTestSuite * inSuite, void * inContext) id.SetCommissionerPasscode(true); id.SetCommissionerPasscodeReady(true); - NL_TEST_ASSERT(inSuite, id.HasDiscoveryInfo()); - NL_TEST_ASSERT(inSuite, strcmp(id.GetInstanceName(), instanceName) == 0); - NL_TEST_ASSERT(inSuite, vendorId == id.GetVendorId()); - NL_TEST_ASSERT(inSuite, productId == id.GetProductId()); - NL_TEST_ASSERT(inSuite, port == id.GetCdPort()); - NL_TEST_ASSERT(inSuite, strcmp(id.GetDeviceName(), deviceName) == 0); - NL_TEST_ASSERT(inSuite, rotatingIdLen == id.GetRotatingIdLength()); - NL_TEST_ASSERT(inSuite, memcmp(id.GetRotatingId(), rotatingId, rotatingIdLen) == 0); - NL_TEST_ASSERT(inSuite, pairingHint == id.GetPairingHint()); - NL_TEST_ASSERT(inSuite, strcmp(id.GetPairingInst(), pairingInst) == 0); - - NL_TEST_ASSERT(inSuite, id.GetNumTargetAppInfos() == 3); - NL_TEST_ASSERT(inSuite, id.GetTargetAppInfo(0, appInfo) && appInfo.vendorId == 1 && appInfo.productId == 9); - NL_TEST_ASSERT(inSuite, id.GetTargetAppInfo(1, appInfo) && appInfo.vendorId == 2 && appInfo.productId == 8); - NL_TEST_ASSERT(inSuite, id.GetTargetAppInfo(2, appInfo) && appInfo.vendorId == 3 && appInfo.productId == 7); - NL_TEST_ASSERT(inSuite, id.GetNoPasscode() == true); - NL_TEST_ASSERT(inSuite, id.GetCdUponPasscodeDialog() == true); - NL_TEST_ASSERT(inSuite, id.GetCommissionerPasscode() == true); - NL_TEST_ASSERT(inSuite, id.GetCommissionerPasscodeReady() == true); + EXPECT_TRUE(id.HasDiscoveryInfo()); + EXPECT_STREQ(id.GetInstanceName(), instanceName); + EXPECT_EQ(vendorId, id.GetVendorId()); + EXPECT_EQ(productId, id.GetProductId()); + EXPECT_EQ(port, id.GetCdPort()); + EXPECT_STREQ(id.GetDeviceName(), deviceName); + EXPECT_EQ(rotatingIdLen, id.GetRotatingIdLength()); + EXPECT_EQ(memcmp(id.GetRotatingId(), rotatingId, rotatingIdLen), 0); + EXPECT_EQ(pairingHint, id.GetPairingHint()); + EXPECT_STREQ(id.GetPairingInst(), pairingInst); + + EXPECT_EQ(id.GetNumTargetAppInfos(), 3); + EXPECT_TRUE(id.GetTargetAppInfo(0, appInfo) && appInfo.vendorId == 1 && appInfo.productId == 9); + EXPECT_TRUE(id.GetTargetAppInfo(1, appInfo) && appInfo.vendorId == 2 && appInfo.productId == 8); + EXPECT_TRUE(id.GetTargetAppInfo(2, appInfo) && appInfo.vendorId == 3 && appInfo.productId == 7); + EXPECT_EQ(id.GetNoPasscode(), true); + EXPECT_EQ(id.GetCdUponPasscodeDialog(), true); + EXPECT_EQ(id.GetCommissionerPasscode(), true); + EXPECT_EQ(id.GetCommissionerPasscodeReady(), true); // TODO: add an ip @@ -444,32 +454,32 @@ void TestUDCIdentificationDeclaration(nlTestSuite * inSuite, void * inContext) // next, parse this object idOut.ReadPayload(idBuffer, sizeof(idBuffer)); - NL_TEST_ASSERT(inSuite, idOut.HasDiscoveryInfo()); - NL_TEST_ASSERT(inSuite, strcmp(idOut.GetInstanceName(), instanceName) == 0); - NL_TEST_ASSERT(inSuite, vendorId == idOut.GetVendorId()); - NL_TEST_ASSERT(inSuite, productId == idOut.GetProductId()); - NL_TEST_ASSERT(inSuite, port == idOut.GetCdPort()); - NL_TEST_ASSERT(inSuite, strcmp(idOut.GetDeviceName(), deviceName) == 0); - NL_TEST_ASSERT(inSuite, rotatingIdLen == idOut.GetRotatingIdLength()); - NL_TEST_ASSERT(inSuite, memcmp(idOut.GetRotatingId(), rotatingId, rotatingIdLen) == 0); - NL_TEST_ASSERT(inSuite, strcmp(idOut.GetPairingInst(), pairingInst) == 0); - NL_TEST_ASSERT(inSuite, pairingHint == idOut.GetPairingHint()); - - NL_TEST_ASSERT(inSuite, id.GetNumTargetAppInfos() == idOut.GetNumTargetAppInfos()); - NL_TEST_ASSERT(inSuite, idOut.GetTargetAppInfo(0, appInfo) && appInfo.vendorId == 1 && appInfo.productId == 9); - NL_TEST_ASSERT(inSuite, idOut.GetTargetAppInfo(1, appInfo) && appInfo.vendorId == 2 && appInfo.productId == 8); - NL_TEST_ASSERT(inSuite, idOut.GetTargetAppInfo(2, appInfo) && appInfo.vendorId == 3 && appInfo.productId == 7); - - NL_TEST_ASSERT(inSuite, id.GetNoPasscode() == idOut.GetNoPasscode()); - NL_TEST_ASSERT(inSuite, id.GetCdUponPasscodeDialog() == idOut.GetCdUponPasscodeDialog()); - NL_TEST_ASSERT(inSuite, id.GetCommissionerPasscode() == idOut.GetCommissionerPasscode()); - NL_TEST_ASSERT(inSuite, id.GetCommissionerPasscodeReady() == idOut.GetCommissionerPasscodeReady()); + EXPECT_TRUE(idOut.HasDiscoveryInfo()); + EXPECT_STREQ(idOut.GetInstanceName(), instanceName); + EXPECT_EQ(vendorId, idOut.GetVendorId()); + EXPECT_EQ(productId, idOut.GetProductId()); + EXPECT_EQ(port, idOut.GetCdPort()); + EXPECT_STREQ(idOut.GetDeviceName(), deviceName); + EXPECT_EQ(rotatingIdLen, idOut.GetRotatingIdLength()); + EXPECT_EQ(memcmp(idOut.GetRotatingId(), rotatingId, rotatingIdLen), 0); + EXPECT_STREQ(idOut.GetPairingInst(), pairingInst); + EXPECT_EQ(pairingHint, idOut.GetPairingHint()); + + EXPECT_EQ(id.GetNumTargetAppInfos(), idOut.GetNumTargetAppInfos()); + EXPECT_TRUE(idOut.GetTargetAppInfo(0, appInfo) && appInfo.vendorId == 1 && appInfo.productId == 9); + EXPECT_TRUE(idOut.GetTargetAppInfo(1, appInfo) && appInfo.vendorId == 2 && appInfo.productId == 8); + EXPECT_TRUE(idOut.GetTargetAppInfo(2, appInfo) && appInfo.vendorId == 3 && appInfo.productId == 7); + + EXPECT_EQ(id.GetNoPasscode(), idOut.GetNoPasscode()); + EXPECT_EQ(id.GetCdUponPasscodeDialog(), idOut.GetCdUponPasscodeDialog()); + EXPECT_EQ(id.GetCommissionerPasscode(), idOut.GetCommissionerPasscode()); + EXPECT_EQ(id.GetCommissionerPasscodeReady(), idOut.GetCommissionerPasscodeReady()); // TODO: remove following "force-fail" debug line // NL_TEST_ASSERT(inSuite, rotatingIdLen != id.GetRotatingIdLength()); } -void TestUDCCommissionerDeclaration(nlTestSuite * inSuite, void * inContext) +TEST_F(TestUdcMessages, TestUDCCommissionerDeclaration) { CommissionerDeclaration id; CommissionerDeclaration idOut; @@ -483,12 +493,12 @@ void TestUDCCommissionerDeclaration(nlTestSuite * inSuite, void * inContext) id.SetCommissionerPasscode(true); id.SetQRCodeDisplayed(true); - NL_TEST_ASSERT(inSuite, errorCode == id.GetErrorCode()); - NL_TEST_ASSERT(inSuite, id.GetNeedsPasscode() == true); - NL_TEST_ASSERT(inSuite, id.GetNoAppsFound() == true); - NL_TEST_ASSERT(inSuite, id.GetPasscodeDialogDisplayed() == true); - NL_TEST_ASSERT(inSuite, id.GetCommissionerPasscode() == true); - NL_TEST_ASSERT(inSuite, id.GetQRCodeDisplayed() == true); + EXPECT_EQ(errorCode, id.GetErrorCode()); + EXPECT_EQ(id.GetNeedsPasscode(), true); + EXPECT_EQ(id.GetNoAppsFound(), true); + EXPECT_EQ(id.GetPasscodeDialogDisplayed(), true); + EXPECT_EQ(id.GetCommissionerPasscode(), true); + EXPECT_EQ(id.GetQRCodeDisplayed(), true); uint8_t idBuffer[500]; id.WritePayload(idBuffer, sizeof(idBuffer)); @@ -496,75 +506,10 @@ void TestUDCCommissionerDeclaration(nlTestSuite * inSuite, void * inContext) // next, parse this object idOut.ReadPayload(idBuffer, sizeof(idBuffer)); - NL_TEST_ASSERT(inSuite, errorCode == idOut.GetErrorCode()); - NL_TEST_ASSERT(inSuite, id.GetNeedsPasscode() == idOut.GetNeedsPasscode()); - NL_TEST_ASSERT(inSuite, id.GetNoAppsFound() == idOut.GetNoAppsFound()); - NL_TEST_ASSERT(inSuite, id.GetPasscodeDialogDisplayed() == idOut.GetPasscodeDialogDisplayed()); - NL_TEST_ASSERT(inSuite, id.GetCommissionerPasscode() == idOut.GetCommissionerPasscode()); - NL_TEST_ASSERT(inSuite, id.GetQRCodeDisplayed() == idOut.GetQRCodeDisplayed()); -} - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("TestUDCServerClients", TestUDCServerClients), - NL_TEST_DEF("TestUDCServerUserConfirmationProvider", TestUDCServerUserConfirmationProvider), - // the following test case is not reliable (fails on mac, clang platforms for example) - // NL_TEST_DEF("TestUDCServerInstanceNameResolver", TestUDCServerInstanceNameResolver), - NL_TEST_DEF("TestUserDirectedCommissioningClientMessage", TestUserDirectedCommissioningClientMessage), - NL_TEST_DEF("TestUDCClients", TestUDCClients), - NL_TEST_DEF("TestUDCClientState", TestUDCClientState), - NL_TEST_DEF("TestUDCIdentificationDeclaration", TestUDCIdentificationDeclaration), - NL_TEST_DEF("TestUDCCommissionerDeclaration", TestUDCCommissionerDeclaration), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; + EXPECT_EQ(errorCode, idOut.GetErrorCode()); + EXPECT_EQ(id.GetNeedsPasscode(), idOut.GetNeedsPasscode()); + EXPECT_EQ(id.GetNoAppsFound(), idOut.GetNoAppsFound()); + EXPECT_EQ(id.GetPasscodeDialogDisplayed(), idOut.GetPasscodeDialogDisplayed()); + EXPECT_EQ(id.GetCommissionerPasscode(), idOut.GetCommissionerPasscode()); + EXPECT_EQ(id.GetQRCodeDisplayed(), idOut.GetQRCodeDisplayed()); } - -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -// clang-format off -static nlTestSuite sSuite = -{ - "Test-CHIP-UdcMessages", - &sTests[0], - TestSetup, - TestTeardown, -}; -// clang-format on - -/** - * Main - */ -int TestUdcMessages() -{ - // Run test suit against one context - nlTestRunner(&sSuite, nullptr); - - return (nlTestRunnerStats(&sSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestUdcMessages) diff --git a/src/test_driver/openiotsdk/unit-tests/test_components.txt b/src/test_driver/openiotsdk/unit-tests/test_components.txt index 4a61ab84fd3a60..bb108309ba1728 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components.txt @@ -14,3 +14,4 @@ RetransmitTests TestShell SetupPayloadTests SupportTests +UserDirectedCommissioningTests diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index 64f1862acfdf6a..de9e40de4b5253 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -7,4 +7,3 @@ SecureChannelTests SetupPayloadTestsNL SupportTestsNL TransportLayerTests -UserDirectedCommissioningTests \ No newline at end of file From f9a36014fa94c52a8a414b24c62ccff0c081623e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Ba=C5=82ys?= Date: Thu, 25 Apr 2024 20:40:27 +0200 Subject: [PATCH 16/40] [crypto] PSA SPAKE2+ introduction (#32924) * [crypto] Add PSA SPAKE2+ implementation Implement Matter's SPAKE2+ protocol using PSA crypto API. Use the PSA implementation in PASE session for nRF Connect platform. Signed-off-by: Damian Krolik * [crypto] Spake2+ alignments regarding the newest PSA version Aligned Spake2+ algorithm to the newest PSA Crypto API version that allows useing the psa_pake_get_shared_key function. * Alignments to the Matter Core. Restyled by gn --------- Signed-off-by: Damian Krolik Co-authored-by: Damian Krolik --- config/nrfconnect/chip-module/CMakeLists.txt | 3 +- .../nrfconnect/chip-module/Kconfig.defaults | 1 + src/crypto/BUILD.gn | 8 + src/crypto/CHIPCryptoPAL.cpp | 2 +- src/crypto/CHIPCryptoPAL.h | 2 +- src/crypto/CHIPCryptoPALPSA.h | 2 +- src/crypto/PSASessionKeystore.cpp | 2 +- src/crypto/PSASpake2p.cpp | 201 ++++++++++++++++++ src/crypto/PSASpake2p.h | 166 +++++++++++++++ src/crypto/crypto.gni | 6 + src/protocols/secure_channel/CASESession.cpp | 2 +- src/protocols/secure_channel/CASESession.h | 2 +- src/protocols/secure_channel/PASESession.cpp | 2 +- src/protocols/secure_channel/PASESession.h | 9 +- src/protocols/secure_channel/PairingSession.h | 2 +- .../tests/TestPairingSession.cpp | 2 +- 16 files changed, 401 insertions(+), 11 deletions(-) create mode 100644 src/crypto/PSASpake2p.cpp create mode 100644 src/crypto/PSASpake2p.h diff --git a/config/nrfconnect/chip-module/CMakeLists.txt b/config/nrfconnect/chip-module/CMakeLists.txt index 98295406628cc1..51ca4689de1ca1 100644 --- a/config/nrfconnect/chip-module/CMakeLists.txt +++ b/config/nrfconnect/chip-module/CMakeLists.txt @@ -168,7 +168,8 @@ else() endif() if (CONFIG_CHIP_CRYPTO_PSA) - matter_add_gn_arg_string("chip_crypto" "psa") + matter_add_gn_arg_string("chip_crypto" "psa") + matter_add_gn_arg_bool ("chip_crypto_psa_spake2p" CONFIG_PSA_WANT_ALG_SPAKE2P_MATTER) endif() if (BOARD STREQUAL "native_posix") diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index d7bcfbd2fb0516..562755b14b9c25 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -298,6 +298,7 @@ config MBEDTLS_HEAP_SIZE config CHIP_CRYPTO_PSA default y if !CHIP_WIFI + imply PSA_WANT_ALG_SPAKE2P_MATTER if CHIP_CRYPTO_PSA diff --git a/src/crypto/BUILD.gn b/src/crypto/BUILD.gn index bfd633947c903d..1fb8b94f39a82f 100644 --- a/src/crypto/BUILD.gn +++ b/src/crypto/BUILD.gn @@ -51,6 +51,7 @@ buildconfig_header("crypto_buildconfig") { defines = [ "CHIP_CRYPTO_MBEDTLS=${chip_crypto_mbedtls}", "CHIP_CRYPTO_PSA=${chip_crypto_psa}", + "CHIP_CRYPTO_PSA_SPAKE2P=${chip_crypto_psa_spake2p}", "CHIP_CRYPTO_OPENSSL=${chip_crypto_openssl}", "CHIP_CRYPTO_BORINGSSL=${chip_crypto_boringssl}", "CHIP_CRYPTO_PLATFORM=${chip_crypto_platform}", @@ -156,6 +157,13 @@ static_library("crypto") { ] } + if (chip_crypto_psa_spake2p) { + sources += [ + "PSASpake2p.cpp", + "PSASpake2p.h", + ] + } + public_configs = [] cflags = [ "-Wconversion" ] diff --git a/src/crypto/CHIPCryptoPAL.cpp b/src/crypto/CHIPCryptoPAL.cpp index 3e58db3a480ba9..fa84d786b8eabb 100644 --- a/src/crypto/CHIPCryptoPAL.cpp +++ b/src/crypto/CHIPCryptoPAL.cpp @@ -501,7 +501,7 @@ CHIP_ERROR Spake2p::KeyConfirm(const uint8_t * in, size_t in_len) return CHIP_NO_ERROR; } -CHIP_ERROR Spake2p::GetKeys(SessionKeystore & keystore, HkdfKeyHandle & key) const +CHIP_ERROR Spake2p::GetKeys(SessionKeystore & keystore, HkdfKeyHandle & key) { VerifyOrReturnError(state == CHIP_SPAKE2P_STATE::KC, CHIP_ERROR_INTERNAL); diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index 74b7f363d4fb7e..80611e93d12d88 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -1216,7 +1216,7 @@ class Spake2p * * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise **/ - CHIP_ERROR GetKeys(SessionKeystore & keystore, HkdfKeyHandle & key) const; + CHIP_ERROR GetKeys(SessionKeystore & keystore, HkdfKeyHandle & key); CHIP_ERROR InternalHash(const uint8_t * in, size_t in_len); CHIP_ERROR WriteMN(); diff --git a/src/crypto/CHIPCryptoPALPSA.h b/src/crypto/CHIPCryptoPALPSA.h index 101a6d0b26568b..2f91b3b4d49765 100644 --- a/src/crypto/CHIPCryptoPALPSA.h +++ b/src/crypto/CHIPCryptoPALPSA.h @@ -146,7 +146,7 @@ class PsaKdf private: CHIP_ERROR InitOperation(psa_key_id_t hkdfKey, const ByteSpan & salt, const ByteSpan & info); - psa_key_id_t mSecretKeyId = 0; + psa_key_id_t mSecretKeyId = PSA_KEY_ID_NULL; psa_key_derivation_operation_t mOperation = PSA_KEY_DERIVATION_OPERATION_INIT; }; diff --git a/src/crypto/PSASessionKeystore.cpp b/src/crypto/PSASessionKeystore.cpp index 7a0fc4af106b46..0ae3ed50755495 100644 --- a/src/crypto/PSASessionKeystore.cpp +++ b/src/crypto/PSASessionKeystore.cpp @@ -188,7 +188,7 @@ void PSASessionKeystore::DestroyKey(HkdfKeyHandle & key) auto & keyId = key.AsMutable(); psa_destroy_key(keyId); - keyId = 0; + keyId = PSA_KEY_ID_NULL; } } // namespace Crypto diff --git a/src/crypto/PSASpake2p.cpp b/src/crypto/PSASpake2p.cpp new file mode 100644 index 00000000000000..ae98b083c8a812 --- /dev/null +++ b/src/crypto/PSASpake2p.cpp @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2024 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 "PSASpake2p.h" + +#include "CHIPCryptoPALPSA.h" + +#include + +#include + +namespace chip { +namespace Crypto { + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::Init(const uint8_t * context, size_t context_len) +{ + Clear(); + + VerifyOrReturnError(context_len <= sizeof(mContext), CHIP_ERROR_BUFFER_TOO_SMALL); + + memcpy(mContext, context, context_len); + mContextLen = context_len; + + return CHIP_NO_ERROR; +} + +void PSASpake2p_P256_SHA256_HKDF_HMAC::Clear() +{ + IgnoreUnusedVariable(psa_pake_abort(&mOperation)); + mOperation = psa_pake_operation_init(); + + IgnoreUnusedVariable(psa_destroy_key(mKey)); + mKey = PSA_KEY_ID_NULL; +} + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::BeginVerifier(const uint8_t * my_identity, size_t my_identity_len, + const uint8_t * peer_identity, size_t peer_identity_len, + const uint8_t * w0in, size_t w0in_len, const uint8_t * Lin, + size_t Lin_len) +{ + VerifyOrReturnError(w0in_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(Lin_len == kP256_Point_Length, CHIP_ERROR_INVALID_ARGUMENT); + + uint8_t password[kSpake2p_WS_Length + kP256_Point_Length]; + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_pake_cipher_suite_t cp = PSA_PAKE_CIPHER_SUITE_INIT; + + psa_pake_cs_set_algorithm(&cp, PSA_ALG_SPAKE2P_MATTER); + psa_pake_cs_set_primitive(&cp, PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256)); + + memcpy(password + 0, w0in, w0in_len); + memcpy(password + w0in_len, Lin, Lin_len); + psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE); + psa_set_key_algorithm(&attributes, PSA_ALG_SPAKE2P_MATTER); + psa_set_key_type(&attributes, PSA_KEY_TYPE_SPAKE2P_PUBLIC_KEY(PSA_ECC_FAMILY_SECP_R1)); + + psa_status_t status = psa_import_key(&attributes, password, w0in_len + Lin_len, &mKey); + + psa_reset_key_attributes(&attributes); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_setup(&mOperation, mKey, &cp); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + mRole = PSA_PAKE_ROLE_SERVER; + status = psa_pake_set_role(&mOperation, PSA_PAKE_ROLE_SERVER); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_set_peer(&mOperation, peer_identity, peer_identity_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_set_user(&mOperation, my_identity, my_identity_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_set_context(&mOperation, mContext, mContextLen); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::BeginProver(const uint8_t * my_identity, size_t my_identity_len, + const uint8_t * peer_identity, size_t peer_identity_len, + const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, + size_t w1in_len) +{ + VerifyOrReturnError(w0in_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(w1in_len <= kSpake2p_WS_Length, CHIP_ERROR_INVALID_ARGUMENT); + + uint8_t password[kSpake2p_WS_Length * 2]; + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + psa_pake_cipher_suite_t cp = PSA_PAKE_CIPHER_SUITE_INIT; + + psa_pake_cs_set_algorithm(&cp, PSA_ALG_SPAKE2P_MATTER); + psa_pake_cs_set_primitive(&cp, PSA_PAKE_PRIMITIVE(PSA_PAKE_PRIMITIVE_TYPE_ECC, PSA_ECC_FAMILY_SECP_R1, 256)); + + memcpy(password + 0, w0in, w0in_len); + memcpy(password + w0in_len, w1in, w1in_len); + psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE); + psa_set_key_algorithm(&attributes, PSA_ALG_SPAKE2P_MATTER); + psa_set_key_type(&attributes, PSA_KEY_TYPE_SPAKE2P_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); + + psa_status_t status = psa_import_key(&attributes, password, w0in_len + w1in_len, &mKey); + + psa_reset_key_attributes(&attributes); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_setup(&mOperation, mKey, &cp); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + mRole = PSA_PAKE_ROLE_CLIENT; + status = psa_pake_set_role(&mOperation, PSA_PAKE_ROLE_CLIENT); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_set_user(&mOperation, my_identity, my_identity_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_set_peer(&mOperation, peer_identity, peer_identity_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + status = psa_pake_set_context(&mOperation, mContext, mContextLen); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::ComputeRoundOne(const uint8_t * pab, size_t pab_len, uint8_t * out, size_t * out_len) +{ + VerifyOrReturnError(out_len != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + psa_status_t status; + + if (mRole == PSA_PAKE_ROLE_SERVER) + { + status = psa_pake_input(&mOperation, PSA_PAKE_STEP_KEY_SHARE, pab, pab_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + } + + status = psa_pake_output(&mOperation, PSA_PAKE_STEP_KEY_SHARE, out, *out_len, out_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::ComputeRoundTwo(const uint8_t * in, size_t in_len, uint8_t * out, size_t * out_len) +{ + VerifyOrReturnError(out_len != nullptr, CHIP_ERROR_INVALID_ARGUMENT); + + psa_status_t status; + + if (mRole == PSA_PAKE_ROLE_CLIENT) + { + status = psa_pake_input(&mOperation, PSA_PAKE_STEP_KEY_SHARE, in, in_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + } + + status = psa_pake_output(&mOperation, PSA_PAKE_STEP_CONFIRM, out, *out_len, out_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::KeyConfirm(const uint8_t * in, size_t in_len) +{ + psa_status_t status = psa_pake_input(&mOperation, PSA_PAKE_STEP_CONFIRM, in, in_len); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +CHIP_ERROR PSASpake2p_P256_SHA256_HKDF_HMAC::GetKeys(SessionKeystore & keystore, HkdfKeyHandle & key) +{ + auto & keyId = key.AsMutable(); + + psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT; + + psa_set_key_type(&attributes, PSA_KEY_TYPE_DERIVE); + psa_set_key_usage_flags(&attributes, PSA_KEY_USAGE_DERIVE); + psa_set_key_algorithm(&attributes, PSA_ALG_HKDF(PSA_ALG_SHA_256)); + + psa_status_t status = psa_pake_get_shared_key(&(mOperation), &attributes, &keyId); + VerifyOrReturnError(status == PSA_SUCCESS, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; +} + +} // namespace Crypto +} // namespace chip diff --git a/src/crypto/PSASpake2p.h b/src/crypto/PSASpake2p.h new file mode 100644 index 00000000000000..9907b1ec09a5bc --- /dev/null +++ b/src/crypto/PSASpake2p.h @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2024 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 "CHIPCryptoPAL.h" + +#include + +namespace chip { +namespace Crypto { + +/** + * The below class implements the draft 01 version of the Spake2+ protocol as + * defined in https://www.ietf.org/id/draft-bar-cfrg-spake2plus-01.html. + * + * The following describes the protocol flows: + * + * Commissioner Accessory + * ------------ --------- + * + * Init + * BeginProver + * ComputeRoundOne -------------> + * Init + * BeginVerifier + * /- ComputeRoundOne + * <------------- ComputeRoundTwo + * ComputeRoundTwo -------------> + * KeyConfirm KeyConfirm + * GetKeys GetKeys + * + **/ +class PSASpake2p_P256_SHA256_HKDF_HMAC +{ +public: + /** + * @brief Initialize Spake2+ with some context specific information. + * + * @param context The context is arbitrary but should include information about the + * protocol being run, contain the transcript for negotiation, include + * the PKBDF parameters, etc. + * @param context_len The length of the context. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR Init(const uint8_t * context, size_t context_len); + + /** + * @brief Free Spake2+ underlying objects. + **/ + void Clear(); + + /** + * @brief Start the Spake2+ process as a verifier (i.e. an accessory being provisioned). + * + * @param my_identity The verifier identity. May be NULL if identities are not established. + * @param my_identity_len The verifier identity length. + * @param peer_identity The peer identity. May be NULL if identities are not established. + * @param peer_identity_len The peer identity length. + * @param w0in The input w0 (a parameter baked into the device or computed with ComputeW0). + * @param w0in_len The input w0 length. + * @param Lin The input L (a parameter baked into the device or computed with ComputeL). + * @param Lin_len The input L length. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR BeginVerifier(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, + size_t peer_identity_len, const uint8_t * w0in, size_t w0in_len, const uint8_t * Lin, size_t Lin_len); + + /** + * @brief Start the Spake2+ process as a prover (i.e. a commissioner). + * + * @param my_identity The prover identity. May be NULL if identities are not established. + * @param my_identity_len The prover identity length. + * @param peer_identity The peer identity. May be NULL if identities are not established. + * @param peer_identity_len The peer identity length. + * @param w0in The input w0 (an output from the PBKDF). + * @param w0in_len The input w0 length. + * @param w1in The input w1 (an output from the PBKDF). + * @param w1in_len The input w1 length. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR BeginProver(const uint8_t * my_identity, size_t my_identity_len, const uint8_t * peer_identity, + size_t peer_identity_len, const uint8_t * w0in, size_t w0in_len, const uint8_t * w1in, size_t w1in_len); + + /** + * @brief Compute the first round of the protocol. + * + * @param pab X value from commissioner. + * @param pab_len X length. + * @param out The output first round Spake2+ contribution. + * @param out_len The output first round Spake2+ contribution length. + * + * The out_len parameter is expected to point to an integer that holds + * the size of the buffer to put the first round Spake2+ contribution. + * After successful execution of this method, the variable is set to the + * actual size of the generated output. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR ComputeRoundOne(const uint8_t * pab, size_t pab_len, uint8_t * out, size_t * out_len); + + /** + * @brief Compute the second round of the protocol. + * + * @param in The peer first round Spake2+ contribution. + * @param in_len The peer first round Spake2+ contribution length. + * @param out The output second round Spake2+ contribution. + * @param out_len The output second round Spake2+ contribution length. + * + * The out_len parameter is expected to point to an integer that holds + * the size of the buffer to put the second round Spake2+ contribution. + * After successful execution of this method, the variable is set to the + * actual size of the generated output. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR ComputeRoundTwo(const uint8_t * in, size_t in_len, uint8_t * out, size_t * out_len); + + /** + * @brief Confirm that each party computed the same keys. + * + * @param in The peer second round Spake2+ contribution. + * @param in_len The peer second round Spake2+ contribution length. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR KeyConfirm(const uint8_t * in, size_t in_len); + + /** + * @brief Return the shared secret. + * + * @param out The output secret. + * @param out_len The output secret length. + * + * @return Returns a CHIP_ERROR on error, CHIP_NO_ERROR otherwise + **/ + CHIP_ERROR GetKeys(SessionKeystore & keystore, HkdfKeyHandle & key); + +private: + psa_pake_operation_t mOperation = PSA_PAKE_OPERATION_INIT; + psa_key_id_t mKey = PSA_KEY_ID_NULL; + + psa_pake_role_t mRole; + uint8_t mContext[kSHA256_Hash_Length]; + size_t mContextLen; +}; + +} // namespace Crypto +} // namespace chip diff --git a/src/crypto/crypto.gni b/src/crypto/crypto.gni index 4fc63b800826b8..96f506033bb56e 100644 --- a/src/crypto/crypto.gni +++ b/src/crypto/crypto.gni @@ -19,8 +19,14 @@ declare_args() { # Compile mbedtls externally. Only used if chip_crypto == "mbedtls" chip_external_mbedtls = false + + # Use PSA Spake2+ implementation. Only used if chip_crypto == "psa" + chip_crypto_psa_spake2p = false } assert( !chip_external_mbedtls || chip_crypto == "mbedtls" || chip_crypto == "psa", "Use of external mbedtls requires the mbedtls or psa crypto impl") + +assert(!chip_crypto_psa_spake2p || chip_crypto == "psa", + "Use of psa spake2+ requires the psa crypto impl") diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index 4436d7fbb77881..e1bac768f81da6 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -571,7 +571,7 @@ void CASESession::AbortPendingEstablish(CHIP_ERROR err) NotifySessionEstablishmentError(err, state); } -CHIP_ERROR CASESession::DeriveSecureSession(CryptoContext & session) const +CHIP_ERROR CASESession::DeriveSecureSession(CryptoContext & session) { switch (mState) { diff --git a/src/protocols/secure_channel/CASESession.h b/src/protocols/secure_channel/CASESession.h index 9e41f6c69fbe84..b7c6b429b950ad 100644 --- a/src/protocols/secure_channel/CASESession.h +++ b/src/protocols/secure_channel/CASESession.h @@ -146,7 +146,7 @@ class DLL_EXPORT CASESession : public Messaging::UnsolicitedMessageHandler, * @param session Reference to the secure session that will be initialized once session establishment is complete * @return CHIP_ERROR The result of session derivation */ - CHIP_ERROR DeriveSecureSession(CryptoContext & session) const override; + CHIP_ERROR DeriveSecureSession(CryptoContext & session) override; //// UnsolicitedMessageHandler Implementation //// CHIP_ERROR OnUnsolicitedMessageReceived(const PayloadHeader & payloadHeader, ExchangeDelegate *& newDelegate) override diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index ca2524d5e3f302..e0f409616ab26c 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -258,7 +258,7 @@ void PASESession::OnResponseTimeout(ExchangeContext * ec) NotifySessionEstablishmentError(CHIP_ERROR_TIMEOUT); } -CHIP_ERROR PASESession::DeriveSecureSession(CryptoContext & session) const +CHIP_ERROR PASESession::DeriveSecureSession(CryptoContext & session) { VerifyOrReturnError(mPairingComplete, CHIP_ERROR_INCORRECT_STATE); diff --git a/src/protocols/secure_channel/PASESession.h b/src/protocols/secure_channel/PASESession.h index f90c2545b7d787..2e731283c88aa8 100644 --- a/src/protocols/secure_channel/PASESession.h +++ b/src/protocols/secure_channel/PASESession.h @@ -27,6 +27,9 @@ #pragma once #include +#if CHIP_CRYPTO_PSA_SPAKE2P +#include +#endif #include #include #include @@ -125,7 +128,7 @@ class DLL_EXPORT PASESession : public Messaging::UnsolicitedMessageHandler, * @param session Reference to the secure session that will be initialized once pairing is complete * @return CHIP_ERROR The result of session derivation */ - CHIP_ERROR DeriveSecureSession(CryptoContext & session) const override; + CHIP_ERROR DeriveSecureSession(CryptoContext & session) override; // TODO: remove Clear, we should create a new instance instead reset the old instance. /** @brief This function zeroes out and resets the memory used by the object. @@ -198,7 +201,11 @@ class DLL_EXPORT PASESession : public Messaging::UnsolicitedMessageHandler, // mNextExpectedMsg is set when we are expecting a message. Optional mNextExpectedMsg; +#if CHIP_CRYPTO_PSA_SPAKE2P + Crypto::PSASpake2p_P256_SHA256_HKDF_HMAC mSpake2p; +#else Crypto::Spake2p_P256_SHA256_HKDF_HMAC mSpake2p; +#endif Crypto::Spake2pVerifier mPASEVerifier; diff --git a/src/protocols/secure_channel/PairingSession.h b/src/protocols/secure_channel/PairingSession.h index ea69f65bfaccb7..fa639a7dd9459a 100644 --- a/src/protocols/secure_channel/PairingSession.h +++ b/src/protocols/secure_channel/PairingSession.h @@ -96,7 +96,7 @@ class DLL_EXPORT PairingSession : public SessionDelegate * @param session Reference to the secure session that will be initialized once pairing is complete * @return CHIP_ERROR The result of session derivation */ - virtual CHIP_ERROR DeriveSecureSession(CryptoContext & session) const = 0; + virtual CHIP_ERROR DeriveSecureSession(CryptoContext & session) = 0; const ReliableMessageProtocolConfig & GetRemoteMRPConfig() const { return mRemoteSessionParams.GetMRPConfig(); } const SessionParameters & GetRemoteSessionParameters() const { return mRemoteSessionParams; } diff --git a/src/protocols/secure_channel/tests/TestPairingSession.cpp b/src/protocols/secure_channel/tests/TestPairingSession.cpp index e0e4a7cd9601c8..4a3fe88d55c7aa 100644 --- a/src/protocols/secure_channel/tests/TestPairingSession.cpp +++ b/src/protocols/secure_channel/tests/TestPairingSession.cpp @@ -48,7 +48,7 @@ class TestPairingSession : public PairingSession const ReliableMessageProtocolConfig & GetRemoteMRPConfig() const { return PairingSession::GetRemoteMRPConfig(); } - CHIP_ERROR DeriveSecureSession(CryptoContext & session) const override { return CHIP_NO_ERROR; } + CHIP_ERROR DeriveSecureSession(CryptoContext & session) override { return CHIP_NO_ERROR; } CHIP_ERROR DecodeMRPParametersIfPresent(TLV::Tag expectedTag, System::PacketBufferTLVReader & tlvReader) { From 7cdea9b7f6b6e71ec8023e105848c82d3e2ab2e4 Mon Sep 17 00:00:00 2001 From: Shao Ling Tan <161761051+shaoltan-amazon@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:17:01 -0700 Subject: [PATCH 17/40] Create test script to verify that the Linux tv-casting-app is able to discover the Linux tv-app. (#32919) --- .../examples-linux-tv-casting-app.yaml | 8 +- scripts/tests/run_tv_casting_test.py | 225 ++++++++++++++++++ 2 files changed, 232 insertions(+), 1 deletion(-) create mode 100644 scripts/tests/run_tv_casting_test.py diff --git a/.github/workflows/examples-linux-tv-casting-app.yaml b/.github/workflows/examples-linux-tv-casting-app.yaml index e7ecb5bdddecc7..679f4be57a35db 100644 --- a/.github/workflows/examples-linux-tv-casting-app.yaml +++ b/.github/workflows/examples-linux-tv-casting-app.yaml @@ -17,7 +17,7 @@ name: Test TV Casting Example on: push: branches-ignore: - - 'dependabot/**' + - "dependabot/**" pull_request: merge_group: @@ -63,6 +63,12 @@ jobs: ./scripts/run_in_build_env.sh \ "scripts/examples/gn_build_example.sh examples/tv-casting-app/linux/ out/tv-casting-app" + - name: Test casting from Linux tv-casting-app to Linux tv-app + run: | + ./scripts/run_in_build_env.sh \ + "python3 ./scripts/tests/run_tv_casting_test.py" + timeout-minutes: 1 + - name: Uploading Size Reports uses: ./.github/actions/upload-size-reports if: ${{ !env.ACT }} diff --git a/scripts/tests/run_tv_casting_test.py b/scripts/tests/run_tv_casting_test.py new file mode 100644 index 00000000000000..7e783102a2fbc5 --- /dev/null +++ b/scripts/tests/run_tv_casting_test.py @@ -0,0 +1,225 @@ +#!/usr/bin/env -S python3 -B + +# Copyright (c) 2024 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 logging +import os +import subprocess +import sys +import tempfile +import time +from typing import List, Optional, TextIO, Tuple + +import click + +# Configure logging format. +logging.basicConfig(level=logging.INFO, format='%(levelname)s - %(message)s') + +# The maximum amount of time to wait for the Linux tv-app to start before timeout. +TV_APP_MAX_START_WAIT_SEC = 2 + +# File names of logs for the Linux tv-casting-app and the Linux tv-app. +LINUX_TV_APP_LOGS = 'Linux-tv-app-logs.txt' +LINUX_TV_CASTING_APP_LOGS = 'Linux-tv-casting-app-logs.txt' + +# Values that identify the Linux tv-app and are noted in the 'Device Configuration' in the Linux tv-app output +# as well as under the 'Discovered Commissioner' details in the Linux tv-casting-app output. +VENDOR_ID = 0xFFF1 # Spec 7.20.2.1 MEI code: test vendor IDs are 0xFFF1 to 0xFFF4 +PRODUCT_ID = 0x8001 # Test product id +DEVICE_TYPE_CASTING_VIDEO_PLAYER = 0x23 # Device type library 10.3: Casting Video Player + + +class ProcessManager: + """A context manager for managing subprocesses. + + This class provides a context manager for safely starting and stopping a subprocess. + """ + + def __init__(self, command: List[str], stdout, stderr): + self.command = command + self.stdout = stdout + self.stderr = stderr + + def __enter__(self): + self.process = subprocess.Popen(self.command, stdout=self.stdout, stderr=self.stderr, text=True) + return self.process + + def __exit__(self, exception_type, exception_value, traceback): + self.process.terminate() + self.process.wait() + + +def dump_temporary_logs_to_console(log_file_path: str): + """Dump log file to the console; log file will be removed once the function exits.""" + """Write the entire content of `log_file_path` to the console.""" + print('\nDumping logs from: ', log_file_path) + + with open(log_file_path, 'r') as file: + for line in file: + print(line.rstrip()) + + +def handle_discovery_failure(log_file_paths: List[str]): + """Log 'Discovery failed!' as error, dump log files to console, exit on error.""" + logging.error('Discovery failed!') + + for log_file_path in log_file_paths: + try: + dump_temporary_logs_to_console(log_file_path) + except Exception as e: + logging.exception(f"Failed to dump {log_file_path}: {e}") + + sys.exit(1) + + +def extract_value_from_string(line: str) -> int: + """Extract and return integer value from given output string. + + The string is expected to be in the following format as it is received + from the Linux tv-casting-app output: + \x1b[0;34m[1713741926895] [7276:9521344] [DIS] Vendor ID: 65521\x1b[0m + The integer value to be extracted here is 65521. + """ + value = line.split(':')[-1].strip().replace('\x1b[0m', '') + value = int(value) + + return value + + +def validate_value(expected_value: int, log_paths: List[str], line: str, value_name: str) -> Optional[str]: + """Validate a value in a string against an expected value.""" + value = extract_value_from_string(line) + + if value != expected_value: + logging.error(f'{value_name} does not match the expected value!') + logging.error(f'Expected {value_name}: {expected_value}') + logging.error(line.rstrip('\n')) + handle_discovery_failure(log_paths) + return None + + # Return the line containing the valid value. + return line.rstrip('\n') + + +def start_up_tv_app_success(tv_app_process: subprocess.Popen, linux_tv_app_log_file: TextIO) -> bool: + """Check if the Linux tv-app is able to successfully start or until timeout occurs.""" + start_wait_time = time.time() + + while True: + # Check if the time elapsed since the start wait time exceeds the maximum allowed startup time for the TV app. + if time.time() - start_wait_time > TV_APP_MAX_START_WAIT_SEC: + logging.error("The Linux tv-app process did not start successfully within the timeout.") + return False + + tv_app_output_line = tv_app_process.stdout.readline() + + linux_tv_app_log_file.write(tv_app_output_line) + linux_tv_app_log_file.flush() + + # Check if the Linux tv-app started successfully. + if "Started commissioner" in tv_app_output_line: + logging.info('Linux tv-app is up and running!') + return True + + +def parse_output_for_valid_commissioner(tv_casting_app_info: Tuple[subprocess.Popen, TextIO], log_paths: List[str]): + """Parse the output of the Linux tv-casting-app to find a valid commissioner.""" + tv_casting_app_process, linux_tv_casting_app_log_file = tv_casting_app_info + + valid_discovered_commissioner = None + valid_vendor_id = None + valid_product_id = None + valid_device_type = None + + # Read the output as we receive it from the tv-casting-app subprocess. + for line in tv_casting_app_process.stdout: + linux_tv_casting_app_log_file.write(line) + linux_tv_casting_app_log_file.flush() + + # Fail fast if "No commissioner discovered" string found. + if "No commissioner discovered" in line: + logging.error(line.rstrip('\n')) + handle_discovery_failure(log_paths) + + elif "Discovered Commissioner" in line: + valid_discovered_commissioner = line.rstrip('\n') + + elif valid_discovered_commissioner: + # Continue parsing the output for the information of interest under 'Discovered Commissioner' + if 'Vendor ID:' in line: + valid_vendor_id = validate_value(VENDOR_ID, log_paths, line, 'Vendor ID') + + elif 'Product ID:' in line: + valid_product_id = validate_value(PRODUCT_ID, log_paths, line, 'Product ID') + + elif 'Device Type:' in line: + valid_device_type = validate_value(DEVICE_TYPE_CASTING_VIDEO_PLAYER, log_paths, line, 'Device Type') + + # A valid commissioner has VENDOR_ID, PRODUCT_ID, and DEVICE TYPE in its list of entries. + if valid_vendor_id and valid_product_id and valid_device_type: + logging.info('Found a valid commissioner in the Linux tv-casting-app logs:') + logging.info(valid_discovered_commissioner) + logging.info(valid_vendor_id) + logging.info(valid_product_id) + logging.info(valid_device_type) + logging.info('Discovery success!') + break + + +@click.command() +@click.option('--tv-app-rel-path', type=str, default='out/tv-app/chip-tv-app', help='Path to the Linux tv-app executable.') +@click.option('--tv-casting-app-rel-path', type=str, default='out/tv-casting-app/chip-tv-casting-app', help='Path to the Linux tv-casting-app executable.') +def test_discovery_fn(tv_app_rel_path, tv_casting_app_rel_path): + """Test if the Linux tv-casting-app is able to discover the Linux tv-app. + + Default paths for the executables are provided but can be overridden via command line arguments. + For example: python3 run_tv_casting_test.py --tv-app-rel-path=path/to/tv-app + --tv-casting-app-rel-path=path/to/tv-casting-app + """ + # Store the log files to a temporary directory. + with tempfile.TemporaryDirectory() as temp_dir: + linux_tv_app_log_path = os.path.join(temp_dir, LINUX_TV_APP_LOGS) + linux_tv_casting_app_log_path = os.path.join(temp_dir, LINUX_TV_CASTING_APP_LOGS) + + with open(linux_tv_app_log_path, 'w') as linux_tv_app_log_file, open(linux_tv_casting_app_log_path, 'w') as linux_tv_casting_app_log_file: + + # Configure command options to disable stdout buffering during tests. + disable_stdout_buffering_cmd = [] + # On Unix-like systems, use stdbuf to disable stdout buffering. + if sys.platform == 'darwin' or sys.platform == 'linux': + disable_stdout_buffering_cmd = ['stdbuf', '-o0', '-i0'] + + tv_app_abs_path = os.path.abspath(tv_app_rel_path) + # Run the Linux tv-app subprocess. + with ProcessManager(disable_stdout_buffering_cmd + [tv_app_abs_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) as tv_app_process: + + if not start_up_tv_app_success(tv_app_process, linux_tv_app_log_file): + handle_discovery_failure([linux_tv_app_log_path]) + + tv_casting_app_abs_path = os.path.abspath(tv_casting_app_rel_path) + # Run the Linux tv-casting-app subprocess. + with ProcessManager(disable_stdout_buffering_cmd + [tv_casting_app_abs_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) as tv_casting_app_process: + log_paths = [linux_tv_app_log_path, linux_tv_casting_app_log_path] + tv_casting_app_info = (tv_casting_app_process, linux_tv_casting_app_log_file) + parse_output_for_valid_commissioner(tv_casting_app_info, log_paths) + + +if __name__ == '__main__': + + # Start with a clean slate by removing any previously cached entries. + os.system('rm -f /tmp/chip_*') + + # Test discovery between the Linux tv-casting-app and the tv-app. + test_discovery_fn() From 5e2bf15db99c5ba3205495a5a4594ec7077d58a9 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Thu, 25 Apr 2024 21:19:53 +0200 Subject: [PATCH 18/40] pw_unit_test migration: setup_payload batch #2 (with fixtures) (#33112) * pw_unit_test migration: setup_payload batch #2 (with fixtures) * restyle fix * integrating comments * restyle * Update test_components_nl.txt --------- Co-authored-by: Andrei Litvin --- src/BUILD.gn | 1 - src/setup_payload/tests/BUILD.gn | 20 +- .../tests/TestAdditionalDataPayload.cpp | 183 +++++----------- src/setup_payload/tests/TestQRCodeTLV.cpp | 206 ++++++------------ .../unit-tests/test_components_nl.txt | 1 - 5 files changed, 127 insertions(+), 284 deletions(-) diff --git a/src/BUILD.gn b/src/BUILD.gn index 60ba11c0d28f61..dd69734ffc68e6 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -86,7 +86,6 @@ if (chip_build_tests) { chip_device_platform != "efr32") { tests += [ "${chip_root}/src/setup_payload/tests", - "${chip_root}/src/setup_payload/tests:tests_nltest", "${chip_root}/src/transport/raw/tests", ] } diff --git a/src/setup_payload/tests/BUILD.gn b/src/setup_payload/tests/BUILD.gn index 0f672c274fc941..b08d18a5a4fc15 100644 --- a/src/setup_payload/tests/BUILD.gn +++ b/src/setup_payload/tests/BUILD.gn @@ -23,25 +23,9 @@ chip_test_suite("tests") { output_name = "libSetupPayloadTests" test_sources = [ + "TestAdditionalDataPayload.cpp", "TestManualCode.cpp", "TestQRCode.cpp", - ] - - sources = [ "TestHelpers.h" ] - - cflags = [ "-Wconversion" ] - - public_deps = [ - "${chip_root}/src/platform", - "${chip_root}/src/setup_payload", - ] -} - -chip_test_suite_using_nltest("tests_nltest") { - output_name = "libSetupPayloadTestsNL" - - test_sources = [ - "TestAdditionalDataPayload.cpp", "TestQRCodeTLV.cpp", ] @@ -50,9 +34,7 @@ chip_test_suite_using_nltest("tests_nltest") { cflags = [ "-Wconversion" ] public_deps = [ - "${chip_root}/src/lib/support:testing_nlunit", "${chip_root}/src/platform", "${chip_root}/src/setup_payload", - "${nlunit_test_root}:nlunit-test", ] } diff --git a/src/setup_payload/tests/TestAdditionalDataPayload.cpp b/src/setup_payload/tests/TestAdditionalDataPayload.cpp index f64846222323e9..36ec0e6a970b90 100644 --- a/src/setup_payload/tests/TestAdditionalDataPayload.cpp +++ b/src/setup_payload/tests/TestAdditionalDataPayload.cpp @@ -24,22 +24,20 @@ #include #include -#include #include +#include + #include #include #include #include -#include +#include #include #include #include #include -#include -#include - using namespace chip; namespace { @@ -59,7 +57,7 @@ constexpr uint16_t kLifetimeCounter constexpr uint16_t kShortRotatingIdLength = 5; #endif // CHIP_ENABLE_ROTATING_DEVICE_ID -CHIP_ERROR GenerateAdditionalDataPayload(nlTestSuite * inSuite, AdditionalDataPayloadGeneratorParams & additionalDataPayloadParams, +CHIP_ERROR GenerateAdditionalDataPayload(AdditionalDataPayloadGeneratorParams & additionalDataPayloadParams, BitFlags additionalDataFields, char * additionalDataPayloadOutput) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -69,7 +67,7 @@ CHIP_ERROR GenerateAdditionalDataPayload(nlTestSuite * inSuite, AdditionalDataPa additionalDataFields); if (err == CHIP_NO_ERROR) { - NL_TEST_ASSERT(inSuite, !bufferHandle.IsNull()); + EXPECT_FALSE(bufferHandle.IsNull()); } else { @@ -99,20 +97,25 @@ CHIP_ERROR ParseAdditionalDataPayload(const char * additionalDataPayload, size_t return AdditionalDataPayloadParser(additionalDataPayloadBytes.get(), bufferSize).populatePayload(outPayload); } -void TestGeneratingAdditionalDataPayloadWithoutRotatingDeviceId(nlTestSuite * inSuite, void * inContext) +class TestAdditionalDataPayload : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestAdditionalDataPayload, TestGeneratingAdditionalDataPayloadWithoutRotatingDeviceId) { BitFlags additionalDataFields; char output[kAdditionalDataPayloadLength]; AdditionalDataPayloadGeneratorParams additionalDataPayloadParams; - NL_TEST_ASSERT(inSuite, - GenerateAdditionalDataPayload(inSuite, additionalDataPayloadParams, additionalDataFields, output) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(output, kAdditionalDataPayloadWithoutRotatingDeviceId) == 0); + EXPECT_EQ(GenerateAdditionalDataPayload(additionalDataPayloadParams, additionalDataFields, output), CHIP_NO_ERROR); + EXPECT_STREQ(output, kAdditionalDataPayloadWithoutRotatingDeviceId); } #if CHIP_ENABLE_ROTATING_DEVICE_ID -void TestGeneratingAdditionalDataPayloadWithRotatingDeviceId(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestGeneratingAdditionalDataPayloadWithRotatingDeviceId) { BitFlags additionalDataFields; additionalDataFields.Set(AdditionalDataFields::RotatingDeviceId); @@ -121,13 +124,11 @@ void TestGeneratingAdditionalDataPayloadWithRotatingDeviceId(nlTestSuite * inSui additionalDataPayloadParams.rotatingDeviceIdUniqueId = ByteSpan(kUniqueId); char output[kAdditionalDataPayloadLength]; - NL_TEST_ASSERT(inSuite, - GenerateAdditionalDataPayload(inSuite, additionalDataPayloadParams, additionalDataFields, output) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(output, kAdditionalDataPayloadWithRotatingDeviceId) == 0); + EXPECT_EQ(GenerateAdditionalDataPayload(additionalDataPayloadParams, additionalDataFields, output), CHIP_NO_ERROR); + EXPECT_STREQ(output, kAdditionalDataPayloadWithRotatingDeviceId); } -void TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdAndMaxLifetimeCounter(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdAndMaxLifetimeCounter) { BitFlags additionalDataFields; additionalDataFields.Set(AdditionalDataFields::RotatingDeviceId); @@ -136,25 +137,22 @@ void TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdAndMaxLifetimeCounte additionalDataPayloadParams.rotatingDeviceIdUniqueId = ByteSpan(kUniqueId); char output[kAdditionalDataPayloadLength]; - NL_TEST_ASSERT(inSuite, - GenerateAdditionalDataPayload(inSuite, additionalDataPayloadParams, additionalDataFields, output) == - CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(output, kAdditionalDataPayloadWithRotatingDeviceIdAndMaxLifetimeCounter) == 0); + EXPECT_EQ(GenerateAdditionalDataPayload(additionalDataPayloadParams, additionalDataFields, output), CHIP_NO_ERROR); + EXPECT_STREQ(output, kAdditionalDataPayloadWithRotatingDeviceIdAndMaxLifetimeCounter); } -void TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdWithNullInputs(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdWithNullInputs) { BitFlags additionalDataFields; additionalDataFields.Set(AdditionalDataFields::RotatingDeviceId); AdditionalDataPayloadGeneratorParams additionalDataPayloadParams; char output[kAdditionalDataPayloadLength]; - NL_TEST_ASSERT(inSuite, - GenerateAdditionalDataPayload(inSuite, additionalDataPayloadParams, additionalDataFields, output) == - CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(GenerateAdditionalDataPayload(additionalDataPayloadParams, additionalDataFields, output), + CHIP_ERROR_INVALID_ARGUMENT); } -void TestGeneratingRotatingDeviceIdAsString(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestGeneratingRotatingDeviceIdAsString) { CHIP_ERROR err = CHIP_NO_ERROR; char rotatingDeviceIdHexBuffer[RotatingDeviceId::kHexMaxLength]; @@ -165,8 +163,8 @@ void TestGeneratingRotatingDeviceIdAsString(nlTestSuite * inSuite, void * inCont err = AdditionalDataPayloadGenerator().generateRotatingDeviceIdAsHexString( additionalDataPayloadParams, rotatingDeviceIdHexBuffer, ArraySize(rotatingDeviceIdHexBuffer), rotatingDeviceIdValueOutputSize); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(rotatingDeviceIdHexBuffer, kRotatingDeviceId) == 0); + EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_STREQ(rotatingDeviceIdHexBuffer, kRotatingDeviceId); // Parsing out the lifetime counter value long lifetimeCounter; char lifetimeCounterStr[3]; @@ -174,10 +172,10 @@ void TestGeneratingRotatingDeviceIdAsString(nlTestSuite * inSuite, void * inCont char * parseEnd; lifetimeCounter = strtol(lifetimeCounterStr, &parseEnd, 16); - NL_TEST_ASSERT(inSuite, lifetimeCounter == kLifetimeCounter); + EXPECT_EQ(lifetimeCounter, kLifetimeCounter); } -void TestGeneratingRotatingDeviceIdAsStringWithNullInputs(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestGeneratingRotatingDeviceIdAsStringWithNullInputs) { CHIP_ERROR err = CHIP_NO_ERROR; char rotatingDeviceIdHexBuffer[RotatingDeviceId::kHexMaxLength]; @@ -188,10 +186,10 @@ void TestGeneratingRotatingDeviceIdAsStringWithNullInputs(nlTestSuite * inSuite, err = AdditionalDataPayloadGenerator().generateRotatingDeviceIdAsHexString( additionalDataPayloadParams, rotatingDeviceIdHexBuffer, ArraySize(rotatingDeviceIdHexBuffer), rotatingDeviceIdValueOutputSize); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); } -void TestGeneratingRotatingDeviceIdWithSmallBuffer(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestGeneratingRotatingDeviceIdWithSmallBuffer) { CHIP_ERROR err = CHIP_NO_ERROR; char rotatingDeviceIdHexBuffer[kShortRotatingIdLength]; @@ -202,122 +200,51 @@ void TestGeneratingRotatingDeviceIdWithSmallBuffer(nlTestSuite * inSuite, void * err = AdditionalDataPayloadGenerator().generateRotatingDeviceIdAsHexString( additionalDataPayloadParams, rotatingDeviceIdHexBuffer, ArraySize(rotatingDeviceIdHexBuffer), rotatingDeviceIdValueOutputSize); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_BUFFER_TOO_SMALL); + EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); } #endif // CHIP_ENABLE_ROTATING_DEVICE_ID -void TestParsingAdditionalDataPayloadWithRotatingDeviceId(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestParsingAdditionalDataPayloadWithRotatingDeviceId) { chip::SetupPayloadData::AdditionalDataPayload resultPayload; - NL_TEST_ASSERT(inSuite, - ParseAdditionalDataPayload(kAdditionalDataPayloadWithRotatingDeviceId, - strlen(kAdditionalDataPayloadWithRotatingDeviceId), resultPayload) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(resultPayload.rotatingDeviceId.c_str(), kRotatingDeviceId) == 0); + EXPECT_EQ(ParseAdditionalDataPayload(kAdditionalDataPayloadWithRotatingDeviceId, + strlen(kAdditionalDataPayloadWithRotatingDeviceId), resultPayload), + CHIP_NO_ERROR); + EXPECT_STREQ(resultPayload.rotatingDeviceId.c_str(), kRotatingDeviceId); } -void TestParsingAdditionalDataPayloadWithoutRotatingDeviceId(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestParsingAdditionalDataPayloadWithoutRotatingDeviceId) { chip::SetupPayloadData::AdditionalDataPayload resultPayload; - NL_TEST_ASSERT(inSuite, - ParseAdditionalDataPayload(kAdditionalDataPayloadWithoutRotatingDeviceId, - strlen(kAdditionalDataPayloadWithoutRotatingDeviceId), - resultPayload) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(resultPayload.rotatingDeviceId.c_str(), "") == 0); + EXPECT_EQ(ParseAdditionalDataPayload(kAdditionalDataPayloadWithoutRotatingDeviceId, + strlen(kAdditionalDataPayloadWithoutRotatingDeviceId), resultPayload), + CHIP_NO_ERROR); + EXPECT_STREQ(resultPayload.rotatingDeviceId.c_str(), ""); } -void TestParsingAdditionalDataPayloadWithInvalidRotatingDeviceIdLength(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestParsingAdditionalDataPayloadWithInvalidRotatingDeviceIdLength) { chip::SetupPayloadData::AdditionalDataPayload resultPayload; - NL_TEST_ASSERT(inSuite, - ParseAdditionalDataPayload(kAdditionalDataPayloadWithInvalidRotatingDeviceIdLength, - strlen(kAdditionalDataPayloadWithInvalidRotatingDeviceIdLength), - resultPayload) == CHIP_ERROR_TLV_UNDERRUN); + EXPECT_EQ(ParseAdditionalDataPayload(kAdditionalDataPayloadWithInvalidRotatingDeviceIdLength, + strlen(kAdditionalDataPayloadWithInvalidRotatingDeviceIdLength), resultPayload), + CHIP_ERROR_TLV_UNDERRUN); } -void TestParsingAdditionalDataPayloadWithLongRotatingDeviceId(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestParsingAdditionalDataPayloadWithLongRotatingDeviceId) { chip::SetupPayloadData::AdditionalDataPayload resultPayload; - NL_TEST_ASSERT(inSuite, - ParseAdditionalDataPayload(kAdditionalDataPayloadWithLongRotatingDeviceId, - strlen(kAdditionalDataPayloadWithLongRotatingDeviceId), - resultPayload) == CHIP_ERROR_INVALID_STRING_LENGTH); + EXPECT_EQ(ParseAdditionalDataPayload(kAdditionalDataPayloadWithLongRotatingDeviceId, + strlen(kAdditionalDataPayloadWithLongRotatingDeviceId), resultPayload), + CHIP_ERROR_INVALID_STRING_LENGTH); } -void TestParsingAdditionalDataPayloadWithShortRotatingDeviceId(nlTestSuite * inSuite, void * inContext) +TEST_F(TestAdditionalDataPayload, TestParsingAdditionalDataPayloadWithShortRotatingDeviceId) { chip::SetupPayloadData::AdditionalDataPayload resultPayload; - NL_TEST_ASSERT(inSuite, - ParseAdditionalDataPayload(kAdditionalDataPayloadWithShortRotatingDeviceId, - strlen(kAdditionalDataPayloadWithShortRotatingDeviceId), - resultPayload) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, strcmp(resultPayload.rotatingDeviceId.c_str(), kShortRotatingDeviceId) == 0); + EXPECT_EQ(ParseAdditionalDataPayload(kAdditionalDataPayloadWithShortRotatingDeviceId, + strlen(kAdditionalDataPayloadWithShortRotatingDeviceId), resultPayload), + CHIP_NO_ERROR); + EXPECT_STREQ(resultPayload.rotatingDeviceId.c_str(), kShortRotatingDeviceId); } -/** - * Test Suite that lists all the Test functions. - */ -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("Test Generating Additional Data Payload without Rotatin gDevice Id", TestGeneratingAdditionalDataPayloadWithoutRotatingDeviceId), - #if CHIP_ENABLE_ROTATING_DEVICE_ID - NL_TEST_DEF("Test Generating Additional Data Payload with Rotating Device Id", TestGeneratingAdditionalDataPayloadWithRotatingDeviceId), - NL_TEST_DEF("Test Generating Additional Data Payload with Rotating Device Id + Max Lifetime Counter", TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdAndMaxLifetimeCounter), - NL_TEST_DEF("Test Generating Additional Data Payload with Rotating Device Id + Null/Empty Inputs", TestGeneratingAdditionalDataPayloadWithRotatingDeviceIdWithNullInputs), - NL_TEST_DEF("Test Generating Rotating Device Id as string", TestGeneratingRotatingDeviceIdAsString), - NL_TEST_DEF("Test Generating Rotating Device Id as string with null/invalid inputs", TestGeneratingRotatingDeviceIdAsStringWithNullInputs), - NL_TEST_DEF("Test Generating Rotating Device Id as string with small buffer", TestGeneratingRotatingDeviceIdWithSmallBuffer), - #endif - NL_TEST_DEF("Test Parsing Additional Data Payload with Rotating Device Id", TestParsingAdditionalDataPayloadWithRotatingDeviceId), - NL_TEST_DEF("Test Parsing Additional Data Payload without Rotating Device Id", TestParsingAdditionalDataPayloadWithoutRotatingDeviceId), - NL_TEST_DEF("Test Parsing Additional Data Payload with Invalid Rotating Device Id Length", TestParsingAdditionalDataPayloadWithInvalidRotatingDeviceIdLength), - NL_TEST_DEF("Test Parsing Additional Data Payload with Long Rotating Device Id", TestParsingAdditionalDataPayloadWithLongRotatingDeviceId), - NL_TEST_DEF("Test Parsing Additional Data Payload with Short Rotating Device Id", TestParsingAdditionalDataPayloadWithShortRotatingDeviceId), - NL_TEST_SENTINEL() -}; -// clang-format on - } // namespace - -/** - * Set up the test suite. - */ -int TestAdditionalDataPayload_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestAdditionalDataPayload_Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; -} - -/** - * Main - */ -int TestAdditionalDataPayload() -{ - // clang-format off - nlTestSuite theSuite = - { - "chip-additional-data-payload-general-Tests", - &sTests[0], - TestAdditionalDataPayload_Setup, - TestAdditionalDataPayload_Teardown - }; - // clang-format on - - // Generate machine-readable, comma-separated value (CSV) output. - nl_test_set_output_style(OUTPUT_CSV); - - return chip::ExecuteTestsWithoutContext(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestAdditionalDataPayload); diff --git a/src/setup_payload/tests/TestQRCodeTLV.cpp b/src/setup_payload/tests/TestQRCodeTLV.cpp index 739a074184b0ca..cdf6048a49b9a0 100644 --- a/src/setup_payload/tests/TestQRCodeTLV.cpp +++ b/src/setup_payload/tests/TestQRCodeTLV.cpp @@ -16,81 +16,86 @@ */ #include "TestHelpers.h" +#include #include -#include #include -#include -#include using namespace chip; using namespace std; namespace { -void TestOptionalDataAddRemove(nlTestSuite * inSuite, void * inContext) +class TestQRCodeTLV : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + +TEST_F(TestQRCodeTLV, TestOptionalDataAddRemove) { SetupPayload payload = GetDefaultPayload(); vector optionalData; CHIP_ERROR err; optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.empty()); + EXPECT_TRUE(optionalData.empty()); err = payload.addOptionalVendorData(kOptionalDefaultStringTag, kOptionalDefaultStringValue); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.size() == 1); + EXPECT_TRUE(optionalData.size()); err = payload.addOptionalVendorData(kOptionalDefaultIntTag, kOptionalDefaultIntValue); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.size() == 2); + EXPECT_EQ(optionalData.size(), 2u); err = payload.removeOptionalVendorData(kOptionalDefaultStringTag); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.size() == 1); + EXPECT_EQ(optionalData.size(), 1u); payload.removeOptionalVendorData(kOptionalDefaultIntTag); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.empty()); + EXPECT_TRUE(optionalData.empty()); err = payload.removeOptionalVendorData(kOptionalDefaultStringTag); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(err, CHIP_ERROR_KEY_NOT_FOUND); optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.empty()); + EXPECT_TRUE(optionalData.empty()); err = payload.removeOptionalVendorData(kOptionalDefaultIntTag); - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(err, CHIP_ERROR_KEY_NOT_FOUND); optionalData = payload.getAllOptionalVendorData(); - NL_TEST_ASSERT(inSuite, optionalData.empty()); + EXPECT_TRUE(optionalData.empty()); } -void TestSimpleWrite(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestSimpleWrite) { SetupPayload inPayload = GetDefaultPayload(); QRCodeSetupPayloadGenerator generator(inPayload); string result; CHIP_ERROR err = generator.payloadBase38Representation(result); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); string result2; err = generator.payloadBase38RepresentationWithAutoTLVBuffer(result2); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, result == result2); + EXPECT_EQ(result, result2); } -void TestSimpleRead(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestSimpleRead) { SetupPayload inPayload = GetDefaultPayload(); SetupPayload outPayload; @@ -98,81 +103,81 @@ void TestSimpleRead(nlTestSuite * inSuite, void * inContext) QRCodeSetupPayloadGenerator generator(inPayload); string result; CHIP_ERROR err = generator.payloadBase38Representation(result); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); QRCodeSetupPayloadParser parser = QRCodeSetupPayloadParser(result); err = parser.populatePayload(outPayload); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, inPayload == outPayload); + EXPECT_TRUE(inPayload == outPayload); } -void TestOptionalTagValues(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalTagValues) { SetupPayload payload = GetDefaultPayload(); CHIP_ERROR err; err = payload.addOptionalVendorData(kOptionalDefaultStringTag, kOptionalDefaultStringValue); // Vendor specific tag - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = payload.addOptionalVendorData(0x80, kOptionalDefaultStringValue); // Vendor specific tag - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = payload.addOptionalVendorData(0x82, kOptionalDefaultStringValue); // Vendor specific tag - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = payload.addOptionalVendorData(127, kOptionalDefaultStringValue); // Common tag - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); err = payload.addOptionalVendorData(0, kOptionalDefaultStringValue); // Common tag - NL_TEST_ASSERT(inSuite, err == CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_EQ(err, CHIP_ERROR_INVALID_ARGUMENT); } -void TestSerialNumberAddRemove(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestSerialNumberAddRemove) { SetupPayload inPayload = GetDefaultPayload(); string sn; - NL_TEST_ASSERT(inSuite, inPayload.getSerialNumber(sn) == CHIP_ERROR_KEY_NOT_FOUND); - NL_TEST_ASSERT(inSuite, inPayload.removeSerialNumber() == CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(inPayload.getSerialNumber(sn), CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(inPayload.removeSerialNumber(), CHIP_ERROR_KEY_NOT_FOUND); - NL_TEST_ASSERT(inSuite, inPayload.addSerialNumber(kSerialNumberDefaultStringValue) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, inPayload.getSerialNumber(sn) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, sn == kSerialNumberDefaultStringValue); + EXPECT_EQ(inPayload.addSerialNumber(kSerialNumberDefaultStringValue), CHIP_NO_ERROR); + EXPECT_EQ(inPayload.getSerialNumber(sn), CHIP_NO_ERROR); + EXPECT_EQ(sn, kSerialNumberDefaultStringValue); - NL_TEST_ASSERT(inSuite, inPayload.addSerialNumber(kSerialNumberDefaultUInt32Value) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, inPayload.getSerialNumber(sn) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, sn == to_string(kSerialNumberDefaultUInt32Value)); + EXPECT_EQ(inPayload.addSerialNumber(kSerialNumberDefaultUInt32Value), CHIP_NO_ERROR); + EXPECT_EQ(inPayload.getSerialNumber(sn), CHIP_NO_ERROR); + EXPECT_EQ(sn, to_string(kSerialNumberDefaultUInt32Value)); - NL_TEST_ASSERT(inSuite, inPayload.removeSerialNumber() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, inPayload.getSerialNumber(sn) == CHIP_ERROR_KEY_NOT_FOUND); - NL_TEST_ASSERT(inSuite, inPayload.removeSerialNumber() == CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(inPayload.removeSerialNumber(), CHIP_NO_ERROR); + EXPECT_EQ(inPayload.getSerialNumber(sn), CHIP_ERROR_KEY_NOT_FOUND); + EXPECT_EQ(inPayload.removeSerialNumber(), CHIP_ERROR_KEY_NOT_FOUND); } -void TestOptionalDataWriteSerial(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataWriteSerial) { CHIP_ERROR err = CHIP_NO_ERROR; SetupPayload inPayload = GetDefaultPayload(); err = inPayload.addSerialNumber("1"); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); QRCodeSetupPayloadGenerator generator(inPayload); string result; err = generator.payloadBase38Representation(result); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); uint8_t optionalInfo[kDefaultBufferSizeInBytes]; err = generator.payloadBase38Representation(result, optionalInfo, sizeof(optionalInfo)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); string result2; err = generator.payloadBase38RepresentationWithAutoTLVBuffer(result2); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, result == result2); + EXPECT_EQ(result, result2); } -void TestOptionalDataWrite(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataWrite) { SetupPayload inPayload = GetDefaultPayloadWithOptionalDefaults(); @@ -180,60 +185,60 @@ void TestOptionalDataWrite(nlTestSuite * inSuite, void * inContext) string result; uint8_t optionalInfo[kDefaultBufferSizeInBytes]; CHIP_ERROR err = generator.payloadBase38Representation(result, optionalInfo, sizeof(optionalInfo)); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); string result2; err = generator.payloadBase38RepresentationWithAutoTLVBuffer(result2); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, result == result2); + EXPECT_EQ(result, result2); } -void TestOptionalDataReadSerial(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataReadSerial) { SetupPayload inPayload = GetDefaultPayload(); inPayload.addSerialNumber(kSerialNumberDefaultStringValue); - NL_TEST_ASSERT(inSuite, CheckWriteRead(inPayload)); + EXPECT_TRUE(CheckWriteRead(inPayload)); inPayload.addSerialNumber(kSerialNumberDefaultUInt32Value); - NL_TEST_ASSERT(inSuite, CheckWriteRead(inPayload)); + EXPECT_TRUE(CheckWriteRead(inPayload)); } -void TestOptionalDataReadVendorInt(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataReadVendorInt) { SetupPayload inPayload = GetDefaultPayload(); inPayload.addOptionalVendorData(kOptionalDefaultIntTag, kOptionalDefaultIntValue); - NL_TEST_ASSERT(inSuite, CheckWriteRead(inPayload)); + EXPECT_TRUE(CheckWriteRead(inPayload)); } -void TestOptionalDataReadVendorString(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataReadVendorString) { SetupPayload inPayload = GetDefaultPayload(); inPayload.addOptionalVendorData(kOptionalDefaultStringTag, kOptionalDefaultStringValue); - NL_TEST_ASSERT(inSuite, CheckWriteRead(inPayload)); + EXPECT_TRUE(CheckWriteRead(inPayload)); } -void TestOptionalDataRead(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataRead) { SetupPayload inPayload = GetDefaultPayloadWithOptionalDefaults(); - NL_TEST_ASSERT(inSuite, CheckWriteRead(inPayload)); + EXPECT_TRUE(CheckWriteRead(inPayload)); } -void TestOptionalDataWriteNoBuffer(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataWriteNoBuffer) { SetupPayload inPayload = GetDefaultPayloadWithOptionalDefaults(); QRCodeSetupPayloadGenerator generator(inPayload); string result; CHIP_ERROR err = generator.payloadBase38Representation(result); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); + EXPECT_NE(err, CHIP_NO_ERROR); } -void TestOptionalDataWriteSmallBuffer(nlTestSuite * inSuite, void * inContext) +TEST_F(TestQRCodeTLV, TestOptionalDataWriteSmallBuffer) { SetupPayload inPayload = GetDefaultPayloadWithOptionalDefaults(); @@ -241,76 +246,7 @@ void TestOptionalDataWriteSmallBuffer(nlTestSuite * inSuite, void * inContext) string result; uint8_t optionalInfo[kSmallBufferSizeInBytes]; CHIP_ERROR err = generator.payloadBase38Representation(result, optionalInfo, sizeof(optionalInfo)); - NL_TEST_ASSERT(inSuite, err != CHIP_NO_ERROR); -} - -// Test Suite - -/** - * Test Suite that lists all the test functions. - */ -// clang-format off -const nlTest sTests[] = -{ - NL_TEST_DEF("Test Simple Write", TestSimpleWrite), - NL_TEST_DEF("Test Simple Read", TestSimpleRead), - NL_TEST_DEF("Test Optional Add Remove", TestOptionalDataAddRemove), - NL_TEST_DEF("Test Serial Number Add Remove", TestSerialNumberAddRemove), - NL_TEST_DEF("Test Optional Write", TestOptionalDataWrite), - NL_TEST_DEF("Test Optional Write Serial", TestOptionalDataWriteSerial), - NL_TEST_DEF("Test Optional Write No Buffer", TestOptionalDataWriteNoBuffer), - NL_TEST_DEF("Test Optional Write Small Buffer", TestOptionalDataWriteSmallBuffer), - NL_TEST_DEF("Test Optional Read Serial", TestOptionalDataReadSerial), - NL_TEST_DEF("Test Optional Read Vendor String", TestOptionalDataReadVendorString), - NL_TEST_DEF("Test Optional Read Vendor Int", TestOptionalDataReadVendorInt), - NL_TEST_DEF("Test Optional Read", TestOptionalDataRead), - NL_TEST_DEF("Test Optional Tag Values", TestOptionalTagValues), - - NL_TEST_SENTINEL() -}; -// clang-format on - -/** - * Set up the test suite. - */ -int TestQRCodeTLV_Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -/** - * Tear down the test suite. - */ -int TestQRCodeTLV_Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; + EXPECT_NE(err, CHIP_NO_ERROR); } } // namespace - -/** - * Main - */ -int TestQRCodeTLV() -{ - // clang-format off - nlTestSuite theSuite = - { - "chip-qrcode-optional-info-tests", - &sTests[0], - TestQRCodeTLV_Setup, - TestQRCodeTLV_Teardown - }; - // clang-format on - - // Generate machine-readable, comma-separated value (CSV) output. - nl_test_set_output_style(OUTPUT_CSV); - - return chip::ExecuteTestsWithoutContext(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestQRCodeTLV); diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index de9e40de4b5253..8631aacb9561a4 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -4,6 +4,5 @@ InetLayerTests MessagingLayerTests RawTransportTests SecureChannelTests -SetupPayloadTestsNL SupportTestsNL TransportLayerTests From 42bb75cb16707b78f10d802508e33cd22a11c217 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Thu, 25 Apr 2024 21:27:40 +0200 Subject: [PATCH 19/40] [Python] Fix OnRead[Event|Attribute]DataCallback for Arm64 Apple Patform devices (#33178) On M1/Arm64 macOS systems, the OnReadEventDataCallback often returned an invalid status, e.g.: ValueError: 16 is not a valid Status Use size_t consistently to fix this issue. --- src/controller/python/chip/clusters/attribute.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controller/python/chip/clusters/attribute.cpp b/src/controller/python/chip/clusters/attribute.cpp index e31f3431b8b2a0..b73b4a49b44d1f 100644 --- a/src/controller/python/chip/clusters/attribute.cpp +++ b/src/controller/python/chip/clusters/attribute.cpp @@ -71,10 +71,10 @@ struct __attribute__((packed)) DataVersionFilter using OnReadAttributeDataCallback = void (*)(PyObject * appContext, chip::DataVersion version, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::AttributeId attributeId, std::underlying_type_t imstatus, uint8_t * data, - uint32_t dataLen); + size_t dataLen); using OnReadEventDataCallback = void (*)(PyObject * appContext, chip::EndpointId endpointId, chip::ClusterId clusterId, chip::EventId eventId, chip::EventNumber eventNumber, uint8_t priority, uint64_t timestamp, - uint8_t timestampType, uint8_t * data, uint32_t dataLen, + uint8_t timestampType, uint8_t * data, size_t dataLen, std::underlying_type_t imstatus); using OnSubscriptionEstablishedCallback = void (*)(PyObject * appContext, SubscriptionId subscriptionId); using OnResubscriptionAttemptedCallback = void (*)(PyObject * appContext, PyChipError aTerminationCause, @@ -114,7 +114,7 @@ class ReadClientCallback : public ReadClient::Callback VerifyOrDie(!aPath.IsListItemOperation()); size_t bufferLen = (apData == nullptr ? 0 : apData->GetRemainingLength() + apData->GetLengthRead()); std::unique_ptr buffer = std::unique_ptr(apData == nullptr ? nullptr : new uint8_t[bufferLen]); - uint32_t size = 0; + size_t size = 0; // When the apData is nullptr, means we did not receive a valid attribute data from server, status will be some error // status. if (apData != nullptr) @@ -166,7 +166,7 @@ class ReadClientCallback : public ReadClient::Callback void OnEventData(const EventHeader & aEventHeader, TLV::TLVReader * apData, const StatusIB * apStatus) override { uint8_t buffer[CHIP_CONFIG_DEFAULT_UDP_MTU_SIZE]; - uint32_t size = 0; + size_t size = 0; CHIP_ERROR err = CHIP_NO_ERROR; // When the apData is nullptr, means we did not receive a valid event data from server, status will be some error // status. From d342d9b2a0a3f12cd324aee92ecd76388481157b Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 25 Apr 2024 22:06:16 +0200 Subject: [PATCH 20/40] Ignore virtual-device-app build directory (#33169) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index d6aefb1d928c1b..1c2d1430263594 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ # Build System out/ +/examples/virtual-device-app/android/App/buildSrc/build/ /src/test_driver/nrfconnect/build/ /src/darwin/Framework/build/ From a28965b0d8297d8aea3b0ba01290f5fac91dc3d8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Thu, 25 Apr 2024 22:38:43 +0200 Subject: [PATCH 21/40] Allow building host tests with code coverage (#33141) * Fix access for == operator defined for AccessControl * Fix nested if warning * Fix access to ==operator and fix mismatched types * Allow building host tests with code coverage * Ignore virtual-device-app build directory * Fix initialization of CHIPoBLEStackMgr with google test * Fix find -exec syntax * Exclude tests from the coverage report * Revert "Ignore virtual-device-app build directory" This reverts commit 2215235dbef9890fa3252ccd200c1aff87f951b8. --- scripts/build/build/target.py | 2 +- scripts/build/build/targets.py | 2 +- scripts/build/builders/host.py | 6 ++-- src/access/tests/TestAccessControl.cpp | 6 ++-- src/lib/core/tests/TestTLV.cpp | 3 +- src/platform/tests/BUILD.gn | 1 - src/platform/tests/TestCHIPoBLEStackMgr.h | 30 ------------------- .../tests/TestCHIPoBLEStackMgrDriver.cpp | 5 +--- src/system/SystemPacketBuffer.h | 5 ++-- src/system/tests/TestSystemPacketBuffer.cpp | 30 +++++++++---------- 10 files changed, 30 insertions(+), 60 deletions(-) delete mode 100644 src/platform/tests/TestCHIPoBLEStackMgr.h diff --git a/scripts/build/build/target.py b/scripts/build/build/target.py index 8411ff9432c2c7..7f1716170178a8 100644 --- a/scripts/build/build/target.py +++ b/scripts/build/build/target.py @@ -406,7 +406,7 @@ def Create(self, name: str, runner, repository_path: str, output_prefix: str, builder.target = self builder.identifier = name builder.output_dir = os.path.join(output_prefix, name) - builder.chip_dir = repository_path + builder.chip_dir = os.path.abspath(repository_path) builder.options = builder_options return builder diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 3f5fc57a616901..9eb2ebfb704e23 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -177,7 +177,7 @@ def BuildHostTarget(): target.AppendModifier("ossfuzz", fuzzing_type=HostFuzzingType.OSS_FUZZ).OnlyIfRe( "-clang").ExceptIfRe('-libfuzzer') target.AppendModifier('coverage', use_coverage=True).OnlyIfRe( - '-(chip-tool|all-clusters)') + '-(chip-tool|all-clusters|tests)') target.AppendModifier('dmalloc', use_dmalloc=True) target.AppendModifier('clang', use_clang=True) target.AppendModifier('test', extra_tests=True) diff --git a/scripts/build/builders/host.py b/scripts/build/builders/host.py index fcb609c70e941f..c1c81dbdc30f9c 100644 --- a/scripts/build/builders/host.py +++ b/scripts/build/builders/host.py @@ -512,19 +512,21 @@ def generate(self): def PreBuildCommand(self): if self.app == HostApp.TESTS and self.use_coverage: self._Execute(['ninja', '-C', self.output_dir, 'default'], title="Build-only") - self._Execute(['find', os.path.join(self.output_dir, 'obj/src/'), '-depth', - '-name', 'tests', '-exec', 'rm -rf {} \\;'], title="Cleanup unit tests") self._Execute(['lcov', '--initial', '--capture', '--directory', os.path.join(self.output_dir, 'obj'), + '--exclude', os.path.join(self.chip_dir, '**/tests/*'), '--exclude', os.path.join(self.chip_dir, 'zzz_generated/*'), '--exclude', os.path.join(self.chip_dir, 'third_party/*'), + '--exclude', os.path.join(self.chip_dir, 'out/*'), '--exclude', '/usr/include/*', '--output-file', os.path.join(self.coverage_dir, 'lcov_base.info')], title="Initial coverage baseline") def PostBuildCommand(self): if self.app == HostApp.TESTS and self.use_coverage: self._Execute(['lcov', '--capture', '--directory', os.path.join(self.output_dir, 'obj'), + '--exclude', os.path.join(self.chip_dir, '**/tests/*'), '--exclude', os.path.join(self.chip_dir, 'zzz_generated/*'), '--exclude', os.path.join(self.chip_dir, 'third_party/*'), + '--exclude', os.path.join(self.chip_dir, 'out/*'), '--exclude', '/usr/include/*', '--output-file', os.path.join(self.coverage_dir, 'lcov_test.info')], title="Update coverage") self._Execute(['lcov', '--add-tracefile', os.path.join(self.coverage_dir, 'lcov_base.info'), diff --git a/src/access/tests/TestAccessControl.cpp b/src/access/tests/TestAccessControl.cpp index 2d25a7c3d33ee4..16f30284fbc4d1 100644 --- a/src/access/tests/TestAccessControl.cpp +++ b/src/access/tests/TestAccessControl.cpp @@ -23,7 +23,8 @@ #include -namespace { +namespace chip { +namespace Access { using namespace chip; using namespace chip::Access; @@ -2189,4 +2190,5 @@ TEST_F(TestAccessControl, TestUpdateEntry) } } -} // namespace +} // namespace Access +} // namespace chip diff --git a/src/lib/core/tests/TestTLV.cpp b/src/lib/core/tests/TestTLV.cpp index 4b391c4983f701..19b4c77ac35280 100644 --- a/src/lib/core/tests/TestTLV.cpp +++ b/src/lib/core/tests/TestTLV.cpp @@ -859,8 +859,7 @@ void WriteEncoding3(TLVWriter & writer) TLVWriter writer1; err = writer.OpenContainer(ProfileTag(TestProfile_1, 1), kTLVType_Structure, writer1); - if (err != CHIP_NO_ERROR) - EXPECT_EQ(err, CHIP_NO_ERROR); + EXPECT_EQ(err, CHIP_NO_ERROR); err = writer1.PutBoolean(ProfileTag(TestProfile_2, 2), false); EXPECT_EQ(err, CHIP_NO_ERROR); diff --git a/src/platform/tests/BUILD.gn b/src/platform/tests/BUILD.gn index 11e8bd5c746029..bf4c2ee6ff90f4 100644 --- a/src/platform/tests/BUILD.gn +++ b/src/platform/tests/BUILD.gn @@ -78,7 +78,6 @@ if (chip_device_platform != "none" && chip_device_platform != "fake") { # sources = [ "TestCHIPoBLEStackMgr.cpp", - "TestCHIPoBLEStackMgr.h", "TestCHIPoBLEStackMgrDriver.cpp", ] tests = [ "TestCHIPoBLEStackMgr" ] diff --git a/src/platform/tests/TestCHIPoBLEStackMgr.h b/src/platform/tests/TestCHIPoBLEStackMgr.h deleted file mode 100644 index b0f4f59516f2b1..00000000000000 --- a/src/platform/tests/TestCHIPoBLEStackMgr.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Copyright (c) 2020 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. - */ - -/** - * @file - * This file declares test entry point for CHIP over BLE code unit tests in Linux - * - */ - -#pragma once - -#include - -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE -int TestCHIPoBLEStackManager(); -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp b/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp index 2635ebe81eb273..38e3f23a10b59c 100644 --- a/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp +++ b/src/platform/tests/TestCHIPoBLEStackMgrDriver.cpp @@ -15,19 +15,16 @@ * limitations under the License. */ -#include "TestCHIPoBLEStackMgr.h" #include #include #include int main(int argc, char * argv[]) { -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE + testing::InitGoogleTest(&argc, argv); if (argc == 2 && atoi(argv[1]) == 1) { - testing::InitGoogleTest(nullptr, nullptr); return RUN_ALL_TESTS(); } return 0; -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE } diff --git a/src/system/SystemPacketBuffer.h b/src/system/SystemPacketBuffer.h index 513f0b4fbc0cdb..928743762e3de7 100644 --- a/src/system/SystemPacketBuffer.h +++ b/src/system/SystemPacketBuffer.h @@ -657,6 +657,8 @@ class DLL_EXPORT PacketBufferHandle #endif } + bool operator==(const PacketBufferHandle & aOther) const { return mBuffer == aOther.mBuffer; } + protected: #if CHIP_SYSTEM_CONFIG_USE_LWIP // For use via LwIPPacketBufferView only. @@ -684,8 +686,7 @@ class DLL_EXPORT PacketBufferHandle } PacketBuffer * Get() const { return mBuffer; } - - bool operator==(const PacketBufferHandle & aOther) const { return mBuffer == aOther.mBuffer; } + PacketBuffer * GetNext() const { return static_cast(mBuffer->next); } #if CHIP_SYSTEM_PACKETBUFFER_HAS_RIGHTSIZE void InternalRightSize(); diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp index 5b3f709a5bee67..5ee708fcd476ed 100644 --- a/src/system/tests/TestSystemPacketBuffer.cpp +++ b/src/system/tests/TestSystemPacketBuffer.cpp @@ -469,13 +469,13 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetDataLength) { EXPECT_EQ(config_2.handle->len, (config_2.end_buffer - config_2.payload_ptr)); EXPECT_EQ(config_2.handle->tot_len, (config_2.end_buffer - config_2.payload_ptr)); - EXPECT_EQ(config_2.handle->next, nullptr); + EXPECT_EQ(config_2.handle.GetNext(), nullptr); } else { EXPECT_EQ(config_2.handle->len, length); EXPECT_EQ(config_2.handle->tot_len, length); - EXPECT_EQ(config_2.handle->next, nullptr); + EXPECT_EQ(config_2.handle.GetNext(), nullptr); } } else @@ -487,7 +487,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetDataLength) { EXPECT_EQ(config_2.handle->len, (config_2.end_buffer - config_2.payload_ptr)); EXPECT_EQ(config_2.handle->tot_len, (config_2.end_buffer - config_2.payload_ptr)); - EXPECT_EQ(config_2.handle->next, nullptr); + EXPECT_EQ(config_2.handle.GetNext(), nullptr); EXPECT_EQ(config_1.handle->tot_len, (config_1.init_len + static_cast(config_2.end_buffer - config_2.payload_ptr) - @@ -497,7 +497,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetDataLength) { EXPECT_EQ(config_2.handle->len, length); EXPECT_EQ(config_2.handle->tot_len, length); - EXPECT_EQ(config_2.handle->next, nullptr); + EXPECT_EQ(config_2.handle.GetNext(), nullptr); EXPECT_EQ(config_1.handle->tot_len, (config_1.init_len + static_cast(length) - static_cast(config_2.init_len))); @@ -632,9 +632,9 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckAddToEnd) EXPECT_EQ(config_3.handle->ref, 1); // config_3.handle EXPECT_EQ(config_1.handle->tot_len, (config_1.init_len + config_2.init_len)); - EXPECT_EQ(config_1.handle->next, config_2.handle.Get()); - EXPECT_EQ(config_2.handle->next, nullptr); - EXPECT_EQ(config_3.handle->next, nullptr); + EXPECT_EQ(config_1.handle.GetNext(), config_2.handle.Get()); + EXPECT_EQ(config_2.handle.GetNext(), nullptr); + EXPECT_EQ(config_3.handle.GetNext(), nullptr); config_1.handle->AddToEnd(config_3.handle.Retain()); EXPECT_EQ(config_1.handle->ref, 1); // config_1.handle @@ -642,9 +642,9 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckAddToEnd) EXPECT_EQ(config_3.handle->ref, 2); // config_3.handle and config_2.handle->next EXPECT_EQ(config_1.handle->tot_len, (config_1.init_len + config_2.init_len + config_3.init_len)); - EXPECT_EQ(config_1.handle->next, config_2.handle.Get()); - EXPECT_EQ(config_2.handle->next, config_3.handle.Get()); - EXPECT_EQ(config_3.handle->next, nullptr); + EXPECT_EQ(config_1.handle.GetNext(), config_2.handle.Get()); + EXPECT_EQ(config_2.handle.GetNext(), config_3.handle.Get()); + EXPECT_EQ(config_3.handle.GetNext(), nullptr); config_1.handle = nullptr; config_2.handle = nullptr; @@ -703,7 +703,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckPopHead) const PacketBufferHandle popped = config_1.handle.PopHead(); EXPECT_EQ(config_1.handle, config_2.handle); - EXPECT_EQ(config_1.handle->next, nullptr); + EXPECT_EQ(config_1.handle.GetNext(), nullptr); EXPECT_EQ(config_1.handle->tot_len, config_1.init_len); } } @@ -786,7 +786,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckCompactHead) { EXPECT_EQ(config_1.handle->len, config_1.handle->MaxDataLength()); EXPECT_EQ(buffer_2->len, config_1.handle->tot_len - config_1.handle->MaxDataLength()); - EXPECT_EQ(config_1.handle->next, buffer_2); + EXPECT_EQ(config_1.handle.GetNext(), buffer_2); EXPECT_EQ(config_1.handle->ref, 2); EXPECT_EQ(buffer_2->ref, 1); } @@ -796,13 +796,13 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckCompactHead) if (data_length_1 >= config_1.handle->MaxDataLength() && data_length_2 == 0) { /* make sure the second buffer is not freed */ - EXPECT_EQ(config_1.handle->next, buffer_2); + EXPECT_EQ(config_1.handle.GetNext(), buffer_2); EXPECT_EQ(buffer_2->ref, 1); } else { /* make sure the second buffer is freed */ - EXPECT_EQ(config_1.handle->next, nullptr); + EXPECT_EQ(config_1.handle.GetNext(), nullptr); buffer_2 = nullptr; } } @@ -1263,7 +1263,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckFree) // Verify that head ref count is decremented. EXPECT_EQ(config_1.handle->ref, initial_refs_1 - 1); // Verify that chain is maintained. - EXPECT_EQ(config_1.handle->next, config_2.handle.Get()); + EXPECT_EQ(config_1.handle.GetNext(), config_2.handle.Get()); // Verify that chained buffer ref count has not changed. EXPECT_EQ(config_2.handle->ref, initial_refs_2); } From 9d0a734b9acb256ef51f6dc31f1499e34fa10f2b Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 25 Apr 2024 17:32:13 -0400 Subject: [PATCH 22/40] [Bloat report]: Report zip file reading exception without failing everything. (#33181) * Report zip file reading exception without failing everything. * Fix bare except --- scripts/tools/memory/gh_report.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index ddaa23a45e79ba..d28e2098d8e670 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -20,6 +20,7 @@ import logging import re import sys +import traceback from typing import Dict import fastcore # type: ignore @@ -163,8 +164,13 @@ def add_sizes_from_github(self): for i in required_artifact_ids: blob = self.gh.download_artifact(i) if blob: - self.db.add_sizes_from_zipfile(io.BytesIO(blob), - {'artifact': i}) + try: + self.db.add_sizes_from_zipfile(io.BytesIO(blob), + {'artifact': i}) + except Exception: + # Report in case the zipfile is invalid, however do not fail + # all the rest (behave as if artifact download has failed) + traceback.print_last() def read_inputs(self): """Read size report from github and/or local files.""" From b2234c248931d3666bf1a81edc6a6328e6ee74a4 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Thu, 25 Apr 2024 17:37:20 -0400 Subject: [PATCH 23/40] Typo fix: not print last, print exc (#33182) --- scripts/tools/memory/gh_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index d28e2098d8e670..ba30cdec4b12b9 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -170,7 +170,7 @@ def add_sizes_from_github(self): except Exception: # Report in case the zipfile is invalid, however do not fail # all the rest (behave as if artifact download has failed) - traceback.print_last() + traceback.print_exc() def read_inputs(self): """Read size report from github and/or local files.""" From b99f6c62a576749905e012365b4df2a6ca2e1136 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Thu, 25 Apr 2024 20:43:02 -0400 Subject: [PATCH 24/40] Add missing define check for LCD calls (#33180) --- examples/lit-icd-app/silabs/src/AppTask.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/lit-icd-app/silabs/src/AppTask.cpp b/examples/lit-icd-app/silabs/src/AppTask.cpp index 0fb98266d2a81d..0f330e700b9548 100644 --- a/examples/lit-icd-app/silabs/src/AppTask.cpp +++ b/examples/lit-icd-app/silabs/src/AppTask.cpp @@ -170,11 +170,15 @@ void AppTask::ButtonEventHandler(uint8_t button, uint8_t btnAction) // DO NOT COPY for product logic. LIT ICD app is a test app with very simple application logic to enable testing. void AppTask::OnEnterActiveMode() { +#ifdef DISPLAY_ENABLED sAppTask.GetLCD().WriteDemoUI(true); +#endif } // DO NOT COPY for product logic. LIT ICD app is a test app with very simple application logic to enable testing. void AppTask::OnEnterIdleMode() { +#ifdef DISPLAY_ENABLED sAppTask.GetLCD().WriteDemoUI(false); +#endif } From 8b1fd136189433e1104d21618ca8969ab90a9e8f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Thu, 25 Apr 2024 21:40:46 -0400 Subject: [PATCH 25/40] Fix handling of non-permitted messages in ExchangeContext. (#33148) They should not count as responses, since we don't notify our delegate about them. --- src/messaging/ExchangeContext.cpp | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/messaging/ExchangeContext.cpp b/src/messaging/ExchangeContext.cpp index 3869ab4c48c921..f36a274be1da2a 100644 --- a/src/messaging/ExchangeContext.cpp +++ b/src/messaging/ExchangeContext.cpp @@ -596,21 +596,26 @@ CHIP_ERROR ExchangeContext::HandleMessage(uint32_t messageCounter, const Payload // Set kFlagReceivedAtLeastOneMessage to true since we have received at least one new application level message SetHasReceivedAtLeastOneMessage(true); - if (IsResponseExpected()) + // Don't send messages on to our delegate if our dispatch does not allow + // those messages. Those messages should also not be treated as responses, + // since if our delegate is expecting a response we will not notify it about + // these messages. + if (mDispatch.MessagePermitted(payloadHeader.GetProtocolID(), payloadHeader.GetMessageType())) { - // Since we got the response, cancel the response timer. - CancelResponseTimer(); + if (IsResponseExpected()) + { + // Since we got the response, cancel the response timer. + CancelResponseTimer(); - // If the context was expecting a response to a previously sent message, this message - // is implicitly that response. - SetResponseExpected(false); - } + // If the context was expecting a response to a previously sent message, this message + // is implicitly that response. + SetResponseExpected(false); + } - // Don't send messages on to our delegate if our dispatch does not allow - // those messages. - if (mDelegate != nullptr && mDispatch.MessagePermitted(payloadHeader.GetProtocolID(), payloadHeader.GetMessageType())) - { - return mDelegate->OnMessageReceived(this, payloadHeader, std::move(msgBuf)); + if (mDelegate != nullptr) + { + return mDelegate->OnMessageReceived(this, payloadHeader, std::move(msgBuf)); + } } DefaultOnMessageReceived(this, payloadHeader.GetProtocolID(), payloadHeader.GetMessageType(), messageCounter, From cfb940406b56f13c62fd9eb4c6d24c9aeed72826 Mon Sep 17 00:00:00 2001 From: shripad621git <79364691+shripad621git@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:00:37 +0530 Subject: [PATCH 26/40] [ESP32] Fixed the output file name in log output for ESP32 factory partition script. (#33162) * Fixed the output file name in log output for ESP32 factory partition script * Restyled by autopep8 --------- Co-authored-by: Restyled.io --- .../tools/generate_esp32_chip_factory_bin.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/tools/generate_esp32_chip_factory_bin.py b/scripts/tools/generate_esp32_chip_factory_bin.py index ff00daedb53682..262be540a9bfed 100755 --- a/scripts/tools/generate_esp32_chip_factory_bin.py +++ b/scripts/tools/generate_esp32_chip_factory_bin.py @@ -382,7 +382,7 @@ def gen_raw_ec_keypair_from_der(key_file, pubkey_raw_file, privkey_raw_file): f.write(public_number_y.to_bytes(32, byteorder='big')) -def generate_nvs_csv(out_csv_filename): +def generate_nvs_csv(output_dir, out_csv_filename): csv_content = 'key,type,encoding,value\n' csv_content += 'chip-factory,namespace,,\n' @@ -391,10 +391,11 @@ def generate_nvs_csv(out_csv_filename): continue csv_content += f"{k},{v['type']},{v['encoding']},{v['value']}\n" - with open(out_csv_filename, 'w') as f: + with open(os.path.join(output_dir, out_csv_filename), 'w') as f: f.write(csv_content) - logging.info('Generated the factory partition csv file : {}'.format(os.path.abspath(out_csv_filename))) + logging.info('Generated the factory partition csv file : {}'.format( + os.path.abspath(os.path.join(output_dir, out_csv_filename)))) def generate_nvs_bin(encrypt, size, csv_filename, bin_filename, output_dir): @@ -412,13 +413,13 @@ def generate_nvs_bin(encrypt, size, csv_filename, bin_filename, output_dir): nvs_partition_gen.generate(nvs_args) -def print_flashing_help(encrypt, bin_filename): +def print_flashing_help(encrypt, output_dir, bin_filename): logging.info('Run below command to flash {}'.format(bin_filename)) - logging.info('esptool.py -p (PORT) write_flash (FACTORY_PARTITION_ADDR) {}'.format(os.path.join(os.getcwd(), bin_filename))) + logging.info('esptool.py -p (PORT) write_flash (FACTORY_PARTITION_ADDR) {}'.format(os.path.join(os.getcwd(), output_dir, bin_filename))) if (encrypt): logging.info('Run below command to flash {}'.format(NVS_KEY_PARTITION_BIN)) logging.info('esptool.py -p (PORT) write_flash --encrypt (NVS_KEY_PARTITION_ADDR) {}'.format( - os.path.join(os.getcwd(), 'keys', NVS_KEY_PARTITION_BIN))) + os.path.join(os.getcwd(), output_dir, 'keys', NVS_KEY_PARTITION_BIN))) def clean_up(): @@ -478,7 +479,7 @@ def any_base_int(s): return int(s, 0) help='Encrypt the factory parititon NVS binary') parser.add_argument('--no-bin', action='store_false', dest='generate_bin', help='Do not generate the factory partition binary') - parser.add_argument('--output_dir', type=str, default='bin', help='Created image output file path') + parser.add_argument('--output_dir', type=str, default='out', help='Created image output file path') parser.add_argument('-cf', '--commissioning-flow', type=any_base_int, default=0, help='Device commissioning flow, 0:Standard, 1:User-Intent, 2:Custom. \ @@ -506,10 +507,10 @@ def set_up_factory_data(args): def generate_factory_partiton_binary(args): - generate_nvs_csv(FACTORY_PARTITION_CSV) + generate_nvs_csv(args.output_dir, FACTORY_PARTITION_CSV) if args.generate_bin: generate_nvs_bin(args.encrypt, args.size, FACTORY_PARTITION_CSV, FACTORY_PARTITION_BIN, args.output_dir) - print_flashing_help(args.encrypt, FACTORY_PARTITION_BIN) + print_flashing_help(args.encrypt, args.output_dir, FACTORY_PARTITION_BIN) clean_up() From 5a23ad5f30b5ca47359de472aa555382f5b1d235 Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:52:29 +0200 Subject: [PATCH 27/40] [nrfconnect] Introduced several platform configuration fixes (#33194) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [nrfconnect] Disable Zephyr socket extensions The recvmsg() is now implemented natively in Zephyr, so we are not supposed to define a custom one. Signed-off-by: Marcin Kajor * [nrfconnect] Remove D_SYS__PTHREADTYPES_H_ flag ... from the gnu17 configuration to avoid missing pthread types definitions (_pthreadtypes.h). This tricked the preprocessor the header was already included, hence we didn't get its content. Signed-off-by: Marcin Kajor * [nrfconnect] Use newlib as a default libc implementation. The PICOLIB is now used by the default. NEWLIB_LIBC symbol is no longer selected by hostap. OpenThread selects NEWLIB_LIBC anyway. Signed-off-by: Marcin Kajor * [zephyr] Added OpenThread dependencies to a few Kconfigs Co-authored-by: Damian Krolik * [zephyr] Lock Thread stack before factory reset This fixes a problem with Thread activity interrupting factory reset. This activity used to led to “Factory reset fail: -6”. Writing to the cleared nvm flash pages caused the problem. Signed-off-by: Patryk Lipinski Signed-off-by: Michał Szablowski * [nrfconnect] Increase default number of packet buffers and stack size This commit reverts the previous optimization of reducing the number of packet buffers in the system. Additionally increase of stack size is needed to accomodate LTO. Signed-off-by: Łukasz Duda * [nrfconnect] Select Experimental for persistent subscriptions Currently, there is an issue with persistent subscriptions when multiple controllers create subscriptions. * [nrfconnect] Fixed mcuboot default configuration Removed the defaults from Kconfig.mcuboot.defaults configuration that should not be set there: * BOOT_ENCRYPT_X - are configs without a prompt, so it should not be modified outside of the mcuboot module * SPI_NOR and NORDIC_QSPI_NOR - are set based on the device tree configuration, so we should not set it, as it may lead to configuration and dts mismatch. Signed-off-by: Kamil Kasperczyk * Revert "[nrfconnect] Disable Zephyr socket extensions" This reverts commit bb09061209748fe634a4b837f4db1db4f8b2d140. --------- Signed-off-by: Marcin Kajor Signed-off-by: Patryk Lipinski Signed-off-by: Michał Szablowski Signed-off-by: Łukasz Duda Signed-off-by: Kamil Kasperczyk Co-authored-by: Marcin Kajor Co-authored-by: Damian Krolik Co-authored-by: Patryk Lipinski Co-authored-by: Łukasz Duda Co-authored-by: Arkadiusz Balys --- config/nrfconnect/app/enable-gnu-std.cmake | 3 +-- config/nrfconnect/chip-module/Kconfig | 5 +++++ config/nrfconnect/chip-module/Kconfig.defaults | 12 ++++++++---- config/nrfconnect/chip-module/Kconfig.features | 4 +--- .../chip-module/Kconfig.mcuboot.defaults | 17 +---------------- config/zephyr/Kconfig | 7 +++++-- .../Zephyr/ConfigurationManagerImpl.cpp | 9 +++++++++ .../nrfconnect/CHIPDevicePlatformConfig.h | 4 ++++ src/platform/nrfconnect/SystemPlatformConfig.h | 2 +- 9 files changed, 35 insertions(+), 28 deletions(-) diff --git a/config/nrfconnect/app/enable-gnu-std.cmake b/config/nrfconnect/app/enable-gnu-std.cmake index 5f31e1a5c62ab8..4019bbd31bf27a 100644 --- a/config/nrfconnect/app/enable-gnu-std.cmake +++ b/config/nrfconnect/app/enable-gnu-std.cmake @@ -1,6 +1,5 @@ add_library(gnu17 INTERFACE) target_compile_options(gnu17 INTERFACE - $<$:-std=gnu++17> - -D_SYS__PTHREADTYPES_H_) + $<$:-std=gnu++17>) target_link_libraries(app PRIVATE gnu17) diff --git a/config/nrfconnect/chip-module/Kconfig b/config/nrfconnect/chip-module/Kconfig index 5d03e82530c84e..e3c5a86bf96c1d 100644 --- a/config/nrfconnect/chip-module/Kconfig +++ b/config/nrfconnect/chip-module/Kconfig @@ -302,4 +302,9 @@ config CHIP_FACTORY_RESET_ON_KEY_MIGRATION_FAILURE Perform factory reset of the device if the operational key for Fabric has not been migrated properly to PSA ITS storage. +config CHIP_PERSISTENT_SUBSCRIPTIONS + default n + # selecting experimental for this feature since there is an issue with multiple controllers. + select EXPERIMENTAL + endif # CHIP diff --git a/config/nrfconnect/chip-module/Kconfig.defaults b/config/nrfconnect/chip-module/Kconfig.defaults index 562755b14b9c25..7e3c2a6077d5ce 100644 --- a/config/nrfconnect/chip-module/Kconfig.defaults +++ b/config/nrfconnect/chip-module/Kconfig.defaults @@ -24,6 +24,10 @@ if CHIP # System configuration # ============================================================================== +choice LIBC_IMPLEMENTATION + default NEWLIB_LIBC +endchoice + config ASSERT default y @@ -318,13 +322,13 @@ if PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON config PSA_USE_CC3XX_HASH_DRIVER default n -endif +endif # PSA_CRYPTO_DRIVER_CC3XX && PSA_CRYPTO_DRIVER_OBERON # Spake2+ support config MBEDTLS_MD_C default y -endif +endif # CHIP_CRYPTO_PSA if !CHIP_CRYPTO_PSA @@ -367,7 +371,7 @@ config MBEDTLS_ECP_C config MBEDTLS_ECP_DP_SECP256R1_ENABLED default y -endif +endif # !CHIP_CRYPTO_PSA config MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG default n if CHIP_WIFI @@ -487,4 +491,4 @@ config OPENTHREAD_SHELL endif # SHELL -endif \ No newline at end of file +endif # CHIP diff --git a/config/nrfconnect/chip-module/Kconfig.features b/config/nrfconnect/chip-module/Kconfig.features index 369f992c9a5070..e6a4e52d500e13 100644 --- a/config/nrfconnect/chip-module/Kconfig.features +++ b/config/nrfconnect/chip-module/Kconfig.features @@ -42,15 +42,13 @@ config CHIP_WIFI config CHIP_QSPI_NOR bool "Enable QSPI NOR feature set" + imply NORDIC_QSPI_NOR help Enables QSPI NOR flash with a set of options for configuring pages and buffer sizes. if CHIP_QSPI_NOR -config NORDIC_QSPI_NOR - default y - config NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE default 16 diff --git a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults index 31759beba22ffc..224dc57bfc2769 100644 --- a/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults +++ b/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults @@ -19,16 +19,7 @@ config MAIN_STACK_SIZE default 10240 -config BOOT_SWAP_SAVE_ENCTLV - default n - -config BOOT_ENCRYPT_RSA - default n - -config BOOT_ENCRYPT_EC256 - default n - -config BOOT_ENCRYPT_X25519 +config BOOT_ENCRYPT_IMAGE default n config BOOT_BOOTSTRAP @@ -53,9 +44,6 @@ if BOARD_NRF7002DK_NRF5340_CPUAPP config SPI default y -config SPI_NOR - default y - choice SPI_NOR_SFDP default SPI_NOR_SFDP_DEVICETREE endchoice @@ -74,9 +62,6 @@ endif # All boards beside nRF7002DK use QSPI NOR external flash if BOARD_NRF5340DK_NRF5340_CPUAPP || BOARD_NRF52840DK_NRF52840 -config NORDIC_QSPI_NOR - default y - config NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE default 4096 diff --git a/config/zephyr/Kconfig b/config/zephyr/Kconfig index bdfa709592adff..c806ceed805385 100644 --- a/config/zephyr/Kconfig +++ b/config/zephyr/Kconfig @@ -309,7 +309,8 @@ config CHIP_PROJECT_CONFIG config CHIP_ENABLE_DNSSD_SRP bool "OpenThread Service Registration Protocol" - default y if NET_L2_OPENTHREAD + default y + depends on NET_L2_OPENTHREAD imply OPENTHREAD_ECDSA imply OPENTHREAD_SRP_CLIENT help @@ -318,7 +319,8 @@ config CHIP_ENABLE_DNSSD_SRP config CHIP_ENABLE_DNS_CLIENT bool "OpenThread DNS client" - default y if NET_L2_OPENTHREAD + default y + depends on NET_L2_OPENTHREAD imply OPENTHREAD_DNS_CLIENT help Enables using the OpenThread DNS client for the Matter service discovery. @@ -413,6 +415,7 @@ config CHIP_THREAD_SSED config CHIP_OPENTHREAD_CONFIG string "Custom OpenThread configuration file" + depends on NET_L2_OPENTHREAD help Provides a path to an OpenThread configuration file. The path can be either absolute or relative to the application directory. When this option diff --git a/src/platform/Zephyr/ConfigurationManagerImpl.cpp b/src/platform/Zephyr/ConfigurationManagerImpl.cpp index f41eed0492080f..2e937c95f0f9e0 100644 --- a/src/platform/Zephyr/ConfigurationManagerImpl.cpp +++ b/src/platform/Zephyr/ConfigurationManagerImpl.cpp @@ -40,6 +40,10 @@ #include #endif +#ifdef CONFIG_NET_L2_OPENTHREAD +#include +#endif + namespace chip { namespace DeviceLayer { @@ -179,6 +183,11 @@ void ConfigurationManagerImpl::DoFactoryReset(intptr_t arg) { ChipLogProgress(DeviceLayer, "Performing factory reset"); +// Lock the Thread stack to avoid unwanted interaction with settings NVS during factory reset. +#ifdef CONFIG_NET_L2_OPENTHREAD + ThreadStackMgr().LockThreadStack(); +#endif + #ifdef CONFIG_CHIP_FACTORY_RESET_ERASE_NVS void * storage = nullptr; int status = settings_storage_get(&storage); diff --git a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h index f9e445f35fb3d4..2e3c93289f8516 100644 --- a/src/platform/nrfconnect/CHIPDevicePlatformConfig.h +++ b/src/platform/nrfconnect/CHIPDevicePlatformConfig.h @@ -161,7 +161,11 @@ #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_PRIORITY #ifndef CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE +#if defined(CONFIG_LTO) +#define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 10240 +#else #define CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE 6144 +#endif // CONFIG_LTO #endif // CHIP_DEVICE_CONFIG_CHIP_TASK_STACK_SIZE #define CHIP_DEVICE_CONFIG_MAX_EVENT_QUEUE_SIZE 64 diff --git a/src/platform/nrfconnect/SystemPlatformConfig.h b/src/platform/nrfconnect/SystemPlatformConfig.h index 60d9c354d01ab1..fb544466dcdd75 100644 --- a/src/platform/nrfconnect/SystemPlatformConfig.h +++ b/src/platform/nrfconnect/SystemPlatformConfig.h @@ -48,7 +48,7 @@ struct ChipDeviceEvent; #define CHIP_SYSTEM_CONFIG_USE_SOCKETS 1 #ifndef CONFIG_ARCH_POSIX -#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 +#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 15 #endif #ifndef CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX From 2495011c26fb28426e5617a616c5ccecd19e5106 Mon Sep 17 00:00:00 2001 From: Marius Tache <102153746+marius-alex-tache@users.noreply.github.com> Date: Fri, 26 Apr 2024 16:54:41 +0300 Subject: [PATCH 28/40] [k32w0] Fix app partition info in readme file (#33139) Signed-off-by: marius-alex-tache --- examples/contact-sensor-app/nxp/k32w/k32w0/README.md | 4 ++-- examples/lighting-app/nxp/k32w/k32w0/README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md index 5ad31921b665ae..5785c1143671d1 100644 --- a/examples/contact-sensor-app/nxp/k32w/k32w0/README.md +++ b/examples/contact-sensor-app/nxp/k32w/k32w0/README.md @@ -559,10 +559,10 @@ This is the list of all supported partitions: 00 -----------------> 0x00 Bootable flag 00 -----------------> 0x00 Image type (0x00 = SSBL) -004000000f020101: Application partition +00400000c9040101: Application partition 00400000 -----------> 0x00004000 Start Address - 0f02 ---------------> 0x020f Number of 512-bytes pages + c904 ---------------> 0x04c9 Number of 512-bytes pages 01 -----------------> 0x01 Bootable flag 01 -----------------> 0x01 Image type (0x01 = Application) diff --git a/examples/lighting-app/nxp/k32w/k32w0/README.md b/examples/lighting-app/nxp/k32w/k32w0/README.md index 106a614191c5f0..7cd4dd7d636ffc 100644 --- a/examples/lighting-app/nxp/k32w/k32w0/README.md +++ b/examples/lighting-app/nxp/k32w/k32w0/README.md @@ -534,10 +534,10 @@ This is the list of all supported partitions: 00 -----------------> 0x00 Bootable flag 00 -----------------> 0x00 Image type (0x00 = SSBL) -004000000f020101: Application partition +00400000c9040101: Application partition 00400000 -----------> 0x00004000 Start Address - 0f02 ---------------> 0x020f Number of 512-bytes pages + c904 ---------------> 0x04c9 Number of 512-bytes pages 01 -----------------> 0x01 Bootable flag 01 -----------------> 0x01 Image type (0x01 = Application) From 1174bdc75195a80b0c22b8910cc5fafb3e67cdd0 Mon Sep 17 00:00:00 2001 From: Matthew Swartwout Date: Fri, 26 Apr 2024 08:31:55 -0700 Subject: [PATCH 29/40] Fix initialization-order-fiasco (#32854) * Fix initialization-order-fiasco * Restyled by clang-format * Fix pointer declaration * Restyled by clang-format * Do not set mLocalMRPConfig in PairingSession constructor * Revert "Restyled by clang-format" This reverts commit 7b9c3a7f14f6e91830df0bf25944219036d18bc1. * Revert "Fix pointer declaration" This reverts commit d5282f6b0634150f32ee990a5e3b4c0eb6f1470e. * Revert "Restyled by clang-format" This reverts commit d73e6e1ca1b4798924a9131e661426346e2d5020. * Revert "Fix initialization-order-fiasco" This reverts commit e9510a243f84e3b96a5985974953a092343d1d32. * Add missing MakeOptional --------- Co-authored-by: Restyled.io --- src/protocols/secure_channel/CASESession.cpp | 13 ++++++++----- src/protocols/secure_channel/PASESession.cpp | 10 ++++++---- src/protocols/secure_channel/PairingSession.h | 3 ++- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index e1bac768f81da6..aa6084d3680127 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -477,7 +477,7 @@ CASESession::PrepareForSessionEstablishment(SessionManager & sessionManager, Fab mFabricsTable = fabricTable; mRole = CryptoContext::SessionRole::kResponder; mSessionResumptionStorage = sessionResumptionStorage; - mLocalMRPConfig = mrpLocalConfig.ValueOr(GetDefaultMRPConfig()); + mLocalMRPConfig = MakeOptional(mrpLocalConfig.ValueOr(GetDefaultMRPConfig())); ChipLogDetail(SecureChannel, "Allocated SecureSession (%p) - waiting for Sigma1 msg", mSecureSessionHolder.Get().Value()->AsSecureSession()); @@ -525,7 +525,7 @@ CHIP_ERROR CASESession::EstablishSession(SessionManager & sessionManager, Fabric mFabricsTable = fabricTable; mFabricIndex = fabricInfo->GetFabricIndex(); mSessionResumptionStorage = sessionResumptionStorage; - mLocalMRPConfig = mrpLocalConfig.ValueOr(GetDefaultMRPConfig()); + mLocalMRPConfig = MakeOptional(mrpLocalConfig.ValueOr(GetDefaultMRPConfig())); mExchangeCtxt.Value()->UseSuggestedResponseTimeout(kExpectedSigma1ProcessingTime); mPeerNodeId = peerScopedNodeId.GetNodeId(); @@ -708,7 +708,8 @@ CHIP_ERROR CASESession::SendSigma1() ReturnErrorOnFailure( tlvWriter.PutBytes(TLV::ContextTag(4), mEphemeralKey->Pubkey(), static_cast(mEphemeralKey->Pubkey().Length()))); - ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig, tlvWriter)); + VerifyOrReturnError(mLocalMRPConfig.HasValue(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig.Value(), tlvWriter)); // Try to find persistent session, and resume it. bool resuming = false; @@ -955,7 +956,8 @@ CHIP_ERROR CASESession::SendSigma2Resume() ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(3), GetLocalSessionId().Value())); - ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(4), mLocalMRPConfig, tlvWriter)); + VerifyOrReturnError(mLocalMRPConfig.HasValue(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(4), mLocalMRPConfig.Value(), tlvWriter)); ReturnErrorOnFailure(tlvWriter.EndContainer(outerContainerType)); ReturnErrorOnFailure(tlvWriter.Finalize(&msg_R2_resume)); @@ -1091,7 +1093,8 @@ CHIP_ERROR CASESession::SendSigma2() ReturnErrorOnFailure(tlvWriterMsg2.PutBytes(TLV::ContextTag(4), msg_R2_Encrypted.Get(), static_cast(msg_r2_signed_enc_len + CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES))); - ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig, tlvWriterMsg2)); + VerifyOrReturnError(mLocalMRPConfig.HasValue(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig.Value(), tlvWriterMsg2)); ReturnErrorOnFailure(tlvWriterMsg2.EndContainer(outerContainerType)); ReturnErrorOnFailure(tlvWriterMsg2.Finalize(&msg_R2)); diff --git a/src/protocols/secure_channel/PASESession.cpp b/src/protocols/secure_channel/PASESession.cpp index e0f409616ab26c..1702a159bb111c 100644 --- a/src/protocols/secure_channel/PASESession.cpp +++ b/src/protocols/secure_channel/PASESession.cpp @@ -195,7 +195,7 @@ CHIP_ERROR PASESession::WaitForPairing(SessionManager & sessionManager, const Sp mIterationCount = pbkdf2IterCount; mNextExpectedMsg.SetValue(MsgType::PBKDFParamRequest); mPairingComplete = false; - mLocalMRPConfig = mrpLocalConfig.ValueOr(GetDefaultMRPConfig()); + mLocalMRPConfig = MakeOptional(mrpLocalConfig.ValueOr(GetDefaultMRPConfig())); ChipLogDetail(SecureChannel, "Waiting for PBKDF param request"); @@ -225,7 +225,7 @@ CHIP_ERROR PASESession::Pair(SessionManager & sessionManager, uint32_t peerSetUp mExchangeCtxt.Value()->UseSuggestedResponseTimeout(kExpectedLowProcessingTime); - mLocalMRPConfig = mrpLocalConfig.ValueOr(GetDefaultMRPConfig()); + mLocalMRPConfig = MakeOptional(mrpLocalConfig.ValueOr(GetDefaultMRPConfig())); err = SendPBKDFParamRequest(); SuccessOrExit(err); @@ -300,7 +300,8 @@ CHIP_ERROR PASESession::SendPBKDFParamRequest() ReturnErrorOnFailure(tlvWriter.Put(TLV::ContextTag(3), kDefaultCommissioningPasscodeId)); ReturnErrorOnFailure(tlvWriter.PutBoolean(TLV::ContextTag(4), mHavePBKDFParameters)); - ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig, tlvWriter)); + VerifyOrReturnError(mLocalMRPConfig.HasValue(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig.Value(), tlvWriter)); ReturnErrorOnFailure(tlvWriter.EndContainer(outerContainerType)); ReturnErrorOnFailure(tlvWriter.Finalize(&req)); @@ -420,7 +421,8 @@ CHIP_ERROR PASESession::SendPBKDFParamResponse(ByteSpan initiatorRandom, bool in ReturnErrorOnFailure(tlvWriter.EndContainer(pbkdfParamContainer)); } - ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig, tlvWriter)); + VerifyOrReturnError(mLocalMRPConfig.HasValue(), CHIP_ERROR_INCORRECT_STATE); + ReturnErrorOnFailure(EncodeSessionParameters(TLV::ContextTag(5), mLocalMRPConfig.Value(), tlvWriter)); ReturnErrorOnFailure(tlvWriter.EndContainer(outerContainerType)); ReturnErrorOnFailure(tlvWriter.Finalize(&resp)); diff --git a/src/protocols/secure_channel/PairingSession.h b/src/protocols/secure_channel/PairingSession.h index fa639a7dd9459a..abdb69786c59f6 100644 --- a/src/protocols/secure_channel/PairingSession.h +++ b/src/protocols/secure_channel/PairingSession.h @@ -244,7 +244,8 @@ class DLL_EXPORT PairingSession : public SessionDelegate // mLocalMRPConfig is our config which is sent to the other end and used by the peer session. // mRemoteSessionParams is received from other end and set to our session. - ReliableMessageProtocolConfig mLocalMRPConfig = GetLocalMRPConfig().ValueOr(GetDefaultMRPConfig()); + // It is set the first time that session establishment is initiated. + Optional mLocalMRPConfig; SessionParameters mRemoteSessionParams; private: From 672269348217822d4eaf8675855dabd43b2e8721 Mon Sep 17 00:00:00 2001 From: Matthew Swartwout Date: Fri, 26 Apr 2024 08:35:42 -0700 Subject: [PATCH 30/40] Add std::source_location to ChipError for C++20 builds (#32935) * Add std::source_location to ChipError for C++20 builds * Fix errors due to CHIP_ERROR default constructor no longer being trivial * Restyled by clang-format * A few more fixes * Replace semicolon with comma * Add enum->int cast * Add tests and simplify constructor * Convert to gtest * Restyled by clang-format * Restyled by gn --------- Co-authored-by: Restyled.io --- src/app/FailSafeContext.cpp | 11 ++- src/app/clusters/bindings/bindings.cpp | 5 +- src/include/platform/CHIPDeviceEvent.h | 1 - .../GenericConnectivityManagerImpl_Thread.ipp | 9 +- src/lib/core/CHIPError.h | 56 ++++++++++--- src/lib/core/tests/BUILD.gn | 1 + src/lib/core/tests/TestCHIPError.cpp | 72 ++++++++++++++++ src/platform/DeviceControlServer.cpp | 24 +++--- src/platform/Linux/BLEManagerImpl.cpp | 82 ++++++++----------- .../Linux/ConnectivityManagerImpl.cpp | 8 +- src/platform/Linux/PlatformManagerImpl.cpp | 7 +- src/platform/Linux/ThreadStackManagerImpl.cpp | 18 ++-- ...nericThreadStackManagerImpl_OpenThread.hpp | 29 ++++--- src/platform/PlatformEventSupport.cpp | 4 +- 14 files changed, 200 insertions(+), 127 deletions(-) create mode 100644 src/lib/core/tests/TestCHIPError.cpp diff --git a/src/app/FailSafeContext.cpp b/src/app/FailSafeContext.cpp index 699fcb8c0ce280..95a5b267f2aa5e 100644 --- a/src/app/FailSafeContext.cpp +++ b/src/app/FailSafeContext.cpp @@ -85,12 +85,11 @@ void FailSafeContext::ScheduleFailSafeCleanup(FabricIndex fabricIndex, bool addN SetFailSafeArmed(false); - ChipDeviceEvent event; - event.Type = DeviceEventType::kFailSafeTimerExpired; - event.FailSafeTimerExpired.fabricIndex = fabricIndex; - event.FailSafeTimerExpired.addNocCommandHasBeenInvoked = addNocCommandInvoked; - event.FailSafeTimerExpired.updateNocCommandHasBeenInvoked = updateNocCommandInvoked; - CHIP_ERROR status = PlatformMgr().PostEvent(&event); + ChipDeviceEvent event{ .Type = DeviceEventType::kFailSafeTimerExpired, + .FailSafeTimerExpired = { .fabricIndex = fabricIndex, + .addNocCommandHasBeenInvoked = addNocCommandInvoked, + .updateNocCommandHasBeenInvoked = updateNocCommandInvoked } }; + CHIP_ERROR status = PlatformMgr().PostEvent(&event); if (status != CHIP_NO_ERROR) { diff --git a/src/app/clusters/bindings/bindings.cpp b/src/app/clusters/bindings/bindings.cpp index cd96e0d32fea78..d7c1712baf9672 100644 --- a/src/app/clusters/bindings/bindings.cpp +++ b/src/app/clusters/bindings/bindings.cpp @@ -259,9 +259,8 @@ CHIP_ERROR BindingTableAccess::WriteBindingTable(const ConcreteDataAttributePath CHIP_ERROR BindingTableAccess::NotifyBindingsChanged() { - DeviceLayer::ChipDeviceEvent event; - event.Type = DeviceLayer::DeviceEventType::kBindingsChangedViaCluster; - event.BindingsChanged.fabricIndex = mAccessingFabricIndex; + DeviceLayer::ChipDeviceEvent event{ .Type = DeviceLayer::DeviceEventType::kBindingsChangedViaCluster, + .BindingsChanged = { .fabricIndex = mAccessingFabricIndex } }; return chip::DeviceLayer::PlatformMgr().PostEvent(&event); } diff --git a/src/include/platform/CHIPDeviceEvent.h b/src/include/platform/CHIPDeviceEvent.h index 9d4f293cd3c3b0..cbab1d9817aed2 100644 --- a/src/include/platform/CHIPDeviceEvent.h +++ b/src/include/platform/CHIPDeviceEvent.h @@ -530,7 +530,6 @@ struct ChipDeviceEvent final } OtaStateChanged; }; - void Clear() { memset(this, 0, sizeof(*this)); } bool IsPublic() const { return DeviceEventType::IsPublic(Type); } bool IsInternal() const { return DeviceEventType::IsInternal(Type); } bool IsPlatformSpecific() const { return DeviceEventType::IsPlatformSpecific(Type); } diff --git a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp index 403ddd643b7193..23b626033593ef 100644 --- a/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp +++ b/src/include/platform/internal/GenericConnectivityManagerImpl_Thread.ipp @@ -70,11 +70,10 @@ void GenericConnectivityManagerImpl_Thread::UpdateServiceConnectivity mFlags.Set(Flags::kHaveServiceConnectivity, haveServiceConnectivity); { - ChipDeviceEvent event; - event.Clear(); - event.Type = DeviceEventType::kServiceConnectivityChange; - event.ServiceConnectivityChange.ViaThread.Result = - (haveServiceConnectivity) ? kConnectivity_Established : kConnectivity_Lost; + ChipDeviceEvent event{ .Type = DeviceEventType::kServiceConnectivityChange, + .ServiceConnectivityChange = { .ViaThread = { .Result = (haveServiceConnectivity) + ? kConnectivity_Established + : kConnectivity_Lost } } }; event.ServiceConnectivityChange.Overall.Result = event.ServiceConnectivityChange.ViaThread.Result; CHIP_ERROR status = PlatformMgr().PostEvent(&event); if (status != CHIP_NO_ERROR) diff --git a/src/lib/core/CHIPError.h b/src/lib/core/CHIPError.h index 38b76bca539c2a..37001c8c6971a2 100644 --- a/src/lib/core/CHIPError.h +++ b/src/lib/core/CHIPError.h @@ -35,6 +35,10 @@ #include #include +#if __cplusplus >= 202002L +#include +#endif // __cplusplus >= 202002L + namespace chip { /** @@ -112,9 +116,13 @@ class ChipError // Helper for declaring constructors without too much repetition. #if CHIP_CONFIG_ERROR_SOURCE -#define CHIP_INITIALIZE_ERROR_SOURCE(f, l) , mFile((f)), mLine((l)) -#else // CHIP_CONFIG_ERROR_SOURCE -#define CHIP_INITIALIZE_ERROR_SOURCE(f, l) +#if __cplusplus >= 202002L +#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l)), mSourceLocation((loc)) +#else +#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l)) +#endif // __cplusplus >= 202002L +#else // CHIP_CONFIG_ERROR_SOURCE +#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) #endif // CHIP_CONFIG_ERROR_SOURCE /** @@ -123,12 +131,17 @@ class ChipError * @note * The result is valid only if CanEncapsulate() is true. */ - constexpr ChipError(Range range, ValueType value) : - mError(MakeInteger(range, (value & MakeMask(0, kValueLength)))) CHIP_INITIALIZE_ERROR_SOURCE(nullptr, 0) + constexpr ChipError(Range range, ValueType value) : ChipError(range, value, /*file=*/nullptr, /*line=*/0) {} +#if __cplusplus >= 202002L + constexpr ChipError(Range range, ValueType value, const char * file, unsigned int line, + std::source_location location = std::source_location::current()) : + mError(MakeInteger(range, (value & MakeMask(0, kValueLength)))) CHIP_INITIALIZE_ERROR_SOURCE(file, line, location) {} +#else constexpr ChipError(Range range, ValueType value, const char * file, unsigned int line) : - mError(MakeInteger(range, (value & MakeMask(0, kValueLength)))) CHIP_INITIALIZE_ERROR_SOURCE(file, line) + mError(MakeInteger(range, (value & MakeMask(0, kValueLength)))) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr) {} +#endif // __cplusplus >= 202002L /** * Construct a CHIP_ERROR for SdkPart @a part with @a code. @@ -136,10 +149,17 @@ class ChipError * @note * The macro version CHIP_SDK_ERROR checks that the numeric value is constant and well-formed. */ - constexpr ChipError(SdkPart part, uint8_t code) : mError(MakeInteger(part, code)) CHIP_INITIALIZE_ERROR_SOURCE(nullptr, 0) {} + constexpr ChipError(SdkPart part, uint8_t code) : ChipError(part, code, /*file=*/nullptr, /*line=*/0) {} +#if __cplusplus >= 202002L + constexpr ChipError(SdkPart part, uint8_t code, const char * file, unsigned int line, + std::source_location location = std::source_location::current()) : + mError(MakeInteger(part, code)) CHIP_INITIALIZE_ERROR_SOURCE(file, line, location) + {} +#else constexpr ChipError(SdkPart part, uint8_t code, const char * file, unsigned int line) : - mError(MakeInteger(part, code)) CHIP_INITIALIZE_ERROR_SOURCE(file, line) + mError(MakeInteger(part, code)) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr) {} +#endif // __cplusplus >= 202002L /** * Construct a CHIP_ERROR constant for SdkPart @a part with @a code at the current source line. @@ -159,10 +179,17 @@ class ChipError * @note * This is intended to be used only in foreign function interfaces. */ - explicit constexpr ChipError(StorageType error) : mError(error) CHIP_INITIALIZE_ERROR_SOURCE(nullptr, 0) {} + explicit constexpr ChipError(StorageType error) : ChipError(error, /*file=*/nullptr, /*line=*/0) {} +#if __cplusplus >= 202002L + explicit constexpr ChipError(StorageType error, const char * file, unsigned int line, + std::source_location location = std::source_location::current()) : + mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, location) + {} +#else explicit constexpr ChipError(StorageType error, const char * file, unsigned int line) : - mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line) + mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr) {} +#endif // __cplusplus >= 202002L #undef CHIP_INITIALIZE_ERROR_SOURCE @@ -299,6 +326,12 @@ class ChipError */ unsigned int GetLine() const { return mLine; } +#if __cplusplus >= 202002L + /** + * Get the source_location of the point where the error occurred. + */ + const std::source_location & GetSourceLocation() { return mSourceLocation; } +#endif // __cplusplus >= 202002L #endif // CHIP_CONFIG_ERROR_SOURCE private: @@ -365,6 +398,9 @@ class ChipError #if CHIP_CONFIG_ERROR_SOURCE const char * mFile; unsigned int mLine; +#if __cplusplus >= 202002L + std::source_location mSourceLocation; +#endif // __cplusplus >= 202002L #endif // CHIP_CONFIG_ERROR_SOURCE public: diff --git a/src/lib/core/tests/BUILD.gn b/src/lib/core/tests/BUILD.gn index 3092ac36809f59..30d50ee9493699 100644 --- a/src/lib/core/tests/BUILD.gn +++ b/src/lib/core/tests/BUILD.gn @@ -24,6 +24,7 @@ chip_test_suite("tests") { test_sources = [ "TestCATValues.cpp", "TestCHIPCallback.cpp", + "TestCHIPError.cpp", "TestCHIPErrorStr.cpp", "TestOTAImageHeader.cpp", "TestOptional.cpp", diff --git a/src/lib/core/tests/TestCHIPError.cpp b/src/lib/core/tests/TestCHIPError.cpp new file mode 100644 index 00000000000000..ba0c25906623a8 --- /dev/null +++ b/src/lib/core/tests/TestCHIPError.cpp @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2024 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 + +namespace chip { +namespace { + +TEST(ChipErrorTest, RangeConstructor) +{ + ChipError error(ChipError::Range::kSDK, /*value=*/1, __FILE__, __LINE__); +#if CHIP_CONFIG_ERROR_SOURCE + EXPECT_EQ(error.GetFile(), __FILE__); + EXPECT_EQ(error.GetLine(), 30u); +#if __cplusplus >= 202002L + std::source_location location = error.GetSourceLocation(); + EXPECT_EQ(location.line(), 30u); + EXPECT_EQ(location.file_name(), __FILE__); +#endif // __cplusplus >= 202002L +#endif // CHIP_CONFIG_ERROR_SOURCE +} + +TEST(ChipErrorTest, SdkPartConstructor) +{ + ChipError error(ChipError::SdkPart::kCore, /*code=*/1, __FILE__, __LINE__); +#if CHIP_CONFIG_ERROR_SOURCE + EXPECT_EQ(error.GetFile(), __FILE__); + EXPECT_EQ(error.GetLine(), 44u); +#if __cplusplus >= 202002L + std::source_location location = error.GetSourceLocation(); + EXPECT_EQ(location.line(), 44u); + EXPECT_EQ(location.file_name(), __FILE__); +#endif // __cplusplus >= 202002L +#endif // CHIP_CONFIG_ERROR_SOURCE +} + +TEST(ChipErrorTest, StorageTypeConstructor) +{ + ChipError error(/*error=*/1, __FILE__, __LINE__); + EXPECT_EQ(error.AsInteger(), 1u); +#if CHIP_CONFIG_ERROR_SOURCE + EXPECT_EQ(error.GetFile(), __FILE__); + EXPECT_EQ(error.GetLine(), 58u); +#if __cplusplus >= 202002L + std::source_location location = error.GetSourceLocation(); + EXPECT_EQ(location.line(), 58u); + EXPECT_EQ(location.file_name(), __FILE__); +#endif // __cplusplus >= 202002L +#endif // CHIP_CONFIG_ERROR_SOURCE +} + +} // namespace +} // namespace chip diff --git a/src/platform/DeviceControlServer.cpp b/src/platform/DeviceControlServer.cpp index ec348669aec213..584ddbc08f056e 100644 --- a/src/platform/DeviceControlServer.cpp +++ b/src/platform/DeviceControlServer.cpp @@ -36,11 +36,11 @@ DeviceControlServer & DeviceControlServer::DeviceControlSvr() CHIP_ERROR DeviceControlServer::PostCommissioningCompleteEvent(NodeId peerNodeId, FabricIndex accessingFabricIndex) { - ChipDeviceEvent event; + ChipDeviceEvent event{ - event.Type = DeviceEventType::kCommissioningComplete; - event.CommissioningComplete.nodeId = peerNodeId; - event.CommissioningComplete.fabricIndex = accessingFabricIndex; + .Type = DeviceEventType::kCommissioningComplete, + .CommissioningComplete = { .nodeId = peerNodeId, .fabricIndex = accessingFabricIndex } + }; return PlatformMgr().PostEvent(&event); } @@ -66,31 +66,27 @@ CHIP_ERROR DeviceControlServer::SetRegulatoryConfig(uint8_t location, const Char CHIP_ERROR DeviceControlServer::PostConnectedToOperationalNetworkEvent(ByteSpan networkID) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kOperationalNetworkEnabled; - // TODO(cecille): This should be some way to specify thread or wifi. - event.OperationalNetwork.network = 0; + ChipDeviceEvent event{ .Type = DeviceEventType::kOperationalNetworkEnabled, + // TODO(cecille): This should be some way to specify thread or wifi. + .OperationalNetwork = { .network = 0 } }; return PlatformMgr().PostEvent(&event); } CHIP_ERROR DeviceControlServer::PostCloseAllBLEConnectionsToOperationalNetworkEvent() { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCloseAllBleConnections; + ChipDeviceEvent event{ .Type = DeviceEventType::kCloseAllBleConnections }; return PlatformMgr().PostEvent(&event); } CHIP_ERROR DeviceControlServer::PostWiFiDeviceAvailableNetworkEvent() { - ChipDeviceEvent event; - event.Type = DeviceEventType::kWiFiDeviceAvailable; + ChipDeviceEvent event{ .Type = DeviceEventType::kWiFiDeviceAvailable }; return PlatformMgr().PostEvent(&event); } CHIP_ERROR DeviceControlServer::PostOperationalNetworkStartedEvent() { - ChipDeviceEvent event; - event.Type = DeviceEventType::kOperationalNetworkStarted; + ChipDeviceEvent event{ .Type = DeviceEventType::kOperationalNetworkStarted }; return PlatformMgr().PostEvent(&event); } diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index a5bd19f877a6a8..a61c6e2403de02 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -204,8 +204,7 @@ void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) case DeviceEventType::kCHIPoBLESubscribe: HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); { - ChipDeviceEvent connectionEvent; - connectionEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; + ChipDeviceEvent connectionEvent{ .Type = DeviceEventType::kCHIPoBLEConnectionEstablished }; PlatformMgr().PostEventOrDie(&connectionEvent); } break; @@ -464,9 +463,8 @@ void BLEManagerImpl::HandleNewConnection(BLE_CONNECTION_OBJECT conId) { if (sInstance.mIsCentral) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLECentralConnected; - event.Platform.BLECentralConnected.mConnection = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLECentralConnected, + .Platform = { .BLECentralConnected = { .mConnection = conId } } }; PlatformMgr().PostEventOrDie(&event); } } @@ -475,27 +473,23 @@ void BLEManagerImpl::HandleConnectFailed(CHIP_ERROR error) { if (sInstance.mIsCentral) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLECentralConnectFailed; - event.Platform.BLECentralConnectFailed.mError = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLECentralConnectFailed, + .Platform = { .BLECentralConnectFailed = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } } void BLEManagerImpl::HandleWriteComplete(BLE_CONNECTION_OBJECT conId) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEWriteComplete; - event.Platform.BLEWriteComplete.mConnection = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEWriteComplete, + .Platform = { .BLEWriteComplete = { .mConnection = conId } } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::HandleSubscribeOpComplete(BLE_CONNECTION_OBJECT conId, bool subscribed) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLESubscribeOpComplete; - event.Platform.BLESubscribeOpComplete.mConnection = conId; - event.Platform.BLESubscribeOpComplete.mIsSubscribed = subscribed; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLESubscribeOpComplete, + .Platform = { .BLESubscribeOpComplete = { .mConnection = conId, .mIsSubscribed = subscribed } } }; PlatformMgr().PostEventOrDie(&event); } @@ -506,12 +500,12 @@ void BLEManagerImpl::HandleTXCharChanged(BLE_CONNECTION_OBJECT conId, const uint ChipLogDetail(DeviceLayer, "Indication received, conn = %p", conId); + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEIndicationReceived, + .Platform = { .BLEIndicationReceived = { .mConnection = conId } } }; + VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEIndicationReceived; - event.Platform.BLEIndicationReceived.mConnection = conId; - event.Platform.BLEIndicationReceived.mData = std::move(buf).UnsafeRelease(); + event.Platform.BLEIndicationReceived.mData = std::move(buf).UnsafeRelease(); PlatformMgr().PostEventOrDie(&event); exit: @@ -530,11 +524,9 @@ void BLEManagerImpl::HandleRXCharWrite(BLE_CONNECTION_OBJECT conId, const uint8_ // Post an event to the Chip queue to deliver the data into the Chip stack. { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEWriteReceived; ChipLogProgress(Ble, "Write request received debug %p", conId); - event.CHIPoBLEWriteReceived.ConId = conId; - event.CHIPoBLEWriteReceived.Data = std::move(buf).UnsafeRelease(); + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEWriteReceived, + .CHIPoBLEWriteReceived = { .ConId = conId, .Data = std::move(buf).UnsafeRelease() } }; PlatformMgr().PostEventOrDie(&event); } @@ -551,10 +543,8 @@ void BLEManagerImpl::CHIPoBluez_ConnectionClosed(BLE_CONNECTION_OBJECT conId) // If this was a CHIPoBLE connection, post an event to deliver a connection error to the CHIPoBLE layer. { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionError; - event.CHIPoBLEConnectionError.ConId = conId; - event.CHIPoBLEConnectionError.Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEConnectionError, + .CHIPoBLEConnectionError = { .ConId = conId, .Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED } }; PlatformMgr().PostEventOrDie(&event); } } @@ -566,9 +556,9 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(BLE_CONNECTION_OBJECT conId) // Post an event to the Chip queue to process either a CHIPoBLE Subscribe or Unsubscribe based on // whether the client is enabling or disabling indications. - ChipDeviceEvent event; - event.Type = conId->IsNotifyAcquired() ? DeviceEventType::kCHIPoBLESubscribe : DeviceEventType::kCHIPoBLEUnsubscribe; - event.CHIPoBLESubscribe.ConId = conId; + ChipDeviceEvent event{ .Type = conId->IsNotifyAcquired() ? static_cast(DeviceEventType::kCHIPoBLESubscribe) + : static_cast(DeviceEventType::kCHIPoBLEUnsubscribe), + .CHIPoBLESubscribe = { .ConId = conId } }; PlatformMgr().PostEventOrDie(&event); ChipLogProgress(DeviceLayer, "CHIPoBLE %s received", @@ -578,9 +568,7 @@ void BLEManagerImpl::HandleTXCharCCCDWrite(BLE_CONNECTION_OBJECT conId) void BLEManagerImpl::HandleTXComplete(BLE_CONNECTION_OBJECT conId) { // Post an event to the Chip queue to process the indicate confirmation. - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = conId; + ChipDeviceEvent event{ .Type = DeviceEventType::kCHIPoBLEIndicateConfirm, .CHIPoBLEIndicateConfirm = { .ConId = conId } }; PlatformMgr().PostEventOrDie(&event); } @@ -835,50 +823,44 @@ CHIP_ERROR BLEManagerImpl::CancelConnection() void BLEManagerImpl::NotifyBLEAdapterAdded(unsigned int aAdapterId, const char * aAdapterAddress) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEAdapterAdded; - event.Platform.BLEAdapter.mAdapterId = aAdapterId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEAdapterAdded, + .Platform = { .BLEAdapter = { .mAdapterId = aAdapterId } } }; Platform::CopyString(event.Platform.BLEAdapter.mAdapterAddress, aAdapterAddress); PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEAdapterRemoved(unsigned int aAdapterId, const char * aAdapterAddress) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEAdapterRemoved; - event.Platform.BLEAdapter.mAdapterId = aAdapterId; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEAdapterRemoved, + .Platform = { .BLEAdapter = { .mAdapterId = aAdapterId } } }; Platform::CopyString(event.Platform.BLEAdapter.mAdapterAddress, aAdapterAddress); PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEPeripheralRegisterAppComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete; - event.Platform.BLEPeripheralRegisterAppComplete.mError = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEPeripheralRegisterAppComplete, + .Platform = { .BLEPeripheralRegisterAppComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEPeripheralAdvStartComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete; - event.Platform.BLEPeripheralAdvStartComplete.mError = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStartComplete, + .Platform = { .BLEPeripheralAdvStartComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEPeripheralAdvStopComplete(CHIP_ERROR error) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete; - event.Platform.BLEPeripheralAdvStopComplete.mError = error; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvStopComplete, + .Platform = { .BLEPeripheralAdvStopComplete = { .mError = error } } }; PlatformMgr().PostEventOrDie(&event); } void BLEManagerImpl::NotifyBLEPeripheralAdvReleased() { - ChipDeviceEvent event; - event.Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvReleased; + ChipDeviceEvent event{ .Type = DeviceEventType::kPlatformLinuxBLEPeripheralAdvReleased }; PlatformMgr().PostEventOrDie(&event); } diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index f7edd474e2d7ea..cd3922baaf2b02 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -1278,11 +1278,9 @@ void ConnectivityManagerImpl::PostNetworkConnect() chip::Inet::IPAddress addr; if ((it.GetAddress(addr) == CHIP_NO_ERROR) && addr.IsIPv4()) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kInternetConnectivityChange; - event.InternetConnectivityChange.IPv4 = kConnectivity_Established; - event.InternetConnectivityChange.IPv6 = kConnectivity_NoChange; - event.InternetConnectivityChange.ipAddress = addr; + ChipDeviceEvent event{ .Type = DeviceEventType::kInternetConnectivityChange, + .InternetConnectivityChange = { + .IPv4 = kConnectivity_Established, .IPv6 = kConnectivity_NoChange, .ipAddress = addr } }; char ipStrBuf[chip::Inet::IPAddress::kMaxStringLength] = { 0 }; addr.ToString(ipStrBuf); diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index 401d72bbe413bd..68f3d58c1ac87b 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -123,10 +123,9 @@ gboolean WiFiIPChangeListener(GIOChannel * ch, GIOCondition /* condition */, voi inet_ntop(AF_INET, RTA_DATA(routeInfo), ipStrBuf, sizeof(ipStrBuf)); ChipLogDetail(DeviceLayer, "Got IP address on interface: %s IP: %s", name, ipStrBuf); - ChipDeviceEvent event; - event.Type = DeviceEventType::kInternetConnectivityChange; - event.InternetConnectivityChange.IPv4 = kConnectivity_Established; - event.InternetConnectivityChange.IPv6 = kConnectivity_NoChange; + ChipDeviceEvent event{ .Type = DeviceEventType::kInternetConnectivityChange, + .InternetConnectivityChange = { .IPv4 = kConnectivity_Established, + .IPv6 = kConnectivity_NoChange } }; if (!chip::Inet::IPAddress::FromString(ipStrBuf, event.InternetConnectivityChange.ipAddress)) { diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index 40bd31ecaeee44..126d30164492fe 100644 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -148,13 +148,11 @@ void ThreadStackManagerImpl::ThreadDeviceRoleChangedHandler(const gchar * role) { bool attached = strcmp(role, kOpenthreadDeviceRoleDetached) != 0 && strcmp(role, kOpenthreadDeviceRoleDisabled) != 0; - ChipDeviceEvent event = ChipDeviceEvent{}; - if (attached != mAttached) { - event.Type = DeviceEventType::kThreadConnectivityChange; - event.ThreadConnectivityChange.Result = - attached ? ConnectivityChange::kConnectivity_Established : ConnectivityChange::kConnectivity_Lost; + ChipDeviceEvent event{ .Type = DeviceEventType::kThreadConnectivityChange, + .ThreadConnectivityChange = { .Result = attached ? ConnectivityChange::kConnectivity_Established + : ConnectivityChange::kConnectivity_Lost } }; CHIP_ERROR status = PlatformMgr().PostEvent(&event); if (status != CHIP_NO_ERROR) { @@ -163,9 +161,8 @@ void ThreadStackManagerImpl::ThreadDeviceRoleChangedHandler(const gchar * role) } mAttached = attached; - event.Type = DeviceEventType::kThreadStateChange; - event.ThreadStateChange.RoleChanged = true; - CHIP_ERROR status = PlatformMgr().PostEvent(&event); + ChipDeviceEvent event{ .Type = DeviceEventType::kThreadStateChange, .ThreadStateChange = { .RoleChanged = true } }; + CHIP_ERROR status = PlatformMgr().PostEvent(&event); if (status != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "Failed to post thread state change: %" CHIP_ERROR_FORMAT, status.Format()); @@ -257,9 +254,8 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadProvision(ByteSpan netInfo) VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(DeviceLayer, "openthread: failed to set active dataset")); // post an event alerting other subsystems about change in provisioning state - ChipDeviceEvent event; - event.Type = DeviceEventType::kServiceProvisioningChange; - event.ServiceProvisioningChange.IsServiceProvisioned = true; + ChipDeviceEvent event{ .Type = DeviceEventType::kServiceProvisioningChange, + .ServiceProvisioningChange = { .IsServiceProvisioned = true } }; return PlatformMgr().PostEvent(&event); } diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index 7c3111a2082339..f4548e67829582 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -123,13 +123,14 @@ NetworkCommissioning::otScanResponseIterator void GenericThreadStackManagerImpl_OpenThread::OnOpenThreadStateChange(uint32_t flags, void * context) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kThreadStateChange; - event.ThreadStateChange.RoleChanged = (flags & OT_CHANGED_THREAD_ROLE) != 0; - event.ThreadStateChange.AddressChanged = (flags & (OT_CHANGED_IP6_ADDRESS_ADDED | OT_CHANGED_IP6_ADDRESS_REMOVED)) != 0; - event.ThreadStateChange.NetDataChanged = (flags & OT_CHANGED_THREAD_NETDATA) != 0; - event.ThreadStateChange.ChildNodesChanged = (flags & (OT_CHANGED_THREAD_CHILD_ADDED | OT_CHANGED_THREAD_CHILD_REMOVED)) != 0; - event.ThreadStateChange.OpenThread.Flags = flags; + ChipDeviceEvent event{ .Type = DeviceEventType::kThreadStateChange, + .ThreadStateChange = { + .RoleChanged = (flags & OT_CHANGED_THREAD_ROLE) != 0, + .AddressChanged = (flags & (OT_CHANGED_IP6_ADDRESS_ADDED | OT_CHANGED_IP6_ADDRESS_REMOVED)) != 0, + .NetDataChanged = (flags & OT_CHANGED_THREAD_NETDATA) != 0, + .ChildNodesChanged = + (flags & (OT_CHANGED_THREAD_CHILD_ADDED | OT_CHANGED_THREAD_CHILD_REMOVED)) != 0, + .OpenThread = { .Flags = flags } } }; CHIP_ERROR status = PlatformMgr().PostEvent(&event); if (status != CHIP_NO_ERROR) @@ -211,11 +212,10 @@ void GenericThreadStackManagerImpl_OpenThread::_OnPlatformEvent(const // Avoid sending muliple events if the attachement state didn't change (Child->router or disable->Detached) if (event->ThreadStateChange.RoleChanged && (isThreadAttached != mIsAttached)) { - ChipDeviceEvent attachEvent; - attachEvent.Clear(); - attachEvent.Type = DeviceEventType::kThreadConnectivityChange; - attachEvent.ThreadConnectivityChange.Result = (isThreadAttached) ? kConnectivity_Established : kConnectivity_Lost; - CHIP_ERROR status = PlatformMgr().PostEvent(&attachEvent); + ChipDeviceEvent attachEvent{ .Type = DeviceEventType::kThreadConnectivityChange, + .ThreadConnectivityChange = { .Result = (isThreadAttached) ? kConnectivity_Established + : kConnectivity_Lost } }; + CHIP_ERROR status = PlatformMgr().PostEvent(&attachEvent); if (status == CHIP_NO_ERROR) { mIsAttached = isThreadAttached; @@ -317,9 +317,8 @@ CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_SetThreadProvis } // post an event alerting other subsystems about change in provisioning state - ChipDeviceEvent event; - event.Type = DeviceEventType::kServiceProvisioningChange; - event.ServiceProvisioningChange.IsServiceProvisioned = true; + ChipDeviceEvent event{ .Type = DeviceEventType::kServiceProvisioningChange, + .ServiceProvisioningChange = { .IsServiceProvisioned = true } }; return PlatformMgr().PostEvent(&event); } diff --git a/src/platform/PlatformEventSupport.cpp b/src/platform/PlatformEventSupport.cpp index 1572a3da865457..947a7f2fe691f8 100644 --- a/src/platform/PlatformEventSupport.cpp +++ b/src/platform/PlatformEventSupport.cpp @@ -34,9 +34,7 @@ using namespace ::chip::DeviceLayer; CHIP_ERROR PlatformEventing::ScheduleLambdaBridge(System::Layer & aLayer, LambdaBridge && bridge) { - ChipDeviceEvent event; - event.Type = DeviceEventType::kChipLambdaEvent; - event.LambdaEvent = std::move(bridge); + ChipDeviceEvent event{ .Type = DeviceEventType::kChipLambdaEvent, .LambdaEvent = std::move(bridge) }; return PlatformMgr().PostEvent(&event); } From 06caebe6b6db58dadadd075c8acf477bec83e0cc Mon Sep 17 00:00:00 2001 From: C Freeman Date: Fri, 26 Apr 2024 11:40:07 -0400 Subject: [PATCH 31/40] Python scripting: Add a test plan generator script (#32718) * Python scriptiong: Add a test plan generator script * Fix linter * Restyled by isort * fix spacing * update spacing on expected outcome * remove init file - it snuck in, but isn't needed * Add documnetation and better error reporting. * make print a little nicer for help * linter... * Restyled by isort * make defined steps function public --------- Co-authored-by: Restyled.io --- src/python_testing/matter_testing_support.py | 8 +- .../test_plan_table_generator.py | 95 +++++++++++++++++++ 2 files changed, 99 insertions(+), 4 deletions(-) create mode 100755 src/python_testing/test_plan_table_generator.py diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index 9ec12dca5fb081..4861cae7ea8c61 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -684,10 +684,10 @@ def get_test_steps(self, test: str) -> list[TestStep]: in order using self.step(number), where number is the test_plan_number from each TestStep. ''' - steps = self._get_defined_test_steps(test) + steps = self.get_defined_test_steps(test) return [TestStep(1, "Run entire test")] if steps is None else steps - def _get_defined_test_steps(self, test: str) -> list[TestStep]: + def get_defined_test_steps(self, test: str) -> list[TestStep]: steps_name = 'steps_' + test[5:] try: fn = getattr(self, steps_name) @@ -781,7 +781,7 @@ def setup_test(self): self.step_skipped = False if self.runner_hook and not self.is_commissioning: test_name = self.current_test_info.name - steps = self._get_defined_test_steps(test_name) + steps = self.get_defined_test_steps(test_name) num_steps = 1 if steps is None else len(steps) filename = inspect.getfile(self.__class__) desc = self.get_test_desc(test_name) @@ -977,7 +977,7 @@ def on_pass(self, record): self.runner_hook.step_success(logger=None, logs=None, duration=step_duration, request=None) # TODO: this check could easily be annoying when doing dev. flag it somehow? Ditto with the in-order check - steps = self._get_defined_test_steps(record.test_name) + steps = self.get_defined_test_steps(record.test_name) if steps is None: # if we don't have a list of steps, assume they were all run all_steps_run = True diff --git a/src/python_testing/test_plan_table_generator.py b/src/python_testing/test_plan_table_generator.py new file mode 100755 index 00000000000000..bed4fa3eaa747e --- /dev/null +++ b/src/python_testing/test_plan_table_generator.py @@ -0,0 +1,95 @@ +#!/usr/bin/env -S python3 -B +# +# Copyright (c) 2024 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. +# +import importlib +import logging +import os +import sys +from pathlib import Path + +import click +from matter_testing_support import MatterTestConfig, generate_mobly_test_config + + +def indent_multiline(multiline: str, num_spaces: int) -> str: + ''' Indents subsequent lines of a multiline string by num_spaces spaces''' + s = multiline.split('\n') + s = [(num_spaces * ' ' + line.lstrip()).rstrip() for line in s] + return '\n'.join(s).lstrip() + + +@click.command() +@click.argument('filename', type=click.Path(exists=True)) +@click.argument('classname', type=str) +@click.argument('test', type=str) +def main(filename, classname, test): + ''' + This script generates the Test Procedure table for the test plans document + from the python script steps. In order to use this generator, the test + automation script conform to the following requirements: + + - automated in python\n + - test implements the steps_ function to provide steps information to the TH\n + - TestStep list returned from the steps_ function includes both description and expectation fields\n + - test does not gate any steps on PICS (top level PICS ok)\n + + + Usage: test_plan_table_generator.py filename classname test + + filename - name of the file where the test is automated\n + classname - name of the MatterBaseTest class\n + test - name of the test to generate the table for (include the test_ portion)\n + ''' + try: + module = importlib.import_module(Path(os.path.basename(filename)).stem) + except ModuleNotFoundError: + logging.error(f'Unable to load python module from {filename}. Please ensure this is a valid python file path') + return -1 + + try: + test_class = getattr(module, classname) + except AttributeError: + logging.error(f'Unable to load the test class {classname}. Please ensure this class is implemented in {filename}') + return -1 + + config = generate_mobly_test_config(MatterTestConfig()) + test_instance = test_class(config) + steps = test_instance.get_defined_test_steps(test) + if not steps: + logging.error(f'Unable to find steps for test {test}. Please ensure the steps_ function is implemented') + return -1 + + indent = 6 + header_num = f'{"**#**":<{indent}}' + header_num_step = f'|{header_num} |*TestStep* ' + s = ('[cols="5%,45%,45%"]\n' + '|===\n' + f'{header_num_step}|*Expected Outcome*\n') + for step in steps: + step_num = f'|{step.test_plan_number:<{indent}}a|' + s += f'{step_num}{indent_multiline(step.description, len(step_num))}\n' + + padding = (len(header_num_step) - 1) * ' ' + # add 2 to indent for a| at start + s += f'{padding}a|{indent_multiline(step.expectation, len(padding)+2)}\n\n' + s += '|===\n' + + print(s) + + +if __name__ == "__main__": + sys.exit(main()) From 29cfb7f1201f8fff2fe54b3dc8b61b50c579d4b4 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 26 Apr 2024 12:18:42 -0400 Subject: [PATCH 32/40] [Chore] Convert chip::Optional to std::optional for dnssd/types.h (#33179) * Replace some chip Optional with std::optional * Restyle * a few more updates * Also fix RemoteDataLogger.cpp * Code review feedback: added some bracketing * Re-do the bracketing * Fix some of the unchecked optional access warnings * Also fix TestIncrementalResolve * Fix Commissionable script binding * Fix more files * Restyle --------- Co-authored-by: Andrei Litvin --- .../commands/common/RemoteDataModelLogger.cpp | 16 +- src/controller/SetUpCodePairer.cpp | 8 +- ...issionableNodeController-ScriptBinding.cpp | 16 +- .../python/ChipDeviceController-Discovery.cpp | 39 ++-- .../AddressResolve_DefaultImpl.cpp | 4 +- src/lib/dnssd/TxtFields.cpp | 18 +- src/lib/dnssd/Types.h | 50 +++--- .../dnssd/tests/TestIncrementalResolve.cpp | 10 +- src/lib/dnssd/tests/TestTxtFields.cpp | 166 ++++++++---------- src/lib/shell/commands/Dns.cpp | 20 +-- 10 files changed, 173 insertions(+), 174 deletions(-) diff --git a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp index 9a996051957ccf..9e4f29c5534757 100644 --- a/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp +++ b/examples/chip-tool/commands/common/RemoteDataModelLogger.cpp @@ -245,24 +245,24 @@ CHIP_ERROR LogDiscoveredNodeData(const chip::Dnssd::CommissionNodeData & nodeDat value["port"] = resolutionData.port; value["numIPs"] = static_cast(resolutionData.numIPs); - if (resolutionData.mrpRetryIntervalIdle.HasValue()) + if (resolutionData.mrpRetryIntervalIdle.has_value()) { - value["mrpRetryIntervalIdle"] = resolutionData.mrpRetryIntervalIdle.Value().count(); + value["mrpRetryIntervalIdle"] = resolutionData.mrpRetryIntervalIdle->count(); } - if (resolutionData.mrpRetryIntervalActive.HasValue()) + if (resolutionData.mrpRetryIntervalActive.has_value()) { - value["mrpRetryIntervalActive"] = resolutionData.mrpRetryIntervalActive.Value().count(); + value["mrpRetryIntervalActive"] = resolutionData.mrpRetryIntervalActive->count(); } - if (resolutionData.mrpRetryActiveThreshold.HasValue()) + if (resolutionData.mrpRetryActiveThreshold.has_value()) { - value["mrpRetryActiveThreshold"] = resolutionData.mrpRetryActiveThreshold.Value().count(); + value["mrpRetryActiveThreshold"] = resolutionData.mrpRetryActiveThreshold->count(); } - if (resolutionData.isICDOperatingAsLIT.HasValue()) + if (resolutionData.isICDOperatingAsLIT.has_value()) { - value["isICDOperatingAsLIT"] = resolutionData.isICDOperatingAsLIT.Value(); + value["isICDOperatingAsLIT"] = *(resolutionData.isICDOperatingAsLIT); } Json::Value rootValue; diff --git a/src/controller/SetUpCodePairer.cpp b/src/controller/SetUpCodePairer.cpp index c3aecbfdd36f66..cf7ba2abd43d89 100644 --- a/src/controller/SetUpCodePairer.cpp +++ b/src/controller/SetUpCodePairer.cpp @@ -620,14 +620,14 @@ SetUpCodePairerParameters::SetUpCodePairerParameters(const Dnssd::CommonResoluti auto & ip = data.ipAddress[index]; SetPeerAddress(Transport::PeerAddress::UDP(ip, data.port, ip.IsIPv6LinkLocal() ? data.interfaceId : Inet::InterfaceId::Null())); - if (data.mrpRetryIntervalIdle.HasValue()) + if (data.mrpRetryIntervalIdle.has_value()) { - SetIdleInterval(data.mrpRetryIntervalIdle.Value()); + SetIdleInterval(*data.mrpRetryIntervalIdle); } - if (data.mrpRetryIntervalActive.HasValue()) + if (data.mrpRetryIntervalActive.has_value()) { - SetActiveInterval(data.mrpRetryIntervalActive.Value()); + SetActiveInterval(*data.mrpRetryIntervalActive); } } diff --git a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp index 6df32c6940667a..157789f5d64136 100644 --- a/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp +++ b/src/controller/python/ChipCommissionableNodeController-ScriptBinding.cpp @@ -97,17 +97,21 @@ void pychip_CommissionableNodeController_PrintDiscoveredCommissioners( ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->pairingInstruction); ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->pairingHint); - if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) + + auto idleInterval = dnsSdInfo->GetMrpRetryIntervalIdle(); + if (idleInterval.has_value()) { - ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", dnsSdInfo->GetMrpRetryIntervalIdle().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", idleInterval->count()); } else { ChipLogProgress(Discovery, "\tMrp Interval idle\tNot present"); } - if (dnsSdInfo->GetMrpRetryIntervalActive().HasValue()) + + auto activeInterval = dnsSdInfo->GetMrpRetryIntervalIdle(); + if (activeInterval.has_value()) { - ChipLogProgress(Discovery, "\tMrp Interval active\t%u", dnsSdInfo->GetMrpRetryIntervalActive().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval active\t%u", activeInterval->count()); } else { @@ -115,9 +119,9 @@ void pychip_CommissionableNodeController_PrintDiscoveredCommissioners( } ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->supportsTcp); - if (dnsSdInfo->isICDOperatingAsLIT.HasValue()) + if (dnsSdInfo->isICDOperatingAsLIT.has_value()) { - ChipLogProgress(Discovery, "\tICD is operating as a\t%s", dnsSdInfo->isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + ChipLogProgress(Discovery, "\tICD is operating as a\t%s", *(dnsSdInfo->isICDOperatingAsLIT) ? "LIT" : "SIT"); } for (unsigned j = 0; j < dnsSdInfo->numIPs; ++j) diff --git a/src/controller/python/ChipDeviceController-Discovery.cpp b/src/controller/python/ChipDeviceController-Discovery.cpp index b7589791b41eab..4ad6db56bf6739 100644 --- a/src/controller/python/ChipDeviceController-Discovery.cpp +++ b/src/controller/python/ChipDeviceController-Discovery.cpp @@ -124,17 +124,23 @@ void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::De jsonVal["deviceName"] = dnsSdInfo->deviceName; jsonVal["pairingInstruction"] = dnsSdInfo->pairingInstruction; jsonVal["pairingHint"] = dnsSdInfo->pairingHint; - if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) + + auto idleInterval = dnsSdInfo->GetMrpRetryIntervalIdle(); + if (idleInterval.has_value()) { - jsonVal["mrpRetryIntervalIdle"] = dnsSdInfo->GetMrpRetryIntervalIdle().Value().count(); + jsonVal["mrpRetryIntervalIdle"] = idleInterval->count(); } - if (dnsSdInfo->GetMrpRetryIntervalActive().HasValue()) + + auto activeInterval = dnsSdInfo->GetMrpRetryIntervalActive(); + if (activeInterval.has_value()) { - jsonVal["mrpRetryIntervalActive"] = dnsSdInfo->GetMrpRetryIntervalActive().Value().count(); + jsonVal["mrpRetryIntervalActive"] = activeInterval->count(); } - if (dnsSdInfo->GetMrpRetryActiveThreshold().HasValue()) + + auto activeThreshold = dnsSdInfo->GetMrpRetryActiveThreshold(); + if (activeThreshold.has_value()) { - jsonVal["mrpRetryActiveThreshold"] = dnsSdInfo->GetMrpRetryActiveThreshold().Value().count(); + jsonVal["mrpRetryActiveThreshold"] = activeThreshold->count(); } jsonVal["supportsTcp"] = dnsSdInfo->supportsTcp; { @@ -147,9 +153,9 @@ void pychip_DeviceController_IterateDiscoveredCommissionableNodes(Controller::De } jsonVal["addresses"] = addresses; } - if (dnsSdInfo->isICDOperatingAsLIT.HasValue()) + if (dnsSdInfo->isICDOperatingAsLIT.has_value()) { - jsonVal["isICDOperatingAsLIT"] = dnsSdInfo->isICDOperatingAsLIT.Value(); + jsonVal["isICDOperatingAsLIT"] = *(dnsSdInfo->isICDOperatingAsLIT); } if (dnsSdInfo->rotatingIdLen > 0) { @@ -188,26 +194,31 @@ void pychip_DeviceController_PrintDiscoveredDevices(Controller::DeviceCommission ChipLogProgress(Discovery, "\tRotating Id\t\t%s", rotatingId); ChipLogProgress(Discovery, "\tPairing Instruction\t%s", dnsSdInfo->pairingInstruction); ChipLogProgress(Discovery, "\tPairing Hint\t\t%u", dnsSdInfo->pairingHint); - if (dnsSdInfo->GetMrpRetryIntervalIdle().HasValue()) + + auto idleInterval = dnsSdInfo->GetMrpRetryIntervalIdle(); + if (idleInterval.has_value()) { - ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", dnsSdInfo->GetMrpRetryIntervalIdle().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval idle\t%u", idleInterval->count()); } else { ChipLogProgress(Discovery, "\tMrp Interval idle\tNot present"); } - if (dnsSdInfo->GetMrpRetryIntervalActive().HasValue()) + + auto activeInterval = dnsSdInfo->GetMrpRetryIntervalActive(); + if (activeInterval.has_value()) { - ChipLogProgress(Discovery, "\tMrp Interval active\t%u", dnsSdInfo->GetMrpRetryIntervalActive().Value().count()); + ChipLogProgress(Discovery, "\tMrp Interval active\t%u", activeInterval->count()); } else { ChipLogProgress(Discovery, "\tMrp Interval active\tNot present"); } + ChipLogProgress(Discovery, "\tSupports TCP\t\t%d", dnsSdInfo->supportsTcp); - if (dnsSdInfo->isICDOperatingAsLIT.HasValue()) + if (dnsSdInfo->isICDOperatingAsLIT.has_value()) { - ChipLogProgress(Discovery, "\tICD is operating as a\t%s", dnsSdInfo->isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + ChipLogProgress(Discovery, "\tICD is operating as a\t%s", *(dnsSdInfo->isICDOperatingAsLIT) ? "LIT" : "SIT"); } for (unsigned j = 0; j < dnsSdInfo->numIPs; ++j) { diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp index 6e461a4b99c72d..5a9651ff76ba3d 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp @@ -290,9 +290,9 @@ void Resolver::OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeDat result.mrpRemoteConfig = nodeData.resolutionData.GetRemoteMRPConfig(); result.supportsTcp = nodeData.resolutionData.supportsTcp; - if (nodeData.resolutionData.isICDOperatingAsLIT.HasValue()) + if (nodeData.resolutionData.isICDOperatingAsLIT.has_value()) { - result.isICDOperatingAsLIT = nodeData.resolutionData.isICDOperatingAsLIT.Value(); + result.isICDOperatingAsLIT = *(nodeData.resolutionData.isICDOperatingAsLIT); } for (size_t i = 0; i < nodeData.resolutionData.numIPs; i++) diff --git a/src/lib/dnssd/TxtFields.cpp b/src/lib/dnssd/TxtFields.cpp index 88a116871ca017..6ac2cfa19e8ece 100644 --- a/src/lib/dnssd/TxtFields.cpp +++ b/src/lib/dnssd/TxtFields.cpp @@ -105,14 +105,14 @@ bool MakeBoolFromAsciiDecimal(const ByteSpan & val) return val.size() == 1 && static_cast(*val.data()) == '1'; } -Optional MakeOptionalBoolFromAsciiDecimal(const ByteSpan & val) +std::optional MakeOptionalBoolFromAsciiDecimal(const ByteSpan & val) { char character = static_cast(*val.data()); if (val.size() == 1 && ((character == '1') || (character == '0'))) { - return MakeOptional(character == '1'); + return std::make_optional(character == '1'); } - return NullOptional; + return std::nullopt; } size_t GetPlusSignIdx(const ByteSpan & value) @@ -188,27 +188,27 @@ uint8_t GetCommissionerPasscode(const ByteSpan & value) return MakeBoolFromAsciiDecimal(value); } -Optional GetRetryInterval(const ByteSpan & value) +std::optional GetRetryInterval(const ByteSpan & value) { const auto undefined = std::numeric_limits::max(); const auto retryInterval = MakeU32FromAsciiDecimal(value, undefined); if (retryInterval != undefined && retryInterval <= kMaxRetryInterval.count()) - return MakeOptional(System::Clock::Milliseconds32(retryInterval)); + return std::make_optional(System::Clock::Milliseconds32(retryInterval)); - return NullOptional; + return std::nullopt; } -Optional GetRetryActiveThreshold(const ByteSpan & value) +std::optional GetRetryActiveThreshold(const ByteSpan & value) { const auto retryInterval = MakeU16FromAsciiDecimal(value); if (retryInterval == 0) { - return NullOptional; + return std::nullopt; } - return MakeOptional(System::Clock::Milliseconds16(retryInterval)); + return std::make_optional(System::Clock::Milliseconds16(retryInterval)); } TxtFieldKey GetTxtFieldKey(const ByteSpan & key) diff --git a/src/lib/dnssd/Types.h b/src/lib/dnssd/Types.h index e62c9a52418efe..c88dd0a9c73522 100644 --- a/src/lib/dnssd/Types.h +++ b/src/lib/dnssd/Types.h @@ -19,10 +19,10 @@ #include #include +#include #include #include -#include #include #include #include @@ -91,10 +91,10 @@ struct CommonResolutionData uint16_t port = 0; char hostName[kHostNameMaxLength + 1] = {}; bool supportsTcp = false; - Optional isICDOperatingAsLIT; - Optional mrpRetryIntervalIdle; - Optional mrpRetryIntervalActive; - Optional mrpRetryActiveThreshold; + std::optional isICDOperatingAsLIT; + std::optional mrpRetryIntervalIdle; + std::optional mrpRetryIntervalActive; + std::optional mrpRetryActiveThreshold; CommonResolutionData() { Reset(); } @@ -103,21 +103,21 @@ struct CommonResolutionData ReliableMessageProtocolConfig GetRemoteMRPConfig() const { const ReliableMessageProtocolConfig defaultConfig = GetDefaultMRPConfig(); - return ReliableMessageProtocolConfig(GetMrpRetryIntervalIdle().ValueOr(defaultConfig.mIdleRetransTimeout), - GetMrpRetryIntervalActive().ValueOr(defaultConfig.mActiveRetransTimeout), - GetMrpRetryActiveThreshold().ValueOr(defaultConfig.mActiveThresholdTime)); + return ReliableMessageProtocolConfig(GetMrpRetryIntervalIdle().value_or(defaultConfig.mIdleRetransTimeout), + GetMrpRetryIntervalActive().value_or(defaultConfig.mActiveRetransTimeout), + GetMrpRetryActiveThreshold().value_or(defaultConfig.mActiveThresholdTime)); } - Optional GetMrpRetryIntervalIdle() const { return mrpRetryIntervalIdle; } - Optional GetMrpRetryIntervalActive() const { return mrpRetryIntervalActive; } - Optional GetMrpRetryActiveThreshold() const { return mrpRetryActiveThreshold; } + std::optional GetMrpRetryIntervalIdle() const { return mrpRetryIntervalIdle; } + std::optional GetMrpRetryIntervalActive() const { return mrpRetryIntervalActive; } + std::optional GetMrpRetryActiveThreshold() const { return mrpRetryActiveThreshold; } bool IsDeviceTreatedAsSleepy(const ReliableMessageProtocolConfig * defaultMRPConfig) const { // If either session interval (Idle - SII, Active - SAI) 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) - return (mrpRetryIntervalIdle.HasValue() && (mrpRetryIntervalIdle.Value() > defaultMRPConfig->mIdleRetransTimeout)) || - (mrpRetryIntervalActive.HasValue() && (mrpRetryIntervalActive.Value() > defaultMRPConfig->mActiveRetransTimeout)); + return (mrpRetryIntervalIdle.has_value() && (*mrpRetryIntervalIdle > defaultMRPConfig->mIdleRetransTimeout)) || + (mrpRetryIntervalActive.has_value() && (*mrpRetryIntervalActive > defaultMRPConfig->mActiveRetransTimeout)); } bool IsHost(const char * host) const { return strcmp(host, hostName) == 0; } @@ -125,10 +125,10 @@ struct CommonResolutionData void Reset() { memset(hostName, 0, sizeof(hostName)); - mrpRetryIntervalIdle = NullOptional; - mrpRetryIntervalActive = NullOptional; - mrpRetryActiveThreshold = NullOptional; - isICDOperatingAsLIT = NullOptional; + mrpRetryIntervalIdle = std::nullopt; + mrpRetryIntervalActive = std::nullopt; + mrpRetryActiveThreshold = std::nullopt; + isICDOperatingAsLIT = std::nullopt; numIPs = 0; port = 0; supportsTcp = false; @@ -157,34 +157,34 @@ struct CommonResolutionData { ChipLogDetail(Discovery, "\tPort: %u", port); } - if (mrpRetryIntervalIdle.HasValue()) + if (mrpRetryIntervalIdle.has_value()) { - ChipLogDetail(Discovery, "\tMrp Interval idle: %" PRIu32 " ms", mrpRetryIntervalIdle.Value().count()); + ChipLogDetail(Discovery, "\tMrp Interval idle: %" PRIu32 " ms", mrpRetryIntervalIdle->count()); } else { ChipLogDetail(Discovery, "\tMrp Interval idle: not present"); } - if (mrpRetryIntervalActive.HasValue()) + if (mrpRetryIntervalActive.has_value()) { - ChipLogDetail(Discovery, "\tMrp Interval active: %" PRIu32 " ms", mrpRetryIntervalActive.Value().count()); + ChipLogDetail(Discovery, "\tMrp Interval active: %" PRIu32 " ms", mrpRetryIntervalActive->count()); } else { ChipLogDetail(Discovery, "\tMrp Interval active: not present"); } - if (mrpRetryActiveThreshold.HasValue()) + if (mrpRetryActiveThreshold.has_value()) { - ChipLogDetail(Discovery, "\tMrp Active Threshold: %u ms", mrpRetryActiveThreshold.Value().count()); + ChipLogDetail(Discovery, "\tMrp Active Threshold: %u ms", mrpRetryActiveThreshold->count()); } else { ChipLogDetail(Discovery, "\tMrp Active Threshold: not present"); } ChipLogDetail(Discovery, "\tTCP Supported: %d", supportsTcp); - if (isICDOperatingAsLIT.HasValue()) + if (isICDOperatingAsLIT.has_value()) { - ChipLogDetail(Discovery, "\tThe ICD operates in %s", isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + ChipLogDetail(Discovery, "\tThe ICD operates in %s", *isICDOperatingAsLIT ? "LIT" : "SIT"); } else { diff --git a/src/lib/dnssd/tests/TestIncrementalResolve.cpp b/src/lib/dnssd/tests/TestIncrementalResolve.cpp index 5ed4191319e824..0b5f26abbcd405 100644 --- a/src/lib/dnssd/tests/TestIncrementalResolve.cpp +++ b/src/lib/dnssd/tests/TestIncrementalResolve.cpp @@ -307,9 +307,8 @@ TEST(TestIncrementalResolve, TestParseOperational) EXPECT_EQ(nodeData.resolutionData.numIPs, 1u); EXPECT_EQ(nodeData.resolutionData.port, 0x1234); EXPECT_FALSE(nodeData.resolutionData.supportsTcp); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle().Value(), chip::System::Clock::Milliseconds32(23)); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle(), std::make_optional(chip::System::Clock::Milliseconds32(23))); Inet::IPAddress addr; EXPECT_TRUE(Inet::IPAddress::FromString("fe80::abcd:ef11:2233:4455", addr)); @@ -396,9 +395,8 @@ TEST(TestIncrementalResolve, TestParseCommissionable) EXPECT_EQ(nodeData.numIPs, 2u); EXPECT_EQ(nodeData.port, 0x1234); EXPECT_FALSE(nodeData.supportsTcp); - EXPECT_TRUE(nodeData.GetMrpRetryIntervalActive().HasValue()); - EXPECT_EQ(nodeData.GetMrpRetryIntervalActive().Value(), chip::System::Clock::Milliseconds32(321)); - EXPECT_FALSE(nodeData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_EQ(nodeData.GetMrpRetryIntervalActive(), std::make_optional(chip::System::Clock::Milliseconds32(321))); + EXPECT_FALSE(nodeData.GetMrpRetryIntervalIdle().has_value()); Inet::IPAddress addr; EXPECT_TRUE(Inet::IPAddress::FromString("fe80::abcd:ef11:2233:4455", addr)); diff --git a/src/lib/dnssd/tests/TestTxtFields.cpp b/src/lib/dnssd/tests/TestTxtFields.cpp index ce206e34ae46aa..b80f1c0682ef32 100644 --- a/src/lib/dnssd/tests/TestTxtFields.cpp +++ b/src/lib/dnssd/tests/TestTxtFields.cpp @@ -304,9 +304,9 @@ bool NodeDataIsEmpty(const CommissionNodeData & node) { if (node.longDiscriminator != 0 || node.vendorId != 0 || node.productId != 0 || node.commissioningMode != 0 || - node.deviceType != 0 || node.rotatingIdLen != 0 || node.pairingHint != 0 || node.mrpRetryIntervalIdle.HasValue() || - node.mrpRetryIntervalActive.HasValue() || node.mrpRetryActiveThreshold.HasValue() || node.isICDOperatingAsLIT.HasValue() || - node.supportsTcp || node.supportsCommissionerGeneratedPasscode != 0) + node.deviceType != 0 || node.rotatingIdLen != 0 || node.pairingHint != 0 || node.mrpRetryIntervalIdle.has_value() || + node.mrpRetryIntervalActive.has_value() || node.mrpRetryActiveThreshold.has_value() || + node.isICDOperatingAsLIT.has_value() || node.supportsTcp || node.supportsCommissionerGeneratedPasscode != 0) { return false; } @@ -411,39 +411,39 @@ TEST(TestTxtFields, TestFillDiscoveredNodeDataFromTxt) bool NodeDataIsEmpty(const ResolvedNodeData & nodeData) { return nodeData.operationalData.peerId == PeerId{} && nodeData.resolutionData.numIPs == 0 && - nodeData.resolutionData.port == 0 && !nodeData.resolutionData.mrpRetryIntervalIdle.HasValue() && - !nodeData.resolutionData.mrpRetryIntervalActive.HasValue() && !nodeData.resolutionData.supportsTcp && - !nodeData.resolutionData.isICDOperatingAsLIT.HasValue(); + nodeData.resolutionData.port == 0 && !nodeData.resolutionData.mrpRetryIntervalIdle.has_value() && + !nodeData.resolutionData.mrpRetryIntervalActive.has_value() && !nodeData.resolutionData.supportsTcp && + !nodeData.resolutionData.isICDOperatingAsLIT.has_value(); } void ResetRetryIntervalIdle(DiscoveredNodeData & nodeData) { - nodeData.Get().mrpRetryIntervalIdle.ClearValue(); + nodeData.Get().mrpRetryIntervalIdle.reset(); } void ResetRetryIntervalIdle(ResolvedNodeData & nodeData) { - nodeData.resolutionData.mrpRetryIntervalIdle.ClearValue(); + nodeData.resolutionData.mrpRetryIntervalIdle.reset(); } void ResetRetryIntervalActive(DiscoveredNodeData & nodeData) { - nodeData.Get().mrpRetryIntervalActive.ClearValue(); + nodeData.Get().mrpRetryIntervalActive.reset(); } void ResetRetryIntervalActive(ResolvedNodeData & nodeData) { - nodeData.resolutionData.mrpRetryIntervalActive.ClearValue(); + nodeData.resolutionData.mrpRetryIntervalActive.reset(); } void ResetRetryActiveThreshold(DiscoveredNodeData & nodeData) { - nodeData.Get().mrpRetryActiveThreshold.ClearValue(); + nodeData.Get().mrpRetryActiveThreshold.reset(); } void ResetRetryActiveThreshold(ResolvedNodeData & nodeData) { - nodeData.resolutionData.mrpRetryActiveThreshold.ClearValue(); + nodeData.resolutionData.mrpRetryActiveThreshold.reset(); } template @@ -459,15 +459,13 @@ void DiscoveredTxtFieldSessionIdleInterval() strcpy(key, "SII"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().Value() == 1_ms32); + EXPECT_EQ(nodeData.Get().GetMrpRetryIntervalIdle(), std::make_optional(1_ms32)); // Maximum strcpy(key, "SII"); strcpy(val, "3600000"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalIdle().Value() == 3600000_ms32); + EXPECT_EQ(nodeData.Get().GetMrpRetryIntervalIdle(), std::make_optional(3600000_ms32)); // Test no other fields were populated ResetRetryIntervalIdle(nodeData); @@ -477,37 +475,37 @@ void DiscoveredTxtFieldSessionIdleInterval() strcpy(key, "SII"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalIdle().has_value()); // Invalid SII - greater than maximum strcpy(key, "SII"); strcpy(val, "3600001"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalIdle().has_value()); // Invalid SII - much greater than maximum strcpy(key, "SII"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalIdle().has_value()); // Invalid SII - hexadecimal value strcpy(key, "SII"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalIdle().has_value()); // Invalid SII - leading zeros strcpy(key, "SII"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalIdle().has_value()); // Invalid SII - text at the end strcpy(key, "SII"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalIdle().has_value()); } // Test SAI (formerly CRA) @@ -524,15 +522,13 @@ void DiscoveredTxtFieldSessionActiveInterval() strcpy(key, "SAI"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().HasValue()); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().Value() == 1_ms32); + EXPECT_EQ(nodeData.Get().GetMrpRetryIntervalActive(), std::make_optional(1_ms32)); // Maximum strcpy(key, "SAI"); strcpy(val, "3600000"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().HasValue()); - EXPECT_TRUE(nodeData.Get().GetMrpRetryIntervalActive().Value() == 3600000_ms32); + EXPECT_EQ(nodeData.Get().GetMrpRetryIntervalActive(), std::make_optional(3600000_ms32)); // Test no other fields were populated ResetRetryIntervalActive(nodeData); @@ -542,37 +538,37 @@ void DiscoveredTxtFieldSessionActiveInterval() strcpy(key, "SAI"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalActive().has_value()); // Invalid SAI - greater than maximum strcpy(key, "SAI"); strcpy(val, "3600001"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalActive().has_value()); // Invalid SAI - much greater than maximum strcpy(key, "SAI"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalActive().has_value()); // Invalid SAI - hexadecimal value strcpy(key, "SAI"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalActive().has_value()); // Invalid SAI - leading zeros strcpy(key, "SAI"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalActive().has_value()); // Invalid SAI - text at the end strcpy(key, "SAI"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryIntervalActive().has_value()); } // Test SAT (Session Active Threshold) @@ -589,15 +585,13 @@ void DiscoveredTxtFieldSessionActiveThreshold() strcpy(key, "SAT"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); - EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().Value() == 1_ms16); + EXPECT_EQ(nodeData.Get().GetMrpRetryActiveThreshold(), std::make_optional(1_ms16)); // Maximum strcpy(key, "SAT"); strcpy(val, "65535"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); - EXPECT_TRUE(nodeData.Get().GetMrpRetryActiveThreshold().Value() == 65535_ms16); + EXPECT_EQ(nodeData.Get().GetMrpRetryActiveThreshold(), std::make_optional(65535_ms16)); // Test no other fields were populated ResetRetryActiveThreshold(nodeData); @@ -607,37 +601,37 @@ void DiscoveredTxtFieldSessionActiveThreshold() strcpy(key, "SAT"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryActiveThreshold().has_value()); // Invalid SAI - greater than maximum strcpy(key, "SAT"); strcpy(val, "65536"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - much greater than maximum strcpy(key, "SAT"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - hexadecimal value strcpy(key, "SAT"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - leading zeros strcpy(key, "SAT"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - text at the end strcpy(key, "SAT"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.Get().GetMrpRetryActiveThreshold().has_value()); } // Test T (TCP support) @@ -687,27 +681,25 @@ void DiscoveredTxtFieldICDoperatesAsLIT() strcpy(key, "ICD"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.HasValue()); - EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.Value()); + EXPECT_EQ(nodeData.Get().isICDOperatingAsLIT, std::make_optional(true)); // Test no other fields were populated - nodeData.Get().isICDOperatingAsLIT.ClearValue(); + nodeData.Get().isICDOperatingAsLIT.reset(); EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); // ICD is operating as a SIT device strcpy(key, "ICD"); strcpy(val, "0"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.HasValue()); - EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.Value() == false); + EXPECT_EQ(nodeData.Get().isICDOperatingAsLIT, std::make_optional(false)); - nodeData.Get().isICDOperatingAsLIT.ClearValue(); + nodeData.Get().isICDOperatingAsLIT.reset(); EXPECT_TRUE(NodeDataIsEmpty(nodeData.Get())); // Invalid value, No key set strcpy(key, "ICD"); strcpy(val, "asdf"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(nodeData.Get().isICDOperatingAsLIT.HasValue() == false); + EXPECT_FALSE(nodeData.Get().isICDOperatingAsLIT.has_value()); } // Test IsDeviceTreatedAsSleepy() with CRI @@ -723,13 +715,13 @@ void DiscoveredTestIsDeviceSessionIdle() CommonResolutionData & resolutionData = nodeData.Get(); // No key/val set, so the device can't be sleepy - EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + EXPECT_FALSE(nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is the default value, the device is not sleepy strcpy(key, "SII"); sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_LOCAL_IDLE_RETRY_INTERVAL.count())); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + EXPECT_FALSE(nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is greater than the default value, the device is sleepy sprintf(key, "SII"); @@ -751,13 +743,13 @@ void DiscoveredTestIsDeviceSessionActive() CommonResolutionData & resolutionData = nodeData.Get(); // No key/val set, so the device can't be sleepy - EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + EXPECT_FALSE(nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is the default value, the device is not sleepy sprintf(key, "SAI"); sprintf(val, "%d", static_cast(CHIP_CONFIG_MRP_LOCAL_ACTIVE_RETRY_INTERVAL.count())); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), resolutionData); - EXPECT_TRUE(!nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); + EXPECT_FALSE(nodeData.Get().IsDeviceTreatedAsSleepy(&defaultMRPConfig)); // If the interval is greater than the default value, the device is sleepy strcpy(key, "SAI"); @@ -778,15 +770,13 @@ void TxtFieldSessionIdleInterval() strcpy(key, "SII"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle().Value(), 1_ms32); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle(), std::make_optional(1_ms32)); // Maximum strcpy(key, "SII"); strcpy(val, "3600000"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle().Value(), 3600000_ms32); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalIdle(), std::make_optional(3600000_ms32)); // Test no other fields were populated ResetRetryIntervalIdle(nodeData); @@ -796,37 +786,37 @@ void TxtFieldSessionIdleInterval() strcpy(key, "SII"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().has_value()); // Invalid SII - greater than maximum strcpy(key, "SII"); strcpy(val, "3600001"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().has_value()); // Invalid SII - much greater than maximum strcpy(key, "SII"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().has_value()); // Invalid SII - hexadecimal value strcpy(key, "SII"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().has_value()); // Invalid SII - leading zeros strcpy(key, "SII"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().has_value()); // Invalid SII - text at the end strcpy(key, "SII"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalIdle().has_value()); } TEST(TestTxtFields, TxtDiscoveredFieldMrpRetryIntervalIdle) @@ -851,15 +841,13 @@ void TxtFieldSessionActiveInterval() strcpy(key, "SAI"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalActive().Value(), 1_ms32); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalActive(), std::make_optional(1_ms32)); // Maximum strcpy(key, "SAI"); strcpy(val, "3600000"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalActive().Value(), 3600000_ms32); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryIntervalActive(), std::make_optional(3600000_ms32)); // Test no other fields were populated ResetRetryIntervalActive(nodeData); @@ -869,37 +857,37 @@ void TxtFieldSessionActiveInterval() strcpy(key, "SAI"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); // Invalid SAI - greater than maximum strcpy(key, "SAI"); strcpy(val, "3600001"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); // Invalid SAI - much greater than maximum strcpy(key, "SAI"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); // Invalid SAI - hexadecimal value strcpy(key, "SAI"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); // Invalid SAI - leading zeros strcpy(key, "SAI"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); // Invalid SAI - text at the end strcpy(key, "SAI"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryIntervalActive().has_value()); } TEST(TestTxtFields, TxtDiscoveredFieldMrpRetryIntervalActive) @@ -924,15 +912,13 @@ void TxtFieldSessionActiveThreshold() strcpy(key, "SAT"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryActiveThreshold().Value(), 1_ms16); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryActiveThreshold(), std::make_optional(1_ms16)); // Maximum strcpy(key, "SAT"); strcpy(val, "65535"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); - EXPECT_EQ(nodeData.resolutionData.GetMrpRetryActiveThreshold().Value(), 65535_ms16); + EXPECT_EQ(nodeData.resolutionData.GetMrpRetryActiveThreshold(), std::make_optional(65535_ms16)); // Test no other fields were populated ResetRetryActiveThreshold(nodeData); @@ -942,37 +928,37 @@ void TxtFieldSessionActiveThreshold() strcpy(key, "SAT"); strcpy(val, "-1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().has_value()); // Invalid SAI - greater than maximum strcpy(key, "SAT"); strcpy(val, "65536"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - much greater than maximum strcpy(key, "SAT"); strcpy(val, "1095216660481"); // 0xFF00000001 == 1 (mod 2^32) FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - hexadecimal value strcpy(key, "SAT"); strcpy(val, "0x20"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - leading zeros strcpy(key, "SAT"); strcpy(val, "0700"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().has_value()); // Invalid SAT - text at the end strcpy(key, "SAT"); strcpy(val, "123abc"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().HasValue()); + EXPECT_FALSE(nodeData.resolutionData.GetMrpRetryActiveThreshold().has_value()); } TEST(TestTxtFields, TxtDiscoveredFieldMrpRetryActiveThreshold) @@ -1038,27 +1024,27 @@ void TxtFieldICDoperatesAsLIT() strcpy(key, "ICD"); strcpy(val, "1"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.isICDOperatingAsLIT.HasValue()); - EXPECT_TRUE(nodeData.resolutionData.isICDOperatingAsLIT.Value()); + EXPECT_TRUE(nodeData.resolutionData.isICDOperatingAsLIT.has_value()); + EXPECT_TRUE(nodeData.resolutionData.isICDOperatingAsLIT.value_or(false)); // Test no other fields were populated - nodeData.resolutionData.isICDOperatingAsLIT.ClearValue(); + nodeData.resolutionData.isICDOperatingAsLIT.reset(); EXPECT_TRUE(NodeDataIsEmpty(nodeData)); // ICD is operating as a SIT device strcpy(key, "ICD"); strcpy(val, "0"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_TRUE(nodeData.resolutionData.isICDOperatingAsLIT.HasValue()); - EXPECT_EQ(nodeData.resolutionData.isICDOperatingAsLIT.Value(), false); + EXPECT_TRUE(nodeData.resolutionData.isICDOperatingAsLIT.has_value()); + EXPECT_EQ(nodeData.resolutionData.isICDOperatingAsLIT.value_or(true), false); - nodeData.resolutionData.isICDOperatingAsLIT.ClearValue(); + nodeData.resolutionData.isICDOperatingAsLIT.reset(); EXPECT_TRUE(NodeDataIsEmpty(nodeData)); // Invalid value, No key set strcpy(key, "ICD"); strcpy(val, "asdf"); FillNodeDataFromTxt(GetSpan(key), GetSpan(val), nodeData.resolutionData); - EXPECT_EQ(nodeData.resolutionData.isICDOperatingAsLIT.HasValue(), false); + EXPECT_EQ(nodeData.resolutionData.isICDOperatingAsLIT.has_value(), false); } TEST(TestTxtFields, TxtDiscoveredIsICDoperatingAsLIT) diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index 04d82313d7d3d4..7fac0186da912f 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -115,25 +115,25 @@ class DnsShellResolverDelegate : public Dnssd::DiscoverNodeDelegate, public Addr auto retryInterval = nodeData.GetMrpRetryIntervalIdle(); - if (retryInterval.HasValue()) - streamer_printf(streamer_get(), " MRP retry interval (idle): %" PRIu32 "ms\r\n", retryInterval.Value()); + if (retryInterval.has_value()) + streamer_printf(streamer_get(), " MRP retry interval (idle): %" PRIu32 "ms\r\n", *retryInterval); retryInterval = nodeData.GetMrpRetryIntervalActive(); - if (retryInterval.HasValue()) - streamer_printf(streamer_get(), " MRP retry interval (active): %" PRIu32 "ms\r\n", retryInterval.Value()); + if (retryInterval.has_value()) + streamer_printf(streamer_get(), " MRP retry interval (active): %" PRIu32 "ms\r\n", *retryInterval); - if (nodeData.GetMrpRetryActiveThreshold().HasValue()) + auto activeThreshold = nodeData.GetMrpRetryActiveThreshold(); + + if (activeThreshold.has_value()) { - streamer_printf(streamer_get(), " MRP retry active threshold time: %" PRIu32 "ms\r\n", - nodeData.GetMrpRetryActiveThreshold().Value()); + streamer_printf(streamer_get(), " MRP retry active threshold time: %" PRIu32 "ms\r\n", *activeThreshold); } streamer_printf(streamer_get(), " Supports TCP: %s\r\n", nodeData.supportsTcp ? "yes" : "no"); - if (nodeData.isICDOperatingAsLIT.HasValue()) + if (nodeData.isICDOperatingAsLIT.has_value()) { - streamer_printf(streamer_get(), " ICD is operating as a: %s\r\n", - nodeData.isICDOperatingAsLIT.Value() ? "LIT" : "SIT"); + streamer_printf(streamer_get(), " ICD is operating as a: %s\r\n", *(nodeData.isICDOperatingAsLIT) ? "LIT" : "SIT"); } streamer_printf(streamer_get(), " IP addresses:\r\n"); for (size_t i = 0; i < nodeData.numIPs; i++) From 10886ac665d85eac19506eceb95fb68aca613991 Mon Sep 17 00:00:00 2001 From: Matthew Swartwout Date: Fri, 26 Apr 2024 10:00:07 -0700 Subject: [PATCH 33/40] Add equality operator to StatusIB (#33156) --- src/app/MessageDef/StatusIB.h | 10 +++++++++ src/app/tests/TestStatusIB.cpp | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/app/MessageDef/StatusIB.h b/src/app/MessageDef/StatusIB.h index 0dadccc58ee527..f5ade6cc71c628 100644 --- a/src/app/MessageDef/StatusIB.h +++ b/src/app/MessageDef/StatusIB.h @@ -117,5 +117,15 @@ struct StatusIB }; // struct StatusIB +constexpr bool operator==(const StatusIB & one, const StatusIB & two) +{ + return one.mStatus == two.mStatus && one.mClusterStatus == two.mClusterStatus; +} + +constexpr bool operator!=(const StatusIB & one, const StatusIB & two) +{ + return !(one == two); +} + }; // namespace app }; // namespace chip diff --git a/src/app/tests/TestStatusIB.cpp b/src/app/tests/TestStatusIB.cpp index 3eb47f438f67df..2e5f78f7da64f7 100644 --- a/src/app/tests/TestStatusIB.cpp +++ b/src/app/tests/TestStatusIB.cpp @@ -113,6 +113,44 @@ void TestStatusIBErrorToString(nlTestSuite * aSuite, void * aContext) } #endif // !CHIP_CONFIG_SHORT_ERROR_STR +void TestStatusIBEqualityOperator(nlTestSuite * aSuite, void * /*aContext*/) +{ + // Equality against self is true. + StatusIB one; + NL_TEST_ASSERT(aSuite, one == one); + + // Default constructors are equal. + NL_TEST_ASSERT(aSuite, one == StatusIB()); + + // Different imStatus is not equal. + StatusIB with_imstatus(Status::Failure); + NL_TEST_ASSERT(aSuite, one != with_imstatus); + + // Same imStatus are equal. + NL_TEST_ASSERT(aSuite, with_imstatus == StatusIB(Status::Failure)); + + // Same imStatus but different clusterStatus are not equal. + StatusIB with_cluster_status(Status::Failure, /*clusterStatus=*/2); + NL_TEST_ASSERT(aSuite, with_imstatus != with_cluster_status); + + // Different imStatus but same clusterStatus are not equal. + NL_TEST_ASSERT(aSuite, with_cluster_status != StatusIB(Status::Success, /*clusterStatus=*/2)); + + // Same imStatus and clusterStatus are equal. + NL_TEST_ASSERT(aSuite, with_cluster_status == StatusIB(Status::Failure, /*clusterStatus=*/2)); + + // From same CHIP_ERROR are equal. + StatusIB invalid_argument(CHIP_ERROR_INVALID_ARGUMENT); + NL_TEST_ASSERT(aSuite, invalid_argument == StatusIB(CHIP_ERROR_INVALID_ARGUMENT)); + + // Different CHIP_ERROR are equal if they are not from kIMClusterStatus or + // kIMGlobalStatus. + NL_TEST_ASSERT(aSuite, invalid_argument == StatusIB(CHIP_ERROR_INCORRECT_STATE)); + + // Error never equals NO_ERROR + NL_TEST_ASSERT(aSuite, invalid_argument != StatusIB(CHIP_NO_ERROR)); +} + // clang-format off const nlTest sTests[] = { @@ -120,6 +158,7 @@ const nlTest sTests[] = #if !CHIP_CONFIG_SHORT_ERROR_STR NL_TEST_DEF("StatusIBErrorToString", TestStatusIBErrorToString), #endif // !CHIP_CONFIG_SHORT_ERROR_STR + NL_TEST_DEF("StatusIBEqualityOperator", TestStatusIBEqualityOperator), NL_TEST_SENTINEL() }; // clang-format on From f141aebe1c76724b04c6be82bfea504f274204b3 Mon Sep 17 00:00:00 2001 From: Amine Alami <43780877+Alami-Amine@users.noreply.github.com> Date: Fri, 26 Apr 2024 20:02:53 +0200 Subject: [PATCH 34/40] pw_unit_test migration: lib support batch 3 (#33177) * pw_unit_test migration: lib support batch 3 * BUILD.gn typo fix * integrating comments, changing EXPECT_NE to ASSERT_NE when checking pointers for null --- src/lib/support/tests/BUILD.gn | 20 +- src/lib/support/tests/TestBufferWriter.cpp | 112 +++---- .../support/tests/TestBytesCircularBuffer.cpp | 305 ++++++++---------- src/lib/support/tests/TestErrorStr.cpp | 97 ++---- src/lib/support/tests/TestPrivateHeap.cpp | 145 ++++----- src/lib/support/tests/TestScopedBuffer.cpp | 104 +++--- src/lib/support/tests/TestSorting.cpp | 42 +-- src/lib/support/tests/TestStringBuilder.cpp | 134 ++++---- src/lib/support/tests/TestStringSplitter.cpp | 137 ++++---- src/lib/support/tests/TestTimeUtils.cpp | 59 +--- src/lib/support/tests/TestVariant.cpp | 226 ++++++------- 11 files changed, 558 insertions(+), 823 deletions(-) diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 585233b1e6667d..7a19ea2415e895 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -25,18 +25,28 @@ chip_test_suite("tests") { test_sources = [ "TestBitMask.cpp", "TestBufferReader.cpp", + "TestBufferWriter.cpp", + "TestBytesCircularBuffer.cpp", "TestBytesToHex.cpp", "TestDefer.cpp", + "TestErrorStr.cpp", "TestFixedBufferAllocator.cpp", "TestFold.cpp", "TestIniEscaping.cpp", + "TestPrivateHeap.cpp", "TestSafeInt.cpp", "TestSafeString.cpp", "TestScoped.cpp", + "TestScopedBuffer.cpp", + "TestSorting.cpp", "TestSpan.cpp", "TestStaticSupportSmartPtr.cpp", + "TestStringBuilder.cpp", + "TestStringSplitter.cpp", "TestTestPersistentStorageDelegate.cpp", + "TestTimeUtils.cpp", "TestUtf8.cpp", + "TestVariant.cpp", ] sources = [] @@ -64,28 +74,18 @@ chip_test_suite_using_nltest("tests_nltest") { output_name = "libSupportTestsNL" test_sources = [ - "TestBufferWriter.cpp", - "TestBytesCircularBuffer.cpp", "TestCHIPCounter.cpp", "TestCHIPMem.cpp", "TestCHIPMemString.cpp", - "TestErrorStr.cpp", "TestIntrusiveList.cpp", "TestJsonToTlv.cpp", "TestJsonToTlvToJson.cpp", "TestPersistedCounter.cpp", "TestPool.cpp", - "TestPrivateHeap.cpp", - "TestScopedBuffer.cpp", - "TestSorting.cpp", "TestStateMachine.cpp", - "TestStringBuilder.cpp", - "TestStringSplitter.cpp", "TestThreadOperationalDataset.cpp", - "TestTimeUtils.cpp", "TestTlvJson.cpp", "TestTlvToJson.cpp", - "TestVariant.cpp", "TestZclString.cpp", ] sources = [] diff --git a/src/lib/support/tests/TestBufferWriter.cpp b/src/lib/support/tests/TestBufferWriter.cpp index 2e8d187ae6a15d..e5d8951d4cf152 100644 --- a/src/lib/support/tests/TestBufferWriter.cpp +++ b/src/lib/support/tests/TestBufferWriter.cpp @@ -15,9 +15,8 @@ * limitations under the License. */ #include -#include -#include +#include namespace { @@ -77,7 +76,7 @@ class BWTest : public Base using namespace chip::Encoding; -void TestSpanVersusRegular(nlTestSuite * inSuite, void * inContext) +TEST(TestBufferWriter, TestSpanVersusRegular) { uint8_t buf_regular[5] = { 0, 0, 0, 0, 0 }; uint8_t buf_span[5] = { 0, 0, 0, 0, 0 }; @@ -87,232 +86,213 @@ void TestSpanVersusRegular(nlTestSuite * inSuite, void * inContext) BufferWriter regular_writer(buf_regular, sizeof(buf_regular)); BufferWriter span_writer(chip::MutableByteSpan{ buf_span }); - NL_TEST_ASSERT(inSuite, regular_writer.Available() == sizeof(buf_regular)); - NL_TEST_ASSERT(inSuite, span_writer.Available() == sizeof(buf_span)); + EXPECT_EQ(regular_writer.Available(), sizeof(buf_regular)); + EXPECT_EQ(span_writer.Available(), sizeof(buf_span)); - NL_TEST_ASSERT(inSuite, 0 == memcmp(buf_regular, all_zeroes, sizeof(all_zeroes))); - NL_TEST_ASSERT(inSuite, 0 == memcmp(buf_span, all_zeroes, sizeof(all_zeroes))); + EXPECT_EQ(0, memcmp(buf_regular, all_zeroes, sizeof(all_zeroes))); + EXPECT_EQ(0, memcmp(buf_span, all_zeroes, sizeof(all_zeroes))); - NL_TEST_ASSERT(inSuite, regular_writer.Put(1).Put(2).Put(3).Put(4).Fit()); - NL_TEST_ASSERT(inSuite, span_writer.Put(1).Put(2).Put(3).Put(4).Fit()); + EXPECT_TRUE(regular_writer.Put(1).Put(2).Put(3).Put(4).Fit()); + EXPECT_TRUE(span_writer.Put(1).Put(2).Put(3).Put(4).Fit()); - NL_TEST_ASSERT(inSuite, 0 == memcmp(buf_regular, final_expected, sizeof(final_expected))); - NL_TEST_ASSERT(inSuite, 0 == memcmp(buf_span, final_expected, sizeof(final_expected))); + EXPECT_EQ(0, memcmp(buf_regular, final_expected, sizeof(final_expected))); + EXPECT_EQ(0, memcmp(buf_span, final_expected, sizeof(final_expected))); } -void TestStringWrite(nlTestSuite * inSuite, void * inContext) +TEST(TestBufferWriter, TestStringWrite) { { BWTest bb(2); bb.Put("hi"); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(1); bb.Put("hi"); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(2); bb.Put("hi"); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(1); bb.Put("hi"); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(2); bb.Put("hi"); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(1); bb.Put("hi"); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } } -void TestBufferWrite(nlTestSuite * inSuite, void * inContext) +TEST(TestBufferWriter, TestBufferWrite) { { BWTest bb(2); bb.Put("hithere", 2); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(1); bb.Put("hithere", 2); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(2); bb.Put("hithere", 2); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(1); bb.Put("hithere", 2); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(2); bb.Put("hithere", 2); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(1); bb.Put("hithere", 2); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } } -void TestPutLittleEndian(nlTestSuite * inSuite, void * inContext) +TEST(TestBufferWriter, TestPutLittleEndian) { { BWTest bb(2); bb.Put16('h' + 'i' * 256); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(4); bb.Put32(0x01020304); - NL_TEST_ASSERT(inSuite, bb.expect("\x04\x03\x02\x01", 4, 0)); + EXPECT_TRUE(bb.expect("\x04\x03\x02\x01", 4, 0)); } { BWTest bb(8); bb.Put64(0x0102030405060708); - NL_TEST_ASSERT(inSuite, bb.expect("\x08\x07\x06\x05\x04\x03\x02\x01", 8, 0)); + EXPECT_TRUE(bb.expect("\x08\x07\x06\x05\x04\x03\x02\x01", 8, 0)); } { BWTest bb(3); bb.EndianPut(0x0102030405060708u, 3); - NL_TEST_ASSERT(inSuite, bb.expect("\x08\x07\x06", 3, 0)); + EXPECT_TRUE(bb.expect("\x08\x07\x06", 3, 0)); } { BWTest bb(4); bb.PutSigned8(static_cast(-6)); - NL_TEST_ASSERT(inSuite, bb.expect("\xfa", 1, 3)); + EXPECT_TRUE(bb.expect("\xfa", 1, 3)); } { BWTest bb(4); bb.PutSigned16(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xfe\xff", 2, 2)); + EXPECT_TRUE(bb.expect("\xfe\xff", 2, 2)); } { BWTest bb(4); bb.PutSigned32(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xfe\xff\xff\xff", 4, 0)); + EXPECT_TRUE(bb.expect("\xfe\xff\xff\xff", 4, 0)); } { BWTest bb(8); bb.PutSigned64(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xfe\xff\xff\xff\xff\xff\xff\xff", 8, 0)); + EXPECT_TRUE(bb.expect("\xfe\xff\xff\xff\xff\xff\xff\xff", 8, 0)); } { BWTest bb(7); bb.PutSigned64(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xfe\xff\xff\xff\xff\xff\xff", 8, 0)); + EXPECT_TRUE(bb.expect("\xfe\xff\xff\xff\xff\xff\xff", 8, 0)); } { BWTest bb(9); bb.PutSigned64(static_cast(9223372036854775807LL)); - NL_TEST_ASSERT(inSuite, bb.expect("\xff\xff\xff\xff\xff\xff\xff\x7f", 8, 1)); + EXPECT_TRUE(bb.expect("\xff\xff\xff\xff\xff\xff\xff\x7f", 8, 1)); } } -void TestPutBigEndian(nlTestSuite * inSuite, void * inContext) +TEST(TestBufferWriter, TestPutBigEndian) { { BWTest bb(2); bb.Put16('i' + 'h' * 256); - NL_TEST_ASSERT(inSuite, bb.expect("hi", 2, 0)); + EXPECT_TRUE(bb.expect("hi", 2, 0)); } { BWTest bb(4); bb.Put32(0x01020304); - NL_TEST_ASSERT(inSuite, bb.expect("\x01\x02\x03\x04", 4, 0)); + EXPECT_TRUE(bb.expect("\x01\x02\x03\x04", 4, 0)); } { BWTest bb(8); bb.Put64(0x0102030405060708); - NL_TEST_ASSERT(inSuite, bb.expect("\x01\x02\x03\x04\x05\x06\x07\x08", 8, 0)); + EXPECT_TRUE(bb.expect("\x01\x02\x03\x04\x05\x06\x07\x08", 8, 0)); } { BWTest bb(3); bb.EndianPut(0x0102030405060708u, 3); - NL_TEST_ASSERT(inSuite, bb.expect("\x06\x07\x08", 3, 0)); + EXPECT_TRUE(bb.expect("\x06\x07\x08", 3, 0)); } { BWTest bb(4); bb.PutSigned8(static_cast(-6)); - NL_TEST_ASSERT(inSuite, bb.expect("\xfa", 1, 3)); + EXPECT_TRUE(bb.expect("\xfa", 1, 3)); } { BWTest bb(4); bb.PutSigned16(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xff\xfe", 2, 2)); + EXPECT_TRUE(bb.expect("\xff\xfe", 2, 2)); } { BWTest bb(4); bb.PutSigned32(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xff\xff\xff\xfe", 4, 0)); + EXPECT_TRUE(bb.expect("\xff\xff\xff\xfe", 4, 0)); } { BWTest bb(8); bb.PutSigned64(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xff\xff\xff\xff\xff\xff\xff\xfe", 8, 0)); + EXPECT_TRUE(bb.expect("\xff\xff\xff\xff\xff\xff\xff\xfe", 8, 0)); } { BWTest bb(7); bb.PutSigned64(static_cast(-2)); - NL_TEST_ASSERT(inSuite, bb.expect("\xff\xff\xff\xff\xff\xff\xff", 8, 0)); + EXPECT_TRUE(bb.expect("\xff\xff\xff\xff\xff\xff\xff", 8, 0)); } { BWTest bb(9); bb.PutSigned64(static_cast(9223372036854775807LL)); - NL_TEST_ASSERT(inSuite, bb.expect("\x7f\xff\xff\xff\xff\xff\xff\xff", 8, 1)); + EXPECT_TRUE(bb.expect("\x7f\xff\xff\xff\xff\xff\xff\xff", 8, 1)); } } - -const nlTest sTests[] = { - NL_TEST_DEF("TestSpanVersusRegular", TestSpanVersusRegular), // - NL_TEST_DEF("TestStringWrite", TestStringWrite), // - NL_TEST_DEF("TestBufferWrite", TestBufferWrite), // - NL_TEST_DEF("TestPutLittleEndian", TestPutLittleEndian), // - NL_TEST_DEF("TestPutBigEndian", TestPutBigEndian), // - NL_TEST_SENTINEL() // -}; - } // namespace - -int TestBufferWriter() -{ - nlTestSuite theSuite = { "BufferWriter", sTests, nullptr, nullptr }; - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestBufferWriter) diff --git a/src/lib/support/tests/TestBytesCircularBuffer.cpp b/src/lib/support/tests/TestBytesCircularBuffer.cpp index be1576cedc5fdc..90305e0cf8590a 100644 --- a/src/lib/support/tests/TestBytesCircularBuffer.cpp +++ b/src/lib/support/tests/TestBytesCircularBuffer.cpp @@ -23,35 +23,44 @@ #include #include -#include -#include +#include -#include +#include namespace { using namespace chip; -void TestPushInvalid(nlTestSuite * inSuite, void * inContext) +class TestBytesCircularBuffer : public ::testing::Test +{ +public: + static void SetUpTestSuite() + { + unsigned seed = static_cast(std::time(nullptr)); + printf("Running " __FILE__ " using seed %d \n", seed); + std::srand(seed); + } +}; + +TEST_F(TestBytesCircularBuffer, TestPushInvalid) { uint8_t storage[10]; BytesCircularBuffer buffer(storage, sizeof(storage)); const uint8_t s[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s, static_cast(-1))) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_EQ(buffer.Push(ByteSpan(s, static_cast(-1))), CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_TRUE(buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s, 8)) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s, 9)) == CHIP_ERROR_INVALID_ARGUMENT); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s, 7)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); + EXPECT_EQ(buffer.Push(ByteSpan(s, 8)), CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_TRUE(buffer.IsEmpty()); + EXPECT_EQ(buffer.Push(ByteSpan(s, 9)), CHIP_ERROR_INVALID_ARGUMENT); + EXPECT_TRUE(buffer.IsEmpty()); + EXPECT_EQ(buffer.Push(ByteSpan(s, 7)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); } -void RandomPushPop(nlTestSuite * inSuite, void * inContext, BytesCircularBuffer & buffer, - std::list> & alreadyInBuffer) +void RandomPushPop(BytesCircularBuffer & buffer, std::list> & alreadyInBuffer) { auto randomString = [] { std::vector str(static_cast(std::rand()) % 8); @@ -64,21 +73,21 @@ void RandomPushPop(nlTestSuite * inSuite, void * inContext, BytesCircularBuffer [](auto s, auto str) { return s + str.size() + 2; }); }; - auto verify = [&inSuite, &alreadyInBuffer, &buffer] { + auto verify = [&alreadyInBuffer, &buffer] { if (alreadyInBuffer.empty()) { - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); } else { - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); + EXPECT_FALSE(buffer.IsEmpty()); auto length = alreadyInBuffer.front().size(); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == length); + EXPECT_EQ(buffer.GetFrontSize(), length); std::vector str(length); MutableByteSpan readSpan(str.data(), length); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, readSpan.size() == length); - NL_TEST_ASSERT(inSuite, alreadyInBuffer.front() == str); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(readSpan.size(), length); + EXPECT_EQ(alreadyInBuffer.front(), str); } }; @@ -90,7 +99,7 @@ void RandomPushPop(nlTestSuite * inSuite, void * inContext, BytesCircularBuffer if (!buffer.IsEmpty() && std::rand() % 3 == 0) { // pop - NL_TEST_ASSERT(inSuite, buffer.Pop() == CHIP_NO_ERROR); + EXPECT_EQ(buffer.Pop(), CHIP_NO_ERROR); alreadyInBuffer.pop_front(); verify(); @@ -99,7 +108,7 @@ void RandomPushPop(nlTestSuite * inSuite, void * inContext, BytesCircularBuffer { // push random string auto str = randomString(); - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(str.data(), str.size())) == CHIP_NO_ERROR); + EXPECT_EQ(buffer.Push(ByteSpan(str.data(), str.size())), CHIP_NO_ERROR); alreadyInBuffer.push_back(str); while (bufferSize() > 9) @@ -112,144 +121,144 @@ void RandomPushPop(nlTestSuite * inSuite, void * inContext, BytesCircularBuffer } } -void TestPushPopRandom(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushPopRandom) { uint8_t storage[10]; BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); std::list> alreadyInBuffer; - RandomPushPop(inSuite, inContext, buffer, alreadyInBuffer); + RandomPushPop(buffer, alreadyInBuffer); } -void TestPushToJustFull(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushToJustFull) { uint8_t storage[10]; // Total space = 9 BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); const uint8_t s1[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; const uint8_t s2[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }; uint8_t o[sizeof(s1)]; MutableByteSpan readSpan(o); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); // Used = 6, Free = 3 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 4)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 4)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_FALSE(memcmp(s1, readSpan.data(), 4)); // Used = 9, Free = 0 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s2, 1)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s2, 1)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_FALSE(memcmp(s1, readSpan.data(), 4)); // Try normal push/pop again std::list> alreadyInBuffer; alreadyInBuffer.push_back(std::vector{ s1[0], s1[1], s1[2], s1[3] }); alreadyInBuffer.push_back(std::vector{ s2[0] }); - RandomPushPop(inSuite, inContext, buffer, alreadyInBuffer); + RandomPushPop(buffer, alreadyInBuffer); } -void TestPushToJustFullOverOne(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushToJustFullOverOne) { uint8_t storage[10]; // Total space = 9 BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); const uint8_t s1[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; const uint8_t s2[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }; uint8_t o[sizeof(s1)]; MutableByteSpan readSpan(o); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); // Used = 6, Free = 3 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 4)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 4)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 4), 0); // Used = 4, Free = 5 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s2, 2)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 2); + EXPECT_EQ(buffer.Push(ByteSpan(s2, 2)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 2u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 2) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 2), 0); // Try normal push/pop again std::list> alreadyInBuffer; alreadyInBuffer.push_back(std::vector{ s2[0], s2[1] }); - RandomPushPop(inSuite, inContext, buffer, alreadyInBuffer); + RandomPushPop(buffer, alreadyInBuffer); } -void TestPushWrap(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushWrap) { uint8_t storage[10]; // Total space = 9 BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); const uint8_t s1[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; const uint8_t s2[] = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' }; uint8_t o[sizeof(s1)]; MutableByteSpan readSpan(o); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); // Used = 6, Free = 3 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 4)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 4)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 4), 0); // Used = 6, Free = 3, s1 was discarded due to lack of storage - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s2, 4)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s2, 4)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 4), 0); // Used = 9, Free = 0 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 1)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 1)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 4), 0); // Used = 3, Free = 6 - NL_TEST_ASSERT(inSuite, buffer.Pop() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 1); + EXPECT_EQ(buffer.Pop(), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_TRUE(buffer.GetFrontSize()); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 1) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 1), 0); // All freed - NL_TEST_ASSERT(inSuite, buffer.Pop() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_EQ(buffer.Pop(), CHIP_NO_ERROR); + EXPECT_TRUE(buffer.IsEmpty()); } -void TestPushWrapStartAtEdge(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushWrapStartAtEdge) { uint8_t storage[10]; const uint8_t s1[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; @@ -259,47 +268,47 @@ void TestPushWrapStartAtEdge(nlTestSuite * inSuite, void * inContext) // Total space = 9 BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); // Used = 6, Free = 3, mDataStart = 0, mDataEnd = 6 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 4)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 4)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 4), 0); // Used = 4, Free = 5, mDataStart = 6, mDataEnd = 0 wrap mDataEnd - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s2, 2)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 2); + EXPECT_EQ(buffer.Push(ByteSpan(s2, 2)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 2u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 2) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 2), 0); // Used = 7, Free = 2, mDataStart = 6, mDataEnd = 3 wrap mDataEnd - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 1)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 2); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 1)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 2u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 2) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 2), 0); // Used = 3, Free = 6, mDataStart = 0, mDataEnd = 3 - NL_TEST_ASSERT(inSuite, buffer.Pop() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 1); + EXPECT_EQ(buffer.Pop(), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 1u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 1) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 1), 0); // Try normal push/pop again std::list> alreadyInBuffer; alreadyInBuffer.push_back(std::vector{ s1[0] }); - RandomPushPop(inSuite, inContext, buffer, alreadyInBuffer); + RandomPushPop(buffer, alreadyInBuffer); } -void TestPushWrapEndAtEdge(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushWrapEndAtEdge) { uint8_t storage[10]; const uint8_t s1[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; @@ -309,31 +318,31 @@ void TestPushWrapEndAtEdge(nlTestSuite * inSuite, void * inContext) // Total space = 9 BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); // Used = 6, Free = 3, mDataStart = 0, mDataEnd = 6 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 4)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 4); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 4)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 4u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 4) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 4), 0); // Used = 4, Free = 5, mDataStart = 6, mDataEnd = 0 wrap mDataEnd - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s2, 2)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 2); + EXPECT_EQ(buffer.Push(ByteSpan(s2, 2)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 2u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 2) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 2), 0); // Try normal push/pop again std::list> alreadyInBuffer; alreadyInBuffer.push_back(std::vector{ s2[0], s2[1] }); - RandomPushPop(inSuite, inContext, buffer, alreadyInBuffer); + RandomPushPop(buffer, alreadyInBuffer); } -void TestPushWhenFull(nlTestSuite * inSuite, void * inContext) +TEST_F(TestBytesCircularBuffer, TestPushWhenFull) { uint8_t storage[10]; const uint8_t s1[] = { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' }; @@ -343,65 +352,31 @@ void TestPushWhenFull(nlTestSuite * inSuite, void * inContext) // Total space = 9 BytesCircularBuffer buffer(storage, sizeof(storage)); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_TRUE(buffer.IsEmpty()); // Used = 9, Free = 0 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s1, 7)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 7); + EXPECT_EQ(buffer.Push(ByteSpan(s1, 7)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 7u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s1, readSpan.data(), 7) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s1, readSpan.data(), 7), 0); // Used = 5, Free = 4 - NL_TEST_ASSERT(inSuite, buffer.Push(ByteSpan(s2, 3)) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, !buffer.IsEmpty()); - NL_TEST_ASSERT(inSuite, buffer.GetFrontSize() == 3); + EXPECT_EQ(buffer.Push(ByteSpan(s2, 3)), CHIP_NO_ERROR); + EXPECT_FALSE(buffer.IsEmpty()); + EXPECT_EQ(buffer.GetFrontSize(), 3u); readSpan = MutableByteSpan(o); - NL_TEST_ASSERT(inSuite, buffer.ReadFront(readSpan) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, memcmp(s2, readSpan.data(), 3) == 0); + EXPECT_EQ(buffer.ReadFront(readSpan), CHIP_NO_ERROR); + EXPECT_EQ(memcmp(s2, readSpan.data(), 3), 0); // All freed - NL_TEST_ASSERT(inSuite, buffer.Pop() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, buffer.IsEmpty()); + EXPECT_EQ(buffer.Pop(), CHIP_NO_ERROR); + EXPECT_TRUE(buffer.IsEmpty()); // Try normal push/pop again std::list> alreadyInBuffer; - RandomPushPop(inSuite, inContext, buffer, alreadyInBuffer); -} - -int Setup(void * inContext) -{ - return SUCCESS; -} - -int Teardown(void * inContext) -{ - return SUCCESS; + RandomPushPop(buffer, alreadyInBuffer); } } // namespace - -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { - NL_TEST_DEF_FN(TestPushPopRandom), NL_TEST_DEF_FN(TestPushInvalid), NL_TEST_DEF_FN(TestPushToJustFull), - NL_TEST_DEF_FN(TestPushToJustFullOverOne), NL_TEST_DEF_FN(TestPushWrap), NL_TEST_DEF_FN(TestPushWrapStartAtEdge), - NL_TEST_DEF_FN(TestPushWrapEndAtEdge), NL_TEST_DEF_FN(TestPushWhenFull), NL_TEST_SENTINEL() -}; - -int TestBytesCircularBuffer() -{ - nlTestSuite theSuite = { "CHIP BytesCircularBuffer tests", &sTests[0], Setup, Teardown }; - - unsigned seed = static_cast(std::time(nullptr)); - printf("Running " __FILE__ " using seed %d", seed); - std::srand(seed); - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestBytesCircularBuffer); diff --git a/src/lib/support/tests/TestErrorStr.cpp b/src/lib/support/tests/TestErrorStr.cpp index 45133e0401f560..49ae9f5a9b40ac 100644 --- a/src/lib/support/tests/TestErrorStr.cpp +++ b/src/lib/support/tests/TestErrorStr.cpp @@ -19,33 +19,31 @@ #include #include -#include +#include +#include #include -#include - -#include using namespace chip; #if CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR -const char * CheckAndSkipSource(nlTestSuite * inSuite, const char * s, const char * file, unsigned int line) +const char * CheckAndSkipSource(const char * s, const char * file, unsigned int line) { size_t fileLength = strlen(file); - NL_TEST_ASSERT(inSuite, strncmp(s, file, fileLength) == 0); - NL_TEST_ASSERT(inSuite, s[fileLength] == ':'); + EXPECT_EQ(strncmp(s, file, fileLength), 0); + EXPECT_EQ(s[fileLength], ':'); char * end; - NL_TEST_ASSERT(inSuite, strtoul(&s[fileLength + 1], &end, 10) == line); - NL_TEST_ASSERT(inSuite, strncmp(end, ": ", 2) == 0); + EXPECT_EQ(strtoul(&s[fileLength + 1], &end, 10), line); + EXPECT_EQ(strncmp(end, ": ", 2), 0); return end + 2; } -#define CHECK_AND_SKIP_SOURCE(suite, s) CheckAndSkipSource((suite), (s), __FILE__, __LINE__) +#define CHECK_AND_SKIP_SOURCE(s) CheckAndSkipSource((s), __FILE__, __LINE__) #else // CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR -#define CHECK_AND_SKIP_SOURCE(suite, s) (s) +#define CHECK_AND_SKIP_SOURCE(s) (s) #endif // CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR @@ -68,7 +66,7 @@ static bool trueFormat(char * buf, uint16_t bufSize, CHIP_ERROR err) return true; // means I handled it } -static void CheckRegisterDeregisterErrorFormatter(nlTestSuite * inSuite, void * inContext) +TEST(TestErrorStr, CheckRegisterDeregisterErrorFormatter) { static ErrorFormatter falseFormatter = { falseFormat, nullptr }; static ErrorFormatter falseFormatter2 = { falseFormat2, nullptr }; @@ -77,22 +75,22 @@ static void CheckRegisterDeregisterErrorFormatter(nlTestSuite * inSuite, void * // simple case RegisterErrorFormatter(&falseFormatter); ErrorStr(CHIP_ERROR_INTERNAL); - NL_TEST_ASSERT(inSuite, falseFormatCalled == 1); + EXPECT_EQ(falseFormatCalled, 1); // reset falseFormatCalled = 0; // re-registration should be ignored RegisterErrorFormatter(&falseFormatter); ErrorStr(CHIP_ERROR_INTERNAL); - NL_TEST_ASSERT(inSuite, falseFormatCalled == 1); + EXPECT_EQ(falseFormatCalled, 1); // reset falseFormatCalled = 0; // registration of a new handler, nobody handling anything RegisterErrorFormatter(&falseFormatter2); ErrorStr(CHIP_ERROR_INTERNAL); - NL_TEST_ASSERT(inSuite, falseFormatCalled == 1); - NL_TEST_ASSERT(inSuite, falseFormat2Called == 1); + EXPECT_EQ(falseFormatCalled, 1); + EXPECT_EQ(falseFormat2Called, 1); // reset falseFormatCalled = 0; falseFormat2Called = 0; @@ -100,29 +98,29 @@ static void CheckRegisterDeregisterErrorFormatter(nlTestSuite * inSuite, void * // registration of a true handler, gets first crack RegisterErrorFormatter(&trueFormatter); ErrorStr(CHIP_ERROR_INTERNAL); - NL_TEST_ASSERT(inSuite, trueFormatCalled == 1); - NL_TEST_ASSERT(inSuite, falseFormatCalled == 0); - NL_TEST_ASSERT(inSuite, falseFormat2Called == 0); + EXPECT_EQ(trueFormatCalled, 1); + EXPECT_EQ(falseFormatCalled, 0); + EXPECT_EQ(falseFormat2Called, 0); // reset trueFormatCalled = 0; // deregister true DeregisterErrorFormatter(&trueFormatter); ErrorStr(CHIP_ERROR_INTERNAL); - NL_TEST_ASSERT(inSuite, trueFormatCalled == 0); - NL_TEST_ASSERT(inSuite, falseFormatCalled == 1); - NL_TEST_ASSERT(inSuite, falseFormat2Called == 1); + EXPECT_EQ(trueFormatCalled, 0); + EXPECT_EQ(falseFormatCalled, 1); + EXPECT_EQ(falseFormat2Called, 1); // verify this doesn't crash DeregisterErrorFormatter(&trueFormatter); } -static void CheckNoError(nlTestSuite * inSuite, void * inContext) +TEST(TestErrorStr, CheckNoError) { - NL_TEST_ASSERT(inSuite, strcmp(CHECK_AND_SKIP_SOURCE(inSuite, ErrorStr(CHIP_NO_ERROR)), CHIP_NO_ERROR_STRING) == 0); + EXPECT_STREQ(CHECK_AND_SKIP_SOURCE(ErrorStr(CHIP_NO_ERROR)), CHIP_NO_ERROR_STRING); } -static void CheckFormatErr(nlTestSuite * inSuite, void * inContext) +TEST(TestErrorStr, CheckFormatErr) { #if CHIP_CONFIG_SHORT_ERROR_STR @@ -137,63 +135,28 @@ static void CheckFormatErr(nlTestSuite * inSuite, void * inContext) strcpy(buf, "hi"); // shouldn't touch the buffer FormatError(buf, 0, subsys, CHIP_ERROR_INTERNAL, desc); - NL_TEST_ASSERT(inSuite, strcmp(buf, "hi") == 0); + EXPECT_STREQ(buf, "hi"); // guarantees null termination, doesn't touch past 1st byte strcpy(buf, "hi"); FormatError(buf, 1, subsys, CHIP_ERROR_INTERNAL, desc); - NL_TEST_ASSERT(inSuite, strcmp(buf, "") == 0); - NL_TEST_ASSERT(inSuite, buf[1] == 'i'); + EXPECT_STREQ(buf, ""); + EXPECT_EQ(buf[1], 'i'); // whole shebang FormatError(buf, kBufSize, subsys, CHIP_CORE_ERROR(1), desc); - NL_TEST_ASSERT(inSuite, strcmp(buf, "subsys Error 0x00000001: desc") == 0); + EXPECT_STREQ(buf, "subsys Error 0x00000001: desc"); // skip desc FormatError(buf, kBufSize, subsys, CHIP_CORE_ERROR(1), nullptr); - NL_TEST_ASSERT(inSuite, strcmp(buf, "subsys Error 0x00000001") == 0); + EXPECT_STREQ(buf, "subsys Error 0x00000001"); // skip subsys FormatError(buf, kBufSize, nullptr, CHIP_CORE_ERROR(1), desc); - NL_TEST_ASSERT(inSuite, strcmp(buf, "Error 0x00000001: desc") == 0); + EXPECT_STREQ(buf, "Error 0x00000001: desc"); // skip both FormatError(buf, kBufSize, nullptr, CHIP_CORE_ERROR(1), nullptr); - NL_TEST_ASSERT(inSuite, strcmp(buf, "Error 0x00000001") == 0); + EXPECT_STREQ(buf, "Error 0x00000001"); #endif } - -/** - * Test Suite. It lists all the test functions. - */ - -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("NoError", CheckNoError), - NL_TEST_DEF("RegisterDeregisterErrorFormatter", CheckRegisterDeregisterErrorFormatter), - NL_TEST_DEF("FormatErr", CheckFormatErr), - - NL_TEST_SENTINEL() -}; -// clang-format on - -int TestErrorStr() -{ - // clang-format off - nlTestSuite theSuite = - { - "Test the ErrorStr primitives", - &sTests[0], - nullptr, - nullptr - }; - // clang-format on - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestErrorStr) diff --git a/src/lib/support/tests/TestPrivateHeap.cpp b/src/lib/support/tests/TestPrivateHeap.cpp index dae83951a2faa8..f808c16cb8e5f6 100644 --- a/src/lib/support/tests/TestPrivateHeap.cpp +++ b/src/lib/support/tests/TestPrivateHeap.cpp @@ -16,12 +16,11 @@ * limitations under the License. */ -#include -#include - #include -#include +#include + +#include namespace { @@ -47,14 +46,14 @@ class PrivateHeapAllocator } mHeap; }; -void SingleHeapAllocAndFree(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestSingleHeapAllocAndFree) { PrivateHeapAllocator<16 + 2 * kBlockHeaderSize> allocator; - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(17)); // insufficient size + EXPECT_EQ(nullptr, allocator.HeapAlloc(17)); // insufficient size void * ptr = allocator.HeapAlloc(16); - NL_TEST_ASSERT(inSuite, nullptr != ptr); - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); // insufficient size + ASSERT_NE(nullptr, ptr); + EXPECT_EQ(nullptr, allocator.HeapAlloc(1)); // insufficient size memset(ptr, 0xab, 16); allocator.HeapFree(ptr); @@ -62,25 +61,25 @@ void SingleHeapAllocAndFree(nlTestSuite * inSuite, void * inContext) for (size_t i = 1; i < 17; ++i) { ptr = allocator.HeapAlloc(i); - NL_TEST_ASSERT(inSuite, nullptr != ptr); - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(17 - i)); // insufficient size + ASSERT_NE(nullptr, ptr); + EXPECT_EQ(nullptr, allocator.HeapAlloc(17 - i)); // insufficient size allocator.HeapFree(ptr); } } -void SplitHeapAllocAndFree(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestSplitHeapAllocAndFree) { PrivateHeapAllocator<128> allocator; // allocator state: // 96 void * p1 = allocator.HeapAlloc(30); - NL_TEST_ASSERT(inSuite, nullptr != p1); + ASSERT_NE(nullptr, p1); // allocator state: // 32 48 void * p2 = allocator.HeapAlloc(4); - NL_TEST_ASSERT(inSuite, nullptr != p2); + ASSERT_NE(nullptr, p2); // allocator state: // 32 8 24 @@ -93,20 +92,20 @@ void SplitHeapAllocAndFree(nlTestSuite * inSuite, void * inContext) // 96 p1 = allocator.HeapAlloc(90); - NL_TEST_ASSERT(inSuite, nullptr != p1); + ASSERT_NE(nullptr, p1); allocator.HeapFree(p1); } -void FreeMergeNext(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestFreeMergeNext) { PrivateHeapAllocator<5 * 16> allocator; void * p1 = allocator.HeapAlloc(16); void * p2 = allocator.HeapAlloc(16); - NL_TEST_ASSERT(inSuite, nullptr != p1); - NL_TEST_ASSERT(inSuite, nullptr != p2); - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); + ASSERT_NE(nullptr, p1); + ASSERT_NE(nullptr, p2); + EXPECT_EQ(nullptr, allocator.HeapAlloc(1)); memset(p1, 0xab, 16); memset(p2, 0xcd, 16); @@ -116,20 +115,20 @@ void FreeMergeNext(nlTestSuite * inSuite, void * inContext) allocator.HeapFree(p2); p1 = allocator.HeapAlloc(3 * 16); - NL_TEST_ASSERT(inSuite, nullptr != p1); + ASSERT_NE(nullptr, p1); allocator.HeapFree(p1); } -void FreeMergePrevious(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestFreeMergePrevious) { PrivateHeapAllocator<5 * 16> allocator; void * p1 = allocator.HeapAlloc(16); void * p2 = allocator.HeapAlloc(16); - NL_TEST_ASSERT(inSuite, nullptr != p1); - NL_TEST_ASSERT(inSuite, nullptr != p2); - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); + ASSERT_NE(nullptr, p1); + ASSERT_NE(nullptr, p2); + EXPECT_EQ(nullptr, allocator.HeapAlloc(1)); memset(p1, 0xab, 16); memset(p2, 0xcd, 16); @@ -138,11 +137,11 @@ void FreeMergePrevious(nlTestSuite * inSuite, void * inContext) allocator.HeapFree(p2); allocator.HeapFree(p1); p1 = allocator.HeapAlloc(3 * 16); - NL_TEST_ASSERT(inSuite, nullptr != p1); + ASSERT_NE(nullptr, p1); allocator.HeapFree(p1); } -void FreeMergePreviousAndNext(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestFreeMergePreviousAndNext) { PrivateHeapAllocator<7 * 16> allocator; @@ -151,10 +150,10 @@ void FreeMergePreviousAndNext(nlTestSuite * inSuite, void * inContext) void * p2 = allocator.HeapAlloc(16); void * p3 = allocator.HeapAlloc(16); - NL_TEST_ASSERT(inSuite, nullptr != p1); - NL_TEST_ASSERT(inSuite, nullptr != p2); - NL_TEST_ASSERT(inSuite, nullptr != p3); - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); + ASSERT_NE(nullptr, p1); + ASSERT_NE(nullptr, p2); + ASSERT_NE(nullptr, p3); + EXPECT_EQ(nullptr, allocator.HeapAlloc(1)); memset(p1, 0xab, 16); memset(p2, 0xcd, 16); @@ -163,16 +162,16 @@ void FreeMergePreviousAndNext(nlTestSuite * inSuite, void * inContext) allocator.HeapFree(p1); allocator.HeapFree(p3); // we have 2 slots of size 16 available now - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(17)); + EXPECT_EQ(nullptr, allocator.HeapAlloc(17)); // Freeing p2 makes enoug space allocator.HeapFree(p2); p1 = allocator.HeapAlloc(5 * 16); - NL_TEST_ASSERT(inSuite, nullptr != p1); + ASSERT_NE(nullptr, p1); allocator.HeapFree(p1); } -void MultipleMerge(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestMultipleMerge) { PrivateHeapAllocator<32 * kBlockHeaderSize> allocator; @@ -184,19 +183,19 @@ void MultipleMerge(nlTestSuite * inSuite, void * inContext) void * p5 = allocator.HeapAlloc(7 * kBlockHeaderSize); // uses up 8 blocks void * p6 = allocator.HeapAlloc(2 * kBlockHeaderSize); // uses up 2 (last given) - NL_TEST_ASSERT(inSuite, nullptr != p1); - NL_TEST_ASSERT(inSuite, nullptr != p2); - NL_TEST_ASSERT(inSuite, nullptr != p3); - NL_TEST_ASSERT(inSuite, nullptr != p4); - NL_TEST_ASSERT(inSuite, nullptr != p5); - NL_TEST_ASSERT(inSuite, nullptr != p6); + ASSERT_NE(nullptr, p1); + ASSERT_NE(nullptr, p2); + ASSERT_NE(nullptr, p3); + ASSERT_NE(nullptr, p4); + ASSERT_NE(nullptr, p5); + ASSERT_NE(nullptr, p6); allocator.HeapFree(p3); allocator.HeapFree(p4); // 10 blocks available (9 from p3 without HDR and 2 from p4 + HDR) p3 = allocator.HeapAlloc(10 * kBlockHeaderSize); - NL_TEST_ASSERT(inSuite, nullptr != p3); - NL_TEST_ASSERT(inSuite, nullptr == allocator.HeapAlloc(1)); // full + ASSERT_NE(nullptr, p3); + EXPECT_EQ(nullptr, allocator.HeapAlloc(1)); // full allocator.HeapFree(p6); allocator.HeapFree(p5); @@ -205,11 +204,11 @@ void MultipleMerge(nlTestSuite * inSuite, void * inContext) allocator.HeapFree(p1); p1 = allocator.HeapAlloc(30 * kBlockHeaderSize); - NL_TEST_ASSERT(inSuite, nullptr != p1); + ASSERT_NE(nullptr, p1); allocator.HeapFree(p1); } -void ForwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestForwardFreeAndRealloc) { constexpr int kNumBlocks = 16; PrivateHeapAllocator<(2 * kNumBlocks + 1) * kBlockHeaderSize> allocator; @@ -218,7 +217,7 @@ void ForwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext) for (auto & ptr : ptrs) { ptr = allocator.HeapAlloc(kBlockHeaderSize); - NL_TEST_ASSERT(inSuite, nullptr != ptr); + ASSERT_NE(nullptr, ptr); memset(ptr, 0xab, kBlockHeaderSize); } @@ -232,12 +231,12 @@ void ForwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext) allocator.HeapFree(ptrs[i]); ptrs[0] = allocator.HeapAlloc((1 + 2 * i) * kBlockHeaderSize); - NL_TEST_ASSERT(inSuite, nullptr != ptrs[0]); + ASSERT_NE(nullptr, ptrs[0]); } allocator.HeapFree(ptrs[0]); } -void BackwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestBackwardFreeAndRealloc) { constexpr int kNumBlocks = 16; PrivateHeapAllocator<(2 * kNumBlocks + 1) * kBlockHeaderSize> allocator; @@ -246,7 +245,7 @@ void BackwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext) for (auto & ptr : ptrs) { ptr = allocator.HeapAlloc(kBlockHeaderSize); - NL_TEST_ASSERT(inSuite, nullptr != ptr); + ASSERT_NE(nullptr, ptr); memset(ptr, 0xab, kBlockHeaderSize); } @@ -260,7 +259,7 @@ void BackwardFreeAndRealloc(nlTestSuite * inSuite, void * inContext) allocator.HeapFree(ptrs[kNumBlocks - i - 1]); ptrs[kNumBlocks - 1] = allocator.HeapAlloc((1 + 2 * i) * kBlockHeaderSize); - NL_TEST_ASSERT(inSuite, nullptr != ptrs[kNumBlocks - 1]); + ASSERT_NE(nullptr, ptrs[kNumBlocks - 1]); } allocator.HeapFree(ptrs[kNumBlocks - 1]); } @@ -293,71 +292,49 @@ bool IsKnownPattern(void * buffer, size_t size, uint8_t start) return true; } -void Realloc(nlTestSuite * inSuite, void * inContext) +TEST(TestPrivateHeap, TestRealloc) { PrivateHeapAllocator<6 * 16> allocator; void * p1 = allocator.HeapRealloc(nullptr, 16); // malloc basically - NL_TEST_ASSERT(inSuite, p1 != nullptr); + ASSERT_NE(p1, nullptr); FillKnownPattern(p1, 16, 11); void * p2 = allocator.HeapRealloc(p1, 8); // resize, should fit - NL_TEST_ASSERT(inSuite, p1 == p2); - NL_TEST_ASSERT(inSuite, IsKnownPattern(p1, 8, 11)); + EXPECT_EQ(p1, p2); + EXPECT_TRUE(IsKnownPattern(p1, 8, 11)); p2 = allocator.HeapRealloc(p1, 16); // resize, should fit - NL_TEST_ASSERT(inSuite, p1 == p2); - NL_TEST_ASSERT(inSuite, IsKnownPattern(p2, 8, 11)); // only 8 bytes are guaranteed + EXPECT_EQ(p1, p2); + EXPECT_TRUE(IsKnownPattern(p2, 8, 11)); // only 8 bytes are guaranteed FillKnownPattern(p1, 16, 33); p2 = allocator.HeapRealloc(p1, 32); // resize, does not fit. This frees p1 - NL_TEST_ASSERT(inSuite, p2 != nullptr); - NL_TEST_ASSERT(inSuite, p2 != p1); // new reallocation occurred - NL_TEST_ASSERT(inSuite, IsKnownPattern(p2, 16, 33)); + ASSERT_NE(p2, nullptr); + EXPECT_NE(p2, p1); // new reallocation occurred + EXPECT_TRUE(IsKnownPattern(p2, 16, 33)); void * p3 = allocator.HeapAlloc(48); // insufficient heap for this - NL_TEST_ASSERT(inSuite, p3 == nullptr); + EXPECT_EQ(p3, nullptr); p1 = allocator.HeapRealloc(p2, 16); // reallocation does not change block size - NL_TEST_ASSERT(inSuite, p1 == p2); + EXPECT_EQ(p1, p2); p3 = allocator.HeapAlloc(48); // still insufficient heap for this - NL_TEST_ASSERT(inSuite, p3 == nullptr); + EXPECT_EQ(p3, nullptr); p2 = allocator.HeapRealloc(p1, 48); // insufficient heap, p1 is NOT freed - NL_TEST_ASSERT(inSuite, p2 == nullptr); + EXPECT_EQ(p2, nullptr); p2 = allocator.HeapRealloc(p1, 48); // Repeat the test to ensure p1 is not freed - NL_TEST_ASSERT(inSuite, p2 == nullptr); + EXPECT_EQ(p2, nullptr); allocator.HeapFree(p1); p3 = allocator.HeapAlloc(48); // above free should have made sufficient space - NL_TEST_ASSERT(inSuite, p3 != nullptr); + ASSERT_NE(p3, nullptr); allocator.HeapFree(p3); } -const nlTest sTests[] = { - NL_TEST_DEF("SingleHeapAllocAndFree", SingleHeapAllocAndFree), // - NL_TEST_DEF("SplitHeapAllocAndFree", SplitHeapAllocAndFree), // - NL_TEST_DEF("FreeMergeNext", FreeMergeNext), // - NL_TEST_DEF("FreeMergePrevious", FreeMergePrevious), // - NL_TEST_DEF("FreeMergePreviousAndNext", FreeMergePreviousAndNext), // - NL_TEST_DEF("MultipleMerge", MultipleMerge), // - NL_TEST_DEF("ForwardFreeAndRealloc", ForwardFreeAndRealloc), // - NL_TEST_DEF("BackwardFreeAndRealloc", BackwardFreeAndRealloc), // - NL_TEST_DEF("Realloc", Realloc), // - NL_TEST_SENTINEL() // -}; - } // namespace - -int TestPrivateHeap() -{ - nlTestSuite theSuite = { "PrivateHeap", sTests, nullptr, nullptr }; - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestPrivateHeap) diff --git a/src/lib/support/tests/TestScopedBuffer.cpp b/src/lib/support/tests/TestScopedBuffer.cpp index 8e77ba75751312..c7ec072726c2be 100644 --- a/src/lib/support/tests/TestScopedBuffer.cpp +++ b/src/lib/support/tests/TestScopedBuffer.cpp @@ -16,13 +16,19 @@ * limitations under the License. */ -#include -#include +#include -#include +#include namespace { +class TestScopedBuffer : public ::testing::Test +{ +public: + static void SetUpTestSuite() { ASSERT_EQ(chip::Platform::MemoryInit(), CHIP_NO_ERROR); } + static void TearDownTestSuite() { chip::Platform::MemoryShutdown(); } +}; + class TestCounterMemoryManagement { public: @@ -52,102 +58,66 @@ int TestCounterMemoryManagement::mAllocCount = 0; using TestCounterScopedBuffer = chip::Platform::ScopedMemoryBuffer; -void TestAutoFree(nlTestSuite * inSuite, void * inContext) +TEST_F(TestScopedBuffer, TestAutoFree) { - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); { TestCounterScopedBuffer buffer; - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); - NL_TEST_ASSERT(inSuite, buffer.Alloc(128)); - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 1); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); + EXPECT_TRUE(buffer.Alloc(128)); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 1); } - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); } -void TestFreeDuringAllocs(nlTestSuite * inSuite, void * inContext) +TEST_F(TestScopedBuffer, TestFreeDuringAllocs) { - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); { TestCounterScopedBuffer buffer; - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); - NL_TEST_ASSERT(inSuite, buffer.Alloc(128)); - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 1); - NL_TEST_ASSERT(inSuite, buffer.Alloc(64)); - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 1); - NL_TEST_ASSERT(inSuite, buffer.Calloc(10)); - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 1); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); + EXPECT_TRUE(buffer.Alloc(128)); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 1); + EXPECT_TRUE(buffer.Alloc(64)); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 1); + EXPECT_TRUE(buffer.Calloc(10)); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 1); } - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); } -void TestRelease(nlTestSuite * inSuite, void * inContext) +TEST_F(TestScopedBuffer, TestRelease) { - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); void * ptr = nullptr; { TestCounterScopedBuffer buffer; - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); - NL_TEST_ASSERT(inSuite, buffer.Alloc(128)); - NL_TEST_ASSERT(inSuite, buffer.Get() != nullptr); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); + EXPECT_TRUE(buffer.Alloc(128)); + EXPECT_NE(buffer.Get(), nullptr); ptr = buffer.Release(); - NL_TEST_ASSERT(inSuite, ptr != nullptr); - NL_TEST_ASSERT(inSuite, buffer.Get() == nullptr); + EXPECT_NE(ptr, nullptr); + EXPECT_EQ(buffer.Get(), nullptr); } - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 1); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 1); { TestCounterScopedBuffer buffer; - NL_TEST_ASSERT(inSuite, buffer.Alloc(128)); - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 2); + EXPECT_TRUE(buffer.Alloc(128)); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 2); TestCounterMemoryManagement::MemoryFree(ptr); - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 1); + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 1); } - NL_TEST_ASSERT(inSuite, TestCounterMemoryManagement::Counter() == 0); -} - -int Setup(void * inContext) -{ - CHIP_ERROR error = chip::Platform::MemoryInit(); - if (error != CHIP_NO_ERROR) - return FAILURE; - return SUCCESS; -} - -int Teardown(void * inContext) -{ - chip::Platform::MemoryShutdown(); - return SUCCESS; + EXPECT_EQ(TestCounterMemoryManagement::Counter(), 0); } } // namespace - -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { - NL_TEST_DEF_FN(TestAutoFree), // - NL_TEST_DEF_FN(TestFreeDuringAllocs), // - NL_TEST_DEF_FN(TestRelease), // - NL_TEST_SENTINEL() // -}; - -int TestScopedBuffer() -{ - nlTestSuite theSuite = { "CHIP ScopedBuffer tests", &sTests[0], Setup, Teardown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestScopedBuffer) diff --git a/src/lib/support/tests/TestSorting.cpp b/src/lib/support/tests/TestSorting.cpp index 4fd5c0954519e5..1d04604c110fd5 100644 --- a/src/lib/support/tests/TestSorting.cpp +++ b/src/lib/support/tests/TestSorting.cpp @@ -20,12 +20,11 @@ #include #include +#include + #include #include -#include -#include - using namespace chip; using namespace chip::Sorting; @@ -71,7 +70,7 @@ class InsertionSorter : public Sorter } }; -void DoBasicSortTest(nlTestSuite * inSuite, Sorter & sorter) +void DoBasicSortTest(Sorter & sorter) { Span empty_to_sort; Span empty_expected; @@ -115,7 +114,7 @@ void DoBasicSortTest(nlTestSuite * inSuite, Sorter & sorter) const auto & expected = expected_outs[case_idx]; sorter.Sort(to_sort); - NL_TEST_ASSERT(inSuite, to_sort.data_equal(expected)); + EXPECT_TRUE(to_sort.data_equal(expected)); if (!to_sort.data_equal(expected)) { for (size_t idx = 0; idx < to_sort.size(); ++idx) @@ -126,44 +125,17 @@ void DoBasicSortTest(nlTestSuite * inSuite, Sorter & sorter) sorted_item.associated_data, expected_item.key, expected_item.associated_data); } } - NL_TEST_ASSERT(inSuite, sorter.compare_count() <= (to_sort.size() * to_sort.size())); + EXPECT_LE(sorter.compare_count(), (to_sort.size() * to_sort.size())); printf("Compare counts: %d\n", static_cast(sorter.compare_count())); sorter.Reset(); } } -void TestBasicSort(nlTestSuite * inSuite, void * inContext) +TEST(TestSorting, TestBasicSort) { printf("Testing insertion sorter.\n"); InsertionSorter insertion_sorter; - DoBasicSortTest(inSuite, insertion_sorter); + DoBasicSortTest(insertion_sorter); } -// clang-format off -static const nlTest sTests[] = -{ - NL_TEST_DEF("Basic sort tests for custom sort utilities", TestBasicSort), - NL_TEST_SENTINEL() -}; -// clang-format on - } // namespace - -int TestSortUtils() -{ - // clang-format off - nlTestSuite theSuite = - { - "Test for SortUtils", - &sTests[0], - nullptr, - nullptr - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return (nlTestRunnerStats(&theSuite)); -} - -CHIP_REGISTER_TEST_SUITE(TestSortUtils) diff --git a/src/lib/support/tests/TestStringBuilder.cpp b/src/lib/support/tests/TestStringBuilder.cpp index 34d04304f4eff1..2f4ad518da3dd1 100644 --- a/src/lib/support/tests/TestStringBuilder.cpp +++ b/src/lib/support/tests/TestStringBuilder.cpp @@ -15,78 +15,77 @@ * limitations under the License. */ #include -#include -#include +#include namespace { using namespace chip; -void TestStringBuilder(nlTestSuite * inSuite, void * inContext) +TEST(TestStringBuilder, TestStringBuilder) { StringBuilder<64> builder; - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), ""); builder.Add("foo"); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "foo") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "foo"); builder.Add("bar"); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "foobar") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "foobar"); } -void TestIntegerAppend(nlTestSuite * inSuite, void * inContext) +TEST(TestStringBuilder, TestIntegerAppend) { StringBuilder<64> builder; builder.Add("nr: ").Add(1234); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "nr: 1234") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "nr: 1234"); builder.Add(", ").Add(-22); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "nr: 1234, -22") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "nr: 1234, -22"); } -void TestOverflow(nlTestSuite * inSuite, void * inContext) +TEST(TestStringBuilder, TestOverflow) { { StringBuilder<4> builder; builder.Add("foo"); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "foo") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "foo"); builder.Add("bar"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "foo") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "foo"); } { StringBuilder<7> builder; builder.Add("x: ").Add(12345); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "x: 123") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "x: 123"); } } -void TestFormat(nlTestSuite * inSuite, void * inContext) +TEST(TestStringBuilder, TestFormat) { { StringBuilder<100> builder; builder.AddFormat("Test: %d Hello %s\n", 123, "world"); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "Test: 123 Hello world\n") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "Test: 123 Hello world\n"); } { @@ -94,8 +93,8 @@ void TestFormat(nlTestSuite * inSuite, void * inContext) builder.AddFormat("Align: %-5s", "abc"); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "Align: abc ") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "Align: abc "); } { @@ -104,20 +103,20 @@ void TestFormat(nlTestSuite * inSuite, void * inContext) builder.AddFormat("Multi: %d", 1234); builder.AddFormat(", then 0x%04X", 0xab); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "Multi: 1234, then 0x00AB") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "Multi: 1234, then 0x00AB"); } } -void TestFormatOverflow(nlTestSuite * inSuite, void * inContext) +TEST(TestStringBuilder, TestFormatOverflow) { { StringBuilder<13> builder; builder.AddFormat("Test: %d Hello %s\n", 123, "world"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "Test: 123 He") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "Test: 123 He"); } { @@ -125,48 +124,48 @@ void TestFormatOverflow(nlTestSuite * inSuite, void * inContext) builder.AddFormat("%d %d %d %d %d", 1, 2, 3, 4, 1234); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1 2 3 4 12") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "1 2 3 4 12"); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1 2 3 4...") == 0); + EXPECT_STREQ(builder.c_str(), "1 2 3 4..."); } { StringBuilder<11> builder; builder.AddFormat("%d", 1234); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1234") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "1234"); builder.AddFormat("%s", "abc"); - NL_TEST_ASSERT(inSuite, builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1234abc") == 0); + EXPECT_TRUE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "1234abc"); builder.AddMarkerIfOverflow(); // no overflow - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1234abc") == 0); + EXPECT_STREQ(builder.c_str(), "1234abc"); builder.AddFormat("%08x", 0x123456); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1234abc001") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "1234abc001"); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "1234abc...") == 0); + EXPECT_STREQ(builder.c_str(), "1234abc..."); } } -void TestOverflowMarker(nlTestSuite * inSuite, void * inContext) +TEST(TestStringBuilder, TestOverflowMarker) { { StringBuilder<1> builder; // useless builder, but ok builder.Add("abc123"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), ""); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "") == 0); + EXPECT_STREQ(builder.c_str(), ""); } { @@ -174,11 +173,11 @@ void TestOverflowMarker(nlTestSuite * inSuite, void * inContext) builder.Add("abc123"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "a") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "a"); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), ".") == 0); + EXPECT_STREQ(builder.c_str(), "."); } { @@ -186,11 +185,11 @@ void TestOverflowMarker(nlTestSuite * inSuite, void * inContext) builder.Add("abc123"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "ab") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "ab"); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "..") == 0); + EXPECT_STREQ(builder.c_str(), ".."); } { @@ -198,11 +197,11 @@ void TestOverflowMarker(nlTestSuite * inSuite, void * inContext) builder.Add("abc123"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "abc") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "abc"); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "...") == 0); + EXPECT_STREQ(builder.c_str(), "..."); } { @@ -210,31 +209,12 @@ void TestOverflowMarker(nlTestSuite * inSuite, void * inContext) builder.Add("abc123"); - NL_TEST_ASSERT(inSuite, !builder.Fit()); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "abc1") == 0); + EXPECT_FALSE(builder.Fit()); + EXPECT_STREQ(builder.c_str(), "abc1"); builder.AddMarkerIfOverflow(); - NL_TEST_ASSERT(inSuite, strcmp(builder.c_str(), "a...") == 0); + EXPECT_STREQ(builder.c_str(), "a..."); } } -const nlTest sTests[] = { - NL_TEST_DEF("TestStringBuilder", TestStringBuilder), // - NL_TEST_DEF("TestIntegerAppend", TestIntegerAppend), // - NL_TEST_DEF("TestOverflow", TestOverflow), // - NL_TEST_DEF("TestFormat", TestFormat), // - NL_TEST_DEF("TestFormatOverflow", TestFormatOverflow), // - NL_TEST_DEF("TestOverflowMarker", TestOverflowMarker), // - NL_TEST_SENTINEL() // -}; - } // namespace - -int TestStringBuilder() -{ - nlTestSuite theSuite = { "StringBuilder", sTests, nullptr, nullptr }; - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestStringBuilder) diff --git a/src/lib/support/tests/TestStringSplitter.cpp b/src/lib/support/tests/TestStringSplitter.cpp index 50b0ec094f0a0f..c8dd1e9f802c47 100644 --- a/src/lib/support/tests/TestStringSplitter.cpp +++ b/src/lib/support/tests/TestStringSplitter.cpp @@ -15,15 +15,13 @@ * limitations under the License. */ #include -#include - -#include +#include namespace { using namespace chip; -void TestStrdupSplitter(nlTestSuite * inSuite, void * inContext) +TEST(TestStringSplitter, TestStrdupSplitter) { CharSpan out; @@ -32,122 +30,107 @@ void TestStrdupSplitter(nlTestSuite * inSuite, void * inContext) StringSplitter splitter("", ','); // next stays at nullptr - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data() == nullptr); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data() == nullptr); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data() == nullptr); + EXPECT_FALSE(splitter.Next(out)); + EXPECT_EQ(out.data(), nullptr); + EXPECT_FALSE(splitter.Next(out)); + EXPECT_EQ(out.data(), nullptr); + EXPECT_FALSE(splitter.Next(out)); + EXPECT_EQ(out.data(), nullptr); } // single item { StringSplitter splitter("single", ','); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("single"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("single"_span)); // next stays at nullptr also after valid data - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data() == nullptr); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data() == nullptr); + EXPECT_FALSE(splitter.Next(out)); + EXPECT_EQ(out.data(), nullptr); + EXPECT_FALSE(splitter.Next(out)); + EXPECT_EQ(out.data(), nullptr); } // multi-item { StringSplitter splitter("one,two,three", ','); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("one"_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("two"_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("three"_span)); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data() == nullptr); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("one"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("two"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("three"_span)); + EXPECT_FALSE(splitter.Next(out)); + EXPECT_EQ(out.data(), nullptr); } // mixed { StringSplitter splitter("a**bc*d,e*f", '*'); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("a"_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("bc"_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("d,e"_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("f"_span)); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("a"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("bc"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("d,e"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("f"_span)); + EXPECT_FALSE(splitter.Next(out)); } // some edge cases { StringSplitter splitter(",", ','); // Note that even though "" is nullptr right away, "," becomes two empty strings - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_FALSE(splitter.Next(out)); } { StringSplitter splitter("log,", ','); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("log"_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("log"_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_FALSE(splitter.Next(out)); } { StringSplitter splitter(",log", ','); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal("log"_span)); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal("log"_span)); + EXPECT_FALSE(splitter.Next(out)); } { StringSplitter splitter(",,,", ','); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, splitter.Next(out)); - NL_TEST_ASSERT(inSuite, out.data_equal(""_span)); - NL_TEST_ASSERT(inSuite, !splitter.Next(out)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_TRUE(splitter.Next(out)); + EXPECT_TRUE(out.data_equal(""_span)); + EXPECT_FALSE(splitter.Next(out)); } } -void TestNullResilience(nlTestSuite * inSuite, void * inContext) +TEST(TestStringSplitter, TestNullResilience) { { StringSplitter splitter(nullptr, ','); CharSpan span; - NL_TEST_ASSERT(inSuite, !splitter.Next(span)); - NL_TEST_ASSERT(inSuite, span.data() == nullptr); + EXPECT_FALSE(splitter.Next(span)); + EXPECT_EQ(span.data(), nullptr); } } -const nlTest sTests[] = { - NL_TEST_DEF("TestSplitter", TestStrdupSplitter), // - NL_TEST_DEF("TestNullResilience", TestNullResilience), // - NL_TEST_SENTINEL() // -}; - } // namespace - -int TestStringSplitter() -{ - nlTestSuite theSuite = { "StringSplitter", sTests, nullptr, nullptr }; - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestStringSplitter) diff --git a/src/lib/support/tests/TestTimeUtils.cpp b/src/lib/support/tests/TestTimeUtils.cpp index cc0f8bbe02827e..7d0a69709b8bc4 100644 --- a/src/lib/support/tests/TestTimeUtils.cpp +++ b/src/lib/support/tests/TestTimeUtils.cpp @@ -29,10 +29,9 @@ #include #include -#include +#include #include -#include #include using namespace chip; @@ -44,7 +43,7 @@ using namespace chip; { \ ChipLogError(NotSpecified, "%s", (message)); \ } \ - NL_TEST_ASSERT(inSuite, (cond)); \ + EXPECT_TRUE((cond)); \ \ if (!(cond)) \ return; \ @@ -800,7 +799,7 @@ OrdinalDateTestValue LeapYearOrdinalDates[] = }; // clang-format on -void TestOrdinalDateConversion(nlTestSuite * inSuite, void * inContext) +TEST(TestTimeUtils, TestOrdinalDateConversion) { for (uint16_t year = 0; year <= 10000; year++) { @@ -823,7 +822,7 @@ void TestOrdinalDateConversion(nlTestSuite * inSuite, void * inContext) } } -void TestDaysSinceEpochConversion(nlTestSuite * inSuite, void * inContext) +TEST(TestTimeUtils, TestDaysSinceEpochConversion) { uint32_t daysSinceEpoch = 0; @@ -870,7 +869,7 @@ void TestDaysSinceEpochConversion(nlTestSuite * inSuite, void * inContext) } } -void TestSecondsSinceEpochConversion(nlTestSuite * inSuite, void * inContext) +TEST(TestTimeUtils, TestSecondsSinceEpochConversion) { uint32_t daysSinceEpoch = 0; uint32_t timeOfDay = 0; // in seconds @@ -949,7 +948,7 @@ void TestSecondsSinceEpochConversion(nlTestSuite * inSuite, void * inContext) } } -void TestChipEpochTimeConversion(nlTestSuite * inSuite, void * inContext) +TEST(TestTimeUtils, TestChipEpochTimeConversion) { uint32_t daysSinceEpoch = 0; uint32_t timeOfDay = 0; // in seconds @@ -1022,54 +1021,22 @@ void TestChipEpochTimeConversion(nlTestSuite * inSuite, void * inContext) } } -void TestChipEpochTimeEdgeConditions(nlTestSuite * inSuite, void * inContext) +TEST(TestTimeUtils, TestChipEpochTimeEdgeConditions) { uint32_t chip_epoch_time_sec = 0; - NL_TEST_ASSERT(inSuite, UnixEpochToChipEpochTime(INT32_MAX, chip_epoch_time_sec)); - NL_TEST_ASSERT(inSuite, chip_epoch_time_sec < INT32_MAX); + EXPECT_TRUE(UnixEpochToChipEpochTime(UINT32_MAX, chip_epoch_time_sec)); + EXPECT_LT(chip_epoch_time_sec, UINT32_MAX); // TODO(#30990): Bring back tests when implementation fixed. #if 0 constexpr uint32_t kUnix2000Jan1 = 946702800; // Start of CHIP epoch. - chip_epoch_time_sec = INT32_MAX; - NL_TEST_ASSERT(inSuite, UnixEpochToChipEpochTime(kUnix2000Jan1, chip_epoch_time_sec) == true); - NL_TEST_ASSERT(inSuite, chip_epoch_time_sec == 0); + chip_epoch_time_sec = UINT32_MAX; + EXPECT_EQ(UnixEpochToChipEpochTime(kUnix2000Jan1, chip_epoch_time_sec), true); + EXPECT_EQ(chip_epoch_time_sec, 0u); chip_epoch_time_sec = 0; - NL_TEST_ASSERT(inSuite, UnixEpochToChipEpochTime(kUnix2000Jan1 - 1, chip_epoch_time_sec) == false); + EXPECT_EQ(UnixEpochToChipEpochTime(kUnix2000Jan1 - 1, chip_epoch_time_sec), false); #endif } - -// clang-format off -static const nlTest g_all_tests[] = -{ - NL_TEST_DEF("Test Ordinal Date conversion", TestOrdinalDateConversion), - NL_TEST_DEF("Test DaysSinceEpoch conversion", TestDaysSinceEpochConversion), - NL_TEST_DEF("Test SecondsSinceEpoch conversion", TestSecondsSinceEpochConversion), - NL_TEST_DEF("Test ChipEpochTime conversion", TestChipEpochTimeConversion), - NL_TEST_DEF("Test edge conditions of time conversions", TestChipEpochTimeEdgeConditions), - - NL_TEST_SENTINEL() -}; -// clang-format on - -int TestTimeUtils() -{ - // clang-format off - nlTestSuite theSuite = - { - "Test common time utilities", - &g_all_tests[0], - nullptr, - nullptr - }; - // clang-format on - - nlTestRunner(&theSuite, nullptr); - - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestTimeUtils); diff --git a/src/lib/support/tests/TestVariant.cpp b/src/lib/support/tests/TestVariant.cpp index 10cb9d48a9070a..cd51d252dd3a0c 100644 --- a/src/lib/support/tests/TestVariant.cpp +++ b/src/lib/support/tests/TestVariant.cpp @@ -18,10 +18,9 @@ #include -#include -#include +#include -#include +#include namespace { @@ -73,159 +72,159 @@ int Count::destroyed = 0; using namespace chip; -void TestVariantSimple(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantSimple) { Variant v; - NL_TEST_ASSERT(inSuite, !v.Valid()); + EXPECT_FALSE(v.Valid()); v.Set(5, 10); - NL_TEST_ASSERT(inSuite, v.Valid()); - NL_TEST_ASSERT(inSuite, v.Is()); - NL_TEST_ASSERT(inSuite, v.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v.Get().m2 == 10); + EXPECT_TRUE(v.Valid()); + EXPECT_TRUE(v.Is()); + EXPECT_EQ(v.Get().m1, 5); + EXPECT_EQ(v.Get().m2, 10); } -void TestVariantMovable(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantMovable) { Variant v; v.Set(); v.Set(Movable{ 5, 10 }); - NL_TEST_ASSERT(inSuite, v.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v.Get().m2 == 10); + EXPECT_EQ(v.Get().m1, 5); + EXPECT_EQ(v.Get().m2, 10); auto & m = v.Get(); - NL_TEST_ASSERT(inSuite, m.m1 == 5); - NL_TEST_ASSERT(inSuite, m.m2 == 10); + EXPECT_EQ(m.m1, 5); + EXPECT_EQ(m.m2, 10); v.Set(); } -void TestVariantCtorDtor(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantCtorDtor) { { Variant v; - NL_TEST_ASSERT(inSuite, Count::created == 0); + EXPECT_EQ(Count::created, 0); v.Set(); - NL_TEST_ASSERT(inSuite, Count::created == 0); + EXPECT_EQ(Count::created, 0); v.Get(); - NL_TEST_ASSERT(inSuite, Count::created == 0); + EXPECT_EQ(Count::created, 0); } { Variant v; - NL_TEST_ASSERT(inSuite, Count::created == 0); + EXPECT_EQ(Count::created, 0); v.Set(); - NL_TEST_ASSERT(inSuite, Count::created == 0); + EXPECT_EQ(Count::created, 0); v.Set(); - NL_TEST_ASSERT(inSuite, Count::created == 1); - NL_TEST_ASSERT(inSuite, Count::destroyed == 0); + EXPECT_EQ(Count::created, 1); + EXPECT_EQ(Count::destroyed, 0); v.Get(); - NL_TEST_ASSERT(inSuite, Count::created == 1); - NL_TEST_ASSERT(inSuite, Count::destroyed == 0); + EXPECT_EQ(Count::created, 1); + EXPECT_EQ(Count::destroyed, 0); v.Set(); - NL_TEST_ASSERT(inSuite, Count::created == 1); - NL_TEST_ASSERT(inSuite, Count::destroyed == 1); + EXPECT_EQ(Count::created, 1); + EXPECT_EQ(Count::destroyed, 1); v.Set(); - NL_TEST_ASSERT(inSuite, Count::created == 2); - NL_TEST_ASSERT(inSuite, Count::destroyed == 1); + EXPECT_EQ(Count::created, 2); + EXPECT_EQ(Count::destroyed, 1); } - NL_TEST_ASSERT(inSuite, Count::destroyed == 2); + EXPECT_EQ(Count::destroyed, 2); { Variant v1; v1.Set(); Variant v2(v1); } - NL_TEST_ASSERT(inSuite, Count::created == 4); - NL_TEST_ASSERT(inSuite, Count::destroyed == 4); + EXPECT_EQ(Count::created, 4); + EXPECT_EQ(Count::destroyed, 4); { Variant v1; v1.Set(); Variant v2(std::move(v1)); } - NL_TEST_ASSERT(inSuite, Count::created == 6); - NL_TEST_ASSERT(inSuite, Count::destroyed == 6); + EXPECT_EQ(Count::created, 6); + EXPECT_EQ(Count::destroyed, 6); { Variant v1, v2; v1.Set(); v2 = v1; } - NL_TEST_ASSERT(inSuite, Count::created == 8); - NL_TEST_ASSERT(inSuite, Count::destroyed == 8); + EXPECT_EQ(Count::created, 8); + EXPECT_EQ(Count::destroyed, 8); { Variant v1, v2; v1.Set(); v2 = std::move(v1); } - NL_TEST_ASSERT(inSuite, Count::created == 10); - NL_TEST_ASSERT(inSuite, Count::destroyed == 10); + EXPECT_EQ(Count::created, 10); + EXPECT_EQ(Count::destroyed, 10); } -void TestVariantCopy(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantCopy) { Variant v1; v1.Set(5, 10); Variant v2 = v1; - NL_TEST_ASSERT(inSuite, v1.Valid()); - NL_TEST_ASSERT(inSuite, v1.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v1.Get().m2 == 10); - NL_TEST_ASSERT(inSuite, v2.Valid()); - NL_TEST_ASSERT(inSuite, v2.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v2.Get().m2 == 10); + EXPECT_TRUE(v1.Valid()); + EXPECT_EQ(v1.Get().m1, 5); + EXPECT_EQ(v1.Get().m2, 10); + EXPECT_TRUE(v2.Valid()); + EXPECT_EQ(v2.Get().m1, 5); + EXPECT_EQ(v2.Get().m2, 10); } -void TestVariantMove(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantMove) { Variant v1; v1.Set(5, 10); Variant v2 = std::move(v1); - NL_TEST_ASSERT(inSuite, !v1.Valid()); // NOLINT(bugprone-use-after-move) - NL_TEST_ASSERT(inSuite, v2.Valid()); - NL_TEST_ASSERT(inSuite, v2.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v2.Get().m2 == 10); + EXPECT_FALSE(v1.Valid()); // NOLINT(bugprone-use-after-move) + EXPECT_TRUE(v2.Valid()); + EXPECT_EQ(v2.Get().m1, 5); + EXPECT_EQ(v2.Get().m2, 10); } -void TestVariantCopyAssign(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantCopyAssign) { Variant v1; Variant v2; v1.Set(5, 10); v2 = v1; - NL_TEST_ASSERT(inSuite, v1.Valid()); - NL_TEST_ASSERT(inSuite, v1.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v1.Get().m2 == 10); - NL_TEST_ASSERT(inSuite, v2.Valid()); - NL_TEST_ASSERT(inSuite, v2.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v2.Get().m2 == 10); + EXPECT_TRUE(v1.Valid()); + EXPECT_EQ(v1.Get().m1, 5); + EXPECT_EQ(v1.Get().m2, 10); + EXPECT_TRUE(v2.Valid()); + EXPECT_EQ(v2.Get().m1, 5); + EXPECT_EQ(v2.Get().m2, 10); } -void TestVariantMoveAssign(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantMoveAssign) { Variant v1; Variant v2; v1.Set(5, 10); v2 = std::move(v1); - NL_TEST_ASSERT(inSuite, !v1.Valid()); // NOLINT(bugprone-use-after-move) - NL_TEST_ASSERT(inSuite, v2.Valid()); - NL_TEST_ASSERT(inSuite, v2.Get().m1 == 5); - NL_TEST_ASSERT(inSuite, v2.Get().m2 == 10); + EXPECT_FALSE(v1.Valid()); // NOLINT(bugprone-use-after-move) + EXPECT_TRUE(v2.Valid()); + EXPECT_EQ(v2.Get().m1, 5); + EXPECT_EQ(v2.Get().m2, 10); } -void TestVariantInPlace(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantInPlace) { int i = 0; Variant> v1 = Variant>(InPlaceTemplate>, i); - NL_TEST_ASSERT(inSuite, v1.Valid()); - NL_TEST_ASSERT(inSuite, v1.Is>()); - NL_TEST_ASSERT(inSuite, &v1.Get>().get() == &i); + EXPECT_TRUE(v1.Valid()); + EXPECT_TRUE(v1.Is>()); + EXPECT_EQ(&v1.Get>().get(), &i); Variant> v2 = Variant>::Create>(i); - NL_TEST_ASSERT(inSuite, v2.Valid()); - NL_TEST_ASSERT(inSuite, v2.Is>()); - NL_TEST_ASSERT(inSuite, &v2.Get>().get() == &i); + EXPECT_TRUE(v2.Valid()); + EXPECT_TRUE(v2.Is>()); + EXPECT_EQ(&v2.Get>().get(), &i); } -void TestVariantCompare(nlTestSuite * inSuite, void * inContext) +TEST(TestVariant, TestVariantCompare) { Variant v0; Variant v1; @@ -238,66 +237,35 @@ void TestVariantCompare(nlTestSuite * inSuite, void * inContext) v3.Set(5, 10); v4.Set(5, 11); - NL_TEST_ASSERT(inSuite, (v0 == v0)); - NL_TEST_ASSERT(inSuite, !(v0 == v1)); - NL_TEST_ASSERT(inSuite, !(v0 == v2)); - NL_TEST_ASSERT(inSuite, !(v0 == v3)); - NL_TEST_ASSERT(inSuite, !(v0 == v4)); - - NL_TEST_ASSERT(inSuite, !(v1 == v0)); - NL_TEST_ASSERT(inSuite, (v1 == v1)); - NL_TEST_ASSERT(inSuite, !(v1 == v2)); - NL_TEST_ASSERT(inSuite, !(v1 == v3)); - NL_TEST_ASSERT(inSuite, !(v1 == v4)); - - NL_TEST_ASSERT(inSuite, !(v2 == v0)); - NL_TEST_ASSERT(inSuite, !(v2 == v1)); - NL_TEST_ASSERT(inSuite, (v2 == v2)); - NL_TEST_ASSERT(inSuite, (v2 == v3)); - NL_TEST_ASSERT(inSuite, !(v2 == v4)); - - NL_TEST_ASSERT(inSuite, !(v3 == v0)); - NL_TEST_ASSERT(inSuite, !(v3 == v1)); - NL_TEST_ASSERT(inSuite, (v3 == v2)); - NL_TEST_ASSERT(inSuite, (v3 == v3)); - NL_TEST_ASSERT(inSuite, !(v3 == v4)); - - NL_TEST_ASSERT(inSuite, !(v4 == v0)); - NL_TEST_ASSERT(inSuite, !(v4 == v1)); - NL_TEST_ASSERT(inSuite, !(v4 == v2)); - NL_TEST_ASSERT(inSuite, !(v4 == v3)); - NL_TEST_ASSERT(inSuite, (v4 == v4)); -} - -int Setup(void * inContext) -{ - return SUCCESS; -} - -int Teardown(void * inContext) -{ - return SUCCESS; + EXPECT_TRUE(v0 == v0); + EXPECT_FALSE(v0 == v1); + EXPECT_FALSE(v0 == v2); + EXPECT_FALSE(v0 == v3); + EXPECT_FALSE(v0 == v4); + + EXPECT_FALSE(v1 == v0); + EXPECT_TRUE(v1 == v1); + EXPECT_FALSE(v1 == v2); + EXPECT_FALSE(v1 == v3); + EXPECT_FALSE(v1 == v4); + + EXPECT_FALSE(v2 == v0); + EXPECT_FALSE(v2 == v1); + EXPECT_TRUE(v2 == v2); + EXPECT_TRUE(v2 == v3); + EXPECT_FALSE(v2 == v4); + + EXPECT_FALSE(v3 == v0); + EXPECT_FALSE(v3 == v1); + EXPECT_TRUE(v3 == v2); + EXPECT_TRUE(v3 == v3); + EXPECT_FALSE(v3 == v4); + + EXPECT_FALSE(v4 == v0); + EXPECT_FALSE(v4 == v1); + EXPECT_FALSE(v4 == v2); + EXPECT_FALSE(v4 == v3); + EXPECT_TRUE(v4 == v4); } } // namespace - -#define NL_TEST_DEF_FN(fn) NL_TEST_DEF("Test " #fn, fn) -/** - * Test Suite. It lists all the test functions. - */ -static const nlTest sTests[] = { NL_TEST_DEF_FN(TestVariantSimple), NL_TEST_DEF_FN(TestVariantMovable), - NL_TEST_DEF_FN(TestVariantCtorDtor), NL_TEST_DEF_FN(TestVariantCopy), - NL_TEST_DEF_FN(TestVariantMove), NL_TEST_DEF_FN(TestVariantCopyAssign), - NL_TEST_DEF_FN(TestVariantMoveAssign), NL_TEST_DEF_FN(TestVariantInPlace), - NL_TEST_DEF_FN(TestVariantCompare), NL_TEST_SENTINEL() }; - -int TestVariant() -{ - nlTestSuite theSuite = { "CHIP Variant tests", &sTests[0], Setup, Teardown }; - - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); - return nlTestRunnerStats(&theSuite); -} - -CHIP_REGISTER_TEST_SUITE(TestVariant); From 5ce992d1f314cd5a4a0fc6a2050d842413a76a58 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 26 Apr 2024 14:28:09 -0400 Subject: [PATCH 35/40] Include what you use for some chef files (#33197) * Some include-what-you-use for stl things in chef * Restyle --------- Co-authored-by: Andrei Litvin --- examples/chef/common/clusters/door-lock/chef-lock-manager.cpp | 4 +++- examples/chef/common/clusters/door-lock/chef-lock-manager.h | 2 ++ .../common/clusters/target-navigator/TargetNavigatorManager.h | 1 + examples/chef/esp32/main/QRCodeScreen.cpp | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp b/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp index b6c3f7a4a35090..24505972fb8e41 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp +++ b/examples/chef/common/clusters/door-lock/chef-lock-manager.cpp @@ -15,12 +15,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include #include #ifdef MATTER_DM_PLUGIN_DOOR_LOCK_SERVER #include "chef-lock-manager.h" +#include +#include + using chip::to_underlying; LockManager LockManager::instance; diff --git a/examples/chef/common/clusters/door-lock/chef-lock-manager.h b/examples/chef/common/clusters/door-lock/chef-lock-manager.h index f941620880678e..b8fb409fc09e3d 100644 --- a/examples/chef/common/clusters/door-lock/chef-lock-manager.h +++ b/examples/chef/common/clusters/door-lock/chef-lock-manager.h @@ -20,7 +20,9 @@ #include "chef-lock-endpoint.h" #include + #include +#include class LockManager { diff --git a/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h b/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h index e9528081661e8d..56382feda5388e 100644 --- a/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h +++ b/examples/chef/common/clusters/target-navigator/TargetNavigatorManager.h @@ -19,6 +19,7 @@ #include +#include #include class TargetNavigatorManager : public chip::app::Clusters::TargetNavigator::Delegate diff --git a/examples/chef/esp32/main/QRCodeScreen.cpp b/examples/chef/esp32/main/QRCodeScreen.cpp index ac39b9498e9f21..0b43664468a717 100644 --- a/examples/chef/esp32/main/QRCodeScreen.cpp +++ b/examples/chef/esp32/main/QRCodeScreen.cpp @@ -43,6 +43,7 @@ #include #include +#include // TODO need sensible library tag when put in library extern const char TAG[]; From 61f305650a65186712c31eb43cccdf81ea79a17f Mon Sep 17 00:00:00 2001 From: Kamil Kasperczyk <66371704+kkasperczyk-no@users.noreply.github.com> Date: Fri, 26 Apr 2024 21:18:19 +0200 Subject: [PATCH 36/40] [thread] Enhance/Optimize attach to thread network (#33191) Enhance attaching to Thread network by verifying if the current dataset is the same as provided. In the current solution implementation will not reset the Thread interface while the dataset are equal to the active dataset. --- .../GenericThreadStackManagerImpl_OpenThread.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp index f4548e67829582..f62b82b4f2d112 100644 --- a/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp +++ b/src/platform/OpenThread/GenericThreadStackManagerImpl_OpenThread.hpp @@ -372,6 +372,14 @@ template CHIP_ERROR GenericThreadStackManagerImpl_OpenThread::_AttachToThreadNetwork( const Thread::OperationalDataset & dataset, NetworkCommissioning::Internal::WirelessDriver::ConnectCallback * callback) { + Thread::OperationalDataset current_dataset; + // Validate the dataset change with the current state + ThreadStackMgrImpl().GetThreadProvision(current_dataset); + if (dataset.AsByteSpan().data_equal(current_dataset.AsByteSpan()) && callback == nullptr) + { + return CHIP_NO_ERROR; + } + // Reset the previously set callback since it will never be called in case incorrect dataset was supplied. mpConnectCallback = nullptr; ReturnErrorOnFailure(Impl()->SetThreadEnabled(false)); From a45386bad240995f4e5d338dd1e95bf898039e23 Mon Sep 17 00:00:00 2001 From: joonhaengHeo <85541460+joonhaengHeo@users.noreply.github.com> Date: Sat, 27 Apr 2024 04:23:53 +0900 Subject: [PATCH 37/40] Fix Android ChipCluster subscribe issue (#33192) --- .../generators/java/ChipClusters_java.jinja | 8 +- .../several_clusters/java/ChipClusters.java | 12 +- .../chip/devicecontroller/ChipClusters.java | 1851 ++++++++++++++++- 3 files changed, 1865 insertions(+), 6 deletions(-) diff --git a/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja b/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja index fb49e5737271b9..b391d09389ac2b 100644 --- a/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja +++ b/scripts/py_matter_idl/matter_idl/generators/java/ChipClusters_java.jinja @@ -217,7 +217,7 @@ public class ChipClusters { long attributeId, int minInterval, int maxInterval) { - ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, null); + ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, callback); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); ChipInteractionClient.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); } @@ -250,7 +250,7 @@ public class ChipClusters { } } - abstract static class ReportCallbackImpl implements ReportCallback, SubscriptionEstablishedCallback { + abstract static class ReportCallbackImpl implements ReportCallback, SubscriptionEstablishedCallback, ResubscriptionAttemptCallback { private BaseAttributeCallback callback; private ChipAttributePath path; @@ -308,6 +308,9 @@ public class ChipClusters { callback.onSubscriptionEstablished(subscriptionId); } + @Override + public void onResubscriptionAttempt(long terminationCause, long nextResubscribeIntervalMsec) {} + public abstract void onSuccess(byte[] tlv); } @@ -551,6 +554,7 @@ public class ChipClusters { public void onSuccess(byte[] tlv) { {%- set encodable = attribute.definition | asEncodable(typeLookup) %} {{encode_value_without_optional(cluster, encodable, 0)}} value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, {{attribute.definition.name | constcase}}_ATTRIBUTE_ID, minInterval, maxInterval); } diff --git a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java index 836940ab4e089f..b574271a684521 100644 --- a/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java +++ b/scripts/py_matter_idl/matter_idl/tests/outputs/several_clusters/java/ChipClusters.java @@ -140,7 +140,7 @@ protected void subscribeAttribute( long attributeId, int minInterval, int maxInterval) { - ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, null); + ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, callback); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); ChipInteractionClient.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); } @@ -173,7 +173,7 @@ protected void finalize() throws Throwable { } } - abstract static class ReportCallbackImpl implements ReportCallback, SubscriptionEstablishedCallback { + abstract static class ReportCallbackImpl implements ReportCallback, SubscriptionEstablishedCallback, ResubscriptionAttemptCallback { private BaseAttributeCallback callback; private ChipAttributePath path; @@ -231,6 +231,9 @@ public void onSubscriptionEstablished(long subscriptionId) { callback.onSubscriptionEstablished(subscriptionId); } + @Override + public void onResubscriptionAttempt(long terminationCause, long nextResubscribeIntervalMsec) {} + public abstract void onSuccess(byte[] tlv); } @@ -334,6 +337,7 @@ public void subscribeSomeIntegerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOME_INTEGER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -385,6 +389,7 @@ public void subscribeFabricsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FABRICS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -410,6 +415,7 @@ public void subscribeSomeBytesAttribute( @Override public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOME_BYTES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -461,6 +467,7 @@ public void subscribeSomeEnumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOME_ENUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -495,6 +502,7 @@ public void subscribeOptionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPTIONS_ATTRIBUTE_ID, minInterval, maxInterval); } diff --git a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java index 66ae0a97ce86a6..0844ffee7a1918 100644 --- a/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java +++ b/src/controller/java/generated/java/chip/devicecontroller/ChipClusters.java @@ -140,7 +140,7 @@ protected void subscribeAttribute( long attributeId, int minInterval, int maxInterval) { - ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, null); + ReportCallbackJni jniCallback = new ReportCallbackJni(callback, callback, callback); ChipAttributePath path = ChipAttributePath.newInstance(endpointId, clusterId, attributeId); ChipInteractionClient.subscribe(0, jniCallback.getCallbackHandle(), devicePtr, Arrays.asList(path), null, null, minInterval, maxInterval, false, true, timeoutMillis.orElse(0L).intValue(), null); } @@ -173,7 +173,7 @@ protected void finalize() throws Throwable { } } - abstract static class ReportCallbackImpl implements ReportCallback, SubscriptionEstablishedCallback { + abstract static class ReportCallbackImpl implements ReportCallback, SubscriptionEstablishedCallback, ResubscriptionAttemptCallback { private BaseAttributeCallback callback; private ChipAttributePath path; @@ -231,6 +231,9 @@ public void onSubscriptionEstablished(long subscriptionId) { callback.onSubscriptionEstablished(subscriptionId); } + @Override + public void onResubscriptionAttempt(long terminationCause, long nextResubscribeIntervalMsec) {} + public abstract void onSuccess(byte[] tlv); } @@ -401,6 +404,7 @@ public void subscribeIdentifyTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, IDENTIFY_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -426,6 +430,7 @@ public void subscribeIdentifyTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, IDENTIFY_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -451,6 +456,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -476,6 +482,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -501,6 +508,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -526,6 +534,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -551,6 +560,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -576,6 +586,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -854,6 +865,7 @@ public void subscribeNameSupportAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NAME_SUPPORT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -879,6 +891,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -904,6 +917,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -929,6 +943,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -954,6 +969,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -979,6 +995,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1004,6 +1021,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1191,6 +1209,7 @@ public void subscribeOnOffAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_OFF_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1216,6 +1235,7 @@ public void subscribeGlobalSceneControlAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GLOBAL_SCENE_CONTROL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1250,6 +1270,7 @@ public void subscribeOnTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1284,6 +1305,7 @@ public void subscribeOffWaitTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OFF_WAIT_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1318,6 +1340,7 @@ public void subscribeStartUpOnOffAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_ON_OFF_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1343,6 +1366,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1368,6 +1392,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1393,6 +1418,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1418,6 +1444,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1443,6 +1470,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1468,6 +1496,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1532,6 +1561,7 @@ public void subscribeSwitchTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SWITCH_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1566,6 +1596,7 @@ public void subscribeSwitchActionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SWITCH_ACTIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1591,6 +1622,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1616,6 +1648,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1641,6 +1674,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1666,6 +1700,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1691,6 +1726,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -1716,6 +1752,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2084,6 +2121,7 @@ public void subscribeCurrentLevelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2109,6 +2147,7 @@ public void subscribeRemainingTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REMAINING_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2134,6 +2173,7 @@ public void subscribeMinLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2159,6 +2199,7 @@ public void subscribeMaxLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2184,6 +2225,7 @@ public void subscribeCurrentFrequencyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2209,6 +2251,7 @@ public void subscribeMinFrequencyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2234,6 +2277,7 @@ public void subscribeMaxFrequencyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2268,6 +2312,7 @@ public void subscribeOptionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPTIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2302,6 +2347,7 @@ public void subscribeOnOffTransitionTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_OFF_TRANSITION_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2336,6 +2382,7 @@ public void subscribeOnLevelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2370,6 +2417,7 @@ public void subscribeOnTransitionTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_TRANSITION_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2404,6 +2452,7 @@ public void subscribeOffTransitionTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OFF_TRANSITION_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2438,6 +2487,7 @@ public void subscribeDefaultMoveRateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_MOVE_RATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2472,6 +2522,7 @@ public void subscribeStartUpCurrentLevelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_CURRENT_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2497,6 +2548,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2522,6 +2574,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2547,6 +2600,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2572,6 +2626,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2597,6 +2652,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2622,6 +2678,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2702,6 +2759,7 @@ public void subscribeActiveTextAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_TEXT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2736,6 +2794,7 @@ public void subscribeDescriptionAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DESCRIPTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2770,6 +2829,7 @@ public void subscribeInactiveTextAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INACTIVE_TEXT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2804,6 +2864,7 @@ public void subscribeOutOfServiceAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OUT_OF_SERVICE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2829,6 +2890,7 @@ public void subscribePolarityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POLARITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2863,6 +2925,7 @@ public void subscribePresentValueAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRESENT_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2897,6 +2960,7 @@ public void subscribeReliabilityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RELIABILITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2922,6 +2986,7 @@ public void subscribeStatusFlagsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATUS_FLAGS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2947,6 +3012,7 @@ public void subscribeApplicationTypeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPLICATION_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2972,6 +3038,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -2997,6 +3064,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3022,6 +3090,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3047,6 +3116,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3072,6 +3142,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3097,6 +3168,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3159,6 +3231,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3184,6 +3257,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3209,6 +3283,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3234,6 +3309,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3259,6 +3335,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3284,6 +3361,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3371,6 +3449,7 @@ public void subscribeDeviceTypeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEVICE_TYPE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3396,6 +3475,7 @@ public void subscribeServerListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SERVER_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3421,6 +3501,7 @@ public void subscribeClientListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLIENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3446,6 +3527,7 @@ public void subscribePartsListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PARTS_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3471,6 +3553,7 @@ public void subscribeTagListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TAG_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3496,6 +3579,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3521,6 +3605,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3546,6 +3631,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3571,6 +3657,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3596,6 +3683,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3621,6 +3709,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3702,6 +3791,7 @@ public void subscribeBindingAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BINDING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3727,6 +3817,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3752,6 +3843,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3777,6 +3869,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3802,6 +3895,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3827,6 +3921,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3852,6 +3947,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3941,6 +4037,7 @@ public void subscribeAclAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -3980,6 +4077,7 @@ public void subscribeExtensionAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EXTENSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4005,6 +4103,7 @@ public void subscribeSubjectsPerAccessControlEntryAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUBJECTS_PER_ACCESS_CONTROL_ENTRY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4030,6 +4129,7 @@ public void subscribeTargetsPerAccessControlEntryAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TARGETS_PER_ACCESS_CONTROL_ENTRY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4055,6 +4155,7 @@ public void subscribeAccessControlEntriesPerFabricAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCESS_CONTROL_ENTRIES_PER_FABRIC_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4080,6 +4181,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4105,6 +4207,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4130,6 +4233,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4155,6 +4259,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4180,6 +4285,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4205,6 +4311,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4586,6 +4693,7 @@ public void subscribeActionListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTION_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4611,6 +4719,7 @@ public void subscribeEndpointListsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENDPOINT_LISTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4636,6 +4745,7 @@ public void subscribeSetupURLAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SETUP_U_R_L_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4661,6 +4771,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4686,6 +4797,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4711,6 +4823,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4736,6 +4849,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4761,6 +4875,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4786,6 +4901,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4895,6 +5011,7 @@ public void subscribeDataModelRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DATA_MODEL_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4920,6 +5037,7 @@ public void subscribeVendorNameAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4945,6 +5063,7 @@ public void subscribeVendorIDAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4970,6 +5089,7 @@ public void subscribeProductNameAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -4995,6 +5115,7 @@ public void subscribeProductIDAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5029,6 +5150,7 @@ public void subscribeNodeLabelAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NODE_LABEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5063,6 +5185,7 @@ public void subscribeLocationAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5088,6 +5211,7 @@ public void subscribeHardwareVersionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARDWARE_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5113,6 +5237,7 @@ public void subscribeHardwareVersionStringAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARDWARE_VERSION_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5138,6 +5263,7 @@ public void subscribeSoftwareVersionAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOFTWARE_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5163,6 +5289,7 @@ public void subscribeSoftwareVersionStringAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOFTWARE_VERSION_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5188,6 +5315,7 @@ public void subscribeManufacturingDateAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MANUFACTURING_DATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5213,6 +5341,7 @@ public void subscribePartNumberAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PART_NUMBER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5238,6 +5367,7 @@ public void subscribeProductURLAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_U_R_L_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5263,6 +5393,7 @@ public void subscribeProductLabelAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_LABEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5288,6 +5419,7 @@ public void subscribeSerialNumberAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SERIAL_NUMBER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5322,6 +5454,7 @@ public void subscribeLocalConfigDisabledAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCAL_CONFIG_DISABLED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5347,6 +5480,7 @@ public void subscribeReachableAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACHABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5372,6 +5506,7 @@ public void subscribeUniqueIDAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNIQUE_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5397,6 +5532,7 @@ public void subscribeCapabilityMinimaAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.BasicInformationClusterCapabilityMinimaStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CAPABILITY_MINIMA_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5422,6 +5558,7 @@ public void subscribeProductAppearanceAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.BasicInformationClusterProductAppearanceStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_APPEARANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5447,6 +5584,7 @@ public void subscribeSpecificationVersionAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPECIFICATION_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5472,6 +5610,7 @@ public void subscribeMaxPathsPerInvokeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_PATHS_PER_INVOKE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5497,6 +5636,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5522,6 +5662,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5547,6 +5688,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5572,6 +5714,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5597,6 +5740,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5622,6 +5766,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5864,6 +6009,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5889,6 +6035,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5914,6 +6061,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5939,6 +6087,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5964,6 +6113,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -5989,6 +6139,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6113,6 +6264,7 @@ public void subscribeDefaultOTAProvidersAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_O_T_A_PROVIDERS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6138,6 +6290,7 @@ public void subscribeUpdatePossibleAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UPDATE_POSSIBLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6163,6 +6316,7 @@ public void subscribeUpdateStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UPDATE_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6188,6 +6342,7 @@ public void subscribeUpdateStateProgressAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UPDATE_STATE_PROGRESS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6213,6 +6368,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6238,6 +6394,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6263,6 +6420,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6288,6 +6446,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6313,6 +6472,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6338,6 +6498,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6415,6 +6576,7 @@ public void subscribeActiveLocaleAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_LOCALE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6440,6 +6602,7 @@ public void subscribeSupportedLocalesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_LOCALES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6465,6 +6628,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6490,6 +6654,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6515,6 +6680,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6540,6 +6706,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6565,6 +6732,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6590,6 +6758,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6668,6 +6837,7 @@ public void subscribeHourFormatAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HOUR_FORMAT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6702,6 +6872,7 @@ public void subscribeActiveCalendarTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_CALENDAR_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6727,6 +6898,7 @@ public void subscribeSupportedCalendarTypesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_CALENDAR_TYPES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6752,6 +6924,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6777,6 +6950,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6802,6 +6976,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6827,6 +7002,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6852,6 +7028,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6877,6 +7054,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6949,6 +7127,7 @@ public void subscribeTemperatureUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEMPERATURE_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6974,6 +7153,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -6999,6 +7179,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7024,6 +7205,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7049,6 +7231,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7074,6 +7257,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7099,6 +7283,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7166,6 +7351,7 @@ public void subscribeSourcesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOURCES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7191,6 +7377,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7216,6 +7403,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7241,6 +7429,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7266,6 +7455,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7291,6 +7481,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7316,6 +7507,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7458,6 +7650,7 @@ public void subscribeStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7483,6 +7676,7 @@ public void subscribeOrderAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ORDER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7508,6 +7702,7 @@ public void subscribeDescriptionAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DESCRIPTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7533,6 +7728,7 @@ public void subscribeWiredAssessedInputVoltageAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_ASSESSED_INPUT_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7558,6 +7754,7 @@ public void subscribeWiredAssessedInputFrequencyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_ASSESSED_INPUT_FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7583,6 +7780,7 @@ public void subscribeWiredCurrentTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_CURRENT_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7608,6 +7806,7 @@ public void subscribeWiredAssessedCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_ASSESSED_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7633,6 +7832,7 @@ public void subscribeWiredNominalVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_NOMINAL_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7658,6 +7858,7 @@ public void subscribeWiredMaximumCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_MAXIMUM_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7683,6 +7884,7 @@ public void subscribeWiredPresentAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIRED_PRESENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7708,6 +7910,7 @@ public void subscribeActiveWiredFaultsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_WIRED_FAULTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7733,6 +7936,7 @@ public void subscribeBatVoltageAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7758,6 +7962,7 @@ public void subscribeBatPercentRemainingAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_PERCENT_REMAINING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7783,6 +7988,7 @@ public void subscribeBatTimeRemainingAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_TIME_REMAINING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7808,6 +8014,7 @@ public void subscribeBatChargeLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_CHARGE_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7833,6 +8040,7 @@ public void subscribeBatReplacementNeededAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_REPLACEMENT_NEEDED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7858,6 +8066,7 @@ public void subscribeBatReplaceabilityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_REPLACEABILITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7883,6 +8092,7 @@ public void subscribeBatPresentAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_PRESENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7908,6 +8118,7 @@ public void subscribeActiveBatFaultsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_BAT_FAULTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7933,6 +8144,7 @@ public void subscribeBatReplacementDescriptionAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_REPLACEMENT_DESCRIPTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7958,6 +8170,7 @@ public void subscribeBatCommonDesignationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_COMMON_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -7983,6 +8196,7 @@ public void subscribeBatANSIDesignationAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_A_N_S_I_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8008,6 +8222,7 @@ public void subscribeBatIECDesignationAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_I_E_C_DESIGNATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8033,6 +8248,7 @@ public void subscribeBatApprovedChemistryAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_APPROVED_CHEMISTRY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8058,6 +8274,7 @@ public void subscribeBatCapacityAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8083,6 +8300,7 @@ public void subscribeBatQuantityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_QUANTITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8108,6 +8326,7 @@ public void subscribeBatChargeStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_CHARGE_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8133,6 +8352,7 @@ public void subscribeBatTimeToFullChargeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_TIME_TO_FULL_CHARGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8158,6 +8378,7 @@ public void subscribeBatFunctionalWhileChargingAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_FUNCTIONAL_WHILE_CHARGING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8183,6 +8404,7 @@ public void subscribeBatChargingCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BAT_CHARGING_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8208,6 +8430,7 @@ public void subscribeActiveBatChargeFaultsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_BAT_CHARGE_FAULTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8233,6 +8456,7 @@ public void subscribeEndpointListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENDPOINT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8258,6 +8482,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8283,6 +8508,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8308,6 +8534,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8333,6 +8560,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8358,6 +8586,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8383,6 +8612,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8594,6 +8824,7 @@ public void subscribeBreadcrumbAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BREADCRUMB_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8619,6 +8850,7 @@ public void subscribeBasicCommissioningInfoAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.GeneralCommissioningClusterBasicCommissioningInfo value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BASIC_COMMISSIONING_INFO_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8644,6 +8876,7 @@ public void subscribeRegulatoryConfigAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REGULATORY_CONFIG_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8669,6 +8902,7 @@ public void subscribeLocationCapabilityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCATION_CAPABILITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8694,6 +8928,7 @@ public void subscribeSupportsConcurrentConnectionAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTS_CONCURRENT_CONNECTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8719,6 +8954,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8744,6 +8980,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8769,6 +9006,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8794,6 +9032,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8819,6 +9058,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -8844,6 +9084,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9365,6 +9606,7 @@ public void subscribeMaxNetworksAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_NETWORKS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9390,6 +9632,7 @@ public void subscribeNetworksAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NETWORKS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9415,6 +9658,7 @@ public void subscribeScanMaxTimeSecondsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCAN_MAX_TIME_SECONDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9440,6 +9684,7 @@ public void subscribeConnectMaxTimeSecondsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONNECT_MAX_TIME_SECONDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9474,6 +9719,7 @@ public void subscribeInterfaceEnabledAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INTERFACE_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9499,6 +9745,7 @@ public void subscribeLastNetworkingStatusAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAST_NETWORKING_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9524,6 +9771,7 @@ public void subscribeLastNetworkIDAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAST_NETWORK_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9549,6 +9797,7 @@ public void subscribeLastConnectErrorValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAST_CONNECT_ERROR_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9574,6 +9823,7 @@ public void subscribeSupportedWiFiBandsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_WI_FI_BANDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9599,6 +9849,7 @@ public void subscribeSupportedThreadFeaturesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_THREAD_FEATURES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9624,6 +9875,7 @@ public void subscribeThreadVersionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, THREAD_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9649,6 +9901,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9674,6 +9927,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9699,6 +9953,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9724,6 +9979,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9749,6 +10005,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9774,6 +10031,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9899,6 +10157,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9924,6 +10183,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9949,6 +10209,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9974,6 +10235,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -9999,6 +10261,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10024,6 +10287,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10214,6 +10478,7 @@ public void subscribeNetworkInterfacesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NETWORK_INTERFACES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10239,6 +10504,7 @@ public void subscribeRebootCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REBOOT_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10264,6 +10530,7 @@ public void subscribeUpTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UP_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10289,6 +10556,7 @@ public void subscribeTotalOperationalHoursAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOTAL_OPERATIONAL_HOURS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10314,6 +10582,7 @@ public void subscribeBootReasonAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BOOT_REASON_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10339,6 +10608,7 @@ public void subscribeActiveHardwareFaultsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_HARDWARE_FAULTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10364,6 +10634,7 @@ public void subscribeActiveRadioFaultsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_RADIO_FAULTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10389,6 +10660,7 @@ public void subscribeActiveNetworkFaultsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_NETWORK_FAULTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10414,6 +10686,7 @@ public void subscribeTestEventTriggersEnabledAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEST_EVENT_TRIGGERS_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10439,6 +10712,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10464,6 +10738,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10489,6 +10764,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10514,6 +10790,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10539,6 +10816,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10564,6 +10842,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10650,6 +10929,7 @@ public void subscribeThreadMetricsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, THREAD_METRICS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10675,6 +10955,7 @@ public void subscribeCurrentHeapFreeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_HEAP_FREE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10700,6 +10981,7 @@ public void subscribeCurrentHeapUsedAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_HEAP_USED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10725,6 +11007,7 @@ public void subscribeCurrentHeapHighWatermarkAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_HEAP_HIGH_WATERMARK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10750,6 +11033,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10775,6 +11059,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10800,6 +11085,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10825,6 +11111,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10850,6 +11137,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -10875,6 +11163,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11096,6 +11385,7 @@ public void subscribeChannelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHANNEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11121,6 +11411,7 @@ public void subscribeRoutingRoleAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ROUTING_ROLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11146,6 +11437,7 @@ public void subscribeNetworkNameAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NETWORK_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11171,6 +11463,7 @@ public void subscribePanIdAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PAN_ID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11196,6 +11489,7 @@ public void subscribeExtendedPanIdAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EXTENDED_PAN_ID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11221,6 +11515,7 @@ public void subscribeMeshLocalPrefixAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MESH_LOCAL_PREFIX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11246,6 +11541,7 @@ public void subscribeOverrunCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OVERRUN_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11271,6 +11567,7 @@ public void subscribeNeighborTableAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEIGHBOR_TABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11296,6 +11593,7 @@ public void subscribeRouteTableAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ROUTE_TABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11321,6 +11619,7 @@ public void subscribePartitionIdAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PARTITION_ID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11346,6 +11645,7 @@ public void subscribeWeightingAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WEIGHTING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11371,6 +11671,7 @@ public void subscribeDataVersionAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DATA_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11396,6 +11697,7 @@ public void subscribeStableDataVersionAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STABLE_DATA_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11421,6 +11723,7 @@ public void subscribeLeaderRouterIdAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEADER_ROUTER_ID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11446,6 +11749,7 @@ public void subscribeDetachedRoleCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DETACHED_ROLE_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11471,6 +11775,7 @@ public void subscribeChildRoleCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHILD_ROLE_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11496,6 +11801,7 @@ public void subscribeRouterRoleCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ROUTER_ROLE_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11521,6 +11827,7 @@ public void subscribeLeaderRoleCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEADER_ROLE_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11546,6 +11853,7 @@ public void subscribeAttachAttemptCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTACH_ATTEMPT_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11571,6 +11879,7 @@ public void subscribePartitionIdChangeCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PARTITION_ID_CHANGE_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11596,6 +11905,7 @@ public void subscribeBetterPartitionAttachAttemptCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BETTER_PARTITION_ATTACH_ATTEMPT_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11621,6 +11931,7 @@ public void subscribeParentChangeCountAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PARENT_CHANGE_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11646,6 +11957,7 @@ public void subscribeTxTotalCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_TOTAL_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11671,6 +11983,7 @@ public void subscribeTxUnicastCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_UNICAST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11696,6 +12009,7 @@ public void subscribeTxBroadcastCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_BROADCAST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11721,6 +12035,7 @@ public void subscribeTxAckRequestedCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_ACK_REQUESTED_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11746,6 +12061,7 @@ public void subscribeTxAckedCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_ACKED_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11771,6 +12087,7 @@ public void subscribeTxNoAckRequestedCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_NO_ACK_REQUESTED_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11796,6 +12113,7 @@ public void subscribeTxDataCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_DATA_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11821,6 +12139,7 @@ public void subscribeTxDataPollCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_DATA_POLL_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11846,6 +12165,7 @@ public void subscribeTxBeaconCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_BEACON_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11871,6 +12191,7 @@ public void subscribeTxBeaconRequestCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_BEACON_REQUEST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11896,6 +12217,7 @@ public void subscribeTxOtherCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_OTHER_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11921,6 +12243,7 @@ public void subscribeTxRetryCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_RETRY_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11946,6 +12269,7 @@ public void subscribeTxDirectMaxRetryExpiryCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_DIRECT_MAX_RETRY_EXPIRY_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11971,6 +12295,7 @@ public void subscribeTxIndirectMaxRetryExpiryCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_INDIRECT_MAX_RETRY_EXPIRY_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -11996,6 +12321,7 @@ public void subscribeTxErrCcaCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_ERR_CCA_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12021,6 +12347,7 @@ public void subscribeTxErrAbortCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_ERR_ABORT_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12046,6 +12373,7 @@ public void subscribeTxErrBusyChannelCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_ERR_BUSY_CHANNEL_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12071,6 +12399,7 @@ public void subscribeRxTotalCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_TOTAL_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12096,6 +12425,7 @@ public void subscribeRxUnicastCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_UNICAST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12121,6 +12451,7 @@ public void subscribeRxBroadcastCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_BROADCAST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12146,6 +12477,7 @@ public void subscribeRxDataCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_DATA_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12171,6 +12503,7 @@ public void subscribeRxDataPollCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_DATA_POLL_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12196,6 +12529,7 @@ public void subscribeRxBeaconCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_BEACON_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12221,6 +12555,7 @@ public void subscribeRxBeaconRequestCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_BEACON_REQUEST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12246,6 +12581,7 @@ public void subscribeRxOtherCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_OTHER_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12271,6 +12607,7 @@ public void subscribeRxAddressFilteredCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ADDRESS_FILTERED_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12296,6 +12633,7 @@ public void subscribeRxDestAddrFilteredCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_DEST_ADDR_FILTERED_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12321,6 +12659,7 @@ public void subscribeRxDuplicatedCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_DUPLICATED_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12346,6 +12685,7 @@ public void subscribeRxErrNoFrameCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ERR_NO_FRAME_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12371,6 +12711,7 @@ public void subscribeRxErrUnknownNeighborCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ERR_UNKNOWN_NEIGHBOR_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12396,6 +12737,7 @@ public void subscribeRxErrInvalidSrcAddrCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ERR_INVALID_SRC_ADDR_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12421,6 +12763,7 @@ public void subscribeRxErrSecCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ERR_SEC_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12446,6 +12789,7 @@ public void subscribeRxErrFcsCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ERR_FCS_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12471,6 +12815,7 @@ public void subscribeRxErrOtherCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RX_ERR_OTHER_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12496,6 +12841,7 @@ public void subscribeActiveTimestampAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_TIMESTAMP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12521,6 +12867,7 @@ public void subscribePendingTimestampAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PENDING_TIMESTAMP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12546,6 +12893,7 @@ public void subscribeDelayAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12571,6 +12919,7 @@ public void subscribeSecurityPolicyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ThreadNetworkDiagnosticsClusterSecurityPolicy value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SECURITY_POLICY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12596,6 +12945,7 @@ public void subscribeChannelPage0MaskAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHANNEL_PAGE0_MASK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12621,6 +12971,7 @@ public void subscribeOperationalDatasetComponentsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ThreadNetworkDiagnosticsClusterOperationalDatasetComponents value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_DATASET_COMPONENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12646,6 +12997,7 @@ public void subscribeActiveNetworkFaultsListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_NETWORK_FAULTS_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12671,6 +13023,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12696,6 +13049,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12721,6 +13075,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12746,6 +13101,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12771,6 +13127,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12796,6 +13153,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12939,6 +13297,7 @@ public void subscribeBssidAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BSSID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12964,6 +13323,7 @@ public void subscribeSecurityTypeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SECURITY_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -12989,6 +13349,7 @@ public void subscribeWiFiVersionAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WI_FI_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13014,6 +13375,7 @@ public void subscribeChannelNumberAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHANNEL_NUMBER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13039,6 +13401,7 @@ public void subscribeRssiAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RSSI_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13064,6 +13427,7 @@ public void subscribeBeaconLostCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BEACON_LOST_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13089,6 +13453,7 @@ public void subscribeBeaconRxCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BEACON_RX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13114,6 +13479,7 @@ public void subscribePacketMulticastRxCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PACKET_MULTICAST_RX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13139,6 +13505,7 @@ public void subscribePacketMulticastTxCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PACKET_MULTICAST_TX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13164,6 +13531,7 @@ public void subscribePacketUnicastRxCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PACKET_UNICAST_RX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13189,6 +13557,7 @@ public void subscribePacketUnicastTxCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PACKET_UNICAST_TX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13214,6 +13583,7 @@ public void subscribeCurrentMaxRateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MAX_RATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13239,6 +13609,7 @@ public void subscribeOverrunCountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OVERRUN_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13264,6 +13635,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13289,6 +13661,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13314,6 +13687,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13339,6 +13713,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13364,6 +13739,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13389,6 +13765,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13488,6 +13865,7 @@ public void subscribePHYRateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, P_H_Y_RATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13513,6 +13891,7 @@ public void subscribeFullDuplexAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FULL_DUPLEX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13538,6 +13917,7 @@ public void subscribePacketRxCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PACKET_RX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13563,6 +13943,7 @@ public void subscribePacketTxCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PACKET_TX_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13588,6 +13969,7 @@ public void subscribeTxErrCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TX_ERR_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13613,6 +13995,7 @@ public void subscribeCollisionCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLLISION_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13638,6 +14021,7 @@ public void subscribeOverrunCountAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OVERRUN_COUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13663,6 +14047,7 @@ public void subscribeCarrierDetectAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CARRIER_DETECT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13688,6 +14073,7 @@ public void subscribeTimeSinceResetAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIME_SINCE_RESET_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13713,6 +14099,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13738,6 +14125,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13763,6 +14151,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13788,6 +14177,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13813,6 +14203,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -13838,6 +14229,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14059,6 +14451,7 @@ public void subscribeUTCTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, U_T_C_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14084,6 +14477,7 @@ public void subscribeGranularityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GRANULARITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14109,6 +14503,7 @@ public void subscribeTimeSourceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIME_SOURCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14134,6 +14529,7 @@ public void subscribeTrustedTimeSourceAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.TimeSynchronizationClusterTrustedTimeSourceStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TRUSTED_TIME_SOURCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14159,6 +14555,7 @@ public void subscribeDefaultNTPAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_N_T_P_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14184,6 +14581,7 @@ public void subscribeTimeZoneAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIME_ZONE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14209,6 +14607,7 @@ public void subscribeDSTOffsetAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, D_S_T_OFFSET_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14234,6 +14633,7 @@ public void subscribeLocalTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCAL_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14259,6 +14659,7 @@ public void subscribeTimeZoneDatabaseAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIME_ZONE_DATABASE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14284,6 +14685,7 @@ public void subscribeNTPServerAvailableAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, N_T_P_SERVER_AVAILABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14309,6 +14711,7 @@ public void subscribeTimeZoneListMaxSizeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIME_ZONE_LIST_MAX_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14334,6 +14737,7 @@ public void subscribeDSTOffsetListMaxSizeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, D_S_T_OFFSET_LIST_MAX_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14359,6 +14763,7 @@ public void subscribeSupportsDNSResolveAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTS_D_N_S_RESOLVE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14384,6 +14789,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14409,6 +14815,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14434,6 +14841,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14459,6 +14867,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14484,6 +14893,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14509,6 +14919,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14591,6 +15002,7 @@ public void subscribeVendorNameAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14616,6 +15028,7 @@ public void subscribeVendorIDAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14641,6 +15054,7 @@ public void subscribeProductNameAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14675,6 +15089,7 @@ public void subscribeNodeLabelAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NODE_LABEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14700,6 +15115,7 @@ public void subscribeHardwareVersionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARDWARE_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14725,6 +15141,7 @@ public void subscribeHardwareVersionStringAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARDWARE_VERSION_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14750,6 +15167,7 @@ public void subscribeSoftwareVersionAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOFTWARE_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14775,6 +15193,7 @@ public void subscribeSoftwareVersionStringAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOFTWARE_VERSION_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14800,6 +15219,7 @@ public void subscribeManufacturingDateAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MANUFACTURING_DATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14825,6 +15245,7 @@ public void subscribePartNumberAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PART_NUMBER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14850,6 +15271,7 @@ public void subscribeProductURLAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_U_R_L_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14875,6 +15297,7 @@ public void subscribeProductLabelAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_LABEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14900,6 +15323,7 @@ public void subscribeSerialNumberAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SERIAL_NUMBER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14925,6 +15349,7 @@ public void subscribeReachableAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACHABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14950,6 +15375,7 @@ public void subscribeUniqueIDAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNIQUE_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -14975,6 +15401,7 @@ public void subscribeProductAppearanceAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.BridgedDeviceBasicInformationClusterProductAppearanceStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_APPEARANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15000,6 +15427,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15025,6 +15453,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15050,6 +15479,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15075,6 +15505,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15100,6 +15531,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15125,6 +15557,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15190,6 +15623,7 @@ public void subscribeNumberOfPositionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_POSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15215,6 +15649,7 @@ public void subscribeCurrentPositionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15240,6 +15675,7 @@ public void subscribeMultiPressMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MULTI_PRESS_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15265,6 +15701,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15290,6 +15727,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15315,6 +15753,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15340,6 +15779,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15365,6 +15805,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15390,6 +15831,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15526,6 +15968,7 @@ public void subscribeWindowStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WINDOW_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15551,6 +15994,7 @@ public void subscribeAdminFabricIndexAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ADMIN_FABRIC_INDEX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15576,6 +16020,7 @@ public void subscribeAdminVendorIdAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ADMIN_VENDOR_ID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15601,6 +16046,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15626,6 +16072,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15651,6 +16098,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15676,6 +16124,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15701,6 +16150,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -15726,6 +16176,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16151,6 +16602,7 @@ public void subscribeNOCsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, N_O_CS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16181,6 +16633,7 @@ public void subscribeFabricsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FABRICS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16206,6 +16659,7 @@ public void subscribeSupportedFabricsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_FABRICS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16231,6 +16685,7 @@ public void subscribeCommissionedFabricsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COMMISSIONED_FABRICS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16256,6 +16711,7 @@ public void subscribeTrustedRootCertificatesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TRUSTED_ROOT_CERTIFICATES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16281,6 +16737,7 @@ public void subscribeCurrentFabricIndexAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_FABRIC_INDEX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16306,6 +16763,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16331,6 +16789,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16356,6 +16815,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16381,6 +16841,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16406,6 +16867,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16431,6 +16893,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16623,6 +17086,7 @@ public void subscribeGroupKeyMapAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GROUP_KEY_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16653,6 +17117,7 @@ public void subscribeGroupTableAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GROUP_TABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16678,6 +17143,7 @@ public void subscribeMaxGroupsPerFabricAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_GROUPS_PER_FABRIC_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16703,6 +17169,7 @@ public void subscribeMaxGroupKeysPerFabricAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_GROUP_KEYS_PER_FABRIC_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16728,6 +17195,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16753,6 +17221,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16778,6 +17247,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16803,6 +17273,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16828,6 +17299,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16853,6 +17325,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16920,6 +17393,7 @@ public void subscribeLabelListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LABEL_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16945,6 +17419,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16970,6 +17445,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -16995,6 +17471,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17020,6 +17497,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17045,6 +17523,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17070,6 +17549,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17146,6 +17626,7 @@ public void subscribeLabelListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LABEL_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17171,6 +17652,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17196,6 +17678,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17221,6 +17704,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17246,6 +17730,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17271,6 +17756,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17296,6 +17782,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17358,6 +17845,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17383,6 +17871,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17408,6 +17897,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17433,6 +17923,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17458,6 +17949,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17483,6 +17975,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17545,6 +18038,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17570,6 +18064,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17595,6 +18090,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17620,6 +18116,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17645,6 +18142,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17670,6 +18168,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17732,6 +18231,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17757,6 +18257,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17782,6 +18283,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17807,6 +18309,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17832,6 +18335,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17857,6 +18361,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17920,6 +18425,7 @@ public void subscribeStateValueAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATE_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17945,6 +18451,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17970,6 +18477,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -17995,6 +18503,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18020,6 +18529,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18045,6 +18555,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18070,6 +18581,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18249,6 +18761,7 @@ public void subscribeIdleModeDurationAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, IDLE_MODE_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18274,6 +18787,7 @@ public void subscribeActiveModeDurationAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_MODE_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18299,6 +18813,7 @@ public void subscribeActiveModeThresholdAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_MODE_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18329,6 +18844,7 @@ public void subscribeRegisteredClientsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REGISTERED_CLIENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18354,6 +18870,7 @@ public void subscribeICDCounterAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, I_C_D_COUNTER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18379,6 +18896,7 @@ public void subscribeClientsSupportedPerFabricAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLIENTS_SUPPORTED_PER_FABRIC_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18404,6 +18922,7 @@ public void subscribeUserActiveModeTriggerHintAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, USER_ACTIVE_MODE_TRIGGER_HINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18429,6 +18948,7 @@ public void subscribeUserActiveModeTriggerInstructionAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, USER_ACTIVE_MODE_TRIGGER_INSTRUCTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18454,6 +18974,7 @@ public void subscribeOperatingModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATING_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18479,6 +19000,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18504,6 +19026,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18529,6 +19052,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18554,6 +19078,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18579,6 +19104,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18604,6 +19130,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18745,6 +19272,7 @@ public void subscribeSetTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SET_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18770,6 +19298,7 @@ public void subscribeTimeRemainingAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIME_REMAINING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18795,6 +19324,7 @@ public void subscribeTimerStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIMER_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18820,6 +19350,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18845,6 +19376,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18870,6 +19402,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18895,6 +19428,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18920,6 +19454,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -18945,6 +19480,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19141,6 +19677,7 @@ public void subscribePhaseListAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHASE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19166,6 +19703,7 @@ public void subscribeCurrentPhaseAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_PHASE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19191,6 +19729,7 @@ public void subscribeCountdownTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COUNTDOWN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19216,6 +19755,7 @@ public void subscribeOperationalStateListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19241,6 +19781,7 @@ public void subscribeOperationalStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19266,6 +19807,7 @@ public void subscribeOperationalErrorAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.OvenCavityOperationalStateClusterErrorStateStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_ERROR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19291,6 +19833,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19316,6 +19859,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19341,6 +19885,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19366,6 +19911,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19391,6 +19937,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19416,6 +19963,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19535,6 +20083,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19560,6 +20109,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19594,6 +20144,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19628,6 +20179,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19653,6 +20205,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19678,6 +20231,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19703,6 +20257,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19728,6 +20283,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19753,6 +20309,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19778,6 +20335,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19850,6 +20408,7 @@ public void subscribeSupportedDrynessLevelsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_DRYNESS_LEVELS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19884,6 +20443,7 @@ public void subscribeSelectedDrynessLevelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SELECTED_DRYNESS_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19909,6 +20469,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19934,6 +20495,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19959,6 +20521,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -19984,6 +20547,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20009,6 +20573,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20034,6 +20599,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20138,6 +20704,7 @@ public void subscribeDescriptionAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DESCRIPTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20163,6 +20730,7 @@ public void subscribeStandardNamespaceAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STANDARD_NAMESPACE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20188,6 +20756,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20213,6 +20782,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20247,6 +20817,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20281,6 +20852,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20306,6 +20878,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20331,6 +20904,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20356,6 +20930,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20381,6 +20956,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20406,6 +20982,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20431,6 +21008,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20550,6 +21128,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20575,6 +21154,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20609,6 +21189,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20643,6 +21224,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20668,6 +21250,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20693,6 +21276,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20718,6 +21302,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20743,6 +21328,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20768,6 +21354,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20793,6 +21380,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20912,6 +21500,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20937,6 +21526,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -20971,6 +21561,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21005,6 +21596,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21030,6 +21622,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21055,6 +21648,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21080,6 +21674,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21105,6 +21700,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21130,6 +21726,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21155,6 +21752,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21233,6 +21831,7 @@ public void subscribeSpinSpeedsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPIN_SPEEDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21267,6 +21866,7 @@ public void subscribeSpinSpeedCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPIN_SPEED_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21301,6 +21901,7 @@ public void subscribeNumberOfRinsesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_RINSES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21326,6 +21927,7 @@ public void subscribeSupportedRinsesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_RINSES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21351,6 +21953,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21376,6 +21979,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21401,6 +22005,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21426,6 +22031,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21451,6 +22057,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21476,6 +22083,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21585,6 +22193,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21610,6 +22219,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21635,6 +22245,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21660,6 +22271,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21685,6 +22297,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21710,6 +22323,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21735,6 +22349,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21760,6 +22375,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21869,6 +22485,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21894,6 +22511,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21919,6 +22537,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21944,6 +22563,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21969,6 +22589,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -21994,6 +22615,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22019,6 +22641,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22044,6 +22667,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22140,6 +22764,7 @@ public void subscribeTemperatureSetpointAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEMPERATURE_SETPOINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22165,6 +22790,7 @@ public void subscribeMinTemperatureAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22190,6 +22816,7 @@ public void subscribeMaxTemperatureAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22215,6 +22842,7 @@ public void subscribeStepAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STEP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22240,6 +22868,7 @@ public void subscribeSelectedTemperatureLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SELECTED_TEMPERATURE_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22265,6 +22894,7 @@ public void subscribeSupportedTemperatureLevelsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_TEMPERATURE_LEVELS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22290,6 +22920,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22315,6 +22946,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22340,6 +22972,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22365,6 +22998,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22390,6 +23024,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22415,6 +23050,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22480,6 +23116,7 @@ public void subscribeMaskAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MASK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22505,6 +23142,7 @@ public void subscribeStateAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22530,6 +23168,7 @@ public void subscribeSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22555,6 +23194,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22580,6 +23220,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22605,6 +23246,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22630,6 +23272,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22655,6 +23298,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22680,6 +23324,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22799,6 +23444,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22824,6 +23470,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22858,6 +23505,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22892,6 +23540,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22917,6 +23566,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22942,6 +23592,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22967,6 +23618,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -22992,6 +23644,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23017,6 +23670,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23042,6 +23696,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23105,6 +23760,7 @@ public void subscribeAirQualityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AIR_QUALITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23130,6 +23786,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23155,6 +23812,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23180,6 +23838,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23205,6 +23864,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23230,6 +23890,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23255,6 +23916,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23346,6 +24008,7 @@ public void subscribeExpressedStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EXPRESSED_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23371,6 +24034,7 @@ public void subscribeSmokeStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SMOKE_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23396,6 +24060,7 @@ public void subscribeCOStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, C_O_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23421,6 +24086,7 @@ public void subscribeBatteryAlertAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BATTERY_ALERT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23446,6 +24112,7 @@ public void subscribeDeviceMutedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEVICE_MUTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23471,6 +24138,7 @@ public void subscribeTestInProgressAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEST_IN_PROGRESS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23496,6 +24164,7 @@ public void subscribeHardwareFaultAlertAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARDWARE_FAULT_ALERT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23521,6 +24190,7 @@ public void subscribeEndOfServiceAlertAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, END_OF_SERVICE_ALERT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23546,6 +24216,7 @@ public void subscribeInterconnectSmokeAlarmAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INTERCONNECT_SMOKE_ALARM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23571,6 +24242,7 @@ public void subscribeInterconnectCOAlarmAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INTERCONNECT_C_O_ALARM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23596,6 +24268,7 @@ public void subscribeContaminationStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONTAMINATION_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23630,6 +24303,7 @@ public void subscribeSmokeSensitivityLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SMOKE_SENSITIVITY_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23655,6 +24329,7 @@ public void subscribeExpiryDateAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EXPIRY_DATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23680,6 +24355,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23705,6 +24381,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23730,6 +24407,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23755,6 +24433,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23780,6 +24459,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23805,6 +24485,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23911,6 +24592,7 @@ public void subscribeMaskAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MASK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23936,6 +24618,7 @@ public void subscribeLatchAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LATCH_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23961,6 +24644,7 @@ public void subscribeStateAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -23986,6 +24670,7 @@ public void subscribeSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24011,6 +24696,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24036,6 +24722,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24061,6 +24748,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24086,6 +24774,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24111,6 +24800,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24136,6 +24826,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24204,6 +24895,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24229,6 +24921,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24254,6 +24947,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24279,6 +24973,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24304,6 +24999,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24329,6 +25025,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24354,6 +25051,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24379,6 +25077,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24510,6 +25209,7 @@ public void subscribeCookTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COOK_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24535,6 +25235,7 @@ public void subscribeMaxCookTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_COOK_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24560,6 +25261,7 @@ public void subscribePowerSettingAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_SETTING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24585,6 +25287,7 @@ public void subscribeMinPowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24610,6 +25313,7 @@ public void subscribeMaxPowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24635,6 +25339,7 @@ public void subscribePowerStepAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_STEP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24660,6 +25365,7 @@ public void subscribeSupportedWattsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_WATTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24685,6 +25391,7 @@ public void subscribeSelectedWattIndexAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SELECTED_WATT_INDEX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24710,6 +25417,7 @@ public void subscribeWattRatingAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WATT_RATING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24735,6 +25443,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24760,6 +25469,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24785,6 +25495,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24810,6 +25521,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24835,6 +25547,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -24860,6 +25573,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25056,6 +25770,7 @@ public void subscribePhaseListAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHASE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25081,6 +25796,7 @@ public void subscribeCurrentPhaseAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_PHASE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25106,6 +25822,7 @@ public void subscribeCountdownTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COUNTDOWN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25131,6 +25848,7 @@ public void subscribeOperationalStateListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25156,6 +25874,7 @@ public void subscribeOperationalStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25181,6 +25900,7 @@ public void subscribeOperationalErrorAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.OperationalStateClusterErrorStateStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_ERROR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25206,6 +25926,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25231,6 +25952,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25256,6 +25978,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25281,6 +26004,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25306,6 +26030,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25331,6 +26056,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25501,6 +26227,7 @@ public void subscribePhaseListAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHASE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25526,6 +26253,7 @@ public void subscribeCurrentPhaseAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_PHASE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25551,6 +26279,7 @@ public void subscribeCountdownTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COUNTDOWN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25576,6 +26305,7 @@ public void subscribeOperationalStateListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25601,6 +26331,7 @@ public void subscribeOperationalStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25626,6 +26357,7 @@ public void subscribeOperationalErrorAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.RvcOperationalStateClusterErrorStateStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_ERROR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25651,6 +26383,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25676,6 +26409,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25701,6 +26435,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25726,6 +26461,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25751,6 +26487,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -25776,6 +26513,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26278,6 +27016,7 @@ public void subscribeLastConfiguredByAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAST_CONFIGURED_BY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26303,6 +27042,7 @@ public void subscribeSceneTableSizeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCENE_TABLE_SIZE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26333,6 +27073,7 @@ public void subscribeFabricSceneInfoAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FABRIC_SCENE_INFO_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26358,6 +27099,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26383,6 +27125,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26408,6 +27151,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26433,6 +27177,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26458,6 +27203,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26483,6 +27229,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26575,6 +27322,7 @@ public void subscribeConditionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONDITION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26600,6 +27348,7 @@ public void subscribeDegradationDirectionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEGRADATION_DIRECTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26625,6 +27374,7 @@ public void subscribeChangeIndicationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHANGE_INDICATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26650,6 +27400,7 @@ public void subscribeInPlaceIndicatorAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, IN_PLACE_INDICATOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26684,6 +27435,7 @@ public void subscribeLastChangedTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAST_CHANGED_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26709,6 +27461,7 @@ public void subscribeReplacementProductListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REPLACEMENT_PRODUCT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26734,6 +27487,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26759,6 +27513,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26784,6 +27539,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26809,6 +27565,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26834,6 +27591,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26859,6 +27617,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26951,6 +27710,7 @@ public void subscribeConditionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONDITION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -26976,6 +27736,7 @@ public void subscribeDegradationDirectionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEGRADATION_DIRECTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27001,6 +27762,7 @@ public void subscribeChangeIndicationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHANGE_INDICATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27026,6 +27788,7 @@ public void subscribeInPlaceIndicatorAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, IN_PLACE_INDICATOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27060,6 +27823,7 @@ public void subscribeLastChangedTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAST_CHANGED_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27085,6 +27849,7 @@ public void subscribeReplacementProductListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REPLACEMENT_PRODUCT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27110,6 +27875,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27135,6 +27901,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27160,6 +27927,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27185,6 +27953,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27210,6 +27979,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27235,6 +28005,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27354,6 +28125,7 @@ public void subscribeCurrentSensitivityLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_SENSITIVITY_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27379,6 +28151,7 @@ public void subscribeSupportedSensitivityLevelsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_SENSITIVITY_LEVELS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27404,6 +28177,7 @@ public void subscribeDefaultSensitivityLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_SENSITIVITY_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27429,6 +28203,7 @@ public void subscribeAlarmsActiveAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALARMS_ACTIVE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27454,6 +28229,7 @@ public void subscribeAlarmsSuppressedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALARMS_SUPPRESSED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27479,6 +28255,7 @@ public void subscribeAlarmsEnabledAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALARMS_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27504,6 +28281,7 @@ public void subscribeAlarmsSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALARMS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27529,6 +28307,7 @@ public void subscribeSensorFaultAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SENSOR_FAULT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27554,6 +28333,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27579,6 +28359,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27604,6 +28385,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27629,6 +28411,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27654,6 +28437,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27679,6 +28463,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27824,6 +28609,7 @@ public void subscribeOpenDurationAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPEN_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27858,6 +28644,7 @@ public void subscribeDefaultOpenDurationAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_OPEN_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27883,6 +28670,7 @@ public void subscribeAutoCloseTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AUTO_CLOSE_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27908,6 +28696,7 @@ public void subscribeRemainingDurationAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REMAINING_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27933,6 +28722,7 @@ public void subscribeCurrentStateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27958,6 +28748,7 @@ public void subscribeTargetStateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TARGET_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -27983,6 +28774,7 @@ public void subscribeCurrentLevelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28008,6 +28800,7 @@ public void subscribeTargetLevelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TARGET_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28042,6 +28835,7 @@ public void subscribeDefaultOpenLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_OPEN_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28067,6 +28861,7 @@ public void subscribeValveFaultAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VALVE_FAULT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28092,6 +28887,7 @@ public void subscribeLevelStepAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_STEP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28117,6 +28913,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28142,6 +28939,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28167,6 +28965,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28192,6 +28991,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28217,6 +29017,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28242,6 +29043,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28391,6 +29193,7 @@ public void subscribePowerModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28416,6 +29219,7 @@ public void subscribeNumberOfMeasurementTypesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_MEASUREMENT_TYPES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28441,6 +29245,7 @@ public void subscribeAccuracyAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCURACY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28466,6 +29271,7 @@ public void subscribeRangesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RANGES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28491,6 +29297,7 @@ public void subscribeVoltageAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28516,6 +29323,7 @@ public void subscribeActiveCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28541,6 +29349,7 @@ public void subscribeReactiveCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28566,6 +29375,7 @@ public void subscribeApparentCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPARENT_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28591,6 +29401,7 @@ public void subscribeActivePowerAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28616,6 +29427,7 @@ public void subscribeReactivePowerAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28641,6 +29453,7 @@ public void subscribeApparentPowerAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPARENT_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28666,6 +29479,7 @@ public void subscribeRMSVoltageAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, R_M_S_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28691,6 +29505,7 @@ public void subscribeRMSCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, R_M_S_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28716,6 +29531,7 @@ public void subscribeRMSPowerAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, R_M_S_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28741,6 +29557,7 @@ public void subscribeFrequencyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28766,6 +29583,7 @@ public void subscribeHarmonicCurrentsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARMONIC_CURRENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28791,6 +29609,7 @@ public void subscribeHarmonicPhasesAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARMONIC_PHASES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28816,6 +29635,7 @@ public void subscribePowerFactorAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_FACTOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28841,6 +29661,7 @@ public void subscribeNeutralCurrentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEUTRAL_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28866,6 +29687,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28891,6 +29713,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28916,6 +29739,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28941,6 +29765,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28966,6 +29791,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -28991,6 +29817,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29083,6 +29910,7 @@ public void subscribeAccuracyAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.ElectricalEnergyMeasurementClusterMeasurementAccuracyStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCURACY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29108,6 +29936,7 @@ public void subscribeCumulativeEnergyImportedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CUMULATIVE_ENERGY_IMPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29133,6 +29962,7 @@ public void subscribeCumulativeEnergyExportedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CUMULATIVE_ENERGY_EXPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29158,6 +29988,7 @@ public void subscribePeriodicEnergyImportedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PERIODIC_ENERGY_IMPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29183,6 +30014,7 @@ public void subscribePeriodicEnergyExportedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ElectricalEnergyMeasurementClusterEnergyMeasurementStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PERIODIC_ENERGY_EXPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29208,6 +30040,7 @@ public void subscribeCumulativeEnergyResetAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ElectricalEnergyMeasurementClusterCumulativeEnergyResetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CUMULATIVE_ENERGY_RESET_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29233,6 +30066,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29258,6 +30092,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29283,6 +30118,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29308,6 +30144,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29333,6 +30170,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29358,6 +30196,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29540,6 +30379,7 @@ public void subscribeLoadControlProgramsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29565,6 +30405,7 @@ public void subscribeNumberOfLoadControlProgramsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_LOAD_CONTROL_PROGRAMS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29590,6 +30431,7 @@ public void subscribeEventsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29615,6 +30457,7 @@ public void subscribeActiveEventsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29640,6 +30483,7 @@ public void subscribeNumberOfEventsPerProgramAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_EVENTS_PER_PROGRAM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29665,6 +30509,7 @@ public void subscribeNumberOfTransitionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_TRANSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29699,6 +30544,7 @@ public void subscribeDefaultRandomStartAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_RANDOM_START_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29733,6 +30579,7 @@ public void subscribeDefaultRandomDurationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_RANDOM_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29758,6 +30605,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29783,6 +30631,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29808,6 +30657,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29833,6 +30683,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29858,6 +30709,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -29883,6 +30735,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30019,6 +30872,7 @@ public void subscribeMessagesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MESSAGES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30044,6 +30898,7 @@ public void subscribeActiveMessageIDsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_MESSAGE_I_DS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30069,6 +30924,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30094,6 +30950,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30119,6 +30976,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30144,6 +31002,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30169,6 +31028,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30194,6 +31054,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30448,6 +31309,7 @@ public void subscribeESATypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, E_S_A_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30473,6 +31335,7 @@ public void subscribeESACanGenerateAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, E_S_A_CAN_GENERATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30498,6 +31361,7 @@ public void subscribeESAStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, E_S_A_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30523,6 +31387,7 @@ public void subscribeAbsMinPowerAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ABS_MIN_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30548,6 +31413,7 @@ public void subscribeAbsMaxPowerAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ABS_MAX_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30573,6 +31439,7 @@ public void subscribePowerAdjustmentCapabilityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_ADJUSTMENT_CAPABILITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30598,6 +31465,7 @@ public void subscribeForecastAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.DeviceEnergyManagementClusterForecastStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FORECAST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30623,6 +31491,7 @@ public void subscribeOptOutStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPT_OUT_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30648,6 +31517,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30673,6 +31543,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30698,6 +31569,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30723,6 +31595,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30748,6 +31621,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -30773,6 +31647,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31047,6 +31922,7 @@ public void subscribeStateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31072,6 +31948,7 @@ public void subscribeSupplyStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPLY_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31097,6 +31974,7 @@ public void subscribeFaultStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FAULT_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31122,6 +32000,7 @@ public void subscribeChargingEnabledUntilAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHARGING_ENABLED_UNTIL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31147,6 +32026,7 @@ public void subscribeDischargingEnabledUntilAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DISCHARGING_ENABLED_UNTIL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31172,6 +32052,7 @@ public void subscribeCircuitCapacityAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CIRCUIT_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31197,6 +32078,7 @@ public void subscribeMinimumChargeCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MINIMUM_CHARGE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31222,6 +32104,7 @@ public void subscribeMaximumChargeCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAXIMUM_CHARGE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31247,6 +32130,7 @@ public void subscribeMaximumDischargeCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAXIMUM_DISCHARGE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31281,6 +32165,7 @@ public void subscribeUserMaximumChargeCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, USER_MAXIMUM_CHARGE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31315,6 +32200,7 @@ public void subscribeRandomizationDelayWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RANDOMIZATION_DELAY_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31340,6 +32226,7 @@ public void subscribeNextChargeStartTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEXT_CHARGE_START_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31365,6 +32252,7 @@ public void subscribeNextChargeTargetTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEXT_CHARGE_TARGET_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31390,6 +32278,7 @@ public void subscribeNextChargeRequiredEnergyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEXT_CHARGE_REQUIRED_ENERGY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31415,6 +32304,7 @@ public void subscribeNextChargeTargetSoCAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEXT_CHARGE_TARGET_SO_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31449,6 +32339,7 @@ public void subscribeApproximateEVEfficiencyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPROXIMATE_E_V_EFFICIENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31474,6 +32365,7 @@ public void subscribeStateOfChargeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATE_OF_CHARGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31499,6 +32391,7 @@ public void subscribeBatteryCapacityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BATTERY_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31524,6 +32417,7 @@ public void subscribeVehicleIDAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VEHICLE_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31549,6 +32443,7 @@ public void subscribeSessionIDAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SESSION_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31574,6 +32469,7 @@ public void subscribeSessionDurationAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SESSION_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31599,6 +32495,7 @@ public void subscribeSessionEnergyChargedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SESSION_ENERGY_CHARGED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31624,6 +32521,7 @@ public void subscribeSessionEnergyDischargedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SESSION_ENERGY_DISCHARGED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31649,6 +32547,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31674,6 +32573,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31699,6 +32599,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31724,6 +32625,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31749,6 +32651,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31774,6 +32677,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31853,6 +32757,7 @@ public void subscribeEnergyBalancesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENERGY_BALANCES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31887,6 +32792,7 @@ public void subscribeCurrentEnergyBalanceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_ENERGY_BALANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31912,6 +32818,7 @@ public void subscribeEnergyPrioritiesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENERGY_PRIORITIES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31937,6 +32844,7 @@ public void subscribeLowPowerModeSensitivitiesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOW_POWER_MODE_SENSITIVITIES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31971,6 +32879,7 @@ public void subscribeCurrentLowPowerModeSensitivityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_LOW_POWER_MODE_SENSITIVITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -31996,6 +32905,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32021,6 +32931,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32046,6 +32957,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32071,6 +32983,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32096,6 +33009,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32121,6 +33035,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32193,6 +33108,7 @@ public void subscribeAvailableEndpointsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVAILABLE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32218,6 +33134,7 @@ public void subscribeActiveEndpointsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_ENDPOINTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32243,6 +33160,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32268,6 +33186,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32293,6 +33212,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32318,6 +33238,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32343,6 +33264,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32368,6 +33290,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32487,6 +33410,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32512,6 +33436,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32546,6 +33471,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32580,6 +33506,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32605,6 +33532,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32630,6 +33558,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32655,6 +33584,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32680,6 +33610,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32705,6 +33636,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32730,6 +33662,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32849,6 +33782,7 @@ public void subscribeSupportedModesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32874,6 +33808,7 @@ public void subscribeCurrentModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32908,6 +33843,7 @@ public void subscribeStartUpModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32942,6 +33878,7 @@ public void subscribeOnModeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32967,6 +33904,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -32992,6 +33930,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -33017,6 +33956,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -33042,6 +33982,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -33067,6 +34008,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -33092,6 +34034,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34031,6 +34974,7 @@ public void subscribeLockStateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCK_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34056,6 +35000,7 @@ public void subscribeLockTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCK_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34081,6 +35026,7 @@ public void subscribeActuatorEnabledAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTUATOR_ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34106,6 +35052,7 @@ public void subscribeDoorStateAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DOOR_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34140,6 +35087,7 @@ public void subscribeDoorOpenEventsAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DOOR_OPEN_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34174,6 +35122,7 @@ public void subscribeDoorClosedEventsAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DOOR_CLOSED_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34208,6 +35157,7 @@ public void subscribeOpenPeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPEN_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34233,6 +35183,7 @@ public void subscribeNumberOfTotalUsersSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_TOTAL_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34258,6 +35209,7 @@ public void subscribeNumberOfPINUsersSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_P_I_N_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34283,6 +35235,7 @@ public void subscribeNumberOfRFIDUsersSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_R_F_I_D_USERS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34308,6 +35261,7 @@ public void subscribeNumberOfWeekDaySchedulesSupportedPerUserAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_WEEK_DAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34333,6 +35287,7 @@ public void subscribeNumberOfYearDaySchedulesSupportedPerUserAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_YEAR_DAY_SCHEDULES_SUPPORTED_PER_USER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34358,6 +35313,7 @@ public void subscribeNumberOfHolidaySchedulesSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_HOLIDAY_SCHEDULES_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34383,6 +35339,7 @@ public void subscribeMaxPINCodeLengthAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_P_I_N_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34408,6 +35365,7 @@ public void subscribeMinPINCodeLengthAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_P_I_N_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34433,6 +35391,7 @@ public void subscribeMaxRFIDCodeLengthAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34458,6 +35417,7 @@ public void subscribeMinRFIDCodeLengthAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_R_F_I_D_CODE_LENGTH_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34483,6 +35443,7 @@ public void subscribeCredentialRulesSupportAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CREDENTIAL_RULES_SUPPORT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34508,6 +35469,7 @@ public void subscribeNumberOfCredentialsSupportedPerUserAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_CREDENTIALS_SUPPORTED_PER_USER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34542,6 +35504,7 @@ public void subscribeLanguageAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LANGUAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34576,6 +35539,7 @@ public void subscribeLEDSettingsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, L_E_D_SETTINGS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34610,6 +35574,7 @@ public void subscribeAutoRelockTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AUTO_RELOCK_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34644,6 +35609,7 @@ public void subscribeSoundVolumeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SOUND_VOLUME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34678,6 +35644,7 @@ public void subscribeOperatingModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATING_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34703,6 +35670,7 @@ public void subscribeSupportedOperatingModesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_OPERATING_MODES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34728,6 +35696,7 @@ public void subscribeDefaultConfigurationRegisterAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DEFAULT_CONFIGURATION_REGISTER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34762,6 +35731,7 @@ public void subscribeEnableLocalProgrammingAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENABLE_LOCAL_PROGRAMMING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34796,6 +35766,7 @@ public void subscribeEnableOneTouchLockingAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENABLE_ONE_TOUCH_LOCKING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34830,6 +35801,7 @@ public void subscribeEnableInsideStatusLEDAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENABLE_INSIDE_STATUS_L_E_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34864,6 +35836,7 @@ public void subscribeEnablePrivacyModeButtonAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENABLE_PRIVACY_MODE_BUTTON_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34898,6 +35871,7 @@ public void subscribeLocalProgrammingFeaturesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCAL_PROGRAMMING_FEATURES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34932,6 +35906,7 @@ public void subscribeWrongCodeEntryLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WRONG_CODE_ENTRY_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -34966,6 +35941,7 @@ public void subscribeUserCodeTemporaryDisableTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, USER_CODE_TEMPORARY_DISABLE_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35000,6 +35976,7 @@ public void subscribeSendPINOverTheAirAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SEND_P_I_N_OVER_THE_AIR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35034,6 +36011,7 @@ public void subscribeRequirePINforRemoteOperationAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REQUIRE_P_I_NFOR_REMOTE_OPERATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35068,6 +36046,7 @@ public void subscribeExpiringUserTimeoutAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EXPIRING_USER_TIMEOUT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35093,6 +36072,7 @@ public void subscribeAliroReaderVerificationKeyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_READER_VERIFICATION_KEY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35118,6 +36098,7 @@ public void subscribeAliroReaderGroupIdentifierAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_READER_GROUP_IDENTIFIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35143,6 +36124,7 @@ public void subscribeAliroReaderGroupSubIdentifierAttribute( @Override public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_READER_GROUP_SUB_IDENTIFIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35168,6 +36150,7 @@ public void subscribeAliroExpeditedTransactionSupportedProtocolVersionsAttribute @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_EXPEDITED_TRANSACTION_SUPPORTED_PROTOCOL_VERSIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35193,6 +36176,7 @@ public void subscribeAliroGroupResolvingKeyAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_GROUP_RESOLVING_KEY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35218,6 +36202,7 @@ public void subscribeAliroSupportedBLEUWBProtocolVersionsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_SUPPORTED_B_L_E_U_W_B_PROTOCOL_VERSIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35243,6 +36228,7 @@ public void subscribeAliroBLEAdvertisingVersionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALIRO_B_L_E_ADVERTISING_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35268,6 +36254,7 @@ public void subscribeNumberOfAliroCredentialIssuerKeysSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_ALIRO_CREDENTIAL_ISSUER_KEYS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35293,6 +36280,7 @@ public void subscribeNumberOfAliroEndpointKeysSupportedAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_ALIRO_ENDPOINT_KEYS_SUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35318,6 +36306,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35343,6 +36332,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35368,6 +36358,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35393,6 +36384,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35418,6 +36410,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35443,6 +36436,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35687,6 +36681,7 @@ public void subscribeTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35712,6 +36707,7 @@ public void subscribePhysicalClosedLimitLiftAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_CLOSED_LIMIT_LIFT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35737,6 +36733,7 @@ public void subscribePhysicalClosedLimitTiltAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_CLOSED_LIMIT_TILT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35762,6 +36759,7 @@ public void subscribeCurrentPositionLiftAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_LIFT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35787,6 +36785,7 @@ public void subscribeCurrentPositionTiltAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_TILT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35812,6 +36811,7 @@ public void subscribeNumberOfActuationsLiftAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_ACTUATIONS_LIFT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35837,6 +36837,7 @@ public void subscribeNumberOfActuationsTiltAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_ACTUATIONS_TILT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35862,6 +36863,7 @@ public void subscribeConfigStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONFIG_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35887,6 +36889,7 @@ public void subscribeCurrentPositionLiftPercentageAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_LIFT_PERCENTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35912,6 +36915,7 @@ public void subscribeCurrentPositionTiltPercentageAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_TILT_PERCENTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35937,6 +36941,7 @@ public void subscribeOperationalStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATIONAL_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35962,6 +36967,7 @@ public void subscribeTargetPositionLiftPercent100thsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TARGET_POSITION_LIFT_PERCENT100THS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -35987,6 +36993,7 @@ public void subscribeTargetPositionTiltPercent100thsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TARGET_POSITION_TILT_PERCENT100THS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36012,6 +37019,7 @@ public void subscribeEndProductTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, END_PRODUCT_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36037,6 +37045,7 @@ public void subscribeCurrentPositionLiftPercent100thsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_LIFT_PERCENT100THS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36062,6 +37071,7 @@ public void subscribeCurrentPositionTiltPercent100thsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_POSITION_TILT_PERCENT100THS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36087,6 +37097,7 @@ public void subscribeInstalledOpenLimitLiftAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTALLED_OPEN_LIMIT_LIFT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36112,6 +37123,7 @@ public void subscribeInstalledClosedLimitLiftAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTALLED_CLOSED_LIMIT_LIFT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36137,6 +37149,7 @@ public void subscribeInstalledOpenLimitTiltAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTALLED_OPEN_LIMIT_TILT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36162,6 +37175,7 @@ public void subscribeInstalledClosedLimitTiltAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTALLED_CLOSED_LIMIT_TILT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36196,6 +37210,7 @@ public void subscribeModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36221,6 +37236,7 @@ public void subscribeSafetyStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SAFETY_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36246,6 +37262,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36271,6 +37288,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36296,6 +37314,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36321,6 +37340,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36346,6 +37366,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36371,6 +37392,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36479,6 +37501,7 @@ public void subscribeBarrierMovingStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_MOVING_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36504,6 +37527,7 @@ public void subscribeBarrierSafetyStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_SAFETY_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36529,6 +37553,7 @@ public void subscribeBarrierCapabilitiesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_CAPABILITIES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36563,6 +37588,7 @@ public void subscribeBarrierOpenEventsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_OPEN_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36597,6 +37623,7 @@ public void subscribeBarrierCloseEventsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_CLOSE_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36631,6 +37658,7 @@ public void subscribeBarrierCommandOpenEventsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_COMMAND_OPEN_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36665,6 +37693,7 @@ public void subscribeBarrierCommandCloseEventsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_COMMAND_CLOSE_EVENTS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36699,6 +37728,7 @@ public void subscribeBarrierOpenPeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_OPEN_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36733,6 +37763,7 @@ public void subscribeBarrierClosePeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_CLOSE_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36758,6 +37789,7 @@ public void subscribeBarrierPositionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BARRIER_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36783,6 +37815,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36808,6 +37841,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36833,6 +37867,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36858,6 +37893,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36883,6 +37919,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -36908,6 +37945,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37065,6 +38103,7 @@ public void subscribeMaxPressureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_PRESSURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37090,6 +38129,7 @@ public void subscribeMaxSpeedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_SPEED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37115,6 +38155,7 @@ public void subscribeMaxFlowAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_FLOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37140,6 +38181,7 @@ public void subscribeMinConstPressureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_CONST_PRESSURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37165,6 +38207,7 @@ public void subscribeMaxConstPressureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_CONST_PRESSURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37190,6 +38233,7 @@ public void subscribeMinCompPressureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_COMP_PRESSURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37215,6 +38259,7 @@ public void subscribeMaxCompPressureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_COMP_PRESSURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37240,6 +38285,7 @@ public void subscribeMinConstSpeedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_CONST_SPEED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37265,6 +38311,7 @@ public void subscribeMaxConstSpeedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_CONST_SPEED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37290,6 +38337,7 @@ public void subscribeMinConstFlowAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_CONST_FLOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37315,6 +38363,7 @@ public void subscribeMaxConstFlowAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_CONST_FLOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37340,6 +38389,7 @@ public void subscribeMinConstTempAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_CONST_TEMP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37365,6 +38415,7 @@ public void subscribeMaxConstTempAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_CONST_TEMP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37390,6 +38441,7 @@ public void subscribePumpStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PUMP_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37415,6 +38467,7 @@ public void subscribeEffectiveOperationModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EFFECTIVE_OPERATION_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37440,6 +38493,7 @@ public void subscribeEffectiveControlModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EFFECTIVE_CONTROL_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37465,6 +38519,7 @@ public void subscribeCapacityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37490,6 +38545,7 @@ public void subscribeSpeedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPEED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37524,6 +38580,7 @@ public void subscribeLifetimeRunningHoursAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIFETIME_RUNNING_HOURS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37549,6 +38606,7 @@ public void subscribePowerAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37583,6 +38641,7 @@ public void subscribeLifetimeEnergyConsumedAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIFETIME_ENERGY_CONSUMED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37617,6 +38676,7 @@ public void subscribeOperationModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPERATION_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37651,6 +38711,7 @@ public void subscribeControlModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONTROL_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37676,6 +38737,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37701,6 +38763,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37726,6 +38789,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37751,6 +38815,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37776,6 +38841,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -37801,6 +38867,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38269,6 +39336,7 @@ public void subscribeLocalTemperatureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCAL_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38294,6 +39362,7 @@ public void subscribeOutdoorTemperatureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OUTDOOR_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38319,6 +39388,7 @@ public void subscribeOccupancyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPANCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38344,6 +39414,7 @@ public void subscribeAbsMinHeatSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ABS_MIN_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38369,6 +39440,7 @@ public void subscribeAbsMaxHeatSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ABS_MAX_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38394,6 +39466,7 @@ public void subscribeAbsMinCoolSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ABS_MIN_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38419,6 +39492,7 @@ public void subscribeAbsMaxCoolSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ABS_MAX_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38444,6 +39518,7 @@ public void subscribePICoolingDemandAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, P_I_COOLING_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38469,6 +39544,7 @@ public void subscribePIHeatingDemandAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, P_I_HEATING_DEMAND_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38503,6 +39579,7 @@ public void subscribeHVACSystemTypeConfigurationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, H_V_A_C_SYSTEM_TYPE_CONFIGURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38537,6 +39614,7 @@ public void subscribeLocalTemperatureCalibrationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LOCAL_TEMPERATURE_CALIBRATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38571,6 +39649,7 @@ public void subscribeOccupiedCoolingSetpointAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPIED_COOLING_SETPOINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38605,6 +39684,7 @@ public void subscribeOccupiedHeatingSetpointAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPIED_HEATING_SETPOINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38639,6 +39719,7 @@ public void subscribeUnoccupiedCoolingSetpointAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNOCCUPIED_COOLING_SETPOINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38673,6 +39754,7 @@ public void subscribeUnoccupiedHeatingSetpointAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNOCCUPIED_HEATING_SETPOINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38707,6 +39789,7 @@ public void subscribeMinHeatSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38741,6 +39824,7 @@ public void subscribeMaxHeatSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_HEAT_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38775,6 +39859,7 @@ public void subscribeMinCoolSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38809,6 +39894,7 @@ public void subscribeMaxCoolSetpointLimitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_COOL_SETPOINT_LIMIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38843,6 +39929,7 @@ public void subscribeMinSetpointDeadBandAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_SETPOINT_DEAD_BAND_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38877,6 +39964,7 @@ public void subscribeRemoteSensingAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REMOTE_SENSING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38911,6 +39999,7 @@ public void subscribeControlSequenceOfOperationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CONTROL_SEQUENCE_OF_OPERATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38945,6 +40034,7 @@ public void subscribeSystemModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SYSTEM_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38970,6 +40060,7 @@ public void subscribeThermostatRunningModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, THERMOSTAT_RUNNING_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -38995,6 +40086,7 @@ public void subscribeStartOfWeekAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_OF_WEEK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39020,6 +40112,7 @@ public void subscribeNumberOfWeeklyTransitionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_WEEKLY_TRANSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39045,6 +40138,7 @@ public void subscribeNumberOfDailyTransitionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_DAILY_TRANSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39079,6 +40173,7 @@ public void subscribeTemperatureSetpointHoldAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEMPERATURE_SETPOINT_HOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39113,6 +40208,7 @@ public void subscribeTemperatureSetpointHoldDurationAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEMPERATURE_SETPOINT_HOLD_DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39147,6 +40243,7 @@ public void subscribeThermostatProgrammingOperationModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, THERMOSTAT_PROGRAMMING_OPERATION_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39172,6 +40269,7 @@ public void subscribeThermostatRunningStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, THERMOSTAT_RUNNING_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39197,6 +40295,7 @@ public void subscribeSetpointChangeSourceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SETPOINT_CHANGE_SOURCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39222,6 +40321,7 @@ public void subscribeSetpointChangeAmountAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SETPOINT_CHANGE_AMOUNT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39247,6 +40347,7 @@ public void subscribeSetpointChangeSourceTimestampAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SETPOINT_CHANGE_SOURCE_TIMESTAMP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39281,6 +40382,7 @@ public void subscribeOccupiedSetbackAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPIED_SETBACK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39306,6 +40408,7 @@ public void subscribeOccupiedSetbackMinAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPIED_SETBACK_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39331,6 +40434,7 @@ public void subscribeOccupiedSetbackMaxAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPIED_SETBACK_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39365,6 +40469,7 @@ public void subscribeUnoccupiedSetbackAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNOCCUPIED_SETBACK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39390,6 +40495,7 @@ public void subscribeUnoccupiedSetbackMinAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNOCCUPIED_SETBACK_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39415,6 +40521,7 @@ public void subscribeUnoccupiedSetbackMaxAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNOCCUPIED_SETBACK_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39449,6 +40556,7 @@ public void subscribeEmergencyHeatDeltaAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EMERGENCY_HEAT_DELTA_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39483,6 +40591,7 @@ public void subscribeACTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39517,6 +40626,7 @@ public void subscribeACCapacityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_CAPACITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39551,6 +40661,7 @@ public void subscribeACRefrigerantTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_REFRIGERANT_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39585,6 +40696,7 @@ public void subscribeACCompressorTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_COMPRESSOR_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39619,6 +40731,7 @@ public void subscribeACErrorCodeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_ERROR_CODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39653,6 +40766,7 @@ public void subscribeACLouverPositionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_LOUVER_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39678,6 +40792,7 @@ public void subscribeACCoilTemperatureAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_COIL_TEMPERATURE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39712,6 +40827,7 @@ public void subscribeACCapacityformatAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, A_C_CAPACITYFORMAT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39737,6 +40853,7 @@ public void subscribePresetTypesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRESET_TYPES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39762,6 +40879,7 @@ public void subscribeScheduleTypesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCHEDULE_TYPES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39787,6 +40905,7 @@ public void subscribeNumberOfPresetsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_PRESETS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39812,6 +40931,7 @@ public void subscribeNumberOfSchedulesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_SCHEDULES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39837,6 +40957,7 @@ public void subscribeNumberOfScheduleTransitionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_SCHEDULE_TRANSITIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39862,6 +40983,7 @@ public void subscribeNumberOfScheduleTransitionPerDayAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_SCHEDULE_TRANSITION_PER_DAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39887,6 +41009,7 @@ public void subscribeActivePresetHandleAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_PRESET_HANDLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39912,6 +41035,7 @@ public void subscribeActiveScheduleHandleAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_SCHEDULE_HANDLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39946,6 +41070,7 @@ public void subscribePresetsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRESETS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -39980,6 +41105,7 @@ public void subscribeSchedulesAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCHEDULES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40005,6 +41131,7 @@ public void subscribePresetsSchedulesEditableAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRESETS_SCHEDULES_EDITABLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40030,6 +41157,7 @@ public void subscribeTemperatureSetpointHoldPolicyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEMPERATURE_SETPOINT_HOLD_POLICY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40055,6 +41183,7 @@ public void subscribeSetpointHoldExpiryTimestampAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SETPOINT_HOLD_EXPIRY_TIMESTAMP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40080,6 +41209,7 @@ public void subscribeQueuedPresetAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ThermostatClusterQueuedPresetStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, QUEUED_PRESET_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40105,6 +41235,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40130,6 +41261,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40155,6 +41287,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40180,6 +41313,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40205,6 +41339,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40230,6 +41365,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40349,6 +41485,7 @@ public void subscribeFanModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FAN_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40374,6 +41511,7 @@ public void subscribeFanModeSequenceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FAN_MODE_SEQUENCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40408,6 +41546,7 @@ public void subscribePercentSettingAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PERCENT_SETTING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40433,6 +41572,7 @@ public void subscribePercentCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PERCENT_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40458,6 +41598,7 @@ public void subscribeSpeedMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPEED_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40492,6 +41633,7 @@ public void subscribeSpeedSettingAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPEED_SETTING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40517,6 +41659,7 @@ public void subscribeSpeedCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SPEED_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40542,6 +41685,7 @@ public void subscribeRockSupportAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ROCK_SUPPORT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40576,6 +41720,7 @@ public void subscribeRockSettingAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ROCK_SETTING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40601,6 +41746,7 @@ public void subscribeWindSupportAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIND_SUPPORT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40635,6 +41781,7 @@ public void subscribeWindSettingAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WIND_SETTING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40669,6 +41816,7 @@ public void subscribeAirflowDirectionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AIRFLOW_DIRECTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40694,6 +41842,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40719,6 +41868,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40744,6 +41894,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40769,6 +41920,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40794,6 +41946,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40819,6 +41972,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40893,6 +42047,7 @@ public void subscribeTemperatureDisplayModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TEMPERATURE_DISPLAY_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40927,6 +42082,7 @@ public void subscribeKeypadLockoutAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, KEYPAD_LOCKOUT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40961,6 +42117,7 @@ public void subscribeScheduleProgrammingVisibilityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCHEDULE_PROGRAMMING_VISIBILITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -40986,6 +42143,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41011,6 +42169,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41036,6 +42195,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41061,6 +42221,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41086,6 +42247,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41111,6 +42273,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41937,6 +43100,7 @@ public void subscribeCurrentHueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_HUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41962,6 +43126,7 @@ public void subscribeCurrentSaturationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_SATURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -41987,6 +43152,7 @@ public void subscribeRemainingTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REMAINING_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42012,6 +43178,7 @@ public void subscribeCurrentXAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42037,6 +43204,7 @@ public void subscribeCurrentYAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42062,6 +43230,7 @@ public void subscribeDriftCompensationAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DRIFT_COMPENSATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42087,6 +43256,7 @@ public void subscribeCompensationTextAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COMPENSATION_TEXT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42112,6 +43282,7 @@ public void subscribeColorTemperatureMiredsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_TEMPERATURE_MIREDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42137,6 +43308,7 @@ public void subscribeColorModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42171,6 +43343,7 @@ public void subscribeOptionsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OPTIONS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42196,6 +43369,7 @@ public void subscribeNumberOfPrimariesAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NUMBER_OF_PRIMARIES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42221,6 +43395,7 @@ public void subscribePrimary1XAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY1_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42246,6 +43421,7 @@ public void subscribePrimary1YAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY1_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42271,6 +43447,7 @@ public void subscribePrimary1IntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY1_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42296,6 +43473,7 @@ public void subscribePrimary2XAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY2_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42321,6 +43499,7 @@ public void subscribePrimary2YAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY2_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42346,6 +43525,7 @@ public void subscribePrimary2IntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY2_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42371,6 +43551,7 @@ public void subscribePrimary3XAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY3_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42396,6 +43577,7 @@ public void subscribePrimary3YAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY3_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42421,6 +43603,7 @@ public void subscribePrimary3IntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY3_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42446,6 +43629,7 @@ public void subscribePrimary4XAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY4_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42471,6 +43655,7 @@ public void subscribePrimary4YAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY4_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42496,6 +43681,7 @@ public void subscribePrimary4IntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY4_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42521,6 +43707,7 @@ public void subscribePrimary5XAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY5_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42546,6 +43733,7 @@ public void subscribePrimary5YAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY5_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42571,6 +43759,7 @@ public void subscribePrimary5IntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY5_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42596,6 +43785,7 @@ public void subscribePrimary6XAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY6_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42621,6 +43811,7 @@ public void subscribePrimary6YAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY6_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42646,6 +43837,7 @@ public void subscribePrimary6IntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRIMARY6_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42680,6 +43872,7 @@ public void subscribeWhitePointXAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WHITE_POINT_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42714,6 +43907,7 @@ public void subscribeWhitePointYAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WHITE_POINT_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42748,6 +43942,7 @@ public void subscribeColorPointRXAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_R_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42782,6 +43977,7 @@ public void subscribeColorPointRYAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_R_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42816,6 +44012,7 @@ public void subscribeColorPointRIntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_R_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42850,6 +44047,7 @@ public void subscribeColorPointGXAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_G_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42884,6 +44082,7 @@ public void subscribeColorPointGYAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_G_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42918,6 +44117,7 @@ public void subscribeColorPointGIntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_G_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42952,6 +44152,7 @@ public void subscribeColorPointBXAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_B_X_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -42986,6 +44187,7 @@ public void subscribeColorPointBYAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_B_Y_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43020,6 +44222,7 @@ public void subscribeColorPointBIntensityAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_POINT_B_INTENSITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43045,6 +44248,7 @@ public void subscribeEnhancedCurrentHueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENHANCED_CURRENT_HUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43070,6 +44274,7 @@ public void subscribeEnhancedColorModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENHANCED_COLOR_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43095,6 +44300,7 @@ public void subscribeColorLoopActiveAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_LOOP_ACTIVE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43120,6 +44326,7 @@ public void subscribeColorLoopDirectionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_LOOP_DIRECTION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43145,6 +44352,7 @@ public void subscribeColorLoopTimeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_LOOP_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43170,6 +44378,7 @@ public void subscribeColorLoopStartEnhancedHueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_LOOP_START_ENHANCED_HUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43195,6 +44404,7 @@ public void subscribeColorLoopStoredEnhancedHueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_LOOP_STORED_ENHANCED_HUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43220,6 +44430,7 @@ public void subscribeColorCapabilitiesAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_CAPABILITIES_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43245,6 +44456,7 @@ public void subscribeColorTempPhysicalMinMiredsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_TEMP_PHYSICAL_MIN_MIREDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43270,6 +44482,7 @@ public void subscribeColorTempPhysicalMaxMiredsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COLOR_TEMP_PHYSICAL_MAX_MIREDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43295,6 +44508,7 @@ public void subscribeCoupleColorTempToLevelMinMiredsAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, COUPLE_COLOR_TEMP_TO_LEVEL_MIN_MIREDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43329,6 +44543,7 @@ public void subscribeStartUpColorTemperatureMiredsAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_UP_COLOR_TEMPERATURE_MIREDS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43354,6 +44569,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43379,6 +44595,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43404,6 +44621,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43429,6 +44647,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43454,6 +44673,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43479,6 +44699,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43575,6 +44796,7 @@ public void subscribePhysicalMinLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_MIN_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43600,6 +44822,7 @@ public void subscribePhysicalMaxLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_MAX_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43625,6 +44848,7 @@ public void subscribeBallastStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BALLAST_STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43659,6 +44883,7 @@ public void subscribeMinLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43693,6 +44918,7 @@ public void subscribeMaxLevelAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_LEVEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43727,6 +44953,7 @@ public void subscribeIntrinsicBallastFactorAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INTRINSIC_BALLAST_FACTOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43761,6 +44988,7 @@ public void subscribeBallastFactorAdjustmentAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BALLAST_FACTOR_ADJUSTMENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43786,6 +45014,7 @@ public void subscribeLampQuantityAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_QUANTITY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43820,6 +45049,7 @@ public void subscribeLampTypeAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43854,6 +45084,7 @@ public void subscribeLampManufacturerAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_MANUFACTURER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43888,6 +45119,7 @@ public void subscribeLampRatedHoursAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_RATED_HOURS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43922,6 +45154,7 @@ public void subscribeLampBurnHoursAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_BURN_HOURS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43956,6 +45189,7 @@ public void subscribeLampAlarmModeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_ALARM_MODE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -43990,6 +45224,7 @@ public void subscribeLampBurnHoursTripPointAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LAMP_BURN_HOURS_TRIP_POINT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44015,6 +45250,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44040,6 +45276,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44065,6 +45302,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44090,6 +45328,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44115,6 +45354,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44140,6 +45380,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44223,6 +45464,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44248,6 +45490,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44273,6 +45516,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44298,6 +45542,7 @@ public void subscribeToleranceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOLERANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44323,6 +45568,7 @@ public void subscribeLightSensorTypeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIGHT_SENSOR_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44348,6 +45594,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44373,6 +45620,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44398,6 +45646,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44423,6 +45672,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44448,6 +45698,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44473,6 +45724,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44551,6 +45803,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44576,6 +45829,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44601,6 +45855,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44626,6 +45881,7 @@ public void subscribeToleranceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOLERANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44651,6 +45907,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44676,6 +45933,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44701,6 +45959,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44726,6 +45985,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44751,6 +46011,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44776,6 +46037,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44871,6 +46133,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44896,6 +46159,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44921,6 +46185,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44946,6 +46211,7 @@ public void subscribeToleranceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOLERANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44971,6 +46237,7 @@ public void subscribeScaledValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCALED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -44996,6 +46263,7 @@ public void subscribeMinScaledValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_SCALED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45021,6 +46289,7 @@ public void subscribeMaxScaledValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_SCALED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45046,6 +46315,7 @@ public void subscribeScaledToleranceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCALED_TOLERANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45071,6 +46341,7 @@ public void subscribeScaleAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCALE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45096,6 +46367,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45121,6 +46393,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45146,6 +46419,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45171,6 +46445,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45196,6 +46471,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45221,6 +46497,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45299,6 +46576,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45324,6 +46602,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45349,6 +46628,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45374,6 +46654,7 @@ public void subscribeToleranceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOLERANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45399,6 +46680,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45424,6 +46706,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45449,6 +46732,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45474,6 +46758,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45499,6 +46784,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45524,6 +46810,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45602,6 +46889,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45627,6 +46915,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45652,6 +46941,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45677,6 +46967,7 @@ public void subscribeToleranceAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOLERANCE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45702,6 +46993,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45727,6 +47019,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45752,6 +47045,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45777,6 +47071,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45802,6 +47097,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45827,6 +47123,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45901,6 +47198,7 @@ public void subscribeOccupancyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPANCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45926,6 +47224,7 @@ public void subscribeOccupancySensorTypeAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPANCY_SENSOR_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45951,6 +47250,7 @@ public void subscribeOccupancySensorTypeBitmapAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCCUPANCY_SENSOR_TYPE_BITMAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -45985,6 +47285,7 @@ public void subscribePIROccupiedToUnoccupiedDelayAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, P_I_R_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46019,6 +47320,7 @@ public void subscribePIRUnoccupiedToOccupiedDelayAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, P_I_R_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46053,6 +47355,7 @@ public void subscribePIRUnoccupiedToOccupiedThresholdAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, P_I_R_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46087,6 +47390,7 @@ public void subscribeUltrasonicOccupiedToUnoccupiedDelayAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ULTRASONIC_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46121,6 +47425,7 @@ public void subscribeUltrasonicUnoccupiedToOccupiedDelayAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46155,6 +47460,7 @@ public void subscribeUltrasonicUnoccupiedToOccupiedThresholdAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ULTRASONIC_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46189,6 +47495,7 @@ public void subscribePhysicalContactOccupiedToUnoccupiedDelayAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_CONTACT_OCCUPIED_TO_UNOCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46223,6 +47530,7 @@ public void subscribePhysicalContactUnoccupiedToOccupiedDelayAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_DELAY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46257,6 +47565,7 @@ public void subscribePhysicalContactUnoccupiedToOccupiedThresholdAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHYSICAL_CONTACT_UNOCCUPIED_TO_OCCUPIED_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46282,6 +47591,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46307,6 +47617,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46332,6 +47643,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46357,6 +47669,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46382,6 +47695,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46407,6 +47721,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46500,6 +47815,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46525,6 +47841,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46550,6 +47867,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46575,6 +47893,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46600,6 +47919,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46625,6 +47945,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46650,6 +47971,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46675,6 +47997,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46700,6 +48023,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46725,6 +48049,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46750,6 +48075,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46775,6 +48101,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46800,6 +48127,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46825,6 +48153,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46850,6 +48179,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46875,6 +48205,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46900,6 +48231,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -46993,6 +48325,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47018,6 +48351,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47043,6 +48377,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47068,6 +48403,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47093,6 +48429,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47118,6 +48455,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47143,6 +48481,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47168,6 +48507,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47193,6 +48533,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47218,6 +48559,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47243,6 +48585,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47268,6 +48611,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47293,6 +48637,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47318,6 +48663,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47343,6 +48689,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47368,6 +48715,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47393,6 +48741,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47486,6 +48835,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47511,6 +48861,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47536,6 +48887,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47561,6 +48913,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47586,6 +48939,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47611,6 +48965,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47636,6 +48991,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47661,6 +49017,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47686,6 +49043,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47711,6 +49069,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47736,6 +49095,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47761,6 +49121,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47786,6 +49147,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47811,6 +49173,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47836,6 +49199,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47861,6 +49225,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47886,6 +49251,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -47979,6 +49345,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48004,6 +49371,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48029,6 +49397,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48054,6 +49423,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48079,6 +49449,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48104,6 +49475,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48129,6 +49501,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48154,6 +49527,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48179,6 +49553,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48204,6 +49579,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48229,6 +49605,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48254,6 +49631,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48279,6 +49657,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48304,6 +49683,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48329,6 +49709,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48354,6 +49735,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48379,6 +49761,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48472,6 +49855,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48497,6 +49881,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48522,6 +49907,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48547,6 +49933,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48572,6 +49959,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48597,6 +49985,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48622,6 +50011,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48647,6 +50037,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48672,6 +50063,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48697,6 +50089,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48722,6 +50115,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48747,6 +50141,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48772,6 +50167,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48797,6 +50193,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48822,6 +50219,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48847,6 +50245,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48872,6 +50271,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48965,6 +50365,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -48990,6 +50391,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49015,6 +50417,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49040,6 +50443,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49065,6 +50469,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49090,6 +50495,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49115,6 +50521,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49140,6 +50547,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49165,6 +50573,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49190,6 +50599,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49215,6 +50625,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49240,6 +50651,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49265,6 +50677,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49290,6 +50703,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49315,6 +50729,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49340,6 +50755,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49365,6 +50781,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49458,6 +50875,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49483,6 +50901,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49508,6 +50927,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49533,6 +50953,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49558,6 +50979,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49583,6 +51005,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49608,6 +51031,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49633,6 +51057,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49658,6 +51083,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49683,6 +51109,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49708,6 +51135,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49733,6 +51161,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49758,6 +51187,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49783,6 +51213,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49808,6 +51239,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49833,6 +51265,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49858,6 +51291,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49951,6 +51385,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -49976,6 +51411,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50001,6 +51437,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50026,6 +51463,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50051,6 +51489,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50076,6 +51515,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50101,6 +51541,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50126,6 +51567,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50151,6 +51593,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50176,6 +51619,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50201,6 +51645,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50226,6 +51671,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50251,6 +51697,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50276,6 +51723,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50301,6 +51749,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50326,6 +51775,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50351,6 +51801,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50444,6 +51895,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50469,6 +51921,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50494,6 +51947,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50519,6 +51973,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50544,6 +51999,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50569,6 +52025,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50594,6 +52051,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50619,6 +52077,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50644,6 +52103,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50669,6 +52129,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50694,6 +52155,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50719,6 +52181,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50744,6 +52207,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50769,6 +52233,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50794,6 +52259,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50819,6 +52285,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50844,6 +52311,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50937,6 +52405,7 @@ public void subscribeMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50962,6 +52431,7 @@ public void subscribeMinMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MIN_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -50987,6 +52457,7 @@ public void subscribeMaxMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MAX_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51012,6 +52483,7 @@ public void subscribePeakMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51037,6 +52509,7 @@ public void subscribePeakMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PEAK_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51062,6 +52535,7 @@ public void subscribeAverageMeasuredValueAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51087,6 +52561,7 @@ public void subscribeAverageMeasuredValueWindowAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_MEASURED_VALUE_WINDOW_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51112,6 +52587,7 @@ public void subscribeUncertaintyAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNCERTAINTY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51137,6 +52613,7 @@ public void subscribeMeasurementUnitAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_UNIT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51162,6 +52639,7 @@ public void subscribeMeasurementMediumAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_MEDIUM_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51187,6 +52665,7 @@ public void subscribeLevelValueAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LEVEL_VALUE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51212,6 +52691,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51237,6 +52717,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51262,6 +52743,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51287,6 +52769,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51312,6 +52795,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51337,6 +52821,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51401,6 +52886,7 @@ public void subscribeMACAddressAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, M_A_C_ADDRESS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51426,6 +52912,7 @@ public void subscribeLinkLocalAddressAttribute( @Override public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LINK_LOCAL_ADDRESS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51451,6 +52938,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51476,6 +52964,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51501,6 +52990,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51526,6 +53016,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51551,6 +53042,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51576,6 +53068,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51867,6 +53360,7 @@ public void subscribeChannelListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHANNEL_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51892,6 +53386,7 @@ public void subscribeLineupAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ChannelClusterLineupInfoStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LINEUP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51917,6 +53412,7 @@ public void subscribeCurrentChannelAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ChannelClusterChannelInfoStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_CHANNEL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51942,6 +53438,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51967,6 +53464,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -51992,6 +53490,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52017,6 +53516,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52042,6 +53542,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52067,6 +53568,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52180,6 +53682,7 @@ public void subscribeTargetListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TARGET_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52205,6 +53708,7 @@ public void subscribeCurrentTargetAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_TARGET_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52230,6 +53734,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52255,6 +53760,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52280,6 +53786,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52305,6 +53812,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52330,6 +53838,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52355,6 +53864,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52911,6 +54421,7 @@ public void subscribeCurrentStateAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_STATE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52936,6 +54447,7 @@ public void subscribeStartTimeAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, START_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52961,6 +54473,7 @@ public void subscribeDurationAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DURATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -52986,6 +54499,7 @@ public void subscribeSampledPositionAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.MediaPlaybackClusterPlaybackPositionStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SAMPLED_POSITION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53011,6 +54525,7 @@ public void subscribePlaybackSpeedAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PLAYBACK_SPEED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53036,6 +54551,7 @@ public void subscribeSeekRangeEndAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SEEK_RANGE_END_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53061,6 +54577,7 @@ public void subscribeSeekRangeStartAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SEEK_RANGE_START_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53086,6 +54603,7 @@ public void subscribeActiveAudioTrackAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.MediaPlaybackClusterTrackStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_AUDIO_TRACK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53111,6 +54629,7 @@ public void subscribeAvailableAudioTracksAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVAILABLE_AUDIO_TRACKS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53136,6 +54655,7 @@ public void subscribeActiveTextTrackAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.MediaPlaybackClusterTrackStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_TEXT_TRACK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53161,6 +54681,7 @@ public void subscribeAvailableTextTracksAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVAILABLE_TEXT_TRACKS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53186,6 +54707,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53211,6 +54733,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53236,6 +54759,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53261,6 +54785,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53286,6 +54811,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53311,6 +54837,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53455,6 +54982,7 @@ public void subscribeInputListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INPUT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53480,6 +55008,7 @@ public void subscribeCurrentInputAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_INPUT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53505,6 +55034,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53530,6 +55060,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53555,6 +55086,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53580,6 +55112,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53605,6 +55138,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53630,6 +55164,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53708,6 +55243,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53733,6 +55269,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53758,6 +55295,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53783,6 +55321,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53808,6 +55347,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53833,6 +55373,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53929,6 +55470,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53954,6 +55496,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -53979,6 +55522,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54004,6 +55548,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54029,6 +55574,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54054,6 +55600,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54224,6 +55771,7 @@ public void subscribeAcceptHeaderAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPT_HEADER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54249,6 +55797,7 @@ public void subscribeSupportedStreamingProtocolsAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SUPPORTED_STREAMING_PROTOCOLS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54274,6 +55823,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54299,6 +55849,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54324,6 +55875,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54349,6 +55901,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54374,6 +55927,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54399,6 +55953,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54511,6 +56066,7 @@ public void subscribeOutputListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OUTPUT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54536,6 +56092,7 @@ public void subscribeCurrentOutputAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_OUTPUT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54561,6 +56118,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54586,6 +56144,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54611,6 +56170,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54636,6 +56196,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54661,6 +56222,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54686,6 +56248,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54877,6 +56440,7 @@ public void subscribeCatalogListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CATALOG_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54902,6 +56466,7 @@ public void subscribeCurrentAppAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.ApplicationLauncherClusterApplicationEPStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_APP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54927,6 +56492,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54952,6 +56518,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -54977,6 +56544,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55002,6 +56570,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55027,6 +56596,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55052,6 +56622,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55130,6 +56701,7 @@ public void subscribeVendorNameAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55155,6 +56727,7 @@ public void subscribeVendorIDAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55180,6 +56753,7 @@ public void subscribeApplicationNameAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPLICATION_NAME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55205,6 +56779,7 @@ public void subscribeProductIDAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PRODUCT_I_D_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55230,6 +56805,7 @@ public void subscribeApplicationAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.ApplicationBasicClusterApplicationStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPLICATION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55255,6 +56831,7 @@ public void subscribeStatusAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STATUS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55280,6 +56857,7 @@ public void subscribeApplicationVersionAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPLICATION_VERSION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55305,6 +56883,7 @@ public void subscribeAllowedVendorListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ALLOWED_VENDOR_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55330,6 +56909,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55355,6 +56935,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55380,6 +56961,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55405,6 +56987,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55430,6 +57013,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55455,6 +57039,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55590,6 +57175,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55615,6 +57201,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55640,6 +57227,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55665,6 +57253,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55690,6 +57279,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55715,6 +57305,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -55995,6 +57586,7 @@ public void subscribeEnabledAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENABLED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56020,6 +57612,7 @@ public void subscribeOnDemandRatingsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_DEMAND_RATINGS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56045,6 +57638,7 @@ public void subscribeOnDemandRatingThresholdAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ON_DEMAND_RATING_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56070,6 +57664,7 @@ public void subscribeScheduledContentRatingsAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCHEDULED_CONTENT_RATINGS_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56095,6 +57690,7 @@ public void subscribeScheduledContentRatingThresholdAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCHEDULED_CONTENT_RATING_THRESHOLD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56120,6 +57716,7 @@ public void subscribeScreenDailyTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, SCREEN_DAILY_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56145,6 +57742,7 @@ public void subscribeRemainingScreenTimeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REMAINING_SCREEN_TIME_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56170,6 +57768,7 @@ public void subscribeBlockUnratedAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BLOCK_UNRATED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56195,6 +57794,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56220,6 +57820,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56245,6 +57846,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56270,6 +57872,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56295,6 +57898,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56320,6 +57924,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56434,6 +58039,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56459,6 +58065,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56484,6 +58091,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56509,6 +58117,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56534,6 +58143,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56559,6 +58169,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56793,6 +58404,7 @@ public void subscribeMeasurementTypeAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASUREMENT_TYPE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56818,6 +58430,7 @@ public void subscribeDcVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56843,6 +58456,7 @@ public void subscribeDcVoltageMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_VOLTAGE_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56868,6 +58482,7 @@ public void subscribeDcVoltageMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_VOLTAGE_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56893,6 +58508,7 @@ public void subscribeDcCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56918,6 +58534,7 @@ public void subscribeDcCurrentMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_CURRENT_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56943,6 +58560,7 @@ public void subscribeDcCurrentMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_CURRENT_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56968,6 +58586,7 @@ public void subscribeDcPowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -56993,6 +58612,7 @@ public void subscribeDcPowerMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_POWER_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57018,6 +58638,7 @@ public void subscribeDcPowerMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_POWER_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57043,6 +58664,7 @@ public void subscribeDcVoltageMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_VOLTAGE_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57068,6 +58690,7 @@ public void subscribeDcVoltageDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_VOLTAGE_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57093,6 +58716,7 @@ public void subscribeDcCurrentMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_CURRENT_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57118,6 +58742,7 @@ public void subscribeDcCurrentDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_CURRENT_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57143,6 +58768,7 @@ public void subscribeDcPowerMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_POWER_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57168,6 +58794,7 @@ public void subscribeDcPowerDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, DC_POWER_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57193,6 +58820,7 @@ public void subscribeAcFrequencyAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_FREQUENCY_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57218,6 +58846,7 @@ public void subscribeAcFrequencyMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_FREQUENCY_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57243,6 +58872,7 @@ public void subscribeAcFrequencyMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_FREQUENCY_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57268,6 +58898,7 @@ public void subscribeNeutralCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NEUTRAL_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57293,6 +58924,7 @@ public void subscribeTotalActivePowerAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOTAL_ACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57318,6 +58950,7 @@ public void subscribeTotalReactivePowerAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOTAL_REACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57343,6 +58976,7 @@ public void subscribeTotalApparentPowerAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TOTAL_APPARENT_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57368,6 +59002,7 @@ public void subscribeMeasured1stHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED1ST_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57393,6 +59028,7 @@ public void subscribeMeasured3rdHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED3RD_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57418,6 +59054,7 @@ public void subscribeMeasured5thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED5TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57443,6 +59080,7 @@ public void subscribeMeasured7thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED7TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57468,6 +59106,7 @@ public void subscribeMeasured9thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED9TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57493,6 +59132,7 @@ public void subscribeMeasured11thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED11TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57518,6 +59158,7 @@ public void subscribeMeasuredPhase1stHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_PHASE1ST_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57543,6 +59184,7 @@ public void subscribeMeasuredPhase3rdHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_PHASE3RD_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57568,6 +59210,7 @@ public void subscribeMeasuredPhase5thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_PHASE5TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57593,6 +59236,7 @@ public void subscribeMeasuredPhase7thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_PHASE7TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57618,6 +59262,7 @@ public void subscribeMeasuredPhase9thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_PHASE9TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57643,6 +59288,7 @@ public void subscribeMeasuredPhase11thHarmonicCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEASURED_PHASE11TH_HARMONIC_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57668,6 +59314,7 @@ public void subscribeAcFrequencyMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_FREQUENCY_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57693,6 +59340,7 @@ public void subscribeAcFrequencyDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_FREQUENCY_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57718,6 +59366,7 @@ public void subscribePowerMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57743,6 +59392,7 @@ public void subscribePowerDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57768,6 +59418,7 @@ public void subscribeHarmonicCurrentMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, HARMONIC_CURRENT_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57793,6 +59444,7 @@ public void subscribePhaseHarmonicCurrentMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, PHASE_HARMONIC_CURRENT_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57818,6 +59470,7 @@ public void subscribeInstantaneousVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTANTANEOUS_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57843,6 +59496,7 @@ public void subscribeInstantaneousLineCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTANTANEOUS_LINE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57868,6 +59522,7 @@ public void subscribeInstantaneousActiveCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTANTANEOUS_ACTIVE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57893,6 +59548,7 @@ public void subscribeInstantaneousReactiveCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTANTANEOUS_REACTIVE_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57918,6 +59574,7 @@ public void subscribeInstantaneousPowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INSTANTANEOUS_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57943,6 +59600,7 @@ public void subscribeRmsVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57968,6 +59626,7 @@ public void subscribeRmsVoltageMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -57993,6 +59652,7 @@ public void subscribeRmsVoltageMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58018,6 +59678,7 @@ public void subscribeRmsCurrentAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58043,6 +59704,7 @@ public void subscribeRmsCurrentMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58068,6 +59730,7 @@ public void subscribeRmsCurrentMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58093,6 +59756,7 @@ public void subscribeActivePowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58118,6 +59782,7 @@ public void subscribeActivePowerMinAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_MIN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58143,6 +59808,7 @@ public void subscribeActivePowerMaxAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_MAX_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58168,6 +59834,7 @@ public void subscribeReactivePowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58193,6 +59860,7 @@ public void subscribeApparentPowerAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPARENT_POWER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58218,6 +59886,7 @@ public void subscribePowerFactorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_FACTOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58252,6 +59921,7 @@ public void subscribeAverageRmsVoltageMeasurementPeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_VOLTAGE_MEASUREMENT_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58286,6 +59956,7 @@ public void subscribeAverageRmsUnderVoltageCounterAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58320,6 +59991,7 @@ public void subscribeRmsExtremeOverVoltagePeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_OVER_VOLTAGE_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58354,6 +60026,7 @@ public void subscribeRmsExtremeUnderVoltagePeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_UNDER_VOLTAGE_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58388,6 +60061,7 @@ public void subscribeRmsVoltageSagPeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SAG_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58422,6 +60096,7 @@ public void subscribeRmsVoltageSwellPeriodAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SWELL_PERIOD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58447,6 +60122,7 @@ public void subscribeAcVoltageMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_VOLTAGE_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58472,6 +60148,7 @@ public void subscribeAcVoltageDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_VOLTAGE_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58497,6 +60174,7 @@ public void subscribeAcCurrentMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_CURRENT_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58522,6 +60200,7 @@ public void subscribeAcCurrentDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_CURRENT_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58547,6 +60226,7 @@ public void subscribeAcPowerMultiplierAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_POWER_MULTIPLIER_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58572,6 +60252,7 @@ public void subscribeAcPowerDivisorAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_POWER_DIVISOR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58606,6 +60287,7 @@ public void subscribeOverloadAlarmsMaskAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OVERLOAD_ALARMS_MASK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58631,6 +60313,7 @@ public void subscribeVoltageOverloadAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VOLTAGE_OVERLOAD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58656,6 +60339,7 @@ public void subscribeCurrentOverloadAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CURRENT_OVERLOAD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58690,6 +60374,7 @@ public void subscribeAcOverloadAlarmsMaskAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_OVERLOAD_ALARMS_MASK_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58715,6 +60400,7 @@ public void subscribeAcVoltageOverloadAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_VOLTAGE_OVERLOAD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58740,6 +60426,7 @@ public void subscribeAcCurrentOverloadAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_CURRENT_OVERLOAD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58765,6 +60452,7 @@ public void subscribeAcActivePowerOverloadAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_ACTIVE_POWER_OVERLOAD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58790,6 +60478,7 @@ public void subscribeAcReactivePowerOverloadAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AC_REACTIVE_POWER_OVERLOAD_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58815,6 +60504,7 @@ public void subscribeAverageRmsOverVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_OVER_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58840,6 +60530,7 @@ public void subscribeAverageRmsUnderVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_UNDER_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58865,6 +60556,7 @@ public void subscribeRmsExtremeOverVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_OVER_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58890,6 +60582,7 @@ public void subscribeRmsExtremeUnderVoltageAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_UNDER_VOLTAGE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58915,6 +60608,7 @@ public void subscribeRmsVoltageSagAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SAG_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58940,6 +60634,7 @@ public void subscribeRmsVoltageSwellAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SWELL_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58965,6 +60660,7 @@ public void subscribeLineCurrentPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LINE_CURRENT_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -58990,6 +60686,7 @@ public void subscribeActiveCurrentPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_CURRENT_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59015,6 +60712,7 @@ public void subscribeReactiveCurrentPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_CURRENT_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59040,6 +60738,7 @@ public void subscribeRmsVoltagePhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59065,6 +60764,7 @@ public void subscribeRmsVoltageMinPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_MIN_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59090,6 +60790,7 @@ public void subscribeRmsVoltageMaxPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_MAX_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59115,6 +60816,7 @@ public void subscribeRmsCurrentPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59140,6 +60842,7 @@ public void subscribeRmsCurrentMinPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_MIN_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59165,6 +60868,7 @@ public void subscribeRmsCurrentMaxPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_MAX_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59190,6 +60894,7 @@ public void subscribeActivePowerPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59215,6 +60920,7 @@ public void subscribeActivePowerMinPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_MIN_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59240,6 +60946,7 @@ public void subscribeActivePowerMaxPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_MAX_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59265,6 +60972,7 @@ public void subscribeReactivePowerPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_POWER_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59290,6 +60998,7 @@ public void subscribeApparentPowerPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPARENT_POWER_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59315,6 +61024,7 @@ public void subscribePowerFactorPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_FACTOR_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59340,6 +61050,7 @@ public void subscribeAverageRmsVoltageMeasurementPeriodPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_VOLTAGE_MEASUREMENT_PERIOD_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59365,6 +61076,7 @@ public void subscribeAverageRmsOverVoltageCounterPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59390,6 +61102,7 @@ public void subscribeAverageRmsUnderVoltageCounterPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59415,6 +61128,7 @@ public void subscribeRmsExtremeOverVoltagePeriodPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_OVER_VOLTAGE_PERIOD_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59440,6 +61154,7 @@ public void subscribeRmsExtremeUnderVoltagePeriodPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59465,6 +61180,7 @@ public void subscribeRmsVoltageSagPeriodPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SAG_PERIOD_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59490,6 +61206,7 @@ public void subscribeRmsVoltageSwellPeriodPhaseBAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SWELL_PERIOD_PHASE_B_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59515,6 +61232,7 @@ public void subscribeLineCurrentPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LINE_CURRENT_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59540,6 +61258,7 @@ public void subscribeActiveCurrentPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_CURRENT_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59565,6 +61284,7 @@ public void subscribeReactiveCurrentPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_CURRENT_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59590,6 +61310,7 @@ public void subscribeRmsVoltagePhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59615,6 +61336,7 @@ public void subscribeRmsVoltageMinPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_MIN_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59640,6 +61362,7 @@ public void subscribeRmsVoltageMaxPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_MAX_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59665,6 +61388,7 @@ public void subscribeRmsCurrentPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59690,6 +61414,7 @@ public void subscribeRmsCurrentMinPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_MIN_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59715,6 +61440,7 @@ public void subscribeRmsCurrentMaxPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_CURRENT_MAX_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59740,6 +61466,7 @@ public void subscribeActivePowerPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59765,6 +61492,7 @@ public void subscribeActivePowerMinPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_MIN_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59790,6 +61518,7 @@ public void subscribeActivePowerMaxPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACTIVE_POWER_MAX_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59815,6 +61544,7 @@ public void subscribeReactivePowerPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, REACTIVE_POWER_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59840,6 +61570,7 @@ public void subscribeApparentPowerPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, APPARENT_POWER_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59865,6 +61596,7 @@ public void subscribePowerFactorPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, POWER_FACTOR_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59890,6 +61622,7 @@ public void subscribeAverageRmsVoltageMeasurementPeriodPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_VOLTAGE_MEASUREMENT_PERIOD_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59915,6 +61648,7 @@ public void subscribeAverageRmsOverVoltageCounterPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_OVER_VOLTAGE_COUNTER_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59940,6 +61674,7 @@ public void subscribeAverageRmsUnderVoltageCounterPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, AVERAGE_RMS_UNDER_VOLTAGE_COUNTER_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59965,6 +61700,7 @@ public void subscribeRmsExtremeOverVoltagePeriodPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_OVER_VOLTAGE_PERIOD_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -59990,6 +61726,7 @@ public void subscribeRmsExtremeUnderVoltagePeriodPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_EXTREME_UNDER_VOLTAGE_PERIOD_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60015,6 +61752,7 @@ public void subscribeRmsVoltageSagPeriodPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SAG_PERIOD_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60040,6 +61778,7 @@ public void subscribeRmsVoltageSwellPeriodPhaseCAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RMS_VOLTAGE_SWELL_PERIOD_PHASE_C_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60065,6 +61804,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60090,6 +61830,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60115,6 +61856,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60140,6 +61882,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60165,6 +61908,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -60190,6 +61934,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61592,6 +63337,7 @@ public void subscribeBooleanAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BOOLEAN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61626,6 +63372,7 @@ public void subscribeBitmap8Attribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BITMAP8_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61660,6 +63407,7 @@ public void subscribeBitmap16Attribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BITMAP16_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61694,6 +63442,7 @@ public void subscribeBitmap32Attribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BITMAP32_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61728,6 +63477,7 @@ public void subscribeBitmap64Attribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, BITMAP64_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61762,6 +63512,7 @@ public void subscribeInt8uAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61796,6 +63547,7 @@ public void subscribeInt16uAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT16U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61830,6 +63582,7 @@ public void subscribeInt24uAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT24U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61864,6 +63617,7 @@ public void subscribeInt32uAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT32U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61898,6 +63652,7 @@ public void subscribeInt40uAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT40U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61932,6 +63687,7 @@ public void subscribeInt48uAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT48U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -61966,6 +63722,7 @@ public void subscribeInt56uAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT56U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62000,6 +63757,7 @@ public void subscribeInt64uAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT64U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62034,6 +63792,7 @@ public void subscribeInt8sAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT8S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62068,6 +63827,7 @@ public void subscribeInt16sAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT16S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62102,6 +63862,7 @@ public void subscribeInt24sAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT24S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62136,6 +63897,7 @@ public void subscribeInt32sAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT32S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62170,6 +63932,7 @@ public void subscribeInt40sAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT40S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62204,6 +63967,7 @@ public void subscribeInt48sAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT48S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62238,6 +64002,7 @@ public void subscribeInt56sAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT56S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62272,6 +64037,7 @@ public void subscribeInt64sAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, INT64S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62306,6 +64072,7 @@ public void subscribeEnum8Attribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENUM8_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62340,6 +64107,7 @@ public void subscribeEnum16Attribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENUM16_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62374,6 +64142,7 @@ public void subscribeFloatSingleAttribute( @Override public void onSuccess(byte[] tlv) { Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FLOAT_SINGLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62408,6 +64177,7 @@ public void subscribeFloatDoubleAttribute( @Override public void onSuccess(byte[] tlv) { Double value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FLOAT_DOUBLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62442,6 +64212,7 @@ public void subscribeOctetStringAttribute( @Override public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, OCTET_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62476,6 +64247,7 @@ public void subscribeListInt8uAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIST_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62510,6 +64282,7 @@ public void subscribeListOctetStringAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIST_OCTET_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62544,6 +64317,7 @@ public void subscribeListStructOctetStringAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIST_STRUCT_OCTET_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62578,6 +64352,7 @@ public void subscribeLongOctetStringAttribute( @Override public void onSuccess(byte[] tlv) { byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LONG_OCTET_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62612,6 +64387,7 @@ public void subscribeCharStringAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CHAR_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62646,6 +64422,7 @@ public void subscribeLongCharStringAttribute( @Override public void onSuccess(byte[] tlv) { String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LONG_CHAR_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62680,6 +64457,7 @@ public void subscribeEpochUsAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EPOCH_US_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62714,6 +64492,7 @@ public void subscribeEpochSAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EPOCH_S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62748,6 +64527,7 @@ public void subscribeVendorIdAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, VENDOR_ID_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62782,6 +64562,7 @@ public void subscribeListNullablesAndOptionalsStructAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIST_NULLABLES_AND_OPTIONALS_STRUCT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62816,6 +64597,7 @@ public void subscribeEnumAttrAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ENUM_ATTR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62850,6 +64632,7 @@ public void subscribeStructAttrAttribute( @Override public void onSuccess(byte[] tlv) { ChipStructs.UnitTestingClusterSimpleStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, STRUCT_ATTR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62884,6 +64667,7 @@ public void subscribeRangeRestrictedInt8uAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RANGE_RESTRICTED_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62918,6 +64702,7 @@ public void subscribeRangeRestrictedInt8sAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RANGE_RESTRICTED_INT8S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62952,6 +64737,7 @@ public void subscribeRangeRestrictedInt16uAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RANGE_RESTRICTED_INT16U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -62986,6 +64772,7 @@ public void subscribeRangeRestrictedInt16sAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, RANGE_RESTRICTED_INT16S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63020,6 +64807,7 @@ public void subscribeListLongOctetStringAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIST_LONG_OCTET_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63059,6 +64847,7 @@ public void subscribeListFabricScopedAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, LIST_FABRIC_SCOPED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63089,6 +64878,7 @@ public void subscribeTimedWriteBooleanAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, TIMED_WRITE_BOOLEAN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63123,6 +64913,7 @@ public void subscribeGeneralErrorBooleanAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERAL_ERROR_BOOLEAN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63157,6 +64948,7 @@ public void subscribeClusterErrorBooleanAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_ERROR_BOOLEAN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63191,6 +64983,7 @@ public void subscribeUnsupportedAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, UNSUPPORTED_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63225,6 +65018,7 @@ public void subscribeNullableBooleanAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_BOOLEAN_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63259,6 +65053,7 @@ public void subscribeNullableBitmap8Attribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_BITMAP8_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63293,6 +65088,7 @@ public void subscribeNullableBitmap16Attribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_BITMAP16_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63327,6 +65123,7 @@ public void subscribeNullableBitmap32Attribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_BITMAP32_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63361,6 +65158,7 @@ public void subscribeNullableBitmap64Attribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_BITMAP64_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63395,6 +65193,7 @@ public void subscribeNullableInt8uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63429,6 +65228,7 @@ public void subscribeNullableInt16uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT16U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63463,6 +65263,7 @@ public void subscribeNullableInt24uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT24U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63497,6 +65298,7 @@ public void subscribeNullableInt32uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT32U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63531,6 +65333,7 @@ public void subscribeNullableInt40uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT40U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63565,6 +65368,7 @@ public void subscribeNullableInt48uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT48U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63599,6 +65403,7 @@ public void subscribeNullableInt56uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT56U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63633,6 +65438,7 @@ public void subscribeNullableInt64uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT64U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63667,6 +65473,7 @@ public void subscribeNullableInt8sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT8S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63701,6 +65508,7 @@ public void subscribeNullableInt16sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT16S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63735,6 +65543,7 @@ public void subscribeNullableInt24sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT24S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63769,6 +65578,7 @@ public void subscribeNullableInt32sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT32S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63803,6 +65613,7 @@ public void subscribeNullableInt40sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT40S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63837,6 +65648,7 @@ public void subscribeNullableInt48sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT48S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63871,6 +65683,7 @@ public void subscribeNullableInt56sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT56S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63905,6 +65718,7 @@ public void subscribeNullableInt64sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_INT64S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63939,6 +65753,7 @@ public void subscribeNullableEnum8Attribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_ENUM8_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -63973,6 +65788,7 @@ public void subscribeNullableEnum16Attribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_ENUM16_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64007,6 +65823,7 @@ public void subscribeNullableFloatSingleAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Float value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_FLOAT_SINGLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64041,6 +65858,7 @@ public void subscribeNullableFloatDoubleAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Double value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_FLOAT_DOUBLE_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64075,6 +65893,7 @@ public void subscribeNullableOctetStringAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable byte[] value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_OCTET_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64109,6 +65928,7 @@ public void subscribeNullableCharStringAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable String value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_CHAR_STRING_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64143,6 +65963,7 @@ public void subscribeNullableEnumAttrAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_ENUM_ATTR_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64177,6 +65998,7 @@ public void subscribeNullableStructAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable ChipStructs.UnitTestingClusterSimpleStruct value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_STRUCT_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64211,6 +66033,7 @@ public void subscribeNullableRangeRestrictedInt8uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_RANGE_RESTRICTED_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64245,6 +66068,7 @@ public void subscribeNullableRangeRestrictedInt8sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_RANGE_RESTRICTED_INT8S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64279,6 +66103,7 @@ public void subscribeNullableRangeRestrictedInt16uAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_RANGE_RESTRICTED_INT16U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64313,6 +66138,7 @@ public void subscribeNullableRangeRestrictedInt16sAttribute( @Override public void onSuccess(byte[] tlv) { @Nullable Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, NULLABLE_RANGE_RESTRICTED_INT16S_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64347,6 +66173,7 @@ public void subscribeWriteOnlyInt8uAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, WRITE_ONLY_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64381,6 +66208,7 @@ public void subscribeMeiInt8uAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, MEI_INT8U_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64406,6 +66234,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64431,6 +66260,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64456,6 +66286,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64481,6 +66312,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64506,6 +66338,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64531,6 +66364,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64657,6 +66491,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64682,6 +66517,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64707,6 +66543,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64732,6 +66569,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64757,6 +66595,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64782,6 +66621,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64908,6 +66748,7 @@ public void subscribeFlipFlopAttribute( @Override public void onSuccess(byte[] tlv) { Boolean value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FLIP_FLOP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64933,6 +66774,7 @@ public void subscribeGeneratedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, GENERATED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64958,6 +66800,7 @@ public void subscribeAcceptedCommandListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ACCEPTED_COMMAND_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -64983,6 +66826,7 @@ public void subscribeEventListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, EVENT_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -65008,6 +66852,7 @@ public void subscribeAttributeListAttribute( @Override public void onSuccess(byte[] tlv) { List value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, ATTRIBUTE_LIST_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -65033,6 +66878,7 @@ public void subscribeFeatureMapAttribute( @Override public void onSuccess(byte[] tlv) { Long value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, FEATURE_MAP_ATTRIBUTE_ID, minInterval, maxInterval); } @@ -65058,6 +66904,7 @@ public void subscribeClusterRevisionAttribute( @Override public void onSuccess(byte[] tlv) { Integer value = ChipTLVValueDecoder.decodeAttributeValue(path, tlv); + callback.onSuccess(value); } }, CLUSTER_REVISION_ATTRIBUTE_ID, minInterval, maxInterval); } From a4b59cb7944ba9be7e95423923aa89dbaada588c Mon Sep 17 00:00:00 2001 From: Pradip De Date: Fri, 26 Apr 2024 21:01:45 +0000 Subject: [PATCH 38/40] Bring PR #31776(Adjust storage for large payloads) from tcp branch to master (#33001) * Adjust storage and processing in SystemPacketBuffer (#31776) and associated code for large payloads. Extend uint16_t type variables to size_t for the APIs and all applicable places. * Address review comments --- src/app/BufferedReadCallback.cpp | 2 +- src/app/server/EchoHandler.cpp | 3 +- src/ble/BtpEngine.cpp | 17 +-- src/ble/tests/TestBtpEngine.cpp | 24 ++-- src/inet/TCPEndPoint.cpp | 8 +- src/inet/TCPEndPoint.h | 8 +- src/inet/TCPEndPointImplLwIP.cpp | 13 +- src/inet/TCPEndPointImplLwIP.h | 2 +- src/inet/TCPEndPointImplOpenThread.cpp | 2 +- src/inet/TCPEndPointImplOpenThread.h | 2 +- src/inet/TCPEndPointImplSockets.cpp | 9 +- src/inet/TCPEndPointImplSockets.h | 4 +- src/inet/UDPEndPointImplLwIP.cpp | 2 +- src/inet/UDPEndPointImplOpenThread.cpp | 4 +- src/inet/UDPEndPointImplSockets.cpp | 9 +- src/inet/tests/TestInetLayer.cpp | 2 +- src/inet/tests/TestInetLayerCommon.cpp | 48 ++++---- src/lib/core/tests/TestTLV.cpp | 8 +- src/messaging/tests/echo/echo_requester.cpp | 5 +- src/messaging/tests/echo/echo_responder.cpp | 2 +- src/platform/ESP32/nimble/BLEManagerImpl.cpp | 7 +- src/platform/Zephyr/BLEManagerImpl.cpp | 8 +- src/platform/android/BLEManagerImpl.cpp | 4 +- .../bouffalolab/common/BLEManagerImpl.cpp | 10 +- src/platform/mbed/BLEManagerImpl.cpp | 6 +- src/protocols/secure_channel/CASESession.cpp | 4 +- .../UserDirectedCommissioningClient.cpp | 2 +- .../UserDirectedCommissioningServer.cpp | 2 +- src/system/SystemPacketBuffer.cpp | 113 +++++++++++++----- src/system/SystemPacketBuffer.h | 42 +++---- src/system/TLVPacketBufferBackingStore.cpp | 16 ++- src/system/tests/TestSystemPacketBuffer.cpp | 99 ++++++++------- .../tests/TestTLVPacketBufferBackingStore.cpp | 6 +- src/transport/SecureMessageCodec.cpp | 14 +-- src/transport/SessionManager.cpp | 2 +- src/transport/raw/MessageHeader.cpp | 14 +-- src/transport/raw/MessageHeader.h | 20 ++-- 37 files changed, 316 insertions(+), 227 deletions(-) diff --git a/src/app/BufferedReadCallback.cpp b/src/app/BufferedReadCallback.cpp index da38d0b38418bb..3752a3e65aef08 100644 --- a/src/app/BufferedReadCallback.cpp +++ b/src/app/BufferedReadCallback.cpp @@ -65,7 +65,7 @@ CHIP_ERROR BufferedReadCallback::GenerateListTLV(TLV::ScopedBufferTLVReader & aR // // To avoid that, a single contiguous buffer is the best likely approach for now. // - uint32_t totalBufSize = 0; + size_t totalBufSize = 0; for (const auto & packetBuffer : mBufferedList) { totalBufSize += packetBuffer->TotalLength(); diff --git a/src/app/server/EchoHandler.cpp b/src/app/server/EchoHandler.cpp index 2f9323426943b6..975b1c60a94d36 100644 --- a/src/app/server/EchoHandler.cpp +++ b/src/app/server/EchoHandler.cpp @@ -40,7 +40,8 @@ chip::Protocols::Echo::EchoServer gEchoServer; */ void HandleEchoRequestReceived(chip::Messaging::ExchangeContext * ec, chip::System::PacketBufferHandle && payload) { - ChipLogProgress(AppServer, "Echo Request, len=%u ... sending response.\n", payload->DataLength()); + ChipLogProgress(AppServer, "Echo Request, len=%" PRIu32 "... sending response.\n", + static_cast(payload->DataLength())); } } // namespace diff --git a/src/ble/BtpEngine.cpp b/src/ble/BtpEngine.cpp index 3a11c61ea75de9..59cc73222e5722 100644 --- a/src/ble/BtpEngine.cpp +++ b/src/ble/BtpEngine.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -282,7 +283,7 @@ CHIP_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle && // mRxFragmentSize may be smaller than the characteristic size. Make sure // we're not truncating to a data length smaller than what we have already consumed. VerifyOrExit(reader.OctetsRead() <= mRxFragmentSize, err = BLE_ERROR_REASSEMBLER_INCORRECT_STATE); - data->SetDataLength(chip::min(data->DataLength(), mRxFragmentSize)); + data->SetDataLength(chip::min(data->DataLength(), static_cast(mRxFragmentSize))); // Now mark the bytes we consumed as consumed. data->ConsumeHead(static_cast(reader.OctetsRead())); @@ -346,11 +347,12 @@ CHIP_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle && if (rx_flags.Has(HeaderFlags::kEndMessage)) { // Trim remainder, if any, of the received packet buffer based on sender-specified length of reassembled message. - int padding = mRxBuf->DataLength() - mRxLength; + VerifyOrExit(CanCastTo(mRxBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); + int padding = static_cast(mRxBuf->DataLength()) - mRxLength; if (padding > 0) { - mRxBuf->SetDataLength(mRxLength); + mRxBuf->SetDataLength(static_cast(mRxLength)); } // Ensure all received fragments add up to sender-specified total message size. @@ -375,7 +377,7 @@ CHIP_ERROR BtpEngine::HandleCharacteristicReceived(System::PacketBufferHandle && } if (!mRxBuf.IsNull()) { - ChipLogError(Ble, "With rx buf data length = %u", mRxBuf->DataLength()); + ChipLogError(Ble, "With rx buf data length = %u", static_cast(mRxBuf->DataLength())); } LogState(); @@ -426,9 +428,10 @@ bool BtpEngine::HandleCharacteristicSend(System::PacketBufferHandle data, bool s return false; } - mTxBuf = std::move(data); - mTxState = kState_InProgress; - mTxLength = mTxBuf->DataLength(); + mTxBuf = std::move(data); + mTxState = kState_InProgress; + VerifyOrReturnError(CanCastTo(mTxBuf->DataLength()), false); + mTxLength = static_cast(mTxBuf->DataLength()); ChipLogDebugBtpEngine(Ble, ">>> CHIPoBle preparing to send whole message:"); PrintBufDebug(mTxBuf); diff --git a/src/ble/tests/TestBtpEngine.cpp b/src/ble/tests/TestBtpEngine.cpp index b799ff40e48f75..2b8fb1ff84b562 100644 --- a/src/ble/tests/TestBtpEngine.cpp +++ b/src/ble/tests/TestBtpEngine.cpp @@ -67,7 +67,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedOnePacket) }; auto packet0 = System::PacketBufferHandle::NewWithData(packetData0, sizeof(packetData0)); - EXPECT_EQ(packet0->DataLength(), 5); + EXPECT_EQ(packet0->DataLength(), static_cast(5)); SequenceNumber_t receivedAck; bool didReceiveAck; @@ -81,7 +81,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedTwoPacket) constexpr uint8_t packetData1[] = { to_underlying(BtpEngine::HeaderFlags::kEndMessage), 0x02, 0xff }; auto packet0 = System::PacketBufferHandle::NewWithData(packetData0, sizeof(packetData0)); - EXPECT_EQ(packet0->DataLength(), 5); + EXPECT_EQ(packet0->DataLength(), static_cast(5)); SequenceNumber_t receivedAck; bool didReceiveAck; @@ -89,7 +89,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedTwoPacket) EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_InProgress); auto packet1 = System::PacketBufferHandle::NewWithData(packetData1, sizeof(packetData1)); - EXPECT_EQ(packet1->DataLength(), 3); + EXPECT_EQ(packet1->DataLength(), static_cast(3)); EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet1), receivedAck, didReceiveAck), CHIP_NO_ERROR); EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_Complete); @@ -102,7 +102,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedThreePacket) constexpr uint8_t packetData2[] = { to_underlying(BtpEngine::HeaderFlags::kEndMessage), 0x03, 0xff }; auto packet0 = System::PacketBufferHandle::NewWithData(packetData0, sizeof(packetData0)); - EXPECT_EQ(packet0->DataLength(), 5); + EXPECT_EQ(packet0->DataLength(), static_cast(5)); SequenceNumber_t receivedAck; bool didReceiveAck; @@ -110,13 +110,13 @@ TEST_F(TestBtpEngine, HandleCharacteristicReceivedThreePacket) EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_InProgress); auto packet1 = System::PacketBufferHandle::NewWithData(packetData1, sizeof(packetData1)); - EXPECT_EQ(packet1->DataLength(), 3); + EXPECT_EQ(packet1->DataLength(), static_cast(3)); EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet1), receivedAck, didReceiveAck), CHIP_NO_ERROR); EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_InProgress); auto packet2 = System::PacketBufferHandle::NewWithData(packetData2, sizeof(packetData2)); - EXPECT_EQ(packet2->DataLength(), 3); + EXPECT_EQ(packet2->DataLength(), static_cast(3)); EXPECT_EQ(mBtpEngine.HandleCharacteristicReceived(std::move(packet2), receivedAck, didReceiveAck), CHIP_NO_ERROR); EXPECT_EQ(mBtpEngine.RxState(), BtpEngine::kState_Complete); @@ -133,7 +133,7 @@ TEST_F(TestBtpEngine, HandleCharacteristicSendOnePacket) EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(packet0.Retain(), false)); EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_Complete); - EXPECT_EQ(packet0->DataLength(), 5); + EXPECT_EQ(packet0->DataLength(), static_cast(5)); } TEST_F(TestBtpEngine, HandleCharacteristicSendTwoPacket) @@ -147,11 +147,11 @@ TEST_F(TestBtpEngine, HandleCharacteristicSendTwoPacket) EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(packet0.Retain(), false)); EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_InProgress); - EXPECT_EQ(packet0->DataLength(), 20); + EXPECT_EQ(packet0->DataLength(), static_cast(20)); EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(nullptr, false)); EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_Complete); - EXPECT_EQ(packet0->DataLength(), 16); + EXPECT_EQ(packet0->DataLength(), static_cast(16)); } // Send 40-byte payload. @@ -169,15 +169,15 @@ TEST_F(TestBtpEngine, HandleCharacteristicSendThreePacket) EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(packet0.Retain(), false)); EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_InProgress); - EXPECT_EQ(packet0->DataLength(), 20); + EXPECT_EQ(packet0->DataLength(), static_cast(20)); EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(nullptr, false)); EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_InProgress); - EXPECT_EQ(packet0->DataLength(), 20); + EXPECT_EQ(packet0->DataLength(), static_cast(20)); EXPECT_TRUE(mBtpEngine.HandleCharacteristicSend(nullptr, false)); EXPECT_EQ(mBtpEngine.TxState(), BtpEngine::kState_Complete); - EXPECT_EQ(packet0->DataLength(), 8); + EXPECT_EQ(packet0->DataLength(), static_cast(8)); } } // namespace diff --git a/src/inet/TCPEndPoint.cpp b/src/inet/TCPEndPoint.cpp index 15b14151a235ce..7fed0b0c26a1ec 100644 --- a/src/inet/TCPEndPoint.cpp +++ b/src/inet/TCPEndPoint.cpp @@ -126,7 +126,7 @@ CHIP_ERROR TCPEndPoint::SetReceivedDataForTesting(System::PacketBufferHandle && return CHIP_NO_ERROR; } -uint32_t TCPEndPoint::PendingSendLength() +size_t TCPEndPoint::PendingSendLength() { if (!mSendQueue.IsNull()) { @@ -135,7 +135,7 @@ uint32_t TCPEndPoint::PendingSendLength() return 0; } -uint32_t TCPEndPoint::PendingReceiveLength() +size_t TCPEndPoint::PendingReceiveLength() { if (!mRcvQueue.IsNull()) { @@ -333,8 +333,8 @@ void TCPEndPoint::DriveReceiving() { // Acknowledgement is done after handling the buffers to allow the // application processing to throttle flow. - uint16_t ackLength = mRcvQueue->TotalLength(); - CHIP_ERROR err = OnDataReceived(this, std::move(mRcvQueue)); + size_t ackLength = mRcvQueue->TotalLength(); + CHIP_ERROR err = OnDataReceived(this, std::move(mRcvQueue)); if (err != CHIP_NO_ERROR) { DoClose(err, false); diff --git a/src/inet/TCPEndPoint.h b/src/inet/TCPEndPoint.h index 0e4c17b12d5876..0c00e327cc3d71 100644 --- a/src/inet/TCPEndPoint.h +++ b/src/inet/TCPEndPoint.h @@ -274,7 +274,7 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis * received. The operational semantics are undefined if \c len is larger * than the total outstanding unacknowledged received data. */ - virtual CHIP_ERROR AckReceive(uint16_t len) = 0; + virtual CHIP_ERROR AckReceive(size_t len) = 0; /** * @brief Set the receive queue, for testing. @@ -295,7 +295,7 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis * * @return Number of untransmitted bytes in the transmit queue. */ - uint32_t PendingSendLength(); + size_t PendingSendLength(); /** * @brief Extract the length of the unacknowledged receive data. @@ -303,7 +303,7 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis * @return Number of bytes in the receive queue that have not yet been * acknowledged with AckReceive(uint16_t len). */ - uint32_t PendingReceiveLength(); + size_t PendingReceiveLength(); /** * @brief Initiate TCP half close, in other words, finished with sending. @@ -447,7 +447,7 @@ class DLL_EXPORT TCPEndPoint : public EndPointBasis * is the length of the message text added to the TCP transmit window, * which are eligible for sending by the underlying network stack. */ - typedef void (*OnDataSentFunct)(TCPEndPoint * endPoint, uint16_t len); + typedef void (*OnDataSentFunct)(TCPEndPoint * endPoint, size_t len); /** * The endpoint's message text transmission event handling function diff --git a/src/inet/TCPEndPointImplLwIP.cpp b/src/inet/TCPEndPointImplLwIP.cpp index 02e5ac97b46d16..763f2eb9613078 100644 --- a/src/inet/TCPEndPointImplLwIP.cpp +++ b/src/inet/TCPEndPointImplLwIP.cpp @@ -350,8 +350,8 @@ CHIP_ERROR TCPEndPointImplLwIP::DriveSendingImpl() do { VerifyOrDie(!startOfUnsent.buffer.IsNull()); - - uint16_t bufDataLen = startOfUnsent.buffer->DataLength(); + VerifyOrDie(CanCastTo(startOfUnsent.buffer->DataLength())); + uint16_t bufDataLen = static_cast(startOfUnsent.buffer->DataLength()); // Get a pointer to the start of unsent data within the first buffer on the unsent queue. const uint8_t * sendData = startOfUnsent.buffer->Start() + startOfUnsent.offset; @@ -503,16 +503,18 @@ void TCPEndPointImplLwIP::DoCloseImpl(CHIP_ERROR err, State oldState) } } -CHIP_ERROR TCPEndPointImplLwIP::AckReceive(uint16_t len) +CHIP_ERROR TCPEndPointImplLwIP::AckReceive(size_t len) { VerifyOrReturnError(IsConnected(), CHIP_ERROR_INCORRECT_STATE); CHIP_ERROR res = CHIP_NO_ERROR; + VerifyOrReturnError(CanCastTo(len), CHIP_ERROR_INVALID_ARGUMENT); + // Lock LwIP stack LOCK_TCPIP_CORE(); if (mTCP != nullptr) - tcp_recved(mTCP, len); + tcp_recved(mTCP, static_cast(len)); else res = CHIP_ERROR_CONNECTION_ABORTED; @@ -570,7 +572,8 @@ TCPEndPointImplLwIP::BufferOffset TCPEndPointImplLwIP::FindStartOfUnsent() while (leftToSkip > 0) { VerifyOrDie(!startOfUnsent.buffer.IsNull()); - uint16_t bufDataLen = startOfUnsent.buffer->DataLength(); + VerifyOrDie(CanCastTo(startOfUnsent.buffer->DataLength())); + uint16_t bufDataLen = static_cast(startOfUnsent.buffer->DataLength()); if (leftToSkip >= bufDataLen) { // We have more to skip than current packet buffer size. diff --git a/src/inet/TCPEndPointImplLwIP.h b/src/inet/TCPEndPointImplLwIP.h index b680f86b3b64e5..86a151f591d303 100644 --- a/src/inet/TCPEndPointImplLwIP.h +++ b/src/inet/TCPEndPointImplLwIP.h @@ -51,7 +51,7 @@ class TCPEndPointImplLwIP : public TCPEndPoint, public EndPointStateLwIP CHIP_ERROR EnableNoDelay() override; CHIP_ERROR EnableKeepAlive(uint16_t interval, uint16_t timeoutCount) override; CHIP_ERROR DisableKeepAlive() override; - CHIP_ERROR AckReceive(uint16_t len) override; + CHIP_ERROR AckReceive(size_t len) override; #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT void TCPUserTimeoutHandler() override; #endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT diff --git a/src/inet/TCPEndPointImplOpenThread.cpp b/src/inet/TCPEndPointImplOpenThread.cpp index 36522ca3c47459..97943787dcf1e7 100644 --- a/src/inet/TCPEndPointImplOpenThread.cpp +++ b/src/inet/TCPEndPointImplOpenThread.cpp @@ -54,7 +54,7 @@ CHIP_ERROR TCPEndPointImplOT::DisableKeepAlive() { return CHIP_ERROR_NOT_IMPLEMENTED; } -CHIP_ERROR TCPEndPointImplOT::AckReceive(uint16_t len) +CHIP_ERROR TCPEndPointImplOT::AckReceive(size_t len) { return CHIP_ERROR_NOT_IMPLEMENTED; } diff --git a/src/inet/TCPEndPointImplOpenThread.h b/src/inet/TCPEndPointImplOpenThread.h index c62c63cdc85f55..007d3cfb118bee 100644 --- a/src/inet/TCPEndPointImplOpenThread.h +++ b/src/inet/TCPEndPointImplOpenThread.h @@ -46,7 +46,7 @@ class TCPEndPointImplOT : public TCPEndPoint, public EndPointStateOpenThread CHIP_ERROR EnableNoDelay() override; CHIP_ERROR EnableKeepAlive(uint16_t interval, uint16_t timeoutCount) override; CHIP_ERROR DisableKeepAlive() override; - CHIP_ERROR AckReceive(uint16_t len) override; + CHIP_ERROR AckReceive(size_t len) override; #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT void TCPUserTimeoutHandler() override; #endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT diff --git a/src/inet/TCPEndPointImplSockets.cpp b/src/inet/TCPEndPointImplSockets.cpp index fc8c6e2da2a77e..d21c11b6a42865 100644 --- a/src/inet/TCPEndPointImplSockets.cpp +++ b/src/inet/TCPEndPointImplSockets.cpp @@ -441,7 +441,7 @@ CHIP_ERROR TCPEndPointImplSockets::DisableKeepAlive() return CHIP_NO_ERROR; } -CHIP_ERROR TCPEndPointImplSockets::AckReceive(uint16_t len) +CHIP_ERROR TCPEndPointImplSockets::AckReceive(size_t len) { VerifyOrReturnError(IsConnected(), CHIP_ERROR_INCORRECT_STATE); @@ -483,7 +483,7 @@ CHIP_ERROR TCPEndPointImplSockets::DriveSendingImpl() while (!mSendQueue.IsNull()) { - uint16_t bufLen = mSendQueue->DataLength(); + size_t bufLen = mSendQueue->DataLength(); ssize_t lenSentRaw = send(mSocket, mSendQueue->Start(), bufLen, sendFlags); @@ -496,14 +496,13 @@ CHIP_ERROR TCPEndPointImplSockets::DriveSendingImpl() break; } - if (lenSentRaw < 0 || lenSentRaw > bufLen) + if (lenSentRaw < 0 || bufLen < static_cast(lenSentRaw)) { err = CHIP_ERROR_INCORRECT_STATE; break; } - // Cast is safe because bufLen is uint16_t. - uint16_t lenSent = static_cast(lenSentRaw); + size_t lenSent = static_cast(lenSentRaw); // Mark the connection as being active. MarkActive(); diff --git a/src/inet/TCPEndPointImplSockets.h b/src/inet/TCPEndPointImplSockets.h index 40e81eeb6a0d06..1d9b86b1c9bb66 100644 --- a/src/inet/TCPEndPointImplSockets.h +++ b/src/inet/TCPEndPointImplSockets.h @@ -46,7 +46,7 @@ class TCPEndPointImplSockets : public TCPEndPoint, public EndPointStateSockets CHIP_ERROR EnableNoDelay() override; CHIP_ERROR EnableKeepAlive(uint16_t interval, uint16_t timeoutCount) override; CHIP_ERROR DisableKeepAlive() override; - CHIP_ERROR AckReceive(uint16_t len) override; + CHIP_ERROR AckReceive(size_t len) override; #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT void TCPUserTimeoutHandler() override; #endif // INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT @@ -72,7 +72,7 @@ class TCPEndPointImplSockets : public TCPEndPoint, public EndPointStateSockets #if INET_CONFIG_OVERRIDE_SYSTEM_TCP_USER_TIMEOUT /// This counts the number of bytes written on the TCP socket since thelast probe into the TCP outqueue was made. - uint32_t mBytesWrittenSinceLastProbe; + size_t mBytesWrittenSinceLastProbe; /// This is the measured size(in bytes) of the kernel TCP send queue at the end of the last user timeout window. uint32_t mLastTCPKernelSendQueueLen; diff --git a/src/inet/UDPEndPointImplLwIP.cpp b/src/inet/UDPEndPointImplLwIP.cpp index 7627ff667db57d..9d0d3bb396f482 100755 --- a/src/inet/UDPEndPointImplLwIP.cpp +++ b/src/inet/UDPEndPointImplLwIP.cpp @@ -352,7 +352,7 @@ void UDPEndPointImplLwIP::LwIPReceiveUDPMessage(void * arg, struct udp_pcb * pcb if (buf->HasChainedBuffer()) { // Have to allocate a new big-enough buffer and copy. - uint16_t messageSize = buf->TotalLength(); + size_t messageSize = buf->TotalLength(); System::PacketBufferHandle copy = System::PacketBufferHandle::New(messageSize, 0); if (copy.IsNull() || buf->Read(copy->Start(), messageSize) != CHIP_NO_ERROR) { diff --git a/src/inet/UDPEndPointImplOpenThread.cpp b/src/inet/UDPEndPointImplOpenThread.cpp index 073f633bd8a38c..7c6ecb80cacbe1 100644 --- a/src/inet/UDPEndPointImplOpenThread.cpp +++ b/src/inet/UDPEndPointImplOpenThread.cpp @@ -225,7 +225,7 @@ CHIP_ERROR UDPEndPointImplOT::SendMsgImpl(const IPPacketInfo * aPktInfo, System: otMessageInfo messageInfo; // For now the entire message must fit within a single buffer. - VerifyOrReturnError(!msg->HasChainedBuffer(), CHIP_ERROR_MESSAGE_TOO_LONG); + VerifyOrReturnError(!msg->HasChainedBuffer() && msg->DataLength() <= UINT16_MAX, CHIP_ERROR_MESSAGE_TOO_LONG); memset(&messageInfo, 0, sizeof(messageInfo)); @@ -237,7 +237,7 @@ CHIP_ERROR UDPEndPointImplOT::SendMsgImpl(const IPPacketInfo * aPktInfo, System: message = otUdpNewMessage(mOTInstance, NULL); VerifyOrExit(message != NULL, error = OT_ERROR_NO_BUFS); - error = otMessageAppend(message, msg->Start(), msg->DataLength()); + error = otMessageAppend(message, msg->Start(), static_cast(msg->DataLength())); if (error == OT_ERROR_NONE) { diff --git a/src/inet/UDPEndPointImplSockets.cpp b/src/inet/UDPEndPointImplSockets.cpp index 23190c15846e88..f1831c475f2cc5 100644 --- a/src/inet/UDPEndPointImplSockets.cpp +++ b/src/inet/UDPEndPointImplSockets.cpp @@ -415,7 +415,10 @@ CHIP_ERROR UDPEndPointImplSockets::SendMsgImpl(const IPPacketInfo * aPktInfo, Sy { return CHIP_ERROR_POSIX(errno); } - if (lenSent != msg->DataLength()) + + size_t len = static_cast(lenSent); + + if (len != msg->DataLength()) { return CHIP_ERROR_OUTBOUND_MESSAGE_TOO_BIG; } @@ -607,11 +610,11 @@ void UDPEndPointImplSockets::HandlePendingIO(System::SocketEvents events) ssize_t rcvLen = recvmsg(mSocket, &msgHeader, MSG_DONTWAIT); - if (rcvLen < 0) + if (rcvLen == -1) { lStatus = CHIP_ERROR_POSIX(errno); } - else if (rcvLen > lBuffer->AvailableDataLength()) + else if (lBuffer->AvailableDataLength() < static_cast(rcvLen)) { lStatus = CHIP_ERROR_INBOUND_MESSAGE_TOO_BIG; } diff --git a/src/inet/tests/TestInetLayer.cpp b/src/inet/tests/TestInetLayer.cpp index a43b3c7a08affc..0001e527af0464 100644 --- a/src/inet/tests/TestInetLayer.cpp +++ b/src/inet/tests/TestInetLayer.cpp @@ -565,7 +565,7 @@ static void HandleTCPConnectionClosed(TCPEndPoint * aEndPoint, CHIP_ERROR aError } } -static void HandleTCPDataSent(TCPEndPoint * aEndPoint, uint16_t len) {} +static void HandleTCPDataSent(TCPEndPoint * aEndPoint, size_t len) {} static CHIP_ERROR HandleTCPDataReceived(TCPEndPoint * aEndPoint, PacketBufferHandle && aBuffer) { diff --git a/src/inet/tests/TestInetLayerCommon.cpp b/src/inet/tests/TestInetLayerCommon.cpp index 7a60a2778239ba..b1f0172bea0642 100644 --- a/src/inet/tests/TestInetLayerCommon.cpp +++ b/src/inet/tests/TestInetLayerCommon.cpp @@ -35,6 +35,7 @@ #include #include +#include #include "TestInetCommon.h" @@ -123,9 +124,9 @@ bool WasSuccessful(const TestStatus & aTestStatus) return (lStatus); } -static void FillDataBufferPattern(uint8_t * aBuffer, uint16_t aLength, uint16_t aPatternStartOffset, uint8_t aFirstValue) +static void FillDataBufferPattern(uint8_t * aBuffer, size_t aLength, size_t aPatternStartOffset, uint8_t aFirstValue) { - for (uint16_t i = aPatternStartOffset; i < aLength; i++) + for (size_t i = aPatternStartOffset; i < aLength; i++) { const uint8_t lValue = static_cast(aFirstValue & 0xFF); @@ -135,9 +136,9 @@ static void FillDataBufferPattern(uint8_t * aBuffer, uint16_t aLength, uint16_t } } -static bool CheckDataBufferPattern(const uint8_t * aBuffer, uint16_t aLength, uint16_t aPatternStartOffset, uint8_t aFirstValue) +static bool CheckDataBufferPattern(const uint8_t * aBuffer, size_t aLength, size_t aPatternStartOffset, size_t aFirstValue) { - for (uint16_t i = aPatternStartOffset; i < aLength; i++) + for (size_t i = aPatternStartOffset; i < aLength; i++) { const uint8_t lValue = aBuffer[i]; @@ -145,8 +146,8 @@ static bool CheckDataBufferPattern(const uint8_t * aBuffer, uint16_t aLength, ui { printf("Bad data value at offset %u (0x%04x): " "expected 0x%02x, found 0x%02x\n", - i, i, aFirstValue, lValue); - DumpMemory(aBuffer + aPatternStartOffset, aLength - aPatternStartOffset, "0x", 16); + static_cast(i), static_cast(i), static_cast(aFirstValue), lValue); + DumpMemory(aBuffer + aPatternStartOffset, static_cast(aLength - aPatternStartOffset), "0x", 16); return false; } @@ -156,7 +157,7 @@ static bool CheckDataBufferPattern(const uint8_t * aBuffer, uint16_t aLength, ui return true; } -static PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength, uint16_t aPatternStartOffset, uint8_t aFirstValue) +static PacketBufferHandle MakeDataBuffer(size_t aDesiredLength, size_t aPatternStartOffset, uint8_t aFirstValue) { VerifyOrReturnError(aPatternStartOffset <= aDesiredLength, PacketBufferHandle()); @@ -172,14 +173,14 @@ static PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength, uint16_t aPatt return lBuffer; } -static PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength, uint16_t aPatternStartOffset) +static PacketBufferHandle MakeDataBuffer(size_t aDesiredLength, size_t aPatternStartOffset) { constexpr uint8_t lFirstValue = 0; return MakeDataBuffer(aDesiredLength, aPatternStartOffset, lFirstValue); } template -static PacketBufferHandle MakeICMPDataBuffer(uint16_t aDesiredUserLength, uint16_t aHeaderLength, uint16_t aPatternStartOffset, +static PacketBufferHandle MakeICMPDataBuffer(size_t aDesiredUserLength, uint16_t aHeaderLength, size_t aPatternStartOffset, uint8_t aType) { static uint16_t lSequenceNumber = 0; @@ -188,7 +189,7 @@ static PacketBufferHandle MakeICMPDataBuffer(uint16_t aDesiredUserLength, uint16 // To ensure there is enough room for the user data and the ICMP // header, include both the user data size and the ICMP header length. - lBuffer = MakeDataBuffer(static_cast(aDesiredUserLength + aHeaderLength), aPatternStartOffset); + lBuffer = MakeDataBuffer(aDesiredUserLength + aHeaderLength, aPatternStartOffset); if (!lBuffer.IsNull()) { @@ -204,7 +205,7 @@ static PacketBufferHandle MakeICMPDataBuffer(uint16_t aDesiredUserLength, uint16 return (lBuffer); } -PacketBufferHandle MakeICMPv4DataBuffer(uint16_t aDesiredUserLength) +PacketBufferHandle MakeICMPv4DataBuffer(size_t aDesiredUserLength) { constexpr uint16_t lICMPHeaderLength = sizeof(ICMPv4EchoHeader); constexpr uint16_t lPatternStartOffset = lICMPHeaderLength; @@ -213,7 +214,7 @@ PacketBufferHandle MakeICMPv4DataBuffer(uint16_t aDesiredUserLength) return MakeICMPDataBuffer(aDesiredUserLength, lICMPHeaderLength, lPatternStartOffset, lType); } -PacketBufferHandle MakeICMPv6DataBuffer(uint16_t aDesiredUserLength) +PacketBufferHandle MakeICMPv6DataBuffer(size_t aDesiredUserLength) { constexpr uint16_t lICMPHeaderLength = sizeof(ICMPv6EchoHeader); constexpr uint16_t lPatternStartOffset = lICMPHeaderLength; @@ -222,44 +223,45 @@ PacketBufferHandle MakeICMPv6DataBuffer(uint16_t aDesiredUserLength) return MakeICMPDataBuffer(aDesiredUserLength, lICMPHeaderLength, lPatternStartOffset, lType); } -PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength, uint8_t aFirstValue) +PacketBufferHandle MakeDataBuffer(size_t aDesiredLength, uint8_t aFirstValue) { - constexpr uint16_t lPatternStartOffset = 0; + constexpr size_t lPatternStartOffset = 0; return MakeDataBuffer(aDesiredLength, lPatternStartOffset, aFirstValue); } -PacketBufferHandle MakeDataBuffer(uint16_t aDesiredLength) +PacketBufferHandle MakeDataBuffer(size_t aDesiredLength) { - constexpr uint16_t lPatternStartOffset = 0; + constexpr size_t lPatternStartOffset = 0; return MakeDataBuffer(aDesiredLength, lPatternStartOffset); } static bool HandleDataReceived(const PacketBufferHandle & aBuffer, TransferStats & aStats, bool aStatsByPacket, bool aCheckBuffer, - uint16_t aPatternStartOffset, uint8_t aFirstValue) + size_t aPatternStartOffset, size_t aFirstValue) { - uint16_t lTotalDataLength = 0; + size_t lTotalDataLength = 0; // Walk through each buffer in the packet chain, checking the // buffer for the expected pattern, if requested. for (PacketBufferHandle lBuffer = aBuffer.Retain(); !lBuffer.IsNull(); lBuffer.Advance()) { - const uint16_t lDataLength = lBuffer->DataLength(); - const uint8_t * const p = lBuffer->Start(); + const size_t lDataLength = lBuffer->DataLength(); + const uint8_t * const p = lBuffer->Start(); if (aCheckBuffer && !CheckDataBufferPattern(p, lDataLength, aPatternStartOffset, aFirstValue)) { return false; } - lTotalDataLength = static_cast(lTotalDataLength + lDataLength); - aFirstValue = static_cast(aFirstValue + lDataLength); + lTotalDataLength = lTotalDataLength + lDataLength; + aFirstValue = aFirstValue + lDataLength; } // If we are accumulating stats by packet rather than by size, // then increment by one (1) rather than the total buffer length. - aStats.mReceive.mActual += ((aStatsByPacket) ? 1 : lTotalDataLength); + VerifyOrReturnError(CanCastTo(lTotalDataLength), false); + aStats.mReceive.mActual += ((aStatsByPacket) ? 1 : static_cast(lTotalDataLength)); return true; } diff --git a/src/lib/core/tests/TestTLV.cpp b/src/lib/core/tests/TestTLV.cpp index 19b4c77ac35280..d7861291a56c73 100644 --- a/src/lib/core/tests/TestTLV.cpp +++ b/src/lib/core/tests/TestTLV.cpp @@ -269,12 +269,12 @@ void TestDupBytes(TLVReader & reader, Tag tag, const uint8_t * expectedVal, uint chip::Platform::MemoryFree(val); } -void TestBufferContents(const System::PacketBufferHandle & buffer, const uint8_t * expectedVal, uint32_t expectedLen) +void TestBufferContents(const System::PacketBufferHandle & buffer, const uint8_t * expectedVal, size_t expectedLen) { System::PacketBufferHandle buf = buffer.Retain(); while (!buf.IsNull()) { - uint16_t len = buf->DataLength(); + size_t len = buf->DataLength(); EXPECT_LE(len, expectedLen); EXPECT_EQ(memcmp(buf->Start(), expectedVal, len), 0); @@ -2978,8 +2978,8 @@ TEST_F(TestTLV, CheckBufferOverflow) System::PacketBufferTLVReader reader; System::PacketBufferHandle buf = System::PacketBufferHandle::New(sizeof(Encoding1), 0); - uint16_t maxDataLen = buf->MaxDataLength(); - uint16_t reserve = static_cast((sizeof(Encoding1) < maxDataLen) ? (maxDataLen - sizeof(Encoding1)) + 2 : 0); + uint32_t maxDataLen = static_cast(buf->MaxDataLength()); + uint32_t reserve = static_cast((sizeof(Encoding1) < maxDataLen) ? (maxDataLen - sizeof(Encoding1)) + 2 : 0); // Repeatedly write and read a TLV encoding to a chain of PacketBuffers. Use progressively larger // and larger amounts of space in the first buffer to force the encoding to overlap the diff --git a/src/messaging/tests/echo/echo_requester.cpp b/src/messaging/tests/echo/echo_requester.cpp index bc5d96d694bb33..1bff8e70f55d8d 100644 --- a/src/messaging/tests/echo/echo_requester.cpp +++ b/src/messaging/tests/echo/echo_requester.cpp @@ -183,8 +183,9 @@ void HandleEchoResponseReceived(chip::Messaging::ExchangeContext * ec, chip::Sys gEchoRespCount++; - printf("Echo Response: %" PRIu64 "/%" PRIu64 "(%.2f%%) len=%u time=%.3fs\n", gEchoRespCount, gEchoCount, - static_cast(gEchoRespCount) * 100 / static_cast(gEchoCount), payload->DataLength(), + printf("Echo Response: %" PRIu64 "/%" PRIu64 "(%.2f%%) len=%" PRIu32 "time=%.3fs\n", gEchoRespCount, gEchoCount, + static_cast(gEchoRespCount) * 100 / static_cast(gEchoCount), + static_cast(payload->DataLength()), static_cast(chip::System::Clock::Milliseconds32(transitTime).count()) / 1000); } diff --git a/src/messaging/tests/echo/echo_responder.cpp b/src/messaging/tests/echo/echo_responder.cpp index 3cf56553294ccb..140aab00b0ff23 100644 --- a/src/messaging/tests/echo/echo_responder.cpp +++ b/src/messaging/tests/echo/echo_responder.cpp @@ -49,7 +49,7 @@ chip::SessionHolder gSession; // Callback handler when a CHIP EchoRequest is received. void HandleEchoRequestReceived(chip::Messaging::ExchangeContext * ec, chip::System::PacketBufferHandle && payload) { - printf("Echo Request, len=%u ... sending response.\n", payload->DataLength()); + printf("Echo Request, len=%" PRIu32 "... sending response.\n", static_cast(payload->DataLength())); } } // namespace diff --git a/src/platform/ESP32/nimble/BLEManagerImpl.cpp b/src/platform/ESP32/nimble/BLEManagerImpl.cpp index a69bc169fe26ed..9a8ae506e7ee05 100644 --- a/src/platform/ESP32/nimble/BLEManagerImpl.cpp +++ b/src/platform/ESP32/nimble/BLEManagerImpl.cpp @@ -34,6 +34,7 @@ #include #endif #include +#include #include #include #include @@ -601,7 +602,11 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU ESP_LOGD(TAG, "Sending indication for CHIPoBLE TX characteristic (con %u, len %u)", conId, data->DataLength()); - om = ble_hs_mbuf_from_flat(data->Start(), data->DataLength()); + // For BLE, the buffer is capped at UINT16_MAX. Nevertheless, have a verify + // check before the cast to uint16_t. + VerifyOrExit(CanCastTo(data->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); + + om = ble_hs_mbuf_from_flat(data->Start(), static_cast(data->DataLength())); if (om == NULL) { ChipLogError(DeviceLayer, "ble_hs_mbuf_from_flat failed:"); diff --git a/src/platform/Zephyr/BLEManagerImpl.cpp b/src/platform/Zephyr/BLEManagerImpl.cpp index 4eba52756d1368..59898c65932a2b 100644 --- a/src/platform/Zephyr/BLEManagerImpl.cpp +++ b/src/platform/Zephyr/BLEManagerImpl.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -707,7 +708,8 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU params->attr = &sChipoBleAttributes[kCHIPoBLE_CCC_AttributeIndex]; params->func = HandleTXIndicated; params->data = pBuf->Start(); - params->len = pBuf->DataLength(); + VerifyOrExit(CanCastTo(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); + params->len = static_cast(pBuf->DataLength()); status = bt_gatt_indicate(conId, params); VerifyOrExit(status == 0, err = MapErrorZephyr(status)); @@ -885,8 +887,10 @@ ssize_t BLEManagerImpl::HandleC3Read(struct bt_conn * conId, const struct bt_gat return 0; } + // For BLE, the max payload size is limited to UINT16_MAX since the length + // field is 2 bytes long. So, the cast to uint16_t should be fine. return bt_gatt_attr_read(conId, attr, buf, len, offset, sInstance.c3CharDataBufferHandle->Start(), - sInstance.c3CharDataBufferHandle->DataLength()); + static_cast(sInstance.c3CharDataBufferHandle->DataLength())); } #endif diff --git a/src/platform/android/BLEManagerImpl.cpp b/src/platform/android/BLEManagerImpl.cpp index d729ba5134573c..0bd7f1e34054d5 100644 --- a/src/platform/android/BLEManagerImpl.cpp +++ b/src/platform/android/BLEManagerImpl.cpp @@ -384,7 +384,9 @@ bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const Ble::Ch err = JniReferences::GetInstance().N2J_ByteArray(env, static_cast(charId->bytes), 16, charIdObj); SuccessOrExit(err); - err = JniReferences::GetInstance().N2J_ByteArray(env, pBuf->Start(), pBuf->DataLength(), characteristicDataObj); + VerifyOrExit(CanCastTo(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); + err = JniReferences::GetInstance().N2J_ByteArray(env, pBuf->Start(), static_cast(pBuf->DataLength()), + characteristicDataObj); SuccessOrExit(err); env->ExceptionClear(); diff --git a/src/platform/bouffalolab/common/BLEManagerImpl.cpp b/src/platform/bouffalolab/common/BLEManagerImpl.cpp index b2f2c82f60716e..0b1679ef2aeb09 100644 --- a/src/platform/bouffalolab/common/BLEManagerImpl.cpp +++ b/src/platform/bouffalolab/common/BLEManagerImpl.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING @@ -669,7 +670,10 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU params->attr = &sChipoBleAttributes[kCHIPoBLE_CCC_AttributeIndex]; params->func = HandleTXIndicated; params->data = pBuf->Start(); - params->len = pBuf->DataLength(); + // For BLE, the buffer is capped at UINT16_MAX. Nevertheless, have a verify + // check before the cast to uint16_t. + VerifyOrExit(CanCastTo(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); + params->len = static_cast(pBuf->DataLength()); status = bt_gatt_indicate(conId, params); VerifyOrExit(status == 0, err = MapErrorZephyr(status)); @@ -848,8 +852,10 @@ ssize_t BLEManagerImpl::HandleC3Read(struct bt_conn * conId, const struct bt_gat return 0; } + // For BLE, the max payload size is limited to UINT16_MAX since the length + // field is 2 bytes long. So, the cast to uint16_t should be fine. return bt_gatt_attr_read(conId, attr, buf, len, offset, sInstance.c3CharDataBufferHandle->Start(), - sInstance.c3CharDataBufferHandle->DataLength()); + static_cast(sInstance.c3CharDataBufferHandle->DataLength())); } #endif diff --git a/src/platform/mbed/BLEManagerImpl.cpp b/src/platform/mbed/BLEManagerImpl.cpp index 75c749f3f145f5..5048a92b1c48f3 100644 --- a/src/platform/mbed/BLEManagerImpl.cpp +++ b/src/platform/mbed/BLEManagerImpl.cpp @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -984,6 +985,9 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU ble::GattServer & gatt_server = ble::BLE::Instance().gattServer(); ble::attribute_handle_t att_handle; + // For BLE, the buffer is capped at UINT16_MAX. + VerifyOrExit(CanCastTo(pBuf->DataLength()), err = CHIP_ERROR_MESSAGE_TOO_LONG); + // No need to do anything fancy here. Only 3 handles are used in this impl. if (UUIDsMatch(charId, &ChipUUID_CHIPoBLEChar_TX)) { @@ -1007,7 +1011,7 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU "(connHandle=%d, attHandle=%d, data_len=%u)", conId, att_handle, pBuf->DataLength()); - mbed_err = gatt_server.write(att_handle, pBuf->Start(), pBuf->DataLength(), false); + mbed_err = gatt_server.write(att_handle, pBuf->Start(), static_cast(pBuf->DataLength()), false); VerifyOrExit(mbed_err == BLE_ERROR_NONE, err = CHIP_ERROR(chip::ChipError::Range::kOS, mbed_err)); exit: diff --git a/src/protocols/secure_channel/CASESession.cpp b/src/protocols/secure_channel/CASESession.cpp index aa6084d3680127..745bd3898fa865 100644 --- a/src/protocols/secure_channel/CASESession.cpp +++ b/src/protocols/secure_channel/CASESession.cpp @@ -1582,8 +1582,8 @@ CHIP_ERROR CASESession::HandleSigma3a(System::PacketBufferHandle && msg) TLV::TLVReader decryptedDataTlvReader; TLV::TLVType containerType = TLV::kTLVType_Structure; - const uint8_t * buf = msg->Start(); - const uint16_t bufLen = msg->DataLength(); + const uint8_t * buf = msg->Start(); + const size_t bufLen = msg->DataLength(); constexpr size_t kCaseOverheadForFutureTbeData = 128; diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp b/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp index 3bb69c099612e3..9fc43634d7ec7d 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioningClient.cpp @@ -255,7 +255,7 @@ void UserDirectedCommissioningClient::OnMessageReceived(const Transport::PeerAdd PayloadHeader payloadHeader; ReturnOnFailure(payloadHeader.DecodeAndConsume(msg)); - ChipLogProgress(AppServer, "CommissionerDeclaration DataLength()=%d", msg->DataLength()); + ChipLogProgress(AppServer, "CommissionerDeclaration DataLength()=%" PRIu32, static_cast(msg->DataLength())); uint8_t udcPayload[IdentificationDeclaration::kUdcTLVDataMaxBytes]; size_t udcPayloadLength = std::min(msg->DataLength(), sizeof(udcPayload)); diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp b/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp index cb953c8a60e5ca..2efd8d0a33de28 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioningServer.cpp @@ -52,7 +52,7 @@ void UserDirectedCommissioningServer::OnMessageReceived(const Transport::PeerAdd PayloadHeader payloadHeader; ReturnOnFailure(payloadHeader.DecodeAndConsume(msg)); - ChipLogProgress(AppServer, "IdentityDeclaration DataLength()=%d", msg->DataLength()); + ChipLogProgress(AppServer, "IdentityDeclaration DataLength()=%" PRIu32, static_cast(msg->DataLength())); uint8_t udcPayload[IdentificationDeclaration::kUdcTLVDataMaxBytes]; size_t udcPayloadLength = std::min(msg->DataLength(), sizeof(udcPayload)); diff --git a/src/system/SystemPacketBuffer.cpp b/src/system/SystemPacketBuffer.cpp index 0226ab783f2415..59e1e822901db0 100644 --- a/src/system/SystemPacketBuffer.cpp +++ b/src/system/SystemPacketBuffer.cpp @@ -117,7 +117,8 @@ void PacketBuffer::InternalCheck(const PacketBuffer * buffer) VerifyOrDieWithMsg(::chip::Platform::MemoryDebugCheckPointer(buffer, buffer->alloc_size + kStructureSize), chipSystemLayer, "invalid packet buffer pointer"); VerifyOrDieWithMsg(buffer->alloc_size >= buffer->ReservedSize() + buffer->len, chipSystemLayer, - "packet buffer overflow %u < %u+%u", buffer->alloc_size, buffer->ReservedSize(), buffer->len); + "packet buffer overflow %" PRIu32 " < %" PRIu32 " +%" PRIu32, static_cast(buffer->alloc_size), + static_cast(buffer->ReservedSize()), static_cast(buffer->len)); } } #endif // CHIP_SYSTEM_PACKETBUFFER_HAS_CHECK @@ -136,7 +137,7 @@ void PacketBufferHandle::InternalRightSize() // Reallocate only if enough space will be saved. const uint8_t * const start = mBuffer->ReserveStart(); const uint8_t * const payload = mBuffer->Start(); - const uint16_t usedSize = static_cast(payload - start + mBuffer->len); + const size_t usedSize = static_cast(payload - start + static_cast(mBuffer->len)); if (usedSize + kRightSizingThreshold > mBuffer->alloc_size) { return; @@ -156,7 +157,7 @@ void PacketBufferHandle::InternalRightSize() newBuffer->tot_len = mBuffer->tot_len; newBuffer->len = mBuffer->len; newBuffer->ref = 1; - newBuffer->alloc_size = static_cast(usedSize); + newBuffer->alloc_size = usedSize; memcpy(newStart, start, usedSize); PacketBuffer::Free(mBuffer); @@ -203,26 +204,42 @@ void PacketBuffer::SetStart(uint8_t * aNewStart) aNewStart = kEnd; ptrdiff_t lDelta = aNewStart - static_cast(this->payload); - if (lDelta > this->len) - lDelta = this->len; + if (lDelta > 0 && this->len < static_cast(lDelta)) + lDelta = static_cast(this->len); - this->len = static_cast(static_cast(this->len) - lDelta); +#if CHIP_SYSTEM_CONFIG_USE_LWIP + VerifyOrDieWithMsg((static_cast(this->len) - lDelta) <= UINT16_MAX, chipSystemLayer, + "LwIP buffer length cannot exceed UINT16_MAX"); + this->len = static_cast(static_cast(this->len) - lDelta); + VerifyOrDieWithMsg((static_cast(this->tot_len) - lDelta) <= UINT16_MAX, chipSystemLayer, + "LwIP buffer length cannot exceed UINT16_MAX"); this->tot_len = static_cast(static_cast(this->tot_len) - lDelta); +#else + this->len = static_cast(static_cast(this->len) - lDelta); + this->tot_len = static_cast(static_cast(this->tot_len) - lDelta); +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP this->payload = aNewStart; } -void PacketBuffer::SetDataLength(uint16_t aNewLen, PacketBuffer * aChainHead) +void PacketBuffer::SetDataLength(size_t aNewLen, PacketBuffer * aChainHead) { - const uint16_t kMaxDataLen = this->MaxDataLength(); + const size_t kMaxDataLen = this->MaxDataLength(); if (aNewLen > kMaxDataLen) aNewLen = kMaxDataLen; - ptrdiff_t lDelta = static_cast(aNewLen) - static_cast(this->len); + ssize_t lDelta = static_cast(aNewLen) - static_cast(this->len); +#if CHIP_SYSTEM_CONFIG_USE_LWIP + VerifyOrDieWithMsg(aNewLen <= UINT16_MAX, chipSystemLayer, "LwIP buffer length cannot exceed UINT16_MAX"); + this->len = static_cast(aNewLen); + VerifyOrDieWithMsg((static_cast(this->tot_len) + lDelta) <= UINT16_MAX, chipSystemLayer, + "LwIP buffer length cannot exceed UINT16_MAX"); + this->tot_len = static_cast(static_cast(this->tot_len) + lDelta); +#else this->len = aNewLen; - this->tot_len = static_cast(this->tot_len + lDelta); - + this->tot_len = static_cast(static_cast(this->tot_len) + lDelta); +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP // SetDataLength is often called after a client finished writing to the buffer, // so it's a good time to check for possible corruption. Check(this); @@ -230,12 +247,18 @@ void PacketBuffer::SetDataLength(uint16_t aNewLen, PacketBuffer * aChainHead) while (aChainHead != nullptr && aChainHead != this) { Check(aChainHead); - aChainHead->tot_len = static_cast(aChainHead->tot_len + lDelta); - aChainHead = aChainHead->ChainedBuffer(); +#if CHIP_SYSTEM_CONFIG_USE_LWIP + VerifyOrDieWithMsg((static_cast(aChainHead->tot_len) + lDelta) <= UINT16_MAX, chipSystemLayer, + "LwIP buffer length cannot exceed UINT16_MAX"); + aChainHead->tot_len = static_cast(static_cast(aChainHead->tot_len) + lDelta); +#else + aChainHead->tot_len = static_cast(static_cast(aChainHead->tot_len) + lDelta); +#endif + aChainHead = aChainHead->ChainedBuffer(); } } -uint16_t PacketBuffer::MaxDataLength() const +size_t PacketBuffer::MaxDataLength() const { #if CHIP_SYSTEM_CONFIG_USE_LWIP if (!(PBUF_STRUCT_DATA_CONTIGUOUS(this))) @@ -243,12 +266,12 @@ uint16_t PacketBuffer::MaxDataLength() const return DataLength(); } #endif - return static_cast(AllocSize() - ReservedSize()); + return static_cast(AllocSize() - ReservedSize()); } -uint16_t PacketBuffer::AvailableDataLength() const +size_t PacketBuffer::AvailableDataLength() const { - return static_cast(this->MaxDataLength() - this->DataLength()); + return (this->MaxDataLength() - this->DataLength()); } uint16_t PacketBuffer::ReservedSize() const @@ -292,8 +315,8 @@ void PacketBuffer::AddToEnd(PacketBufferHandle && aPacketHandle) while (true) { - uint16_t old_total_length = lCursor->tot_len; - lCursor->tot_len = static_cast(lCursor->tot_len + aPacket->tot_len); + size_t old_total_length = lCursor->tot_len; + lCursor->tot_len = lCursor->tot_len + aPacket->tot_len; VerifyOrDieWithMsg(lCursor->tot_len >= old_total_length, chipSystemLayer, "buffer chain too large"); if (!lCursor->HasChainedBuffer()) { @@ -316,37 +339,50 @@ void PacketBuffer::CompactHead() this->payload = kStart; } - uint16_t lAvailLength = this->AvailableDataLength(); + size_t lAvailLength = this->AvailableDataLength(); while (lAvailLength > 0 && HasChainedBuffer()) { PacketBuffer & lNextPacket = *ChainedBuffer(); VerifyOrDieWithMsg(lNextPacket.ref == 1, chipSystemLayer, "next buffer %p is not exclusive to this chain", &lNextPacket); - uint16_t lMoveLength = lNextPacket.len; + size_t lMoveLength = lNextPacket.len; if (lMoveLength > lAvailLength) lMoveLength = lAvailLength; memcpy(static_cast(this->payload) + this->len, lNextPacket.payload, lMoveLength); lNextPacket.payload = static_cast(lNextPacket.payload) + lMoveLength; + lAvailLength = lAvailLength - lMoveLength; +#if CHIP_SYSTEM_CONFIG_USE_LWIP + VerifyOrDieWithMsg(CanCastTo(this->len + lMoveLength), chipSystemLayer, + "LwIP buffer length cannot exceed UINT16_MAX"); this->len = static_cast(this->len + lMoveLength); - lAvailLength = static_cast(lAvailLength - lMoveLength); lNextPacket.len = static_cast(lNextPacket.len - lMoveLength); lNextPacket.tot_len = static_cast(lNextPacket.tot_len - lMoveLength); +#else + this->len = this->len + lMoveLength; + lNextPacket.len = lNextPacket.len - lMoveLength; + lNextPacket.tot_len = lNextPacket.tot_len - lMoveLength; +#endif if (lNextPacket.len == 0) this->next = this->FreeHead(&lNextPacket); } } -void PacketBuffer::ConsumeHead(uint16_t aConsumeLength) +void PacketBuffer::ConsumeHead(size_t aConsumeLength) { if (aConsumeLength > this->len) aConsumeLength = this->len; this->payload = static_cast(this->payload) + aConsumeLength; +#if CHIP_SYSTEM_CONFIG_USE_LWIP this->len = static_cast(this->len - aConsumeLength); this->tot_len = static_cast(this->tot_len - aConsumeLength); +#else + this->len = this->len - aConsumeLength; + this->tot_len = this->tot_len - aConsumeLength; +#endif } /** @@ -360,18 +396,18 @@ void PacketBuffer::ConsumeHead(uint16_t aConsumeLength) * * @return the first buffer from the current chain that contains any remaining data. If no data remains, nullptr is returned. */ -PacketBuffer * PacketBuffer::Consume(uint16_t aConsumeLength) +PacketBuffer * PacketBuffer::Consume(size_t aConsumeLength) { PacketBuffer * lPacket = this; while (lPacket != nullptr && aConsumeLength > 0) { - const uint16_t kLength = lPacket->DataLength(); + const size_t kLength = lPacket->DataLength(); if (aConsumeLength >= kLength) { lPacket = PacketBuffer::FreeHead(lPacket); - aConsumeLength = static_cast(aConsumeLength - kLength); + aConsumeLength = aConsumeLength - kLength; } else { @@ -478,7 +514,13 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese static_assert(PacketBuffer::kStructureSize == sizeof(PacketBuffer), "PacketBuffer size mismatch"); static_assert(PacketBuffer::kStructureSize < UINT16_MAX, "Check for overflow more carefully"); static_assert(SIZE_MAX >= INT_MAX, "Our additions might not fit in size_t"); - static_assert(PacketBuffer::kMaxSizeWithoutReserve <= UINT16_MAX, "PacketBuffer may have size not fitting uint16_t"); + static_assert(PacketBuffer::kMaxSizeWithoutReserve <= UINT32_MAX, "PacketBuffer may have size not fitting uint32_t"); +#if CHIP_SYSTEM_CONFIG_USE_LWIP + // LwIP based APIs have a maximum buffer size of UINT16_MAX. Ensure that + // limit is met during allocation. + VerifyOrDieWithMsg(aAvailableSize + aReservedSize < UINT16_MAX, chipSystemLayer, + "LwIP based systems can handle only up to UINT16_MAX!"); +#endif // CHIP_SYSTEM_CONFIG_USE_LWIP // When `aAvailableSize` fits in uint16_t (as tested below) and size_t is at least 32 bits (as asserted above), // these additions will not overflow. @@ -488,7 +530,8 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese CHIP_SYSTEM_FAULT_INJECT(FaultInjection::kFault_PacketBufferNew, return PacketBufferHandle()); - if (aAvailableSize > UINT16_MAX || lAllocSize > PacketBuffer::kMaxSizeWithoutReserve || lBlockSize > UINT16_MAX) + // TODO: Change the max to a lower value + if (aAvailableSize > UINT32_MAX || lAllocSize > PacketBuffer::kMaxSizeWithoutReserve || lBlockSize > UINT32_MAX) { ChipLogError(chipSystemLayer, "PacketBuffer: allocation too large."); return PacketBufferHandle(); @@ -541,13 +584,13 @@ PacketBufferHandle PacketBufferHandle::New(size_t aAvailableSize, uint16_t aRese lPacket->next = nullptr; lPacket->ref = 1; #if CHIP_SYSTEM_PACKETBUFFER_FROM_CHIP_HEAP - lPacket->alloc_size = static_cast(lAllocSize); + lPacket->alloc_size = lAllocSize; #endif return PacketBufferHandle(lPacket); } -PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aDataSize, uint16_t aAdditionalSize, +PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aDataSize, size_t aAdditionalSize, uint16_t aReservedSize) { if (aDataSize > UINT16_MAX) @@ -561,7 +604,11 @@ PacketBufferHandle PacketBufferHandle::NewWithData(const void * aData, size_t aD if (buffer.mBuffer != nullptr) { memcpy(buffer.mBuffer->payload, aData, aDataSize); +#if CHIP_SYSTEM_CONFIG_USE_LWIP buffer.mBuffer->len = buffer.mBuffer->tot_len = static_cast(aDataSize); +#else + buffer.mBuffer->len = buffer.mBuffer->tot_len = aDataSize; +#endif } return buffer; } @@ -677,7 +724,7 @@ PacketBufferHandle PacketBufferHandle::CloneData() const for (PacketBuffer * original = mBuffer; original != nullptr; original = original->ChainedBuffer()) { - uint16_t originalDataSize = original->MaxDataLength(); + size_t originalDataSize = original->MaxDataLength(); uint16_t originalReservedSize = original->ReservedSize(); if (originalDataSize + originalReservedSize > PacketBuffer::kMaxSizeWithoutReserve) @@ -691,7 +738,7 @@ PacketBufferHandle PacketBufferHandle::CloneData() const } // Otherwise, reduce the requested data size. This subtraction can not underflow because the above test // guarantees originalReservedSize <= PacketBuffer::kMaxSizeWithoutReserve. - originalDataSize = static_cast(PacketBuffer::kMaxSizeWithoutReserve - originalReservedSize); + originalDataSize = PacketBuffer::kMaxSizeWithoutReserve - originalReservedSize; } PacketBufferHandle clone = PacketBufferHandle::New(originalDataSize, originalReservedSize); @@ -725,7 +772,7 @@ System::PacketBufferHandle PacketBufferWriterUtil::Finalize(BufferWriter & aBuff { // Since mPacket was successfully allocated to hold the maximum length, // we know that the actual length fits in a uint16_t. - aPacket->SetDataLength(static_cast(aBufferWriter.Needed())); + aPacket->SetDataLength(aBufferWriter.Needed()); } else { diff --git a/src/system/SystemPacketBuffer.h b/src/system/SystemPacketBuffer.h index 928743762e3de7..41eaef6d9e305c 100644 --- a/src/system/SystemPacketBuffer.h +++ b/src/system/SystemPacketBuffer.h @@ -54,11 +54,11 @@ struct pbuf { struct pbuf * next; void * payload; - uint16_t tot_len; - uint16_t len; + size_t tot_len; + size_t len; uint16_t ref; #if CHIP_SYSTEM_PACKETBUFFER_FROM_CHIP_HEAP - uint16_t alloc_size; + size_t alloc_size; #endif }; #endif // !CHIP_SYSTEM_CONFIG_USE_LWIP @@ -112,9 +112,9 @@ class DLL_EXPORT PacketBuffer : private pbuf private: // The effective size of the packet buffer structure. #if CHIP_SYSTEM_CONFIG_USE_LWIP - static constexpr uint16_t kStructureSize = LWIP_MEM_ALIGN_SIZE(sizeof(struct ::pbuf)); + static constexpr size_t kStructureSize = LWIP_MEM_ALIGN_SIZE(sizeof(struct ::pbuf)); #else // CHIP_SYSTEM_CONFIG_USE_LWIP - static constexpr uint16_t kStructureSize = CHIP_SYSTEM_ALIGN_SIZE(sizeof(::chip::System::pbuf), 4u); + static constexpr size_t kStructureSize = CHIP_SYSTEM_ALIGN_SIZE(sizeof(::chip::System::pbuf), 4u); #endif // CHIP_SYSTEM_CONFIG_USE_LWIP public: @@ -122,9 +122,9 @@ class DLL_EXPORT PacketBuffer : private pbuf * The maximum size buffer an application can allocate with no protocol header reserve. */ #if CHIP_SYSTEM_CONFIG_USE_LWIP - static constexpr uint16_t kMaxSizeWithoutReserve = LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE); + static constexpr size_t kMaxSizeWithoutReserve = LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE); #else - static constexpr uint16_t kMaxSizeWithoutReserve = CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX; + static constexpr size_t kMaxSizeWithoutReserve = CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX; #endif /** @@ -136,7 +136,7 @@ class DLL_EXPORT PacketBuffer : private pbuf /** * The maximum size buffer an application can allocate with the default protocol header reserve. */ - static constexpr uint16_t kMaxSize = kMaxSizeWithoutReserve - kDefaultHeaderReserve; + static constexpr size_t kMaxSize = kMaxSizeWithoutReserve - kDefaultHeaderReserve; /** * Return the size of the allocation including the reserved and payload data spaces but not including space @@ -146,7 +146,7 @@ class DLL_EXPORT PacketBuffer : private pbuf * * @return size of the allocation */ - uint16_t AllocSize() const + size_t AllocSize() const { #if CHIP_SYSTEM_PACKETBUFFER_FROM_LWIP_STANDARD_POOL || CHIP_SYSTEM_PACKETBUFFER_FROM_CHIP_POOL return kMaxSizeWithoutReserve; @@ -189,7 +189,7 @@ class DLL_EXPORT PacketBuffer : private pbuf * * @return length, in bytes (current payload length). */ - uint16_t DataLength() const { return this->len; } + size_t DataLength() const { return this->len; } /** * Set the length, in bytes, of data in a packet buffer, adjusting total length accordingly. @@ -204,29 +204,29 @@ class DLL_EXPORT PacketBuffer : private pbuf * @param[in,out] aChainHead - the head of the buffer chain the current buffer belongs to. May be \c nullptr if the current * buffer is the head of the buffer chain. */ - void SetDataLength(uint16_t aNewLen, const PacketBufferHandle & aChainHead); - void SetDataLength(uint16_t aNewLen) { SetDataLength(aNewLen, nullptr); } + void SetDataLength(size_t aNewLen, const PacketBufferHandle & aChainHead); + void SetDataLength(size_t aNewLen) { SetDataLength(aNewLen, nullptr); } /** * Get the total length of packet data in the buffer chain. * * @return total length, in octets. */ - uint16_t TotalLength() const { return this->tot_len; } + size_t TotalLength() const { return this->tot_len; } /** * Get the maximum amount, in bytes, of data that will fit in the buffer given the current start position and buffer size. * * @return number of bytes that fits in the buffer given the current start position. */ - uint16_t MaxDataLength() const; + size_t MaxDataLength() const; /** * Get the number of bytes of data that can be added to the current buffer given the current start position and data length. * * @return the length, in bytes, of data that will fit in the current buffer given the current start position and data length. */ - uint16_t AvailableDataLength() const; + size_t AvailableDataLength() const; /** * Get the number of bytes within the current buffer between the start of the buffer and the current data start position. @@ -272,7 +272,7 @@ class DLL_EXPORT PacketBuffer : private pbuf * * @param[in] aConsumeLength - number of bytes to consume from the current buffer. */ - void ConsumeHead(uint16_t aConsumeLength); + void ConsumeHead(size_t aConsumeLength); /** * Ensure the buffer has at least the specified amount of reserved space. @@ -377,9 +377,9 @@ class DLL_EXPORT PacketBuffer : private pbuf static PacketBuffer * FreeHead(PacketBuffer * aPacket); PacketBuffer * ChainedBuffer() const { return static_cast(this->next); } - PacketBuffer * Consume(uint16_t aConsumeLength); + PacketBuffer * Consume(size_t aConsumeLength); void Clear(); - void SetDataLength(uint16_t aNewLen, PacketBuffer * aChainHead); + void SetDataLength(size_t aNewLen, PacketBuffer * aChainHead); /** * Get a pointer to the start of the reserved space (which comes before the @@ -540,7 +540,7 @@ class DLL_EXPORT PacketBufferHandle * * @param[in] aConsumeLength - number of bytes to consume from the current chain. */ - void Consume(uint16_t aConsumeLength) { mBuffer = mBuffer->Consume(aConsumeLength); } + void Consume(size_t aConsumeLength) { mBuffer = mBuffer->Consume(aConsumeLength); } /** * Copy the given buffer to a right-sized buffer if applicable. @@ -628,7 +628,7 @@ class DLL_EXPORT PacketBufferHandle * * @return On success, a PacketBufferHandle to the allocated buffer. On fail, \c nullptr. */ - static PacketBufferHandle NewWithData(const void * aData, size_t aDataSize, uint16_t aAdditionalSize = 0, + static PacketBufferHandle NewWithData(const void * aData, size_t aDataSize, size_t aAdditionalSize = 0, uint16_t aReservedSize = PacketBuffer::kDefaultHeaderReserve); /** @@ -698,7 +698,7 @@ class DLL_EXPORT PacketBufferHandle friend class TestSystemPacketBuffer; }; -inline void PacketBuffer::SetDataLength(uint16_t aNewLen, const PacketBufferHandle & aChainHead) +inline void PacketBuffer::SetDataLength(size_t aNewLen, const PacketBufferHandle & aChainHead) { SetDataLength(aNewLen, aChainHead.mBuffer); } diff --git a/src/system/TLVPacketBufferBackingStore.cpp b/src/system/TLVPacketBufferBackingStore.cpp index 5059f837ff69a3..bc49d878e78c9a 100644 --- a/src/system/TLVPacketBufferBackingStore.cpp +++ b/src/system/TLVPacketBufferBackingStore.cpp @@ -31,7 +31,8 @@ namespace System { CHIP_ERROR TLVPacketBufferBackingStore::OnInit(chip::TLV::TLVReader & reader, const uint8_t *& bufStart, uint32_t & bufLen) { bufStart = mHeadBuffer->Start(); - bufLen = mHeadBuffer->DataLength(); + VerifyOrReturnError(CanCastTo(mHeadBuffer->DataLength()), CHIP_ERROR_INVALID_ARGUMENT); + bufLen = static_cast(mHeadBuffer->DataLength()); return CHIP_NO_ERROR; } @@ -54,7 +55,8 @@ CHIP_ERROR TLVPacketBufferBackingStore::GetNextBuffer(chip::TLV::TLVReader & rea else { bufStart = mCurrentBuffer->Start(); - bufLen = mCurrentBuffer->DataLength(); + VerifyOrReturnError(CanCastTo(mCurrentBuffer->DataLength()), CHIP_ERROR_INVALID_ARGUMENT); + bufLen = static_cast(mCurrentBuffer->DataLength()); } return CHIP_NO_ERROR; @@ -63,7 +65,8 @@ CHIP_ERROR TLVPacketBufferBackingStore::GetNextBuffer(chip::TLV::TLVReader & rea CHIP_ERROR TLVPacketBufferBackingStore::OnInit(chip::TLV::TLVWriter & writer, uint8_t *& bufStart, uint32_t & bufLen) { bufStart = mHeadBuffer->Start() + mHeadBuffer->DataLength(); - bufLen = mHeadBuffer->AvailableDataLength(); + VerifyOrReturnError(CanCastTo(mHeadBuffer->AvailableDataLength()), CHIP_ERROR_INVALID_ARGUMENT); + bufLen = static_cast(mHeadBuffer->AvailableDataLength()); return CHIP_NO_ERROR; } @@ -72,11 +75,11 @@ CHIP_ERROR TLVPacketBufferBackingStore::FinalizeBuffer(chip::TLV::TLVWriter & wr uint8_t * endPtr = bufStart + dataLen; intptr_t length = endPtr - mCurrentBuffer->Start(); - if (!CanCastTo(length)) + if (!CanCastTo(length)) { return CHIP_ERROR_INVALID_ARGUMENT; } - mCurrentBuffer->SetDataLength(static_cast(length), mHeadBuffer); + mCurrentBuffer->SetDataLength(static_cast(length), mHeadBuffer); return CHIP_NO_ERROR; } @@ -107,7 +110,8 @@ CHIP_ERROR TLVPacketBufferBackingStore::GetNewBuffer(chip::TLV::TLVWriter & writ else { bufStart = mCurrentBuffer->Start(); - bufLen = mCurrentBuffer->MaxDataLength(); + VerifyOrReturnError(CanCastTo(mCurrentBuffer->MaxDataLength()), CHIP_ERROR_INVALID_ARGUMENT); + bufLen = static_cast(mCurrentBuffer->MaxDataLength()); } return CHIP_NO_ERROR; diff --git a/src/system/tests/TestSystemPacketBuffer.cpp b/src/system/tests/TestSystemPacketBuffer.cpp index 5ee708fcd476ed..c71ad542d6225a 100644 --- a/src/system/tests/TestSystemPacketBuffer.cpp +++ b/src/system/tests/TestSystemPacketBuffer.cpp @@ -34,6 +34,7 @@ #include #include +#include #include #include @@ -64,9 +65,9 @@ using ::chip::System::pbuf; #define OF_LWIP_PBUF(x) (reinterpret_cast(reinterpret_cast(x))) namespace { -void ScrambleData(uint8_t * start, uint16_t length) +void ScrambleData(uint8_t * start, size_t length) { - for (uint16_t i = 0; i < length; ++i) + for (size_t i = 0; i < length; ++i) ++start[i]; } } // namespace @@ -117,7 +118,7 @@ class TestSystemPacketBuffer : public ::testing::Test static void PrintHandle(const char * tag, const PacketBuffer * buffer) { - printf("%s %p ref=%u len=%-4u next=%p\n", StringOrNullMarker(tag), buffer, buffer ? buffer->ref : 0, + printf("%s %p ref=%u len=%-4zu next=%p\n", StringOrNullMarker(tag), buffer, buffer ? buffer->ref : 0, buffer ? buffer->len : 0, buffer ? buffer->next : nullptr); } static void PrintHandle(const char * tag, const PacketBufferHandle & handle) { PrintHandle(tag, handle.mBuffer); } @@ -129,7 +130,7 @@ class TestSystemPacketBuffer : public ::testing::Test handle(nullptr) {} - uint16_t init_len; + size_t init_len; uint16_t reserved_size; uint8_t * start_buffer; uint8_t * end_buffer; @@ -140,7 +141,7 @@ class TestSystemPacketBuffer : public ::testing::Test static void PrintHandle(const char * tag, const BufferConfiguration & config) { PrintHandle(tag, config.handle); } static void PrintConfig(const char * tag, const BufferConfiguration & config) { - printf("%s pay=%-4zu len=%-4u res=%-4u:", StringOrNullMarker(tag), config.payload_ptr - config.start_buffer, + printf("%s pay=%-4zu len=%-4zu res=%-4u:", StringOrNullMarker(tag), config.payload_ptr - config.start_buffer, config.init_len, config.reserved_size); PrintHandle("", config.handle); } @@ -209,21 +210,17 @@ void TestSystemPacketBuffer::PrepareTestBuffer(BufferConfiguration * config, int if (config->handle.IsNull()) { config->handle = PacketBufferHandle::New(chip::System::PacketBuffer::kMaxSizeWithoutReserve, 0); - if (config->handle.IsNull()) - { - printf("NewPacketBuffer: Failed to allocate packet buffer (%u retained): %s\n", - static_cast(handles.size()), strerror(errno)); - exit(EXIT_FAILURE); - } + VerifyOrDieWithMsg(!config->handle.IsNull(), chipSystemLayer, + "NewPacketBuffer: Failed to allocate packet buffer (%u retained): %s", + static_cast(handles.size()), strerror(errno)); if (flags & kRecordHandle) { handles.push_back(config->handle.Retain()); } } - else if ((flags & kAllowHandleReuse) == 0) + else { - printf("Dirty test configuration\n"); - exit(EXIT_FAILURE); + VerifyOrDieWithMsg((flags & kAllowHandleReuse) != 0, chipSystemLayer, "Dirty test configuration"); } const size_t lInitialSize = kStructureSize + config->reserved_size; @@ -251,8 +248,15 @@ void TestSystemPacketBuffer::PrepareTestBuffer(BufferConfiguration * config, int config->handle->next = nullptr; } config->handle->payload = config->payload_ptr; +#if CHIP_SYSTEM_CONFIG_USE_LWIP + VerifyOrDieWithMsg(chip::CanCastTo(config->init_len), chipSystemLayer, "Max Length exceeded for LwIP based systems"); + + config->handle->len = static_cast(config->init_len); + config->handle->tot_len = static_cast(config->init_len); +#else config->handle->len = config->init_len; config->handle->tot_len = config->init_len; +#endif } bool TestSystemPacketBuffer::ResetConfigurations() @@ -321,8 +325,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckNew) const pbuf * const pb = TO_LWIP_PBUF(buffer.Get()); // NOLINTEND(bugprone-casting-through-void) - EXPECT_EQ(pb->len, 0); - EXPECT_EQ(pb->tot_len, 0); + EXPECT_EQ(pb->len, static_cast(0)); + EXPECT_EQ(pb->tot_len, static_cast(0)); EXPECT_EQ(pb->next, nullptr); EXPECT_EQ(pb->ref, 1); } @@ -409,16 +413,17 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetStart) EXPECT_EQ(config.handle->payload, verify_start); - if ((verify_start - config.payload_ptr) > config.init_len) + if (verify_start - config.payload_ptr > static_cast(config.init_len)) { // Set start to the beginning of payload, right after handle's header. - EXPECT_EQ(config.handle->len, 0); + EXPECT_EQ(config.handle->len, static_cast(0)); } else { // Set start to somewhere between the end of the handle's // header and the end of payload. - EXPECT_EQ(config.handle->len, (config.init_len - (verify_start - config.payload_ptr))); + EXPECT_EQ(config.handle->len, + static_cast((static_cast(config.init_len) - (verify_start - config.payload_ptr)))); } } } @@ -467,8 +472,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetDataLength) if (length > (config_2.end_buffer - config_2.payload_ptr)) { - EXPECT_EQ(config_2.handle->len, (config_2.end_buffer - config_2.payload_ptr)); - EXPECT_EQ(config_2.handle->tot_len, (config_2.end_buffer - config_2.payload_ptr)); + EXPECT_EQ(config_2.handle->len, static_cast(config_2.end_buffer - config_2.payload_ptr)); + EXPECT_EQ(config_2.handle->tot_len, static_cast(config_2.end_buffer - config_2.payload_ptr)); EXPECT_EQ(config_2.handle.GetNext(), nullptr); } else @@ -485,13 +490,14 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetDataLength) if (length > (config_2.end_buffer - config_2.payload_ptr)) { - EXPECT_EQ(config_2.handle->len, (config_2.end_buffer - config_2.payload_ptr)); - EXPECT_EQ(config_2.handle->tot_len, (config_2.end_buffer - config_2.payload_ptr)); + EXPECT_EQ(config_2.handle->len, static_cast(config_2.end_buffer - config_2.payload_ptr)); + EXPECT_EQ(config_2.handle->tot_len, static_cast(config_2.end_buffer - config_2.payload_ptr)); EXPECT_EQ(config_2.handle.GetNext(), nullptr); EXPECT_EQ(config_1.handle->tot_len, - (config_1.init_len + static_cast(config_2.end_buffer - config_2.payload_ptr) - - static_cast(config_2.init_len))); + static_cast(static_cast(config_1.init_len) + + static_cast(config_2.end_buffer - config_2.payload_ptr) - + static_cast(config_2.init_len))); } else { @@ -500,7 +506,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckSetDataLength) EXPECT_EQ(config_2.handle.GetNext(), nullptr); EXPECT_EQ(config_1.handle->tot_len, - (config_1.init_len + static_cast(length) - static_cast(config_2.init_len))); + static_cast(static_cast(config_1.init_len) + static_cast(length) - + static_cast(config_2.init_len))); } } } @@ -528,7 +535,7 @@ TEST_F(TestSystemPacketBuffer, CheckMaxDataLength) for (auto & config : configurations) { PrepareTestBuffer(&config, kRecordHandle); - EXPECT_EQ(config.handle->MaxDataLength(), (config.end_buffer - config.payload_ptr)); + EXPECT_EQ(config.handle->MaxDataLength(), static_cast(config.end_buffer - config.payload_ptr)); } } @@ -540,7 +547,9 @@ TEST_F(TestSystemPacketBuffer, CheckAvailableDataLength) for (auto & config : configurations) { PrepareTestBuffer(&config, kRecordHandle); - EXPECT_EQ(config.handle->AvailableDataLength(), ((config.end_buffer - config.payload_ptr) - config.init_len)); + EXPECT_EQ(config.handle->AvailableDataLength(), + static_cast(static_cast(config.end_buffer - config.payload_ptr) - + static_cast(config.init_len))); } } @@ -729,7 +738,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckCompactHead) { PrepareTestBuffer(&config, kRecordHandle | kAllowHandleReuse); config.handle->SetDataLength(length, config.handle); - const uint16_t data_length = config.handle->DataLength(); + const uint32_t data_length = static_cast(config.handle->DataLength()); config.handle->CompactHead(); @@ -769,14 +778,14 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckCompactHead) EXPECT_TRUE(config_2.handle.IsNull()); config_1.handle->SetDataLength(length_1, config_1.handle); - const uint16_t data_length_1 = config_1.handle->DataLength(); + const uint32_t data_length_1 = static_cast(config_1.handle->DataLength()); // This chain will cause buffer_2 to be freed. config_1.handle->next = buffer_2; // Add various lengths to the second buffer buffer_2->SetDataLength(length_2, config_1.handle); - const uint16_t data_length_2 = buffer_2->DataLength(); + const uint32_t data_length_2 = static_cast(buffer_2->DataLength()); config_1.handle->CompactHead(); @@ -841,8 +850,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckConsumeHead) if (length > config.init_len) { EXPECT_EQ(config.handle->payload, (config.payload_ptr + config.init_len)); - EXPECT_EQ(config.handle->len, 0); - EXPECT_EQ(config.handle->tot_len, 0); + EXPECT_EQ(config.handle->len, static_cast(0)); + EXPECT_EQ(config.handle->tot_len, static_cast(0)); } else { @@ -897,8 +906,8 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckConsume) config_1.handle->SetDataLength(len_1, config_1.handle); config_2.handle->SetDataLength(len_2, config_1.handle); - const uint16_t buf_1_len = config_1.handle->len; - const uint16_t buf_2_len = config_2.handle->len; + const uint32_t buf_1_len = static_cast(config_1.handle->len); + const uint32_t buf_2_len = static_cast(config_2.handle->len); PacketBufferHandle original_handle_1 = config_1.handle.Retain(); EXPECT_EQ(config_1.handle->ref, 2); // config_1.handle and original_handle_1 @@ -963,7 +972,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckEnsureReservedSize) for (auto length : kLengths) { PrepareTestBuffer(&config, kRecordHandle | kAllowHandleReuse); - const uint16_t kAllocSize = config.handle->AllocSize(); + const uint32_t kAllocSize = static_cast(config.handle->AllocSize()); uint16_t reserved_size = config.reserved_size; if (kStructureSize + config.reserved_size > kAllocSize) @@ -1005,7 +1014,7 @@ TEST_F(TestSystemPacketBuffer, CheckAlignPayload) for (auto length : kLengths) { PrepareTestBuffer(&config, kRecordHandle | kAllowHandleReuse); - const uint16_t kAllocSize = config.handle->AllocSize(); + const uint32_t kAllocSize = static_cast(config.handle->AllocSize()); if (length == 0) { @@ -1013,16 +1022,16 @@ TEST_F(TestSystemPacketBuffer, CheckAlignPayload) continue; } - uint16_t reserved_size = config.reserved_size; + uint32_t reserved_size = config.reserved_size; if (config.reserved_size > kAllocSize) { reserved_size = kAllocSize; } - const uint16_t payload_offset = static_cast(reinterpret_cast(config.handle->Start()) % length); - uint16_t payload_shift = 0; + const uint32_t payload_offset = static_cast(reinterpret_cast(config.handle->Start()) % length); + uint32_t payload_shift = 0; if (payload_offset > 0) - payload_shift = static_cast(length - payload_offset); + payload_shift = static_cast(length - payload_offset); if (payload_shift <= kAllocSize - reserved_size) { @@ -1136,10 +1145,10 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckRead) PrepareTestBuffer(&config_1, kAllowHandleReuse); PrepareTestBuffer(&config_2, kAllowHandleReuse); - const uint16_t length_1 = config_1.handle->MaxDataLength(); - const uint16_t length_2 = config_2.handle->MaxDataLength(); + const size_t length_1 = config_1.handle->MaxDataLength(); + const size_t length_2 = config_2.handle->MaxDataLength(); const size_t length_sum = length_1 + length_2; - const uint16_t length_total = static_cast(length_sum); + const uint32_t length_total = static_cast(length_sum); EXPECT_EQ(length_total, length_sum); memcpy(config_1.handle->Start(), payloads, length_1); @@ -1167,7 +1176,7 @@ TEST_F_FROM_FIXTURE(TestSystemPacketBuffer, CheckRead) EXPECT_EQ(err, CHIP_ERROR_BUFFER_TOO_SMALL); // Check that running off the end of a corrupt buffer chain is detected. - if (length_total < UINT16_MAX) + if (length_total < UINT32_MAX) { // First case: TotalLength() is wrong. config_1.handle->tot_len = static_cast(config_1.handle->tot_len + 1); diff --git a/src/system/tests/TestTLVPacketBufferBackingStore.cpp b/src/system/tests/TestTLVPacketBufferBackingStore.cpp index 6dc76fed46745e..8ebf23242efb95 100644 --- a/src/system/tests/TestTLVPacketBufferBackingStore.cpp +++ b/src/system/tests/TestTLVPacketBufferBackingStore.cpp @@ -81,8 +81,8 @@ TEST_F(TestTLVPacketBufferBackingStore, BasicEncodeDecode) // Array start/end is 2 bytes. Each entry is also 2 bytes: control + // value. So 8 bytes total. EXPECT_FALSE(buffer->HasChainedBuffer()); - EXPECT_EQ(buffer->TotalLength(), 8); - EXPECT_EQ(buffer->DataLength(), 8); + EXPECT_EQ(buffer->TotalLength(), static_cast(8)); + EXPECT_EQ(buffer->DataLength(), static_cast(8)); PacketBufferTLVReader reader; reader.Init(std::move(buffer)); @@ -163,7 +163,7 @@ TEST_F(TestTLVPacketBufferBackingStore, MultiBufferEncode) constexpr size_t totalSize = 2009; EXPECT_TRUE(buffer->HasChainedBuffer()); EXPECT_EQ(buffer->TotalLength(), totalSize); - EXPECT_EQ(buffer->DataLength(), 2); + EXPECT_EQ(buffer->DataLength(), static_cast(2)); auto nextBuffer = buffer->Next(); EXPECT_TRUE(nextBuffer->HasChainedBuffer()); EXPECT_EQ(nextBuffer->TotalLength(), totalSize - 2); diff --git a/src/transport/SecureMessageCodec.cpp b/src/transport/SecureMessageCodec.cpp index 9c08d535ff57a3..3b70026c5681d6 100644 --- a/src/transport/SecureMessageCodec.cpp +++ b/src/transport/SecureMessageCodec.cpp @@ -43,13 +43,10 @@ CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView VerifyOrReturnError(!msgBuf->HasChainedBuffer(), CHIP_ERROR_INVALID_MESSAGE_LENGTH); VerifyOrReturnError(msgBuf->TotalLength() <= kMaxAppMessageLen, CHIP_ERROR_MESSAGE_TOO_LONG); - static_assert(std::is_sameTotalLength()), uint16_t>::value, - "Addition to generate payloadLength might overflow"); - ReturnErrorOnFailure(payloadHeader.EncodeBeforeData(msgBuf)); - uint8_t * data = msgBuf->Start(); - uint16_t totalLen = msgBuf->TotalLength(); + uint8_t * data = msgBuf->Start(); + size_t totalLen = msgBuf->TotalLength(); MessageAuthenticationCode mac; ReturnErrorOnFailure(context.Encrypt(data, totalLen, data, nonce, packetHeader, mac)); @@ -57,8 +54,7 @@ CHIP_ERROR Encrypt(const CryptoContext & context, CryptoContext::ConstNonceView uint16_t taglen = 0; ReturnErrorOnFailure(mac.Encode(packetHeader, &data[totalLen], msgBuf->AvailableDataLength(), &taglen)); - VerifyOrReturnError(CanCastTo(totalLen + taglen), CHIP_ERROR_INTERNAL); - msgBuf->SetDataLength(static_cast(totalLen + taglen)); + msgBuf->SetDataLength(totalLen + taglen); return CHIP_NO_ERROR; } @@ -69,7 +65,7 @@ CHIP_ERROR Decrypt(const CryptoContext & context, CryptoContext::ConstNonceView ReturnErrorCodeIf(msg.IsNull(), CHIP_ERROR_INVALID_ARGUMENT); uint8_t * data = msg->Start(); - uint16_t len = msg->DataLength(); + size_t len = msg->DataLength(); PacketBufferHandle origMsg; #if CHIP_SYSTEM_CONFIG_USE_LWIP @@ -89,7 +85,7 @@ CHIP_ERROR Decrypt(const CryptoContext & context, CryptoContext::ConstNonceView ReturnErrorOnFailure(mac.Decode(packetHeader, &data[len - footerLen], footerLen, &taglen)); VerifyOrReturnError(taglen == footerLen, CHIP_ERROR_INTERNAL); - len = static_cast(len - taglen); + len = len - taglen; msg->SetDataLength(len); uint8_t * plainText = msg->Start(); diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 7f7691ef00dbb7..5adfde18b47ff4 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -929,7 +929,7 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & partialPack // Extract MIC from the end of the message. uint8_t * data = msg->Start(); - uint16_t len = msg->DataLength(); + size_t len = msg->DataLength(); uint16_t footerLen = partialPacketHeader.MICTagLength(); VerifyOrReturn(footerLen <= len); diff --git a/src/transport/raw/MessageHeader.cpp b/src/transport/raw/MessageHeader.cpp index 2947756b644d1a..d9376328ee65fd 100644 --- a/src/transport/raw/MessageHeader.cpp +++ b/src/transport/raw/MessageHeader.cpp @@ -156,12 +156,12 @@ CHIP_ERROR PacketHeader::DecodeFixedCommon(Encoding::LittleEndian::Reader & read CHIP_ERROR PacketHeader::DecodeFixed(const System::PacketBufferHandle & buf) { const uint8_t * const data = buf->Start(); - uint16_t size = buf->DataLength(); + size_t size = buf->DataLength(); LittleEndian::Reader reader(data, size); return DecodeFixedCommon(reader); } -CHIP_ERROR PacketHeader::Decode(const uint8_t * const data, uint16_t size, uint16_t * decode_len) +CHIP_ERROR PacketHeader::Decode(const uint8_t * const data, size_t size, uint16_t * decode_len) { CHIP_ERROR err = CHIP_NO_ERROR; LittleEndian::Reader reader(data, size); @@ -247,7 +247,7 @@ CHIP_ERROR PacketHeader::DecodeAndConsume(const System::PacketBufferHandle & buf return CHIP_NO_ERROR; } -CHIP_ERROR PayloadHeader::Decode(const uint8_t * const data, uint16_t size, uint16_t * decode_len) +CHIP_ERROR PayloadHeader::Decode(const uint8_t * const data, size_t size, uint16_t * decode_len) { CHIP_ERROR err = CHIP_NO_ERROR; LittleEndian::Reader reader(data, size); @@ -312,7 +312,7 @@ CHIP_ERROR PayloadHeader::DecodeAndConsume(const System::PacketBufferHandle & bu return CHIP_NO_ERROR; } -CHIP_ERROR PacketHeader::Encode(uint8_t * data, uint16_t size, uint16_t * encode_size) const +CHIP_ERROR PacketHeader::Encode(uint8_t * data, size_t size, uint16_t * encode_size) const { VerifyOrReturnError(size >= EncodeSizeBytes(), CHIP_ERROR_INVALID_ARGUMENT); VerifyOrReturnError(!(mDestinationNodeId.HasValue() && mDestinationGroupId.HasValue()), CHIP_ERROR_INTERNAL); @@ -364,7 +364,7 @@ CHIP_ERROR PacketHeader::EncodeBeforeData(const System::PacketBufferHandle & buf return CHIP_NO_ERROR; } -CHIP_ERROR PayloadHeader::Encode(uint8_t * data, uint16_t size, uint16_t * encode_size) const +CHIP_ERROR PayloadHeader::Encode(uint8_t * data, size_t size, uint16_t * encode_size) const { VerifyOrReturnError(size >= EncodeSizeBytes(), CHIP_ERROR_INVALID_ARGUMENT); @@ -404,7 +404,7 @@ CHIP_ERROR PayloadHeader::EncodeBeforeData(const System::PacketBufferHandle & bu return CHIP_NO_ERROR; } -CHIP_ERROR MessageAuthenticationCode::Decode(const PacketHeader & packetHeader, const uint8_t * const data, uint16_t size, +CHIP_ERROR MessageAuthenticationCode::Decode(const PacketHeader & packetHeader, const uint8_t * const data, size_t size, uint16_t * decode_len) { const uint16_t taglen = packetHeader.MICTagLength(); @@ -419,7 +419,7 @@ CHIP_ERROR MessageAuthenticationCode::Decode(const PacketHeader & packetHeader, return CHIP_NO_ERROR; } -CHIP_ERROR MessageAuthenticationCode::Encode(const PacketHeader & packetHeader, uint8_t * data, uint16_t size, +CHIP_ERROR MessageAuthenticationCode::Encode(const PacketHeader & packetHeader, uint8_t * data, size_t size, uint16_t * encode_size) const { uint8_t * p = data; diff --git a/src/transport/raw/MessageHeader.h b/src/transport/raw/MessageHeader.h index 7c637fa782d957..ef4f86d3993793 100644 --- a/src/transport/raw/MessageHeader.h +++ b/src/transport/raw/MessageHeader.h @@ -418,13 +418,13 @@ class PacketHeader * CHIP_ERROR_INVALID_ARGUMENT on insufficient buffer size * CHIP_ERROR_VERSION_MISMATCH if header version is not supported. */ - CHIP_ERROR Decode(const uint8_t * data, uint16_t size, uint16_t * decode_size); + CHIP_ERROR Decode(const uint8_t * data, size_t size, uint16_t * decode_size); /** * A version of Decode that uses the type system to determine available * space. */ - template + template inline CHIP_ERROR Decode(const uint8_t (&data)[N], uint16_t * decode_size) { return Decode(data, N, decode_size); @@ -448,13 +448,13 @@ class PacketHeader * Possible failures: * CHIP_ERROR_INVALID_ARGUMENT on insufficient buffer size */ - CHIP_ERROR Encode(uint8_t * data, uint16_t size, uint16_t * encode_size) const; + CHIP_ERROR Encode(uint8_t * data, size_t size, uint16_t * encode_size) const; /** * A version of Encode that uses the type system to determine available * space. */ - template + template inline CHIP_ERROR Encode(uint8_t (&data)[N], uint16_t * encode_size) const { return Encode(data, N, encode_size); @@ -662,13 +662,13 @@ class PayloadHeader * CHIP_ERROR_INVALID_ARGUMENT on insufficient buffer size * CHIP_ERROR_VERSION_MISMATCH if header version is not supported. */ - CHIP_ERROR Decode(const uint8_t * data, uint16_t size, uint16_t * decode_size); + CHIP_ERROR Decode(const uint8_t * data, size_t size, uint16_t * decode_size); /** * A version of Decode that uses the type system to determine available * space. */ - template + template inline CHIP_ERROR Decode(const uint8_t (&data)[N], uint16_t * decode_size) { return Decode(data, N, decode_size); @@ -692,13 +692,13 @@ class PayloadHeader * Possible failures: * CHIP_ERROR_INVALID_ARGUMENT on insufficient buffer size */ - CHIP_ERROR Encode(uint8_t * data, uint16_t size, uint16_t * encode_size) const; + CHIP_ERROR Encode(uint8_t * data, size_t size, uint16_t * encode_size) const; /** * A version of Encode that uses the type system to determine available * space. */ - template + template inline CHIP_ERROR Encode(uint8_t (&data)[N], uint16_t * decode_size) const { return Encode(data, N, decode_size); @@ -779,7 +779,7 @@ class MessageAuthenticationCode * CHIP_ERROR_INVALID_ARGUMENT on insufficient buffer size * CHIP_ERROR_VERSION_MISMATCH if header version is not supported. */ - CHIP_ERROR Decode(const PacketHeader & packetHeader, const uint8_t * data, uint16_t size, uint16_t * decode_size); + CHIP_ERROR Decode(const PacketHeader & packetHeader, const uint8_t * data, size_t size, uint16_t * decode_size); /** * Encodes the Messae Authentication Tag into the given buffer. @@ -794,7 +794,7 @@ class MessageAuthenticationCode * Possible failures: * CHIP_ERROR_INVALID_ARGUMENT on insufficient buffer size */ - CHIP_ERROR Encode(const PacketHeader & packetHeader, uint8_t * data, uint16_t size, uint16_t * encode_size) const; + CHIP_ERROR Encode(const PacketHeader & packetHeader, uint8_t * data, size_t size, uint16_t * encode_size) const; private: /// Message authentication tag generated at encryption of the message. From dd5f6b7b0e4514293754d303b564f78b496b4863 Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Fri, 26 Apr 2024 17:47:27 -0400 Subject: [PATCH 39/40] [ICD] Add counter invalidation events to the ICD Test Event trigger handler (#33174) * Add counter invalidation events to the ICD Test Event trigger handler * add issue number * address review comments * add missing dependency * Update counter interfaces * Update CheckInCounter to fit counter changes * Fix openiot ci * Add missing type * Fix templates for uint8 type * Apply suggestions from code review Co-authored-by: Boris Zbarsky * Fix TestICDManager with counter API * Cover rollover case for AdvanceBy and add unit test to validate behavior * Update comment * restyle * fix macro in template headeR * Update src/lib/support/PersistedCounter.h Co-authored-by: Boris Zbarsky * restyle --------- Co-authored-by: Boris Zbarsky --- src/BUILD.gn | 1 + src/app/icd/server/ICDManager.cpp | 14 +- src/app/tests/TestICDManager.cpp | 52 +++- src/lib/support/CHIPCounter.h | 37 ++- src/lib/support/PersistedCounter.h | 74 ++++- src/lib/support/tests/BUILD.gn | 4 +- src/lib/support/tests/TestCHIPCounter.cpp | 95 +++--- .../support/tests/TestPersistedCounter.cpp | 286 +++++++++++------- src/protocols/secure_channel/BUILD.gn | 11 +- .../secure_channel/CheckInCounter.cpp | 47 +++ src/protocols/secure_channel/CheckInCounter.h | 19 ++ src/protocols/secure_channel/tests/BUILD.gn | 18 +- .../tests/TestCheckInCounter.cpp | 129 ++++++++ src/python_testing/TC_ICDManagementCluster.py | 55 +++- .../openiotsdk/unit-tests/test_components.txt | 1 + .../unit-tests/test_components_nl.txt | 2 +- 16 files changed, 633 insertions(+), 212 deletions(-) create mode 100644 src/protocols/secure_channel/CheckInCounter.cpp create mode 100644 src/protocols/secure_channel/tests/TestCheckInCounter.cpp diff --git a/src/BUILD.gn b/src/BUILD.gn index dd69734ffc68e6..6bf4a2ed6d7071 100644 --- a/src/BUILD.gn +++ b/src/BUILD.gn @@ -99,6 +99,7 @@ if (chip_build_tests) { "${chip_root}/src/lib/support/tests", "${chip_root}/src/lib/support/tests:tests_nltest", "${chip_root}/src/protocols/secure_channel/tests", + "${chip_root}/src/protocols/secure_channel/tests:tests_nltest", "${chip_root}/src/system/tests", "${chip_root}/src/transport/tests", ] diff --git a/src/app/icd/server/ICDManager.cpp b/src/app/icd/server/ICDManager.cpp index 8691a4d1360c64..d2755f7a187f06 100644 --- a/src/app/icd/server/ICDManager.cpp +++ b/src/app/icd/server/ICDManager.cpp @@ -30,8 +30,10 @@ namespace { enum class ICDTestEventTriggerEvent : uint64_t { - kAddActiveModeReq = 0x0046'0000'00000001, - kRemoveActiveModeReq = 0x0046'0000'00000002, + kAddActiveModeReq = 0x0046'0000'00000001, + kRemoveActiveModeReq = 0x0046'0000'00000002, + kInvalidateHalfCounterValues = 0x0046'0000'00000003, + kInvalidateAllCounterValues = 0x0046'0000'00000004, }; } // namespace @@ -666,6 +668,14 @@ CHIP_ERROR ICDManager::HandleEventTrigger(uint64_t eventTrigger) case ICDTestEventTriggerEvent::kRemoveActiveModeReq: SetKeepActiveModeRequirements(KeepActiveFlag::kTestEventTriggerActiveMode, false); break; +#if CHIP_CONFIG_ENABLE_ICD_CIP + case ICDTestEventTriggerEvent::kInvalidateHalfCounterValues: + err = ICDConfigurationData::GetInstance().GetICDCounter().InvalidateHalfCheckInCouterValues(); + break; + case ICDTestEventTriggerEvent::kInvalidateAllCounterValues: + err = ICDConfigurationData::GetInstance().GetICDCounter().InvalidateAllCheckInCounterValues(); + break; +#endif // CHIP_CONFIG_ENABLE_ICD_CIP default: err = CHIP_ERROR_INVALID_ARGUMENT; break; diff --git a/src/app/tests/TestICDManager.cpp b/src/app/tests/TestICDManager.cpp index 6e814ebb01f579..ea49e0ac557fc8 100644 --- a/src/app/tests/TestICDManager.cpp +++ b/src/app/tests/TestICDManager.cpp @@ -70,8 +70,10 @@ constexpr uint8_t kKeyBuffer2b[] = { // Taken from the ICDManager Implementation enum class ICDTestEventTriggerEvent : uint64_t { - kAddActiveModeReq = 0x0046'0000'00000001, - kRemoveActiveModeReq = 0x0046'0000'00000002, + kAddActiveModeReq = 0x0046'0000'00000001, + kRemoveActiveModeReq = 0x0046'0000'00000002, + kInvalidateHalfCounterValues = 0x0046'0000'00000003, + kInvalidateAllCounterValues = 0x0046'0000'00000004, }; class TestICDStateObserver : public app::ICDStateObserver @@ -742,6 +744,48 @@ class TestICDManager NL_TEST_ASSERT(aSuite, ctx->mICDManager.mOperationalState == ICDManager::OperationalState::IdleMode); } + static void TestHandleTestEventTriggerInvalidateHalfCounterValues(nlTestSuite * aSuite, void * aContext) + { + TestContext * ctx = static_cast(aContext); + + constexpr uint32_t startValue = 1; + constexpr uint32_t expectedValue = 2147483648; + + // Set starting value + uint32_t currentValue = ICDConfigurationData::GetInstance().GetICDCounter().GetValue(); + uint32_t delta = startValue - currentValue; + + NL_TEST_ASSERT(aSuite, ICDConfigurationData::GetInstance().GetICDCounter().AdvanceBy(delta) == CHIP_NO_ERROR); + NL_TEST_ASSERT(aSuite, ICDConfigurationData::GetInstance().GetICDCounter().GetValue() == startValue); + + // Trigger ICD kInvalidateHalfCounterValues event + ctx->mICDManager.HandleEventTrigger(static_cast(ICDTestEventTriggerEvent::kInvalidateHalfCounterValues)); + + // Validate counter has the expected value + NL_TEST_ASSERT(aSuite, ICDConfigurationData::GetInstance().GetICDCounter().GetValue() == expectedValue); + } + + static void TestHandleTestEventTriggerInvalidateAllCounterValues(nlTestSuite * aSuite, void * aContext) + { + TestContext * ctx = static_cast(aContext); + + constexpr uint32_t startValue = 105; + constexpr uint32_t expectedValue = 104; + + // Set starting value + uint32_t currentValue = ICDConfigurationData::GetInstance().GetICDCounter().GetValue(); + uint32_t delta = startValue - currentValue; + + NL_TEST_ASSERT(aSuite, ICDConfigurationData::GetInstance().GetICDCounter().AdvanceBy(delta) == CHIP_NO_ERROR); + NL_TEST_ASSERT(aSuite, ICDConfigurationData::GetInstance().GetICDCounter().GetValue() == startValue); + + // Trigger ICD kInvalidateAllCounterValues event + ctx->mICDManager.HandleEventTrigger(static_cast(ICDTestEventTriggerEvent::kInvalidateAllCounterValues)); + + // Validate counter has the expected value + NL_TEST_ASSERT(aSuite, ICDConfigurationData::GetInstance().GetICDCounter().GetValue() == expectedValue); + } + /** * @brief Test verifies when OnEnterIdleMode is called during normal operations. * Without the ActiveMode timer being extended @@ -1083,6 +1127,10 @@ static const nlTest sTests[] = { NL_TEST_DEF("TestICDStayActive", TestICDManager::TestICDMStayActive), NL_TEST_DEF("TestShouldCheckInMsgsBeSentAtActiveModeFunction", TestICDManager::TestShouldCheckInMsgsBeSentAtActiveModeFunction), NL_TEST_DEF("TestHandleTestEventTriggerActiveModeReq", TestICDManager::TestHandleTestEventTriggerActiveModeReq), + NL_TEST_DEF("TestHandleTestEventTriggerInvalidateHalfCounterValues", + TestICDManager::TestHandleTestEventTriggerInvalidateHalfCounterValues), + NL_TEST_DEF("TestHandleTestEventTriggerInvalidateAllCounterValues", + TestICDManager::TestHandleTestEventTriggerInvalidateAllCounterValues), NL_TEST_DEF("TestICDStateObserverOnEnterIdleModeActiveModeDuration", TestICDManager::TestICDStateObserverOnEnterIdleModeActiveModeDuration), NL_TEST_DEF("TestICDStateObserverOnEnterIdleModeActiveModeThreshold", diff --git a/src/lib/support/CHIPCounter.h b/src/lib/support/CHIPCounter.h index 89a7bb751ad645..7e34425c1ab46c 100644 --- a/src/lib/support/CHIPCounter.h +++ b/src/lib/support/CHIPCounter.h @@ -45,16 +45,23 @@ class Counter virtual ~Counter() {} /** - * @brief - * Advance the value of the counter. + * @brief Advance the value of the counter. * * @return A CHIP error code if anything failed, CHIP_NO_ERROR otherwise. */ virtual CHIP_ERROR Advance() = 0; /** - * @brief - * Get the current value of the counter. + * @brief Advances the current counter value by N + * + * @param value value of N + * + * @return A CHIP error code if anything failed, CHIP_NO_ERROR otherwise. + */ + virtual CHIP_ERROR AdvanceBy(T value) = 0; + + /** + * @brief Get the current value of the counter. * * @return The current value of the counter. */ @@ -76,8 +83,7 @@ class MonotonicallyIncreasingCounter : public Counter ~MonotonicallyIncreasingCounter() override{}; /** - * @brief - * Initialize a MonotonicallyIncreasingCounter object. + * @brief Initialize a MonotonicallyIncreasingCounter object. * * @param[in] aStartValue The starting value of the counter. * @@ -93,8 +99,7 @@ class MonotonicallyIncreasingCounter : public Counter } /** - * @brief - * Advance the value of the counter. + * @brief Advance the value of the counter. * * @return A CHIP error code if something fails, CHIP_NO_ERROR otherwise */ @@ -108,8 +113,20 @@ class MonotonicallyIncreasingCounter : public Counter } /** - * @brief - * Get the current value of the counter. + * @brief Advances the current counter value by N + * + * @param value value of N + * + * @return A CHIP error code if something fails, CHIP_NO_ERROR otherwise + */ + CHIP_ERROR AdvanceBy(T value) override + { + mCounterValue = static_cast(mCounterValue + value); + return CHIP_NO_ERROR; + } + + /** + * @brief Get the current value of the counter. * * @return The current value of the counter. */ diff --git a/src/lib/support/PersistedCounter.h b/src/lib/support/PersistedCounter.h index 02096a486edcd3..24640d24057f20 100644 --- a/src/lib/support/PersistedCounter.h +++ b/src/lib/support/PersistedCounter.h @@ -32,6 +32,7 @@ #include #include #include +#include namespace chip { @@ -104,16 +105,50 @@ class PersistedCounter : public MonotonicallyIncreasingCounter } #endif - ReturnErrorOnFailure(PersistNextEpochStart(startValue + aEpoch)); + ReturnErrorOnFailure(PersistNextEpochStart(static_cast(startValue + aEpoch))); // This will set the starting value, after which we're ready. return MonotonicallyIncreasingCounter::Init(startValue); } /** - * @brief - * Increment the counter and write to persisted storage if we've completed - * the current epoch. + * @brief Increment the counter by N and write to persisted storage if we've completed the current epoch. + * + * @param value value of N + * + * @return Any error returned by a write to persisted storage. + */ + CHIP_ERROR AdvanceBy(T value) override + { + VerifyOrReturnError(mStorage != nullptr, CHIP_ERROR_INCORRECT_STATE); + VerifyOrReturnError(mKey.IsInitialized(), CHIP_ERROR_INCORRECT_STATE); + + // If value is 0, we do not need to do anything + VerifyOrReturnError(value > 0, CHIP_NO_ERROR); + + // We should update the persisted epoch value if : + // 1- Sum of the current counter and value is greater or equal to the mNextEpoch. + // This is the standard operating case. + // 2- Increasing the current counter by value would cause a roll over. This would cause the current value to be < to the + // mNextEpoch so we force an update. + bool shouldDoEpochUpdate = ((MonotonicallyIncreasingCounter::GetValue() + value) >= mNextEpoch) || + (MonotonicallyIncreasingCounter::GetValue() > std::numeric_limits::max() - value); + + ReturnErrorOnFailure(MonotonicallyIncreasingCounter::AdvanceBy(value)); + + if (shouldDoEpochUpdate) + { + // Since AdvanceBy allows the counter to be increased by an arbitrary value, it is possible that the new counter value + // is greater than mNextEpoch + mEpoch. As such, we want the next Epoch value to be calculated from the new current + // value. + PersistAndVerifyNextEpochStart(MonotonicallyIncreasingCounter::GetValue()); + } + + return CHIP_NO_ERROR; + } + + /** + * @brief Increment the counter and write to persisted storage if we've completed the current epoch. * * @return Any error returned by a write to persisted storage. */ @@ -126,18 +161,32 @@ class PersistedCounter : public MonotonicallyIncreasingCounter if (MonotonicallyIncreasingCounter::GetValue() >= mNextEpoch) { - // Value advanced past the previously persisted "start point". - // Ensure that a new starting point is persisted. - ReturnErrorOnFailure(PersistNextEpochStart(mNextEpoch + mEpoch)); - - // Advancing the epoch should have ensured that the current value - // is valid - VerifyOrReturnError(MonotonicallyIncreasingCounter::GetValue() < mNextEpoch, CHIP_ERROR_INTERNAL); + ReturnErrorOnFailure(PersistAndVerifyNextEpochStart(mNextEpoch)); } + return CHIP_NO_ERROR; } private: + CHIP_ERROR PersistAndVerifyNextEpochStart(T refEpoch) + { + // Value advanced past the previously persisted "start point". + // Ensure that a new starting point is persisted. + ReturnErrorOnFailure(PersistNextEpochStart(static_cast(refEpoch + mEpoch))); + + // Advancing the epoch should have ensured that the current value is valid + VerifyOrReturnError(static_cast(MonotonicallyIncreasingCounter::GetValue() + mEpoch) == mNextEpoch, + CHIP_ERROR_INTERNAL); + + // Previous check did not take into consideration that the counter value can be equal to the max counter value or + // rollover. + // TODO(#33175): PersistedCounter allows rollover so this check is incorrect. We need a Counter class that adequatly + // manages rollover behavior for counters that cannot rollover. + // VerifyOrReturnError(MonotonicallyIncreasingCounter::GetValue() < mNextEpoch, CHIP_ERROR_INTERNAL); + + return CHIP_NO_ERROR; + } + /** * @brief * Write out the counter value to persistent storage. @@ -146,7 +195,8 @@ class PersistedCounter : public MonotonicallyIncreasingCounter * * @return Any error returned by a write to persistent storage. */ - CHIP_ERROR PersistNextEpochStart(T aStartValue) + CHIP_ERROR + PersistNextEpochStart(T aStartValue) { mNextEpoch = aStartValue; #if CHIP_CONFIG_PERSISTED_COUNTER_DEBUG_LOGGING diff --git a/src/lib/support/tests/BUILD.gn b/src/lib/support/tests/BUILD.gn index 7a19ea2415e895..6a7c7905d27c02 100644 --- a/src/lib/support/tests/BUILD.gn +++ b/src/lib/support/tests/BUILD.gn @@ -28,11 +28,13 @@ chip_test_suite("tests") { "TestBufferWriter.cpp", "TestBytesCircularBuffer.cpp", "TestBytesToHex.cpp", + "TestCHIPCounter.cpp", "TestDefer.cpp", "TestErrorStr.cpp", "TestFixedBufferAllocator.cpp", "TestFold.cpp", "TestIniEscaping.cpp", + "TestPersistedCounter.cpp", "TestPrivateHeap.cpp", "TestSafeInt.cpp", "TestSafeString.cpp", @@ -74,13 +76,11 @@ chip_test_suite_using_nltest("tests_nltest") { output_name = "libSupportTestsNL" test_sources = [ - "TestCHIPCounter.cpp", "TestCHIPMem.cpp", "TestCHIPMemString.cpp", "TestIntrusiveList.cpp", "TestJsonToTlv.cpp", "TestJsonToTlvToJson.cpp", - "TestPersistedCounter.cpp", "TestPool.cpp", "TestStateMachine.cpp", "TestThreadOperationalDataset.cpp", diff --git a/src/lib/support/tests/TestCHIPCounter.cpp b/src/lib/support/tests/TestCHIPCounter.cpp index ee049fa04060e0..d1212b97c5a3b7 100644 --- a/src/lib/support/tests/TestCHIPCounter.cpp +++ b/src/lib/support/tests/TestCHIPCounter.cpp @@ -16,82 +16,63 @@ * limitations under the License. */ -#include - +#include #include -#include +#include + +using namespace chip; -static void CheckStartWithZero(nlTestSuite * inSuite, void * inContext) +TEST(TestCHIPCounter, TestStartWithZero) { - chip::MonotonicallyIncreasingCounter counter; - NL_TEST_ASSERT(inSuite, counter.GetValue() == 0); + MonotonicallyIncreasingCounter counter; + EXPECT_EQ(counter.GetValue(), 0ULL); } -static void CheckInitialize(nlTestSuite * inSuite, void * inContext) +TEST(TestCHIPCounter, TestInitialize) { - chip::MonotonicallyIncreasingCounter counter; + MonotonicallyIncreasingCounter counter; - NL_TEST_ASSERT(inSuite, counter.Init(4321) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, counter.GetValue() == 4321); + EXPECT_EQ(counter.Init(4321), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 4321ULL); } -static void CheckAdvance(nlTestSuite * inSuite, void * inContext) +TEST(TestCHIPCounter, TestAdvance) { - chip::MonotonicallyIncreasingCounter counter; + MonotonicallyIncreasingCounter counter; - NL_TEST_ASSERT(inSuite, counter.Init(22) == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, counter.GetValue() == 22); - NL_TEST_ASSERT(inSuite, counter.Advance() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, counter.GetValue() == 23); - NL_TEST_ASSERT(inSuite, counter.Advance() == CHIP_NO_ERROR); - NL_TEST_ASSERT(inSuite, counter.GetValue() == 24); + EXPECT_EQ(counter.Init(22), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 22ULL); + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 23ULL); + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 24ULL); } -/** - * Test Suite. It lists all the test functions. - */ - -// clang-format off -static const nlTest sTests[] = +TEST(TestCHIPCounter, TestAdvanceWithRollover) { - NL_TEST_DEF("Start with zero", CheckStartWithZero), - NL_TEST_DEF("Can initialize", CheckInitialize), - NL_TEST_DEF("Can Advance", CheckAdvance), - NL_TEST_SENTINEL() -}; -// clang-format on + MonotonicallyIncreasingCounter counter; + EXPECT_EQ(counter.Init(UINT64_MAX), CHIP_NO_ERROR); -/** - * Set up the test suite. - */ -static int TestSetup(void * inContext) -{ - return (SUCCESS); + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); } -/** - * Tear down the test suite. - */ -static int TestTeardown(void * inContext) +TEST(TestCHIPCounter, AdvanceBy) { - return (SUCCESS); -} + MonotonicallyIncreasingCounter counter; + constexpr uint64_t step = 9876; + uint64_t expectedValue = step; -int TestCHIPCounter() -{ - // clang-format off - nlTestSuite theSuite = { - "chip-counter", - &sTests[0], - TestSetup, - TestTeardown - }; - // clang-format on + EXPECT_EQ(counter.Init(0), CHIP_NO_ERROR); + EXPECT_EQ(counter.AdvanceBy(step), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), expectedValue); - // Run test suite against one context. - nlTestRunner(&theSuite, nullptr); + expectedValue += step; + EXPECT_EQ(counter.AdvanceBy(step), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), expectedValue); - return nlTestRunnerStats(&theSuite); + // Force rollover + expectedValue += UINT64_MAX; + EXPECT_EQ(counter.AdvanceBy(UINT64_MAX), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), expectedValue); } - -CHIP_REGISTER_TEST_SUITE(TestCHIPCounter) diff --git a/src/lib/support/tests/TestPersistedCounter.cpp b/src/lib/support/tests/TestPersistedCounter.cpp index e4cf11de9fbc9b..3d9b13583e49a0 100644 --- a/src/lib/support/tests/TestPersistedCounter.cpp +++ b/src/lib/support/tests/TestPersistedCounter.cpp @@ -23,169 +23,223 @@ * */ -#include -#include - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include +#include +#include #include #include #include -#include -#include -#include #include -namespace { +using namespace chip; -chip::TestPersistentStorageDelegate * sPersistentStore = nullptr; - -} // namespace +namespace { -struct TestPersistedCounterContext +TEST(TestPersistedCounter, TestOutOfBox) { - TestPersistedCounterContext(); - bool mVerbose; -}; + TestPersistentStorageDelegate storage; + PersistedCounter counter; -TestPersistedCounterContext::TestPersistedCounterContext() : mVerbose(false) {} + // When initializing the first time out of the box, we should have a count of 0 and a value of 0x10000 for the next starting + // value in persistent storage. + EXPECT_EQ(counter.Init(&storage, DefaultStorageKeyAllocator::IMEventNumber(), 0x10000), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); +} -static void InitializePersistedStorage(TestPersistedCounterContext * context) +TEST(TestPersistedCounter, TestReboot) { - if (sPersistentStore != nullptr) - { - delete sPersistentStore; - } + chip::TestPersistentStorageDelegate storage; + chip::PersistedCounter counter, counter2; - sPersistentStore = new chip::TestPersistentStorageDelegate; -} + // When initializing the first time out of the box, we should have a count of 0. + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); -static int TestSetup(void * inContext) -{ - return SUCCESS; + // Now we "reboot", and we should get a count of 0x10000. + EXPECT_EQ(counter2.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000), CHIP_NO_ERROR); + EXPECT_EQ(counter2.GetValue(), 0x10000ULL); } -static int TestTeardown(void * inContext) +TEST(TestPersistedCounter, TestkWriteNextCounterStart) { - if (sPersistentStore != nullptr) - { - delete sPersistentStore; - sPersistentStore = nullptr; - } - return SUCCESS; -} + chip::TestPersistentStorageDelegate storage; + chip::PersistedCounter counter; -static void CheckOOB(nlTestSuite * inSuite, void * inContext) -{ - TestPersistedCounterContext * context = static_cast(inContext); + uint64_t storedValue = 0; + uint16_t size = sizeof(storedValue); - InitializePersistedStorage(context); + // When initializing the first time out of the box, we should have a count of 0. + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); - // When initializing the first time out of the box, we should have - // a count of 0 and a value of 0x10000 for the next starting value - // in persistent storage. + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(0x10000ULL, storedValue); - chip::PersistedCounter counter; + // Verify that we write out the next starting counter value after + // we've exhausted the counter's range. + for (int32_t i = 0; i < 0x10000; i++) + { + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + } + EXPECT_EQ(counter.GetValue(), 0x10000ULL); - CHIP_ERROR err = counter.Init(sPersistentStore, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(0x20000ULL, storedValue); - auto value = counter.GetValue(); - NL_TEST_ASSERT(inSuite, value == 0); + for (int32_t i = 0; i < 0x10000; i++) + { + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + } + EXPECT_EQ(counter.GetValue(), 0x20000ULL); + + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(0x30000ULL, storedValue); } -static void CheckReboot(nlTestSuite * inSuite, void * inContext) +TEST(TestPersistedCounter, TestAdvanceMaxCounterValue) { - TestPersistedCounterContext * context = static_cast(inContext); - - InitializePersistedStorage(context); - - chip::PersistedCounter counter, counter2; + chip::TestPersistentStorageDelegate storage; + chip::PersistedCounter counter; - // When initializing the first time out of the box, we should have - // a count of 0. + uint8_t storedValue = 0; + uint16_t size = sizeof(storedValue); - CHIP_ERROR err = counter.Init(sPersistentStore, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + // When initializing the first time out of the box, we should have a count of 0. + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), 1U), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0); - auto value = counter.GetValue(); - NL_TEST_ASSERT(inSuite, value == 0); + for (uint16_t i = 0; i < UINT8_MAX; i++) + { + // Make sure we can increment to max value without error + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + } + EXPECT_EQ(counter.GetValue(), 255); - // Now we "reboot", and we should get a count of 0x10000. + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); - err = counter2.Init(sPersistentStore, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + EXPECT_EQ(storedValue, 0); - value = counter2.GetValue(); - NL_TEST_ASSERT(inSuite, value == 0x10000); + // Increment one more step to make sure counter continues to increment + EXPECT_EQ(counter.Advance(), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0); } -static void CheckWriteNextCounterStart(nlTestSuite * inSuite, void * inContext) +TEST(TestPersistedCounter, TestAdvanceBy) { - TestPersistedCounterContext * context = static_cast(inContext); + chip::TestPersistentStorageDelegate storage; + chip::PersistedCounter counter; - InitializePersistedStorage(context); + // Test values + constexpr uint64_t startingEpochValue = 65535; + constexpr uint64_t newValue = 2 * startingEpochValue + 156; + constexpr uint64_t newEpochValue = newValue + startingEpochValue; + uint64_t storedValue = 0; + uint16_t size = sizeof(storedValue); - chip::PersistedCounter counter; + // When initializing the first time out of the box, we should have a count of 0. + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), startingEpochValue), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); - // When initializing the first time out of the box, we should have - // a count of 0. + // Set New value + EXPECT_EQ(counter.AdvanceBy(newValue), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), newValue); - CHIP_ERROR err = counter.Init(sPersistentStore, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); - auto value = counter.GetValue(); - NL_TEST_ASSERT(inSuite, value == 0); + EXPECT_EQ(newEpochValue, storedValue); +} - // Verify that we write out the next starting counter value after - // we've exhausted the counter's range. +TEST(TestPersistedCounter, TestAdvanceByMaxCounterValue) +{ + chip::TestPersistentStorageDelegate storage; + chip::PersistedCounter counter; - for (int32_t i = 0; i < 0x10000; i++) - { - err = counter.Advance(); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - } + uint64_t storedValue = 0; + uint16_t size = sizeof(storedValue); - value = counter.GetValue(); - NL_TEST_ASSERT(inSuite, value == 0x10000); + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), 1ULL), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); - for (int32_t i = 0; i < 0x10000; i++) - { - err = counter.Advance(); - NL_TEST_ASSERT(inSuite, err == CHIP_NO_ERROR); - } + EXPECT_EQ(counter.AdvanceBy(UINT64_MAX), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), UINT64_MAX); - value = counter.GetValue(); - NL_TEST_ASSERT(inSuite, value == 0x20000); -} + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(0ULL, storedValue); -// Test Suite + // Increment one more step to make sure counter continues to increment + EXPECT_EQ(counter.AdvanceBy(1ULL), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), 0ULL); +} -/** - * Test Suite that lists all the test functions. - */ -static const nlTest sTests[] = { - NL_TEST_DEF("Out of box Test", CheckOOB), // - NL_TEST_DEF("Reboot Test", CheckReboot), // - NL_TEST_DEF("Write Next Counter Start Test", CheckWriteNextCounterStart), // - NL_TEST_SENTINEL() // -}; - -int TestPersistedCounter() +TEST(TestPersistedCounter, TestAdvanceByRollover) { - nlTestSuite theSuite = { "chip-persisted-storage", &sTests[0], TestSetup, TestTeardown }; + chip::TestPersistentStorageDelegate storage; + chip::PersistedCounter counter; - return chip::ExecuteTestsWithContext(&theSuite); + uint64_t epoch = UINT64_MAX / 4; + uint64_t currentEpoch = epoch; + uint64_t current = 0; + uint64_t storedValue = 0; + uint16_t size = sizeof(storedValue); + + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), epoch), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), current); + + // Check new Epoch value was persisted + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(currentEpoch, storedValue); + + // Increase counter to update persisted value + current += (currentEpoch + 100); + EXPECT_EQ(counter.AdvanceBy(currentEpoch + 100), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), current); + + // Check new Epoch value was persisted + currentEpoch = (currentEpoch * 2 + 100); + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(currentEpoch, storedValue); + + // Force roll over + current += (3 * epoch); + EXPECT_EQ(counter.AdvanceBy((3 * epoch)), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), current); + + // Check new Epoch value was persisted + currentEpoch = current + epoch; + EXPECT_EQ(storage.SyncGetKeyValue(chip::DefaultStorageKeyAllocator::IMEventNumber().KeyName(), &storedValue, size), + CHIP_NO_ERROR); + EXPECT_EQ(sizeof(storedValue), size); + storedValue = Encoding::LittleEndian::HostSwap(storedValue); + EXPECT_EQ(currentEpoch, storedValue); } -CHIP_REGISTER_TEST_SUITE(TestPersistedCounter); +} // namespace diff --git a/src/protocols/secure_channel/BUILD.gn b/src/protocols/secure_channel/BUILD.gn index 1202c0bb88a9ae..1bc60518331dd2 100644 --- a/src/protocols/secure_channel/BUILD.gn +++ b/src/protocols/secure_channel/BUILD.gn @@ -1,12 +1,17 @@ import("//build_overrides/chip.gni") source_set("check-in-counter") { - sources = [ "CheckInCounter.h" ] + sources = [ + "CheckInCounter.cpp", + "CheckInCounter.h", + ] - deps = [ - "${chip_root}/src/crypto", + public_deps = [ + "${chip_root}/src/lib/core", "${chip_root}/src/lib/support", ] + + deps = [ "${chip_root}/src/crypto" ] } source_set("check-in-message") { diff --git a/src/protocols/secure_channel/CheckInCounter.cpp b/src/protocols/secure_channel/CheckInCounter.cpp new file mode 100644 index 00000000000000..5ef576cd6678e9 --- /dev/null +++ b/src/protocols/secure_channel/CheckInCounter.cpp @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * @brief The file implements the Matter Check-In counter + */ + +#include +#include + +namespace chip { +namespace Protocols { +namespace SecureChannel { + +CHIP_ERROR CheckInCounter::InvalidateHalfCheckInCouterValues() +{ + // Increases the current counter value by half of its maximum range and updates underlying counter storage. + // CheckInCounter is allowed to roll over. + ReturnErrorOnFailure(AdvanceBy((UINT32_MAX / 2))); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CheckInCounter::InvalidateAllCheckInCounterValues() +{ + // Increase current counter value by its maximum value to mimic N -> UINT32_MAX -> N-1 to invalidate all Check-In counter + // values. CheckInCounter is allowed to roll over. + ReturnErrorOnFailure(AdvanceBy(UINT32_MAX)); + return CHIP_NO_ERROR; +} + +} // namespace SecureChannel +} // namespace Protocols +} // namespace chip diff --git a/src/protocols/secure_channel/CheckInCounter.h b/src/protocols/secure_channel/CheckInCounter.h index 257114b8a1e971..d22308ce9fb033 100644 --- a/src/protocols/secure_channel/CheckInCounter.h +++ b/src/protocols/secure_channel/CheckInCounter.h @@ -22,6 +22,7 @@ #pragma once #include +#include #include namespace chip { @@ -45,6 +46,24 @@ class CheckInCounter : public PersistedCounter */ inline uint32_t GetNextCheckInCounterValue() { return (mCounterValue + 1); }; + /** + * @brief Advances the current Check-In counter value to invalidate half of the values. + * Function adds UINT32_MAX / 2 to the current counter value. Next time a Check-In message is sent, 1 is added to the + * current value. + * + * @return CHIP_ERROR Any error returned by a write to persisted storage. + */ + CHIP_ERROR InvalidateHalfCheckInCouterValues(); + + /** + * @brief Invalidates all the Check-In counter values. After this function is called, the new Check-In counter value will be + * equal to current value minus 1 (with rollover) to mimic N -> UINT32_MAX -> N-1. Next time a Check-In message is sent, + * 1 is added to the current value which will be an invalid counter value. + * + * @return CHIP_ERROR Any error returned by a write to persisted storage. + */ + CHIP_ERROR InvalidateAllCheckInCounterValues(); + private: /** * @brief Get the Initial Counter Value for the Check-In counter diff --git a/src/protocols/secure_channel/tests/BUILD.gn b/src/protocols/secure_channel/tests/BUILD.gn index 9a0ec760950d3f..afebe3cee24aa6 100644 --- a/src/protocols/secure_channel/tests/BUILD.gn +++ b/src/protocols/secure_channel/tests/BUILD.gn @@ -4,8 +4,24 @@ import("//build_overrides/nlunit_test.gni") import("${chip_root}/build/chip/chip_test_suite.gni") import("${chip_root}/src/app/icd/icd.gni") -chip_test_suite_using_nltest("tests") { +chip_test_suite("tests") { output_name = "libSecureChannelTests" + test_sources = [ "TestCheckInCounter.cpp" ] + + cflags = [ "-Wconversion" ] + public_deps = [ + "${chip_root}/src/lib/core", + "${chip_root}/src/lib/support", + "${chip_root}/src/lib/support:test_utils", + "${chip_root}/src/lib/support:testing", + "${chip_root}/src/protocols/secure_channel:check-in-counter", + "${dir_pw_unit_test}", + ] +} + +chip_test_suite_using_nltest("tests_nltest") { + # Renamed ouput during the transition away from nltest + output_name = "libSecureChannelTestsNL" test_sources = [ "TestCASESession.cpp", diff --git a/src/protocols/secure_channel/tests/TestCheckInCounter.cpp b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp new file mode 100644 index 00000000000000..8a64d1805d42ae --- /dev/null +++ b/src/protocols/secure_channel/tests/TestCheckInCounter.cpp @@ -0,0 +1,129 @@ +/* + * + * 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. + */ + +#include +#include +#include +#include +#include + +using namespace chip; +using namespace chip::Protocols::SecureChannel; + +namespace { + +enum class CheckInCounterOperations : uint8_t +{ + kInvalidateHalf = 1, + kInvalidateAll = 2, +}; + +/** + * @brief Helper function that validates CheckInCounter value after an operation for configurable input values + * + * @param startValue Starting value of the Check-In counter + * @param expectedValue Expected value after the InvalidateHalfCheckInCouterValues call + */ +void VerifyCheckInCounterValues(uint32_t startValue, uint32_t expectedValue, CheckInCounterOperations operation) +{ + // Test Configuration + TestPersistentStorageDelegate storage; + CheckInCounter counter; + + // Init Value of the counter is random + EXPECT_EQ(counter.Init(&storage, chip::DefaultStorageKeyAllocator::IMEventNumber(), 0x10000), CHIP_NO_ERROR); + + // Set starting value + uint32_t currentValue = counter.GetValue(); + uint32_t delta = startValue - currentValue; + + EXPECT_EQ(counter.AdvanceBy(delta), CHIP_NO_ERROR); + EXPECT_EQ(counter.GetValue(), startValue); + + // Test operation + CHIP_ERROR err = CHIP_NO_ERROR; + switch (operation) + { + case CheckInCounterOperations::kInvalidateHalf: { + EXPECT_EQ(counter.InvalidateHalfCheckInCouterValues(), CHIP_NO_ERROR); + break; + } + case CheckInCounterOperations::kInvalidateAll: { + EXPECT_EQ(counter.InvalidateAllCheckInCounterValues(), CHIP_NO_ERROR); + break; + } + default: { + err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; + FAIL(); + } + }; + + EXPECT_EQ(counter.GetValue(), expectedValue); +} + +TEST(TestCheckInCounter, TestInvalidateHalfCheckInCounterValues) +{ + + constexpr uint32_t startValue = 1; + constexpr uint32_t expectedValue = 2147483648; + + VerifyCheckInCounterValues(startValue, expectedValue, CheckInCounterOperations::kInvalidateHalf); +} + +TEST(TestCheckInCounter, TestInvalidateHalfCheckInCounterValuesRollover) +{ + + constexpr uint32_t startValue = 4294967295; + constexpr uint32_t expectedValue = 2147483646; + + VerifyCheckInCounterValues(startValue, expectedValue, CheckInCounterOperations::kInvalidateHalf); +} + +TEST(TestCheckInCounter, TestInvalidateHalfCheckInCounterValues0Value) +{ + constexpr uint32_t startValue = 0; + constexpr uint32_t expectedValue = 2147483647; + + VerifyCheckInCounterValues(startValue, expectedValue, CheckInCounterOperations::kInvalidateHalf); +} + +TEST(TestCheckInCounter, TestInvalidateAllCheckInCounterValues) +{ + constexpr uint32_t startValue = 105; + constexpr uint32_t expectedValue = 104; + + VerifyCheckInCounterValues(startValue, expectedValue, CheckInCounterOperations::kInvalidateAll); +} + +TEST(TestCheckInCounter, TestInvalidateAllCheckInCounterValues0Value) +{ + constexpr uint32_t startValue = 0; + constexpr uint32_t expectedValue = UINT32_MAX; + + VerifyCheckInCounterValues(startValue, expectedValue, CheckInCounterOperations::kInvalidateAll); +} + +TEST(TestCheckInCounter, TestInvalidateAllCheckInCounterValuesRollover) +{ + constexpr uint32_t startValue = UINT32_MAX; + constexpr uint32_t expectedValue = UINT32_MAX - 1; + + VerifyCheckInCounterValues(startValue, expectedValue, CheckInCounterOperations::kInvalidateAll); +} + +} // namespace diff --git a/src/python_testing/TC_ICDManagementCluster.py b/src/python_testing/TC_ICDManagementCluster.py index a5b769ba30272c..744b3bfa926690 100644 --- a/src/python_testing/TC_ICDManagementCluster.py +++ b/src/python_testing/TC_ICDManagementCluster.py @@ -14,6 +14,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import ctypes +from enum import IntEnum + import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main from mobly import asserts @@ -21,9 +24,16 @@ # Assumes `--enable-key 000102030405060708090a0b0c0d0e0f` on Linux app command line, or a DUT # that has that Enable Key kTestEventTriggerKey = bytes([b for b in range(16)]) +kRootEndpointId = 0 +kMaxUint32Value = 0xFFFFFFFF +kHalfMaxUint32Value = 0xFFFFFFFF >> 1 + -kAddActiveModeReq = 0x0046000000000001 -kRemoveActiveModeReq = 0x0046000000000002 +class ICDTestEventTriggerOperations(IntEnum): + kAddActiveModeReq = 0x0046000000000001 + kRemoveActiveModeReq = 0x0046000000000002 + kInvalidateHalfCounterValues = 0x0046000000000003 + kInvalidateAllCounterValues = 0x0046000000000004 class TestICDManagementCluster(MatterBaseTest): @@ -43,18 +53,51 @@ async def test_active_mode_test_event_trigger(self): asserts.assert_is_none( await dev_ctrl.SendCommand( self.dut_node_id, - endpoint=0, + endpoint=kRootEndpointId, + payload=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=kTestEventTriggerKey, + eventTrigger=ICDTestEventTriggerOperations.kAddActiveModeReq) + ) + ) + + startingICDCounter = await self.read_single_attribute_check_success(endpoint=kRootEndpointId, cluster=Clusters.Objects.IcdManagement, attribute=Clusters.IcdManagement.Attributes.ICDCounter) + + asserts.assert_is_none( + await dev_ctrl.SendCommand( + self.dut_node_id, + endpoint=kRootEndpointId, payload=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=kTestEventTriggerKey, - eventTrigger=kAddActiveModeReq) + eventTrigger=ICDTestEventTriggerOperations.kInvalidateHalfCounterValues) ) ) + currentICDCounter = await self.read_single_attribute_check_success(endpoint=kRootEndpointId, cluster=Clusters.Objects.IcdManagement, attribute=Clusters.IcdManagement.Attributes.ICDCounter) + + # Check new current counter value has the expected value + asserts.assert_equal((ctypes.c_uint32(startingICDCounter + kHalfMaxUint32Value).value), + currentICDCounter, "Incorrect ICDCounter value after kInvalidateHalfCounterValues opration") + + # Set starting counter to currentICDCounter for next test + startingICDCounter = currentICDCounter + + asserts.assert_is_none( + await dev_ctrl.SendCommand( + self.dut_node_id, + endpoint=kRootEndpointId, + payload=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=kTestEventTriggerKey, + eventTrigger=ICDTestEventTriggerOperations.kInvalidateAllCounterValues) + ) + ) + currentICDCounter = await self.read_single_attribute_check_success(endpoint=kRootEndpointId, cluster=Clusters.Objects.IcdManagement, attribute=Clusters.IcdManagement.Attributes.ICDCounter) + + # Check new current counter value has the expected value + asserts.assert_equal((ctypes.c_uint32(startingICDCounter + kMaxUint32Value).value), + currentICDCounter, "Incorrect ICDCounter value after kInvalidateHalfCounterValues opration") asserts.assert_is_none( await dev_ctrl.SendCommand( self.dut_node_id, - endpoint=0, + endpoint=kRootEndpointId, payload=Clusters.GeneralDiagnostics.Commands.TestEventTrigger(enableKey=kTestEventTriggerKey, - eventTrigger=kRemoveActiveModeReq) + eventTrigger=ICDTestEventTriggerOperations.kRemoveActiveModeReq) ) ) diff --git a/src/test_driver/openiotsdk/unit-tests/test_components.txt b/src/test_driver/openiotsdk/unit-tests/test_components.txt index bb108309ba1728..2694c2a5afd8fb 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components.txt @@ -15,3 +15,4 @@ TestShell SetupPayloadTests SupportTests UserDirectedCommissioningTests +SecureChannelTests diff --git a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt index 8631aacb9561a4..d30358d4353c85 100644 --- a/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt +++ b/src/test_driver/openiotsdk/unit-tests/test_components_nl.txt @@ -3,6 +3,6 @@ DataModelTests InetLayerTests MessagingLayerTests RawTransportTests -SecureChannelTests +SecureChannelTestsNL SupportTestsNL TransportLayerTests From f9ac954217dd41375f0455d3034e1a323dfb9dfa Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Fri, 26 Apr 2024 17:34:20 -0700 Subject: [PATCH 40/40] Add OnCreateRefreshKey (#33202) * Add OnCreateRefreshKey * Update src/app/icd/client/DefaultCheckInDelegate.h Co-authored-by: Boris Zbarsky * Update src/app/icd/client/DefaultCheckInDelegate.h Co-authored-by: Boris Zbarsky * Update src/app/icd/client/DefaultCheckInDelegate.h Co-authored-by: Boris Zbarsky * Update DefaultCheckInDelegate.cpp * Restyled by whitespace --------- Co-authored-by: Boris Zbarsky Co-authored-by: Restyled.io --- src/app/icd/client/DefaultCheckInDelegate.cpp | 9 ++++++--- src/app/icd/client/DefaultCheckInDelegate.h | 12 ++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/app/icd/client/DefaultCheckInDelegate.cpp b/src/app/icd/client/DefaultCheckInDelegate.cpp index e967138310c0f4..2d4624b7837470 100644 --- a/src/app/icd/client/DefaultCheckInDelegate.cpp +++ b/src/app/icd/client/DefaultCheckInDelegate.cpp @@ -16,7 +16,6 @@ */ #include -#include #include #include #include @@ -40,12 +39,16 @@ void DefaultCheckInDelegate::OnCheckInComplete(const ICDClientInfo & clientInfo) clientInfo.start_icd_counter, clientInfo.offset, ChipLogValueScopedNodeId(clientInfo.peer_node)); } +CHIP_ERROR DefaultCheckInDelegate::GenerateRefreshKey(RefreshKeySender::RefreshKeyBuffer & newKey) +{ + return Crypto::DRBG_get_bytes(newKey.Bytes(), newKey.Capacity()); +} + RefreshKeySender * DefaultCheckInDelegate::OnKeyRefreshNeeded(ICDClientInfo & clientInfo, ICDClientStorage * clientStorage) { CHIP_ERROR err = CHIP_NO_ERROR; RefreshKeySender::RefreshKeyBuffer newKey; - - err = Crypto::DRBG_get_bytes(newKey.Bytes(), newKey.Capacity()); + err = GenerateRefreshKey(newKey); if (err != CHIP_NO_ERROR) { ChipLogError(ICD, "Generation of new key failed: %" CHIP_ERROR_FORMAT, err.Format()); diff --git a/src/app/icd/client/DefaultCheckInDelegate.h b/src/app/icd/client/DefaultCheckInDelegate.h index 355259f561ea40..52941817bd3f9f 100644 --- a/src/app/icd/client/DefaultCheckInDelegate.h +++ b/src/app/icd/client/DefaultCheckInDelegate.h @@ -20,6 +20,7 @@ #include #include +#include namespace chip { namespace app { @@ -33,6 +34,17 @@ class DefaultCheckInDelegate : public CheckInDelegate virtual ~DefaultCheckInDelegate() {} CHIP_ERROR Init(ICDClientStorage * storage, InteractionModelEngine * engine); void OnCheckInComplete(const ICDClientInfo & clientInfo) override; + + /** + * @brief Callback used to let the application generate the new ICD symmetric key + * + * If this calback is not overridden, Crypto::DRBG_get_bytes will be used to generated the key. + * + * @param[inout] newKey sensitive data buffer with type Crypto::SensitiveDataBuffer + * @param[out] CHIP_ERROR CHIP_ERROR_INVALID_ARGUMENT + * CHIP_ERROR_INTERNAL + */ + virtual CHIP_ERROR GenerateRefreshKey(RefreshKeySender::RefreshKeyBuffer & newKey); RefreshKeySender * OnKeyRefreshNeeded(ICDClientInfo & clientInfo, ICDClientStorage * clientStorage) override; void OnKeyRefreshDone(RefreshKeySender * refreshKeySender, CHIP_ERROR error) override;