diff --git a/.clang-tidy b/.clang-tidy index 06cbc661ea73f9..b494558e513460 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -10,20 +10,23 @@ Checks: > readability-redundant-control-flow, readability-redundant-string-cstr, readability-redundant-string-init, - -bugprone-assignment-in-if-condition, + -bugprone-assignment-in-if-condition, -bugprone-branch-clone, -bugprone-copy-constructor-init, -bugprone-easily-swappable-parameters, -bugprone-forward-declaration-namespace, -bugprone-forwarding-reference-overload, -bugprone-implicit-widening-of-multiplication-result, + -bugprone-inc-dec-in-conditions, -bugprone-macro-parentheses, -bugprone-misplaced-widening-cast, + -bugprone-multi-level-implicit-pointer-conversion, -bugprone-narrowing-conversions, -bugprone-not-null-terminated-result, -bugprone-reserved-identifier, -bugprone-signed-char-misuse, -bugprone-suspicious-include, + -bugprone-switch-missing-default-case, -bugprone-undelegated-constructor, -bugprone-unused-return-value, -clang-analyzer-core.CallAndMessage, diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c3914b86230305..e96209e6ac3885 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -200,7 +200,7 @@ jobs: ./scripts/run_in_build_env.sh \ "./scripts/run-clang-tidy-on-compile-commands.py \ --compile-database out/sanitizers/compile_commands.json \ - --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/' \ + --file-exclude-regex '/(repo|zzz_generated|lwip/standalone)/|-ReadImpl|-InvokeSubscribeImpl' \ check \ " - name: Clean output diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index ce56a06b25db37..144af18c4d4d89 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -196,6 +196,18 @@ jobs: - name: clean out build output run: rm -rf ./out + - name: Build example Telink (B91) Resource Monitoring App + run: | + ./scripts/run_in_build_env.sh \ + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-resource-monitoring' build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tlsr9518adk80d resource-monitoring-app \ + out/telink-tlsr9518adk80d-resource-monitoring/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + + - name: clean out build output + run: rm -rf ./out + - name: Build example Telink (B91) Shell App run: | ./scripts/run_in_build_env.sh \ diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e1e900f7fb57a7..c5949bde691141 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -673,6 +673,7 @@ "telink-tlsr9518adk80d-ota-requestor", "telink-tlsr9518adk80d-pump-app", "telink-tlsr9518adk80d-pump-controller-app", + "telink-tlsr9518adk80d-resource-monitoring-app", "telink-tlsr9518adk80d-shell", "telink-tlsr9518adk80d-smoke-co-alarm-app", "telink-tlsr9518adk80d-temperature-measurement", diff --git a/build/chip/linux/gdbus_library.gni b/build/chip/linux/gdbus_library.gni index 0c27b77d6918cb..fa949ccac9be4d 100644 --- a/build/chip/linux/gdbus_library.gni +++ b/build/chip/linux/gdbus_library.gni @@ -35,6 +35,12 @@ template("gdbus_library") { include_dirs = [ "${root_gen_dir}/include" ] } + config("${library_name}_compile_config") { + # dbus code generation may generate some code detected as unreacheable + # by recent enough clang + cflags = [ "-Wno-unreachable-code" ] + } + dbus_sources = [] foreach(xml, invoker.sources) { name = get_path_info(xml, "name") @@ -94,6 +100,7 @@ template("gdbus_library") { sources = dbus_sources deps = [ ":${library_name}_gen" ] + configs += [ ":${library_name}_compile_config" ] public_configs = [ ":${library_name}_config", glib_config, diff --git a/config/esp32/components/chip/CMakeLists.txt b/config/esp32/components/chip/CMakeLists.txt index 61920102605cba..13beac09ce2153 100644 --- a/config/esp32/components/chip/CMakeLists.txt +++ b/config/esp32/components/chip/CMakeLists.txt @@ -486,12 +486,12 @@ endforeach() set(components_to_link esp_event hal esp_system soc efuse vfs driver esp_coex freertos) idf_build_get_property(build_components BUILD_COMPONENTS) foreach(component ${components_to_link}) - # Some of the components are not present in IDF v4.x - # So, Check if the component is in the list of build components - if("${component}" IN_LIST build_components) + # Some of the components are not present in IDF v4.x + # So, Check if the component is in the list of build components + if("${component}" IN_LIST build_components) idf_component_get_property(lib_name ${component} COMPONENT_LIB) + list(APPEND chip_libraries $) endif() - list(APPEND chip_libraries $) endforeach() target_link_libraries(${COMPONENT_LIB} INTERFACE -Wl,--start-group diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index bfb38cb5172c69..1ebe7bb91ce844 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -97,6 +97,7 @@ matter_add_gn_arg_bool ("chip_error_logging" CONFIG_MATTER_ matter_add_gn_arg_bool ("chip_progress_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 3) matter_add_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LEVEL GREATER_EQUAL 4) matter_add_gn_arg_bool ("chip_automation_logging" FALSE) +matter_add_gn_arg_bool ("chip_enable_icd_server" CONFIG_CHIP_ENABLE_ICD_SUPPORT) if (CONFIG_CHIP_FACTORY_DATA) matter_add_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false") diff --git a/config/telink/chip-module/Kconfig b/config/telink/chip-module/Kconfig index 325eb4172f198c..fb1f20e0dfbc63 100644 --- a/config/telink/chip-module/Kconfig +++ b/config/telink/chip-module/Kconfig @@ -188,26 +188,6 @@ config SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE int default 255 if SHELL_BACKEND_SERIAL -config CHIP_ICD_SUBSCRIPTION_HANDLING - bool "Enables platform specific handling of ICD subscriptions" - default PM - help - Enables platform specific implementation that handles ICD subscription requests - and selects subscription report interval value considering maximum interval preferred - by the publisher. - -config CHIP_MAX_PREFERRED_SUBSCRIPTION_REPORT_INTERVAL - int "Maximum preferred interval of sending subscription reports (s)" - default 60 - help - Provides maximum preferred interval to be used by a publisher for negotiation - of the final maximum subscription report interval, after receiving a subscription - request from the initiator. This value should be selected as a compromise between - keeping the power consumption low due to not sending reports too often, and allowing - the initiator device to detect the publisher absence reasonably fast due to not sending - the reports too rarely. The current algorithm is to select bigger value from the one - requested by the initiator and the one preferred by the publisher. - config CHIP_ENABLE_POWER_ON_FACTORY_RESET bool "Enable power on factory reset sequence" default n diff --git a/docs/guides/chip_tool_guide.md b/docs/guides/chip_tool_guide.md index 5ea235ab1263ac..ea60f7cfd84a38 100644 --- a/docs/guides/chip_tool_guide.md +++ b/docs/guides/chip_tool_guide.md @@ -727,7 +727,7 @@ Here, __ is the ID of the payload to be parsed. To parse additional data payload, use the following command pattern: ``` -$ ./chip-tool parse-additional-data-payload +$ ./chip-tool payload parse-additional-data-payload ``` In this command: diff --git a/docs/guides/ti/matter_cc2674_migration.md b/docs/guides/ti/matter_cc2674_migration.md index 0590037ea03157..03a0c2e4f41e62 100644 --- a/docs/guides/ti/matter_cc2674_migration.md +++ b/docs/guides/ti/matter_cc2674_migration.md @@ -1,109 +1,124 @@ -# Running Matter Examples on the TI SimpleLink CC2674P10 and CC2674R10 - -The existing Matter project examples are based on LP_EM_CC1354P10_6. If using -the CC2674P10, the following migration steps are required. Developers are -strongly encouraged to start with a `cc13x4_26x4` example and migrate the -project accordingly. Example projects can be found in the following location: -`matter/examples/[application]/cc13x4_26x4` - -## Dependencies - -The following must be installed on your system before proceeding: - -- [SysConfig](https://www.ti.com/tool/SYSCONFIG) v1.16.2 or later -- [SIMPLELINK-LOWPOWER-F2-SDK](https://www.ti.com/tool/SIMPLELINK-LOWPOWER-SDK) - v7.10.01.24 - -## Matter source code changes - -The following are changes to the Matter source code files which should be -applied to convert a `matter/examples/[application]/cc13x4_26x4` project to the -CC2674P10 device - -- `examples/[application]/cc13x4_26x4/args.gni`, modify/add the following - defines for the CC2674 - - `ti_simplelink_board = CC2674` - - `ti_simplelink_device = CC2674P10RGZ` -- `third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx`, replace this folder - contents with the 7.10.01.24 version from - [TI's downloads page](https://www.ti.com/tool/download/SIMPLELINK-LOWPOWER-F2-SDK/7.10.01.24) - which is required to add support SDK for the CC2674P10 device. - -## Configuring `chip.syscfg` in the SysConfig GUI - -1. To open `matter/examples/[application]/cc13x4_26x4/chip.syscfg` in the GUI, - add the following line to the top of the file: - -``` - // @cliArgs --product /.metadata/product.json --board /ti/boards/LP_EM_CC1354P10_6 --rtos freertos -``` - -2. Open the `syscfg` file using the standalone Sysconfig GUI - (`sysconfig_gui.sh`) from the SysConfig installation folder. -3. Click on _Show Device View_ and then click _Switch_. -4. Select _Board_ as _None_ and _Device_ as _`CC2674P10RGZ`_, Unselect - _`Lock PinMux`_, and click _Confirm_. -5. To fix errors, make the following module changes: - - _RF Design_ and _RF Stacks -> BLE -> Radio_: click on _accepting the - current value_, which should be _`LP_CC2674P10_RGZ`_ in the drop down menu - for _Based On RF Design_ - - _TI DEVICES -> Device Configuration_: Clear - _`XOSC Cap Array Modification`_ - - _TI DRIVERS -> RF_: Set _Global Event Mask_ as _None_ and _No. of Antenna - Switch Control Pins_ as _0_ - - _TI DRIVERS -> UART2 -> `PinMux`_: Set _UART Peripheral_ to _UART0_, _TX - Pin_ to _`DIO_13/19`_, and _RX Pin_ to _`DIO_12/18`_ - - _TI DRIVERS APPS -> Button_: Set _`PinMux`_ of _CONFIG_BTN_LEFT_ to - _`DIO_15`_ and _CONFIG_BTN_RIGHT_ to _`DIO_14`_ - - _TI DRIVERS APPS -> LED_: Set _`PinMux`_ of _CONFIG_LED_RED_ to _`DIO_6`_ - and _CONFIG_LED_RIGHT_ to _`DIO_7`_ -6. Save the SysConfig file (click on _Save As_) and ensure the file name matches - the reference from `BUILD.gn` (default project name is `chip.syscfg`). -7. Open the new SysConfig file with a text editor and remove the generated - arguments. - ``` - /** - * These arguments were used when this file was generated. They will be automatically applied on subsequent loads - * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments. - * @cliArgs --device "CC2674P10RGZ" --package "RGZ" --part "Default" --rtos "freertos" --product "simplelink_cc13xx_cc26xx_sdk@7.10.01.24" - * @versions {"tool":"1.18.0+3130"} - */ - ``` -8. Move the `*.syscfg` file into the - `matter/examples/[application]/cc13x4_26x4/` folder. Make sure that the - `args.gni` parameters are aligned for the `CC2674P10RGZ` as detailed above, - and build the example using the `README.md` instructions. - -## Modifications required for the CC2674R10 - -After applying all items in the "Configuring `chip.syscfg` in the SysConfig GUI" -section, additional steps must also be applied to generate Matter project for -the CC2674R10. - -- `examples/[application]/cc13x4_26x4/args.gni` should have - `ti_simplelink_board` as `CC2674` and `ti_simplelink_device = CC2674R10RGZ`. -- `examples/[application]/cc13x4_26x4/chip.syscfg` opened with a Text Editor - should change `ble.radioConfig.codeExportConfig.$name` to - `ti_devices_radioconfig_code_export_param2` and `ble.rfDesign` to - `LP_EM_CC1354P10_1` - -Furthermore, the subsequent changes apply specifically for the CC2674R10 and -should be addressed from a SysConfig Editor. - -1. Pins will need to be reconfigured as such: - - | SysConfig pin name | R10 `PinMux` | - | ------------------ | ------------ | - | UART_RX | `DIO_2` | - | UART_TX | `DIO_3` | - | CONFIG_BTN_LEFT | `DIO_13` | - | CONFIG_BTN_RIGHT | `DIO_14` | - | CONFIG_LED_RED | `DIO_6` | - | CONFIG_LED_GREEN | `DIO_7` | - -2. _Custom -> IEEE 802.15.4-2006, `250 kbps`, `OQPSK`, `DSSS = 1:8` -> Code - Export Configuration_, acknowledge and dismiss the PA radio setup error -3. _Custom -> IEEE 802.15.4-2006, `250 kbps`, `OQPSK`, `DSSS = 1:8` -> RF - Command Symbols_, change `CMD_RADIO_SETUP` from `RF_cmdRadioSetup` to - `RF_cmdIeeeRadioSetup` and add the following functions from the drop-down: - `CMD_TX_TEST`,`CMD_IEEE_ED_SCAN`, `CMD_IEEE_CSMA`, and `CMD_IEEE_RX_ACK`. +# Running Matter Examples on the TI SimpleLink CC2674P10 and CC2674R10 + +The existing Matter project examples are based on LP_EM_CC1354P10_6. If using +the CC2674P10, the following migration steps are required. Developers are +strongly encouraged to start with a `cc13x4_26x4` example and migrate the +project accordingly. Example projects can be found in the following location: +`matter/examples/[application]/cc13x4_26x4` + +## Dependencies + +The following must be installed on your system before proceeding: + +- [SysConfig](https://www.ti.com/tool/SYSCONFIG) v1.16.2 or later +- [SIMPLELINK-LOWPOWER-F2-SDK](https://www.ti.com/tool/SIMPLELINK-LOWPOWER-SDK) + v7.10.01.24 + +## Matter source code changes + +The following are changes to the Matter source code files which should be +applied to convert a `matter/examples/[application]/cc13x4_26x4` project to the +CC2674P10 device + +- `examples/[application]/cc13x4_26x4/args.gni`, modify/add the following + defines for the CC2674 + - `ti_simplelink_board = CC2674` + - `ti_simplelink_device = CC2674P10RGZ` +- `third_party/ti_simplelink_sdk/repo_cc13xx_cc26xx`, replace this folder + contents with the 7.10.01.24 version from + [TI's downloads page](https://www.ti.com/tool/download/SIMPLELINK-LOWPOWER-F2-SDK/7.10.01.24) + which is required to add support SDK for the CC2674P10 device. + +## Configuring `chip.syscfg` in the SysConfig GUI + +1. To open `matter/examples/[application]/cc13x4_26x4/chip.syscfg` in the GUI, + add the following line to the top of the file: + +``` + // @cliArgs --product /.metadata/product.json --board /ti/boards/LP_EM_CC1354P10_6 --rtos freertos +``` + +2. Open the `syscfg` file using the standalone Sysconfig GUI + (`sysconfig_gui.sh`) from the SysConfig installation folder. +3. Click on _Show Device View_ and then click _Switch_. +4. Select _Board_ as _None_ and _Device_ as _`CC2674P10RGZ`_, Unselect + _`Lock PinMux`_, and click _Confirm_. +5. To fix errors, make the following module changes: + - _RF Design_ and _RF Stacks -> BLE -> Radio_: click on _accepting the + current value_, which should be _`LP_CC2674P10_RGZ`_ in the drop down menu + for _Based On RF Design_ + - _TI DEVICES -> Device Configuration_: Clear + _`XOSC Cap Array Modification`_ + - _TI DRIVERS -> RF_: Set _Global Event Mask_ as _None_ and _No. of Antenna + Switch Control Pins_ as _0_ + - _TI DRIVERS -> UART2 -> `PinMux`_: Set _UART Peripheral_ to _UART0_, _TX + Pin_ to _`DIO_13/19`_, and _RX Pin_ to _`DIO_12/18`_ + - _TI DRIVERS APPS -> Button_: Set _`PinMux`_ of _CONFIG_BTN_LEFT_ to + _`DIO_15`_ and _CONFIG_BTN_RIGHT_ to _`DIO_14`_ + - _TI DRIVERS APPS -> LED_: Set _`PinMux`_ of _CONFIG_LED_RED_ to _`DIO_6`_ + and _CONFIG_LED_RIGHT_ to _`DIO_7`_ +6. Save the SysConfig file (click on _Save As_) and ensure the file name matches + the reference from `BUILD.gn` (default project name is `chip.syscfg`). +7. Open the new SysConfig file with a text editor and remove the generated + arguments. + ``` + /** + * These arguments were used when this file was generated. They will be automatically applied on subsequent loads + * via the GUI or CLI. Run CLI with '--help' for additional information on how to override these arguments. + * @cliArgs --device "CC2674P10RGZ" --package "RGZ" --part "Default" --rtos "freertos" --product "simplelink_cc13xx_cc26xx_sdk@7.10.01.24" + * @versions {"tool":"1.18.0+3130"} + */ + ``` +8. Move the `*.syscfg` file into the + `matter/examples/[application]/cc13x4_26x4/` folder. Make sure that the + `args.gni` parameters are aligned for the `CC2674P10RGZ` as detailed above, + and build the example using the `README.md` instructions. + +## Modifications required for the CC2674R10 + +After applying all items in the "Configuring `chip.syscfg` in the SysConfig GUI" +section, additional steps must also be applied to generate Matter project for +the CC2674R10. + +- `examples/[application]/cc13x4_26x4/args.gni` should have + `ti_simplelink_board` as `CC2674` and `ti_simplelink_device = CC2674R10RGZ`. +- `examples/[application]/cc13x4_26x4/chip.syscfg` opened with a Text Editor + should change `ble.radioConfig.codeExportConfig.$name` to + `ti_devices_radioconfig_code_export_param2` and `ble.rfDesign` to + `LP_EM_CC1354P10_1` + +Furthermore, the subsequent changes apply specifically for the CC2674R10 and +should be addressed from a SysConfig Editor. + +1. Pins will need to be reconfigured as such: + + | SysConfig pin name | R10 `PinMux` | + | ------------------ | ------------ | + | UART_RX | `DIO_2` | + | UART_TX | `DIO_3` | + | CONFIG_BTN_LEFT | `DIO_13` | + | CONFIG_BTN_RIGHT | `DIO_14` | + | CONFIG_LED_RED | `DIO_6` | + | CONFIG_LED_GREEN | `DIO_7` | + +2. _Custom -> IEEE 802.15.4-2006, `250 kbps`, `OQPSK`, `DSSS = 1:8` -> Code + Export Configuration_, acknowledge and dismiss the PA radio setup error +3. _Custom -> IEEE 802.15.4-2006, `250 kbps`, `OQPSK`, `DSSS = 1:8` -> RF + Command Symbols_, change `CMD_RADIO_SETUP` from `RF_cmdRadioSetup` to + `RF_cmdIeeeRadioSetup` and add the following functions from the drop-down: + `CMD_TX_TEST`,`CMD_IEEE_ED_SCAN`, `CMD_IEEE_CSMA`, and `CMD_IEEE_RX_ACK`. + +## Building examples for the CC1354P10-1 + +To migrate the CC1354P10-6 examples to the CC1354P10-1 platform, there are only +two steps: + +1. `examples/[application]/cc13x4_26x4/args.gni` should have + `ti_simplelink_board` as `CC1354P10-1` +2. `examples/[application]/cc13x4_26x4/chip.syscfg` opened with a Text Editor + should change `ble.radioConfig.codeExportConfig.$name` to + `ti_devices_radioconfig_code_export_param2` and `ble.rfDesign` to + `LP_EM_CC1354P10_1` + +After this, the example's `README.md` instructions can be followed to produce +the executable needed. diff --git a/docs/requirements.txt b/docs/requirements.txt index cc399509e28909..62b6ad8fc5c3e8 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -3,4 +3,4 @@ Sphinx>=4.5 sphinx-book-theme myst-parser breathe>=4.34 -pydata-sphinx-theme==0.13.3 +pydata-sphinx-theme==0.14.0 diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter index f42f02a87f8a82..c48282979c4341 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.matter @@ -7204,9 +7204,9 @@ endpoint 1 { } server cluster FlowMeasurement { - ram attribute measuredValue; - ram attribute minMeasuredValue; - ram attribute maxMeasuredValue; + ram attribute measuredValue default = 5; + ram attribute minMeasuredValue default = 0; + ram attribute maxMeasuredValue default = 100; ram attribute tolerance default = 0; ram attribute featureMap default = 0; ram attribute clusterRevision default = 3; diff --git a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap index 785e3aaef11fe8..fb5b94436d0176 100644 --- a/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap +++ b/examples/all-clusters-app/all-clusters-common/all-clusters-app.zap @@ -23526,7 +23526,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "5", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -23542,7 +23542,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "0", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -23558,7 +23558,7 @@ "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": "100", "reportable": 1, "minInterval": 0, "maxInterval": 65344, @@ -35392,5 +35392,6 @@ "endpointId": 65534, "networkId": 0 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chip-tool/commands/clusters/ComplexArgument.h b/examples/chip-tool/commands/clusters/ComplexArgument.h index 7705ba50369a59..fa19553d0cab62 100644 --- a/examples/chip-tool/commands/clusters/ComplexArgument.h +++ b/examples/chip-tool/commands/clusters/ComplexArgument.h @@ -45,8 +45,8 @@ #include "JsonParser.h" -constexpr uint8_t kMaxLabelLength = UINT8_MAX; -constexpr const char kNullString[] = "null"; +inline constexpr uint8_t kMaxLabelLength = UINT8_MAX; +inline constexpr const char kNullString[] = "null"; class ComplexArgumentParser { diff --git a/examples/chip-tool/commands/clusters/WriteAttributeCommand.h b/examples/chip-tool/commands/clusters/WriteAttributeCommand.h index 46a0b3dc4b37dd..76dc64ef6201db 100644 --- a/examples/chip-tool/commands/clusters/WriteAttributeCommand.h +++ b/examples/chip-tool/commands/clusters/WriteAttributeCommand.h @@ -23,9 +23,9 @@ #include "DataModelLogger.h" #include "ModelCommand.h" -constexpr const char * kWriteCommandKey = "write"; -constexpr const char * kWriteByIdCommandKey = "write-by-id"; -constexpr const char * kForceWriteCommandKey = "force-write"; +inline constexpr const char * kWriteCommandKey = "write"; +inline constexpr const char * kWriteByIdCommandKey = "write-by-id"; +inline constexpr const char * kForceWriteCommandKey = "force-write"; enum class WriteCommandType { diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index d348211af7e9e7..944360fb2eea3a 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #if CHIP_CONFIG_TRANSPORT_TRACE_ENABLED #include "TraceDecoder.h" @@ -222,17 +223,17 @@ CHIP_ERROR CHIPCommand::Run() CHIP_ERROR err = StartWaiting(GetWaitDuration()); - bool deferCleanup = (IsInteractive() && DeferInteractiveCleanup()); - - Shutdown(); - - if (deferCleanup) + if (IsInteractive()) { - sDeferredCleanups.insert(this); + bool timedOut; + // Give it 2 hours to run our cleanup; that should never get hit in practice. + CHIP_ERROR cleanupErr = RunOnMatterQueue(RunCommandCleanup, chip::System::Clock::Seconds16(7200), &timedOut); + VerifyOrDie(cleanupErr == CHIP_NO_ERROR); + VerifyOrDie(!timedOut); } else { - Cleanup(); + CleanupAfterRun(); } MaybeTearDownStack(); @@ -504,6 +505,56 @@ void CHIPCommand::RunQueuedCommand(intptr_t commandArg) } } +void CHIPCommand::RunCommandCleanup(intptr_t commandArg) +{ + auto * command = reinterpret_cast(commandArg); + command->CleanupAfterRun(); + command->StopWaiting(); +} + +void CHIPCommand::CleanupAfterRun() +{ + assertChipStackLockedByCurrentThread(); + bool deferCleanup = (IsInteractive() && DeferInteractiveCleanup()); + + Shutdown(); + + if (deferCleanup) + { + sDeferredCleanups.insert(this); + } + else + { + Cleanup(); + } +} + +CHIP_ERROR CHIPCommand::RunOnMatterQueue(MatterWorkCallback callback, chip::System::Clock::Timeout timeout, bool * timedOut) +{ + { + std::lock_guard lk(cvWaitingForResponseMutex); + mWaitingForResponse = true; + } + + auto err = chip::DeviceLayer::PlatformMgr().ScheduleWork(callback, reinterpret_cast(this)); + if (CHIP_NO_ERROR != err) + { + { + std::lock_guard lk(cvWaitingForResponseMutex); + mWaitingForResponse = false; + } + return err; + } + + auto waitingUntil = std::chrono::system_clock::now() + std::chrono::duration_cast(timeout); + { + std::unique_lock lk(cvWaitingForResponseMutex); + *timedOut = !cvWaitingForResponse.wait_until(lk, waitingUntil, [this]() { return !this->mWaitingForResponse; }); + } + + return CHIP_NO_ERROR; +} + #if !CONFIG_USE_SEPARATE_EVENTLOOP static void OnResponseTimeout(chip::System::Layer *, void * appState) { @@ -526,28 +577,15 @@ CHIP_ERROR CHIPCommand::StartWaiting(chip::System::Clock::Timeout duration) } else { - { - std::lock_guard lk(cvWaitingForResponseMutex); - mWaitingForResponse = true; - } - - auto err = chip::DeviceLayer::PlatformMgr().ScheduleWork(RunQueuedCommand, reinterpret_cast(this)); + bool timedOut; + CHIP_ERROR err = RunOnMatterQueue(RunQueuedCommand, duration, &timedOut); if (CHIP_NO_ERROR != err) { - { - std::lock_guard lk(cvWaitingForResponseMutex); - mWaitingForResponse = false; - } return err; } - - auto waitingUntil = std::chrono::system_clock::now() + std::chrono::duration_cast(duration); + if (timedOut) { - std::unique_lock lk(cvWaitingForResponseMutex); - if (!cvWaitingForResponse.wait_until(lk, waitingUntil, [this]() { return !this->mWaitingForResponse; })) - { - mCommandExitStatus = CHIP_ERROR_TIMEOUT; - } + mCommandExitStatus = CHIP_ERROR_TIMEOUT; } } if (!IsInteractive()) diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 9d7c3c1a741ea6..f1cd84439eae49 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -34,9 +34,9 @@ #pragma once -constexpr const char kIdentityAlpha[] = "alpha"; -constexpr const char kIdentityBeta[] = "beta"; -constexpr const char kIdentityGamma[] = "gamma"; +inline constexpr const char kIdentityAlpha[] = "alpha"; +inline constexpr const char kIdentityBeta[] = "beta"; +inline constexpr const char kIdentityGamma[] = "gamma"; // The null fabric commissioner is a commissioner that isn't on a fabric. // This is a legal configuration in which the commissioner delegates // operational communication and invocation of the commssioning complete @@ -46,7 +46,7 @@ constexpr const char kIdentityGamma[] = "gamma"; // commissioner portion of such an architecture. The null-fabric-commissioner // can carry a commissioning flow up until the point of operational channel // (CASE) communcation. -constexpr const char kIdentityNull[] = "null-fabric-commissioner"; +inline constexpr const char kIdentityNull[] = "null-fabric-commissioner"; class CHIPCommand : public Command { @@ -220,6 +220,18 @@ class CHIPCommand : public Command static const chip::Credentials::AttestationTrustStore * sTrustStore; static void RunQueuedCommand(intptr_t commandArg); + typedef decltype(RunQueuedCommand) MatterWorkCallback; + static void RunCommandCleanup(intptr_t commandArg); + + // Do cleanup after a commmand is done running. Must happen with the + // Matter stack locked. + void CleanupAfterRun(); + + // Run the given callback on the Matter thread. Return whether we managed + // to successfully dispatch it to the Matter thread. If we did, *timedOut + // will be set to whether we timed out or whether our mWaitingForResponse + // got set to false by the callback itself. + CHIP_ERROR RunOnMatterQueue(MatterWorkCallback callback, chip::System::Clock::Timeout timeout, bool * timedOut); CHIP_ERROR mCommandExitStatus = CHIP_ERROR_INTERNAL; diff --git a/examples/chip-tool/commands/common/CustomStringPrefix.h b/examples/chip-tool/commands/common/CustomStringPrefix.h index 235e190fd8f924..63196f78dbe3da 100644 --- a/examples/chip-tool/commands/common/CustomStringPrefix.h +++ b/examples/chip-tool/commands/common/CustomStringPrefix.h @@ -22,17 +22,17 @@ #include -static constexpr char kJsonStringPrefix[] = "json:"; -constexpr size_t kJsonStringPrefixLen = ArraySize(kJsonStringPrefix) - 1; // Don't count the null +static constexpr char kJsonStringPrefix[] = "json:"; +inline constexpr size_t kJsonStringPrefixLen = ArraySize(kJsonStringPrefix) - 1; // Don't count the null -static constexpr char kBase64StringPrefix[] = "base64:"; -constexpr size_t kBase64StringPrefixLen = ArraySize(kBase64StringPrefix) - 1; // Don't count the null +static constexpr char kBase64StringPrefix[] = "base64:"; +inline constexpr size_t kBase64StringPrefixLen = ArraySize(kBase64StringPrefix) - 1; // Don't count the null -static constexpr char kHexStringPrefix[] = "hex:"; -constexpr size_t kHexStringPrefixLen = ArraySize(kHexStringPrefix) - 1; // Don't count the null +static constexpr char kHexStringPrefix[] = "hex:"; +inline constexpr size_t kHexStringPrefixLen = ArraySize(kHexStringPrefix) - 1; // Don't count the null -static constexpr char kStrStringPrefix[] = "str:"; -constexpr size_t kStrStringPrefixLen = ArraySize(kStrStringPrefix) - 1; // Don't count the null +static constexpr char kStrStringPrefix[] = "str:"; +inline constexpr size_t kStrStringPrefixLen = ArraySize(kStrStringPrefix) - 1; // Don't count the null inline bool IsJsonString(const char * str) { diff --git a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h index 0f5015e4711c71..4537f522081cff 100644 --- a/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h +++ b/examples/darwin-framework-tool/commands/common/CHIPCommandBridge.h @@ -28,9 +28,9 @@ #pragma once -constexpr const char kIdentityAlpha[] = "alpha"; -constexpr const char kIdentityBeta[] = "beta"; -constexpr const char kIdentityGamma[] = "gamma"; +inline constexpr const char kIdentityAlpha[] = "alpha"; +inline constexpr const char kIdentityBeta[] = "beta"; +inline constexpr const char kIdentityGamma[] = "gamma"; class CHIPCommandBridge : public Command { public: diff --git a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h index b3d08ecf051774..abcc56dffbaf9d 100644 --- a/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h +++ b/examples/darwin-framework-tool/commands/tests/TestCommandBridge.h @@ -41,7 +41,7 @@ const char basePath[] = "./src/app/tests/suites/commands/delay/scripts/"; const char * getScriptsFolder() { return basePath; } } // namespace -constexpr const char * kDefaultKey = "default"; +inline constexpr const char * kDefaultKey = "default"; @interface TestDeviceControllerDelegate : NSObject @property TestCommandBridge * commandBridge; @@ -58,7 +58,7 @@ constexpr const char * kDefaultKey = "default"; NS_ASSUME_NONNULL_END -constexpr uint16_t kTimeoutInSeconds = 90; +inline constexpr uint16_t kTimeoutInSeconds = 90; class TestCommandBridge : public CHIPCommandBridge, public ValueChecker, diff --git a/examples/java-matter-controller/Manifest.txt b/examples/java-matter-controller/Manifest.txt index f9f5a70c109c59..ff412c89d3fa20 100644 --- a/examples/java-matter-controller/Manifest.txt +++ b/examples/java-matter-controller/Manifest.txt @@ -1,3 +1,3 @@ Main-Class: com.matter.controller.MainKt -Class-Path: ../lib/third_party/connectedhomeip/src/controller/java/CHIPController.jar ../lib/third_party/connectedhomeip/src/setup_payload/java/OnboardingPayload.jar ../lib/third_party/connectedhomeip/third_party/java_deps/stub_src/Android.jar ../lib/third_party/connectedhomeip/third_party/java_deps/json-20220924.jar ../lib/third_party/connectedhomeip/third_party/java_deps/jsr305-3.0.2.jar ../lib/third_party/connectedhomeip/third_party/java_deps/kotlin-stdlib-1.8.10.jar +Class-Path: ../lib/third_party/connectedhomeip/src/controller/java/CHIPController.jar ../lib/third_party/connectedhomeip/src/setup_payload/java/OnboardingPayload.jar ../lib/third_party/connectedhomeip/third_party/java_deps/stub_src/Android.jar ../lib/third_party/connectedhomeip/third_party/java_deps/json-20220924.jar ../lib/third_party/connectedhomeip/third_party/java_deps/jsr305-3.0.2.jar ../lib/third_party/connectedhomeip/third_party/java_deps/kotlin-stdlib-1.8.20.jar diff --git a/examples/java-matter-controller/args.gni b/examples/java-matter-controller/args.gni index 5d279bfa552053..af9681d8d85eef 100644 --- a/examples/java-matter-controller/args.gni +++ b/examples/java-matter-controller/args.gni @@ -24,3 +24,4 @@ chip_project_config_include_dirs = [ "${chip_root}/examples/java-matter-controller/include" ] chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ] chip_stack_lock_tracking = "fatal" +chip_build_controller_dynamic_server = true diff --git a/examples/lighting-app/silabs/src/AppTask.cpp b/examples/lighting-app/silabs/src/AppTask.cpp index bb27d8c702bff5..542dc2fbfd55c8 100644 --- a/examples/lighting-app/silabs/src/AppTask.cpp +++ b/examples/lighting-app/silabs/src/AppTask.cpp @@ -101,7 +101,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/lock-app/silabs/src/AppTask.cpp b/examples/lock-app/silabs/src/AppTask.cpp index 7d86fec80a07d9..4e8527f4f4fa1a 100644 --- a/examples/lock-app/silabs/src/AppTask.cpp +++ b/examples/lock-app/silabs/src/AppTask.cpp @@ -190,7 +190,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/placeholder/linux/include/TestCommand.h b/examples/placeholder/linux/include/TestCommand.h index 7bd4d3b6e8497b..e078345f430643 100644 --- a/examples/placeholder/linux/include/TestCommand.h +++ b/examples/placeholder/linux/include/TestCommand.h @@ -35,9 +35,9 @@ #include #include -constexpr const char kIdentityAlpha[] = ""; -constexpr const char kIdentityBeta[] = ""; -constexpr const char kIdentityGamma[] = ""; +inline constexpr const char kIdentityAlpha[] = ""; +inline constexpr const char kIdentityBeta[] = ""; +inline constexpr const char kIdentityGamma[] = ""; class TestCommand : public TestRunner, public PICSChecker, diff --git a/examples/platform/silabs/BaseApplication.cpp b/examples/platform/silabs/BaseApplication.cpp index 09556e899b79a3..665c65bcda6a15 100644 --- a/examples/platform/silabs/BaseApplication.cpp +++ b/examples/platform/silabs/BaseApplication.cpp @@ -400,6 +400,7 @@ bool BaseApplication::ActivateStatusLedPatterns() return isPatternSet; } +// TODO Move State Monitoring elsewhere void BaseApplication::LightEventHandler() { // Collect connectivity and configuration state from the CHIP stack. Because @@ -420,8 +421,17 @@ void BaseApplication::LightEventHandler() sIsAttached = ConnectivityMgr().IsThreadAttached(); #endif /* CHIP_ENABLE_OPENTHREAD */ sHaveBLEConnections = (ConnectivityMgr().NumBLEConnections() != 0); + +#ifdef DISPLAY_ENABLED + SilabsLCD::DisplayStatus_t status; + status.connected = sIsEnabled && sIsAttached; + status.advertising = chip::Server::GetInstance().GetCommissioningWindowManager().IsCommissioningWindowOpen(); + status.nbFabric = chip::Server::GetInstance().GetFabricTable().FabricCount(); + slLCD.SetStatus(status); +#endif PlatformMgr().UnlockChipStack(); } + #endif // CHIP_CONFIG_ENABLE_ICD_SERVER #if (defined(ENABLE_WSTK_LEDS) && (defined(SL_CATALOG_SIMPLE_LED_LED1_PRESENT) || defined(SIWX_917))) @@ -473,9 +483,8 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent) mFunction = kFunction_NoneSelected; OutputQrCode(false); -#ifdef QR_CODE_ENABLED - // TOGGLE QRCode/LCD demo UI - slLCD.ToggleQRCode(); +#ifdef DISPLAY_ENABLED + slLCD.CycleScreens(); #endif #ifdef SL_WIFI @@ -732,7 +741,7 @@ void BaseApplication::OutputQrCode(bool refreshLCD) if (refreshLCD) { slLCD.SetQRCode((uint8_t *) setupPayload.data(), setupPayload.size()); - slLCD.ShowQRCode(true, true); + slLCD.ShowQRCode(true); } #endif // QR_CODE_ENABLED diff --git a/examples/platform/silabs/FreeRTOSConfig.h b/examples/platform/silabs/FreeRTOSConfig.h index e904f1930a6a61..bce38a6a579039 100644 --- a/examples/platform/silabs/FreeRTOSConfig.h +++ b/examples/platform/silabs/FreeRTOSConfig.h @@ -223,18 +223,24 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ #define configSUPPORT_STATIC_ALLOCATION (1) #define configSUPPORT_DYNAMIC_ALLOCATION (1) +#ifdef PW_RPC_ENABLED +#define EXTRA_HEAP_k 10 +#else +#define EXTRA_HEAP_k 0 +#endif + #ifndef configTOTAL_HEAP_SIZE #ifdef SL_WIFI #ifdef DIC_ENABLE -#define configTOTAL_HEAP_SIZE ((size_t)(68 * 1024)) +#define configTOTAL_HEAP_SIZE ((size_t)((68 + EXTRA_HEAP_k) * 1024)) #else -#define configTOTAL_HEAP_SIZE ((size_t)(42 * 1024)) +#define configTOTAL_HEAP_SIZE ((size_t)((42 + EXTRA_HEAP_k) * 1024)) #endif // DIC #else // SL_WIFI #if SL_CONFIG_OPENTHREAD_LIB == 1 -#define configTOTAL_HEAP_SIZE ((size_t)(40 * 1024)) +#define configTOTAL_HEAP_SIZE ((size_t)((40 + EXTRA_HEAP_k) * 1024)) #else -#define configTOTAL_HEAP_SIZE ((size_t)(38 * 1024)) +#define configTOTAL_HEAP_SIZE ((size_t)((38 + EXTRA_HEAP_k) * 1024)) #endif // SL_CONFIG_OPENTHREAD_LIB #endif // configTOTAL_HEAP_SIZE #endif // configTOTAL_HEAP_SIZE diff --git a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c index 8f738e36159dc6..6b7801e1fac3cc 100644 --- a/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c +++ b/examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.c @@ -35,7 +35,7 @@ #include "task.h" #include "wfx_host_events.h" -#include "rsi_ble_config.h" +#include "ble_config.h" #include "dhcp_client.h" #include "lwip/nd6.h" @@ -66,7 +66,7 @@ bool is_wifi_disconnection_event = false; /* Declare a variable to hold connection time intervals */ uint32_t retryInterval = WLAN_MIN_RETRY_TIMER_MS; volatile bool scan_results_complete = false; -#define WIFI_SCAN_TIMEOUT 10000 // WiFi Scan interval +#define WIFI_SCAN_TIMEOUT_TICK 10000 extern osSemaphoreId_t sl_rs_ble_init_sem; @@ -89,13 +89,12 @@ volatile sl_status_t callback_status = SL_STATUS_OK; int32_t wfx_rsi_get_ap_info(wfx_wifi_scan_result_t * ap) { sl_status_t status = SL_STATUS_OK; - uint8_t rssi = 0; + int32_t rssi = 0; ap->security = wfx_rsi.sec.security; ap->chan = wfx_rsi.ap_chan; memcpy(&ap->bssid[0], &wfx_rsi.ap_mac.octet[0], BSSID_MAX_STR_LEN); sl_wifi_get_signal_strength(SL_WIFI_CLIENT_INTERFACE, &rssi); ap->rssi = rssi; - return status; } @@ -182,12 +181,9 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t /* * Join was complete - Do the DHCP */ - SILABS_LOG("Join Completed %c: Join Event received with %u bytes payload\n", *result, result_length); + SILABS_LOG("join_callback_handler: join completed."); + SILABS_LOG("%c: Join Event received with %u bytes payload\n", *result, result_length); xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_CONN); - wfx_rsi.join_retries = 0; - retryInterval = WLAN_MIN_RETRY_TIMER_MS; - if (is_wifi_disconnection_event) - is_wifi_disconnection_event = false; callback_status = SL_STATUS_OK; return SL_STATUS_OK; } @@ -234,12 +230,12 @@ int32_t wfx_rsi_power_save() *****************************************************************************************/ int32_t wfx_wifi_rsi_init(void) { + SILABS_LOG("wfx_wifi_rsi_init started"); sl_status_t status; status = sl_wifi_init(&config, default_wifi_event_handler); if (status != SL_STATUS_OK) { SILABS_LOG("wfx_wifi_rsi_init failed %x", status); - return status; } return status; } @@ -252,9 +248,19 @@ int32_t wfx_wifi_rsi_init(void) * @return * None *****************************************************************************************/ -static int32_t wfx_rsi_init(void) +static sl_status_t wfx_rsi_init(void) { sl_status_t status; + +#ifndef RSI_M4_INTERFACE + status = wfx_wifi_rsi_init(); + if (status != SL_STATUS_OK) + { + SILABS_LOG("wfx_rsi_init failed %x", status); + return status; + } +#endif + status = sl_wifi_get_mac_address(SL_WIFI_CLIENT_INTERFACE, (sl_mac_address_t *) &wfx_rsi.sta_mac.octet[0]); if (status != SL_STATUS_OK) { @@ -269,13 +275,18 @@ static int32_t wfx_rsi_init(void) } /************************************************************************************* - * @fn sl_status_t scan_callback_handler + * @fn void wfx_show_err(char *msg) * @brief - * scan callback handler + * driver shows error message * @param[in] msg * @return - * sl_status_t + * None *****************************************************************************************/ +void wfx_show_err(char * msg) +{ + SILABS_LOG("wfx_show_err: message: %d", msg); +} + sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * scan_result, uint32_t result_length, void * arg) { if (CHECK_IF_EVENT_FAILED(event)) @@ -291,7 +302,7 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * } wfx_rsi.sec.security = WFX_SEC_UNSPECIFIED; wfx_rsi.ap_chan = scan_result->scan_info[0].rf_channel; - memcpy(&wfx_rsi.ap_mac.octet[0], scan_result->scan_info[0].bssid[0], BSSID_MAX_STR_LEN); + memcpy(&wfx_rsi.ap_mac.octet, scan_result->scan_info[0].bssid, BSSID_MAX_STR_LEN); switch (scan_result->scan_info[0].security_mode) { case SL_WIFI_OPEN: @@ -323,15 +334,6 @@ sl_status_t scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * scan_results_complete = true; return SL_STATUS_OK; } - -/************************************************************************************* - * @fn sl_status_t show_scan_results - * @brief - * driver shows scan results - * @param[in] msg - * @return - * sl_status_t - *****************************************************************************************/ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result) { ARGS_CHECK_NULL_POINTER(scan_result); @@ -339,10 +341,9 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result) wfx_wifi_scan_result_t ap; if (wfx_rsi.dev_state & WFX_RSI_ST_STA_CONNECTED) { - for (x = 0; x < scan_result->scan_count; x++) + for (x = 0; x < (int) scan_result->scan_count; x++) { strcpy(&ap.ssid[0], (char *) &scan_result->scan_info[x].ssid); - uint8_t * bssid = (uint8_t *) &scan_result->scan_info[x].bssid; if (wfx_rsi.scan_ssid) { SILABS_LOG("SCAN SSID: %s , ap scan: %s", wfx_rsi.scan_ssid, ap.ssid); @@ -373,15 +374,6 @@ sl_status_t show_scan_results(sl_wifi_scan_result_t * scan_result) } return SL_STATUS_OK; } - -/************************************************************************************* - * @fn bg_scan_callback_handler - * @brief - * scan for wifi events in background - * @param[in] - * @return - * SL_STATUS_OK - *****************************************************************************************/ sl_status_t bg_scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_t * result, uint32_t result_length, void * arg) { callback_status = show_scan_results(result); @@ -409,13 +401,12 @@ static void wfx_rsi_save_ap_info() // translation if (SL_STATUS_IN_PROGRESS == status) { const uint32_t start = osKernelGetTickCount(); - while (!scan_results_complete && (osKernelGetTickCount() - start) <= WIFI_SCAN_TIMEOUT) + while (!scan_results_complete && (osKernelGetTickCount() - start) <= WIFI_SCAN_TIMEOUT_TICK) { osThreadYield(); } status = scan_results_complete ? callback_status : SL_STATUS_TIMEOUT; } - return status; } /******************************************************************************************** @@ -425,9 +416,9 @@ static void wfx_rsi_save_ap_info() // translation * @return * None **********************************************************************************************/ -static void wfx_rsi_do_join(void) +static sl_status_t wfx_rsi_do_join(void) { - int32_t status; + sl_status_t status = SL_STATUS_OK; sl_wifi_security_t connect_security_mode; switch (wfx_rsi.sec.security) { @@ -445,8 +436,8 @@ static void wfx_rsi_do_join(void) connect_security_mode = SL_WIFI_OPEN; break; default: - SILABS_LOG("%s: error: unknown security type."); - return; + SILABS_LOG("error: unknown security type."); + return status; } if (wfx_rsi.dev_state & (WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED)) @@ -466,12 +457,7 @@ static void wfx_rsi_do_join(void) */ wfx_rsi.dev_state |= WFX_RSI_ST_STA_CONNECTING; - status = sl_wifi_set_join_callback(join_callback_handler, NULL); - if (SL_STATUS_OK != status) - { - SILABS_LOG(" Set Join Callback fail "); - return status; - } + sl_wifi_set_join_callback(join_callback_handler, NULL); /* Try to connect Wifi with given Credentials * untill there is a success or maximum number of tries allowed @@ -487,6 +473,7 @@ static void wfx_rsi_do_join(void) status = sl_net_set_credential(id, SL_NET_WIFI_PSK, &wfx_rsi.sec.passkey[0], strlen(wfx_rsi.sec.passkey)); if (SL_STATUS_OK != status) { + SILABS_LOG("wfx_rsi_do_join: RSI callback register join failed with status: %02x", status); return status; } @@ -509,21 +496,18 @@ static void wfx_rsi_do_join(void) } else { - if (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) + while (is_wifi_disconnection_event || wfx_rsi.join_retries <= WFX_RSI_CONFIG_MAX_JOIN) { 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); SILABS_LOG("%s: starting JOIN to %s after %d tries\n", __func__, (char *) &wfx_rsi.sec.ssid[0], wfx_rsi.join_retries); - wfx_rsi.join_retries += 1; - wfx_rsi.dev_state &= ~(WFX_RSI_ST_STA_CONNECTING | WFX_RSI_ST_STA_CONNECTED); - if (wfx_rsi.join_retries <= MAX_JOIN_RETRIES_COUNT) - { - xEventGroupSetBits(wfx_rsi.events, WFX_EVT_STA_START_JOIN); - } - wfx_retry_interval_handler(is_wifi_disconnection_event, wfx_rsi.join_retries); } } } + return status; } /********************************************************************************* @@ -543,10 +527,10 @@ void wfx_rsi_task(void * arg) TickType_t last_dhcp_poll, now; struct netif * sta_netif; (void) arg; - uint32_t rsi_status = wfx_rsi_init(); - if (rsi_status != RSI_SUCCESS) + sl_status_t status = wfx_rsi_init(); + if (status != RSI_SUCCESS) { - SILABS_LOG("%s: error: wfx_rsi_init with status: %02x", __func__, rsi_status); + SILABS_LOG("wfx_rsi_task: error: wfx_rsi_init with status: %02x", status); return; } wfx_lwip_start(); @@ -554,7 +538,7 @@ void wfx_rsi_task(void * arg) sta_netif = wfx_get_netif(SL_WFX_STA_INTERFACE); wfx_started_notify(); - SILABS_LOG("%s: starting event wait", __func__); + SILABS_LOG("wfx_rsi_task: starting event wait"); for (;;) { /* @@ -604,6 +588,14 @@ void wfx_rsi_task(void * arg) hasNotifiedIPV4 = false; } #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ + /* + * Checks if the IPv6 event has been notified, if not invoke the nd6_tmr, + * which starts the duplicate address detectation. + */ + if (!hasNotifiedIPV6) + { + nd6_tmr(); + } /* Checks if the assigned IPv6 address is preferred by evaluating * the first block of IPv6 address ( block 0) */ @@ -625,7 +617,7 @@ void wfx_rsi_task(void * arg) // saving the AP related info wfx_rsi_save_ap_info(); // Joining to the network - wfx_rsi_do_join(); + status = wfx_rsi_do_join(); } if (flags & WFX_EVT_STA_CONN) { @@ -664,9 +656,8 @@ void wfx_rsi_task(void * arg) if (!(wfx_rsi.dev_state & WFX_RSI_ST_SCANSTARTED)) { SILABS_LOG("%s: start SSID scan", __func__); - int x; sl_wifi_scan_configuration_t wifi_scan_configuration = { 0 }; - wfx_wifi_scan_result_t ap; + // TODO: Add scan logic sl_wifi_advanced_scan_configuration_t advanced_scan_configuration = { 0 }; int32_t status; @@ -676,23 +667,16 @@ void wfx_rsi_task(void * arg) advanced_scan_configuration.trigger_level_change = ADV_RSSI_TOLERANCE_THRESHOLD; advanced_scan_configuration.enable_multi_probe = ADV_MULTIPROBE; status = sl_wifi_set_advanced_scan_configuration(&advanced_scan_configuration); - VERIFY_STATUS_AND_RETURN(status); /* Terminate with end of scan which is no ap sent back */ wifi_scan_configuration.type = SL_WIFI_SCAN_TYPE_ADV_SCAN; wifi_scan_configuration.periodic_scan_interval = ADV_SCAN_PERIODICITY; - - status = sl_wifi_set_scan_callback(bg_scan_callback_handler, NULL); - if (SL_STATUS_OK != status) - { - return status; - } - + sl_wifi_set_scan_callback(bg_scan_callback_handler, NULL); status = sl_wifi_start_scan(SL_WIFI_CLIENT_2_4GHZ_INTERFACE, NULL, &wifi_scan_configuration); if (SL_STATUS_IN_PROGRESS == status) { printf("Scanning...\r\n"); const uint32_t start = osKernelGetTickCount(); - while (!scan_results_complete && (osKernelGetTickCount() - start) <= WIFI_SCAN_TIMEOUT) + while (!scan_results_complete && (osKernelGetTickCount() - start) <= WIFI_SCAN_TIMEOUT_TICK) { osThreadYield(); } @@ -740,6 +724,7 @@ void wfx_dhcp_got_ipv4(uint32_t ip) } #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ +#if !EXP_BOARD /* * WARNING - Taken from RSI and broken up * This is my own RSI stuff for not copying code and allocating an extra @@ -763,13 +748,14 @@ void * wfx_rsi_alloc_pkt(uint16_t data_length) /* Confirm if packet is allocated */ status = sl_si91x_allocate_command_buffer(&buffer, (void **) &packet, sizeof(sl_si91x_packet_t) + data_length, - SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME); + SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS); if (packet == NULL) { return SL_STATUS_ALLOCATION_FAILED; } return (void *) packet; } +#endif /******************************************************************************************** * @fn void wfx_rsi_pkt_add_data(void *p, uint8_t *buf, uint16_t len, uint16_t off) @@ -788,3 +774,29 @@ void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off) pkt = (sl_si91x_packet_t *) p; memcpy(((char *) pkt->data) + off, buf, len); } + +#if !EXP_BOARD +/******************************************************************************************** + * @fn int32_t wfx_rsi_send_data(void *p, uint16_t len) + * @brief + * Driver send a data + * @param[in] p: + * @param[in] len: + * @return + * None + **********************************************************************************************/ +int32_t wfx_rsi_send_data(void * p, uint16_t len) +{ + int32_t status; + sl_wifi_buffer_t * buffer; + buffer = (sl_wifi_buffer_t *) p; + + if (sl_si91x_driver_send_data_packet(SI91X_WLAN_CMD_QUEUE, buffer, RSI_SEND_RAW_DATA_RESPONSE_WAIT_TIME)) + { + SILABS_LOG("*ERR*EN-RSI:Send fail"); + return ERR_IF; + } + return status; +} + +#endif diff --git a/examples/platform/silabs/display/demo-ui-bitmaps.h b/examples/platform/silabs/display/demo-ui-bitmaps.h index 4b3650e39d6603..b5a6103a8fddb2 100644 --- a/examples/platform/silabs/display/demo-ui-bitmaps.h +++ b/examples/platform/silabs/display/demo-ui-bitmaps.h @@ -98,63 +98,38 @@ 0x7F, 0xFC, 0xFC, 0xFC, 0xE3, 0xF1, 0x87, 0x87, 0xC7, 0xDE, 0x88, 0x33, 0xC7, 0xCF, 0xFC, 0xFF, 0xFF, 0x03 #ifndef ON_DEMO_BITMAP // Unknown demo.... + #define ON_DEMO_BITMAP \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xC0, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x7F, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, \ - 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xF0, 0x0F, \ - 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFC, 0x3F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFE, 0x7F, 0xFE, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF8, 0x1F, 0xF8, 0x1F, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0F, 0xF0, \ - 0x0F, 0xFF, 0xFF, 0xFF, 0x7F, 0xE0, 0x07, 0xE0, 0x07, 0xFE, 0xFF, 0xFF, 0x7F, 0xC0, 0x03, 0xC0, 0x03, 0xFE, 0xFF, 0xFF, \ - 0x7F, 0xC0, 0x03, 0xC0, 0x03, 0xFE, 0xFF, 0xFF, 0x3F, 0xC0, 0x03, 0xC0, 0x03, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, \ - 0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, \ - 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, \ - 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, \ - 0x8F, 0x01, 0x80, 0x01, 0x80, 0xF1, 0xFF, 0xFF, 0xCF, 0x03, 0xC0, 0x03, 0xC0, 0xF3, 0xFF, 0xFF, 0xEF, 0x07, 0xE0, 0x07, \ - 0xE0, 0xF7, 0xFF, 0xFF, 0xFF, 0x0F, 0xF0, 0x0F, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0xF8, 0x1F, 0xF8, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x3F, 0xFC, 0x3F, 0xFC, 0xFF, 0xFF, 0xFF, 0x7F, 0x7E, 0x7E, 0x7E, 0x7E, 0xFE, 0xFF, 0xFF, 0x3F, 0xFC, 0x3F, 0xFC, \ - 0x3F, 0xFC, 0xFF, 0xFF, 0x1F, 0xF8, 0x1F, 0xF8, 0x1F, 0xF8, 0xFF, 0xFF, 0x1F, 0xF0, 0x0F, 0xF0, 0x0F, 0xF8, 0xFF, 0xFF, \ - 0x1F, 0xE0, 0x07, 0xE0, 0x07, 0xF8, 0xFF, 0xFF, 0x3F, 0xC0, 0x03, 0xC0, 0x03, 0xFC, 0xFF, 0xFF, 0x3F, 0x80, 0x01, 0x80, \ - 0x01, 0xFC, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, \ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, \ - 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x1F, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x80, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xB9, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB1, 0xFF, 0xFD, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xB5, \ + 0xF9, 0x0D, 0x30, 0x0C, 0xC3, 0xFF, 0xFF, 0xB5, 0xF6, 0x6D, 0xF6, 0x6D, 0x9B, 0xFF, 0xFF, 0xAD, 0xF6, 0x6D, 0x36, 0x6C, \ + 0x83, 0xFF, 0xFF, 0x8D, 0xF6, 0x6D, 0xB6, 0x6D, 0xFB, 0xFF, 0xFF, 0x9D, 0xF9, 0x6D, 0x36, 0x0C, 0x83, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xE1, 0xFF, 0xFF, 0xE7, 0x99, 0xF9, 0xFF, 0xFF, 0xFD, 0xFF, 0xFF, 0xE7, 0x99, \ + 0xF9, 0xFF, 0xFF, 0x7D, 0x6E, 0xC3, 0xE0, 0x99, 0xF9, 0xFF, 0xFF, 0xA1, 0x6D, 0xDB, 0xE6, 0x99, 0xF9, 0xFF, 0xFF, 0xBD, \ + 0x6D, 0xDB, 0xE6, 0x99, 0xF9, 0xFF, 0xFF, 0xBD, 0x6D, 0xDB, 0xE6, 0xFF, 0xFF, 0xFF, 0xFF, 0x7D, 0x9E, 0xDB, 0xE0, 0x99, \ + 0xF9, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF #endif #ifndef OFF_DEMO_BITMAP // Unknown demo.... -#define OFF_DEMO_BITMAP \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0x7F, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0xC0, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x7F, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0x1F, 0x00, 0x00, \ - 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, \ - 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, \ - 0x00, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, \ - 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, \ - 0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, \ - 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, \ - 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, \ - 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, \ - 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, \ - 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0x00, \ - 0x00, 0xF0, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, \ - 0x1F, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, 0x00, 0xFC, 0xFF, 0xFF, 0x3F, 0x00, 0x00, 0x00, \ - 0x00, 0xFC, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, \ - 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0x03, 0x00, 0x00, \ - 0xC0, 0xFF, 0xFF, 0xFF, 0xFF, 0x07, 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0x0F, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0x1F, 0x00, 0x00, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x01, 0x80, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x3F, 0xFC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF +#define OFF_DEMO_BITMAP ON_DEMO_BITMAP #endif #endif // SILABS_DEMO_UI_BITMAPS_H diff --git a/examples/platform/silabs/display/lcd.cpp b/examples/platform/silabs/display/lcd.cpp index 6a06be1c28f6c8..63a91795487963 100644 --- a/examples/platform/silabs/display/lcd.cpp +++ b/examples/platform/silabs/display/lcd.cpp @@ -25,6 +25,10 @@ #include "dmd.h" #include "glib.h" +#if (SIWX_917) +#include "rsi_chip.h" +#endif + #ifdef QR_CODE_ENABLED #include "qrcodegen.h" #endif // QR_CODE_ENABLED @@ -38,6 +42,7 @@ #define QR_CODE_VERSION 4 #define QR_CODE_MODULE_SIZE 3 #define QR_CODE_BORDER_SIZE 0 +#define SL_BOARD_ENABLE_DISPLAY_PIN 0 #ifdef QR_CODE_ENABLED static uint8_t qrCode[qrcodegen_BUFFER_LEN_FOR_VERSION(QR_CODE_VERSION)]; @@ -64,12 +69,19 @@ CHIP_ERROR SilabsLCD::Init(uint8_t * name, bool initialState) } /* Enable the memory lcd */ +#if (SIWX_917) + RSI_NPSSGPIO_InputBufferEn(SL_BOARD_ENABLE_DISPLAY_PIN, 1U); + RSI_NPSSGPIO_SetPinMux(SL_BOARD_ENABLE_DISPLAY_PIN, 0); + RSI_NPSSGPIO_SetDir(SL_BOARD_ENABLE_DISPLAY_PIN, 0); + RSI_NPSSGPIO_SetPin(SL_BOARD_ENABLE_DISPLAY_PIN, 1U); +#else status = sl_board_enable_display(); if (status != SL_STATUS_OK) { SILABS_LOG("Board Display enable fail %d", status); err = CHIP_ERROR_INTERNAL; } +#endif /* Initialize the DMD module for the DISPLAY device driver. */ status = DMD_init(0); @@ -125,12 +137,10 @@ int SilabsLCD::Update(void) void SilabsLCD::WriteDemoUI(bool state) { -#ifdef QR_CODE_ENABLED - if (mShowQRCode) + if (mCurrentScreen != DemoScreen) { - mShowQRCode = false; + mCurrentScreen = DemoScreen; } -#endif dState.mainState = state; WriteDemoUI(); } @@ -149,11 +159,104 @@ void SilabsLCD::WriteDemoUI() } } +void SilabsLCD::WriteStatus() +{ + uint8_t lineNb = 0; + char str[20]; + + GLIB_clear(&glibContext); + sprintf(str, "# Fabrics : %d", mStatus.nbFabric); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + + if (strlen(mStatus.networkName) >= sizeof(str)) + { + memcpy(str, mStatus.networkName, sizeof(str) - 1); + str[sizeof(str) - 1] = '\0'; + } + else + { + memcpy(str, mStatus.networkName, sizeof(str)); + } + +#if SL_WIFI + GLIB_drawStringOnLine(&glibContext, "SSID : ", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#else + GLIB_drawStringOnLine(&glibContext, "PANID : ", lineNb, GLIB_ALIGN_LEFT, 0, 0, true); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 64, 0, true); +#if CHIP_DEVICE_CONFIG_THREAD_FTD + GLIB_drawStringOnLine(&glibContext, "OT Type : FTD", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#else + GLIB_drawStringOnLine(&glibContext, "OT Type : MTD", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#endif // FTD +#endif + GLIB_drawStringOnLine(&glibContext, "", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + sprintf(str, "Connected : %c", mStatus.connected ? 'Y' : 'N'); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); + sprintf(str, "Advertising : %c", mStatus.advertising ? 'Y' : 'N'); + GLIB_drawStringOnLine(&glibContext, str, lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#if CHIP_CONFIG_ENABLE_ICD_SERVER + GLIB_drawStringOnLine(&glibContext, "Is ICD : Y", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#else + GLIB_drawStringOnLine(&glibContext, "Is ICD : N", lineNb++, GLIB_ALIGN_LEFT, 0, 0, true); +#endif + + updateDisplay(); +} + void SilabsLCD::SetCustomUI(customUICB cb) { customUI = cb; } +void SilabsLCD::SetScreen(Screen_e screen) +{ + if (screen >= InvalidScreen) + { + return; + } + + switch (screen) + { + case DemoScreen: + WriteDemoUI(); + break; + case StatusScreen: + WriteStatus(); + break; +#ifdef QR_CODE_ENABLED + case QRCodeScreen: + WriteQRCode(); + break; +#endif + default: + break; + } +} + +void SilabsLCD::CycleScreens(void) +{ +#ifdef QR_CODE_ENABLED + if (mCurrentScreen < QRCodeScreen) +#else + if (mCurrentScreen < StatusScreen) +#endif + { + mCurrentScreen++; + } + else + { + mCurrentScreen = DemoScreen; + } + + SetScreen(static_cast(mCurrentScreen)); +} + +void SilabsLCD::SetStatus(DisplayStatus_t & status) +{ + mStatus = status; +} + #ifdef QR_CODE_ENABLED void SilabsLCD::WriteQRCode() { @@ -194,19 +297,14 @@ void SilabsLCD::SetQRCode(uint8_t * str, uint32_t size) } } -void SilabsLCD::ShowQRCode(bool show, bool forceRefresh) +void SilabsLCD::ShowQRCode(bool show) { - if (show != mShowQRCode || forceRefresh) + if (mCurrentScreen != QRCodeScreen) { - (show) ? WriteQRCode() : WriteDemoUI(); - mShowQRCode = show; + mCurrentScreen = QRCodeScreen; } -} -void SilabsLCD::ToggleQRCode(void) -{ - (mShowQRCode) ? WriteDemoUI() : WriteQRCode(); - mShowQRCode = !mShowQRCode; + WriteQRCode(); } void SilabsLCD::LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h) diff --git a/examples/platform/silabs/display/lcd.h b/examples/platform/silabs/display/lcd.h index d375b7a133c9aa..9324f068b15742 100644 --- a/examples/platform/silabs/display/lcd.h +++ b/examples/platform/silabs/display/lcd.h @@ -33,6 +33,24 @@ class SilabsLCD { public: + typedef enum screen + { + DemoScreen = 0, + StatusScreen, +#ifdef QR_CODE_ENABLED + QRCodeScreen, +#endif + InvalidScreen, + } Screen_e; + + typedef struct dStatus + { + uint8_t nbFabric = 0; + bool connected = false; + char networkName[50] = { "TODO" }; + bool advertising = false; + } DisplayStatus_t; + typedef void (*customUICB)(GLIB_Context_t * context); CHIP_ERROR Init(uint8_t * name = nullptr, bool initialState = false); void * Context(); @@ -42,10 +60,13 @@ class SilabsLCD void WriteDemoUI(bool state); void SetCustomUI(customUICB cb); + void SetScreen(Screen_e screen); + void CycleScreens(void); + void SetStatus(DisplayStatus_t & status); + #ifdef QR_CODE_ENABLED void SetQRCode(uint8_t * str, uint32_t size); - void ShowQRCode(bool show, bool forceRefresh = false); - void ToggleQRCode(void); + void ShowQRCode(bool show); #endif private: @@ -55,13 +76,15 @@ class SilabsLCD bool protocol1 = false; /* data */ } DemoState_t; - void WriteQRCode(); void WriteDemoUI(); + void WriteStatus(); + #ifdef QR_CODE_ENABLED + void WriteQRCode(); void LCDFillRect(uint8_t x, uint8_t y, uint8_t w, uint8_t h); char mQRCodeBuffer[chip::QRCodeBasicSetupPayloadGenerator::kMaxQRCodeBase38RepresentationLength + 1]; - bool mShowQRCode = true; #endif + GLIB_Context_t glibContext; #ifdef SL_DEMO_NAME @@ -71,4 +94,7 @@ class SilabsLCD #endif customUICB customUI = nullptr; DemoState_t dState; + + DisplayStatus_t mStatus; + uint8_t mCurrentScreen = DemoScreen; }; diff --git a/examples/platform/silabs/efr32/BUILD.gn b/examples/platform/silabs/efr32/BUILD.gn index ec7091ad50dada..477ecf1214b0bf 100644 --- a/examples/platform/silabs/efr32/BUILD.gn +++ b/examples/platform/silabs/efr32/BUILD.gn @@ -62,10 +62,13 @@ if (chip_enable_wifi) { assert(use_rs9116 || use_wf200 || use_SiWx917) import("${chip_root}/src/platform/silabs/wifi_args.gni") - if (use_rs9116 || use_SiWx917) { + if (use_rs9116) { wiseconnect_sdk_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" import("rs911x/rs911x.gni") + } else if (use_SiWx917) { + wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk" + import("rs911x/rs9117.gni") } if (use_wf200) { import("wf200/wf200.gni") diff --git a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c index 62b14e0bd34b51..aff756aad8888a 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c +++ b/examples/platform/silabs/efr32/rs911x/hal/efx_spi.c @@ -51,11 +51,26 @@ #include "wfx_host_events.h" #include "wfx_rsi.h" +#ifdef CHIP_9117 +#include "cmsis_os2.h" +#include "sl_board_configuration.h" +#include "sl_net.h" +#include "sl_si91x_driver.h" +#include "sl_si91x_types.h" +#include "sl_wifi_callback_framework.h" +#include "sl_wifi_constants.h" +#include "sl_wifi_types.h" +#else #include "rsi_board_configuration.h" #include "rsi_driver.h" +#endif + #include "sl_device_init_dpll.h" #include "sl_device_init_hfxo.h" +#define DEFAULT_SPI_TRASFER_MODE 0 +// Macro to drive semaphore block minimun timer in milli seconds +#define RSI_SEM_BLOCK_MIN_TIMER_VALUE_MS (50) #if defined(SL_CATALOG_POWER_MANAGER_PRESENT) #include "sl_power_manager.h" #endif @@ -72,6 +87,8 @@ StaticSemaphore_t xEfxSpiIntfSemaBuffer; static SemaphoreHandle_t spiTransferLock; static TaskHandle_t spiInitiatorTaskHandle = NULL; +static uint32_t dummy_buffer; /* Used for DMA - when results don't matter */ + #if defined(EFR32MG12) #include "sl_spidrv_exp_config.h" extern SPIDRV_Handle_t sl_spidrv_exp_handle; @@ -174,6 +191,18 @@ void rsi_hal_board_init(void) sl_wfx_host_reset_chip(); } +// wifi-sdk +sl_status_t sl_si91x_host_bus_init(void) +{ + rsi_hal_board_init(); + return SL_STATUS_OK; +} + +void sl_si91x_host_enable_high_speed_bus() +{ + // dummy function for wifi-sdk +} + #if defined(EFR32MG24) void SPIDRV_SetBaudrate(uint32_t baudrate) @@ -342,11 +371,12 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint */ if (xlen <= MIN_XLEN || (tx_buf == NULL && rx_buf == NULL)) { - return RSI_ERROR_INVALID_PARAM; + rx_buf = (uint8_t *) &dummy_buffer; + tx_buf = (uint8_t *) &dummy_buffer; } (void) mode; // currently not used; - rsi_error_t rsiError = RSI_ERROR_NONE; + error_t rsiError = RSI_ERROR_NONE; xSemaphoreTake(spiTransferLock, portMAX_DELAY); @@ -398,3 +428,19 @@ int16_t rsi_spi_transfer(uint8_t * tx_buf, uint8_t * rx_buf, uint16_t xlen, uint #endif /* EFR32MG24 */ return rsiError; } + +/********************************************************************* + * @fn int16_t rsi_spi_transfer(uint8_t *tx_buf, uint8_t *rx_buf, uint16_t xlen, uint8_t mode) + * @brief + * Do a SPI transfer - Mode is 8/16 bit - But every 8 bit is aligned + * @param[in] tx_buf: + * @param[in] rx_buf: + * @param[in] xlen: + * @param[in] mode: + * @return + * None + **************************************************************************/ +sl_status_t sl_si91x_host_spi_transfer(const void * tx_buf, void * rx_buf, uint16_t xlen) +{ + return (rsi_spi_transfer((uint8_t *) tx_buf, rx_buf, xlen, DEFAULT_SPI_TRASFER_MODE)); +} diff --git a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c b/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c index b8edbd71cace76..b57bd9cf988f4f 100644 --- a/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c +++ b/examples/platform/silabs/efr32/rs911x/hal/rsi_hal_mcu_interrupt.c @@ -38,8 +38,16 @@ #include "wfx_host_events.h" #include "wfx_rsi.h" +#if (SIWX_917 | EXP_BOARD) +#include "sl_board_configuration.h" + +#include "sl_si91x_host_interface.h" + +void gpio_interrupt(uint8_t interrupt_number); +#else #include "rsi_board_configuration.h" #include "rsi_driver.h" +#endif typedef void (*UserIntCallBack_t)(void); UserIntCallBack_t call_back, gpio_callback; @@ -52,9 +60,13 @@ void rsi_gpio_irq_cb(uint8_t irqnum) { if (irqnum != SL_WFX_HOST_PINOUT_SPI_IRQ) return; +#if (SIWX_917 | EXP_BOARD) + sl_si91x_host_set_bus_event(NCP_HOST_BUS_RX_EVENT); +#else GPIO_IntClear(1 << SL_WFX_HOST_PINOUT_SPI_IRQ); if (call_back != NULL) (*call_back)(); +#endif } /*===================================================*/ diff --git a/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h new file mode 100644 index 00000000000000..056fb22817d22d --- /dev/null +++ b/examples/platform/silabs/efr32/rs911x/hal/sl_board_configuration.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _RSI_BOARD_CONFIGURATION_H_ +#define _RSI_BOARD_CONFIGURATION_H_ + +typedef struct +{ + unsigned char port; + unsigned char pin; +} sl_pin_t; + +#define PIN(port_id, pin_id) \ + (sl_pin_t) { .port = gpioPort##port_id, .pin = pin_id } + +#define PACKET_PENDING_INT_PRI 3 +#if defined(EFR32MG12_BRD4161A) || defined(BRD4161A) || defined(EFR32MG12_BRD4162A) || defined(BRD4162A) || \ + defined(EFR32MG12_BRD4163A) || defined(BRD4163A) || defined(EFR32MG12_BRD4164A) || defined(BRD4164A) || \ + defined(EFR32MG12_BRD4170A) || defined(BRD4170A) +// BRD4161-63-64 are pin to pin compatible for SPI +#include "brd4161a.h" +#elif defined(EFR32MG24_BRD4186C) || defined(BRD4186C) +#include "brd4186c.h" +#elif defined(EFR32MG24_BRD4187C) || defined(BRD4187C) +#include "brd4187c.h" +#else +#error "Need SPI Pins" +#endif +#if EXP_BOARD +#define RESET_PIN PIN(A, 6) +#define INTERRUPT_PIN PIN(A, 7) +#define SLEEP_CONFIRM_PIN PIN(A, 5) /* Exp hdr 7 */ +#endif + +#define NETWORK_INTERFACE_VALID(x) (x == SL_NET_DEFAULT_WIFI_CLIENT_INTERFACE) || (x == SL_NET_DEFAULT_WIFI_AP_INTERFACE) +#endif /* _RSI_BOARD_CONFIGURATION_H_ */ \ No newline at end of file diff --git a/examples/platform/silabs/efr32/rs911x/rs9117.gni b/examples/platform/silabs/efr32/rs911x/rs9117.gni index 9f7b895a660650..3aa5e3e775b999 100644 --- a/examples/platform/silabs/efr32/rs911x/rs9117.gni +++ b/examples/platform/silabs/efr32/rs911x/rs9117.gni @@ -2,63 +2,70 @@ import("//build_overrides/chip.gni") examples_plat_dir = "${chip_root}/examples/platform/silabs/efr32" wifi_sdk_dir = "${chip_root}/src/platform/silabs/efr32/wifi" -wisemcu_sdk_root = "${chip_root}/third_party/silabs/wisemcu-wifi-bt-sdk" +wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk" rs911x_src_plat = [ - "${examples_plat_dir}/rs911x/rsi_if.c", + "${examples_plat_dir}/rs911x/sl_wifi_if.c", "${examples_plat_dir}/rs911x/wfx_rsi_host.c", "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_interrupt.c", - "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_ioports.c", - "${examples_plat_dir}/rs911x/hal/rsi_hal_mcu_timer.c", "${examples_plat_dir}/rs911x/hal/efx_spi.c", "${wifi_sdk_dir}/wfx_notify.cpp", ] -# -# All the stuff from wiseconnect -# -rs911x_src_sapi = [ - "${wisemcu_sdk_root}/sapi/wlan/rsi_wlan_apis.c", - "${wisemcu_sdk_root}/sapi/common/rsi_apis_non_rom.c", - "${wisemcu_sdk_root}/sapi/common/rsi_apis_rom.c", - "${wisemcu_sdk_root}/sapi/common/rsi_common_apis.c", - "${wisemcu_sdk_root}/sapi/common/rsi_device_init_apis.c", - "${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_frame_rd_wr.c", - "${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_functs.c", - "${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_iface_init.c", - "${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_mem_rd_wr.c", - "${wisemcu_sdk_root}/sapi/driver/device_interface/spi/rsi_spi_reg_rd_wr.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_common.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_device_init.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_driver_event_handlers.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_driver.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_events_rom.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_events.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_iap.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_nwk_rom.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_nwk.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt_rom.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_pkt_mgmt.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_queue_rom.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_queue.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_scheduler_rom.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_scheduler.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_setregion_countryinfo.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_timer.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_utils_rom.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_utils.c", - "${wisemcu_sdk_root}/sapi/driver/rsi_wlan.c", - "${wisemcu_sdk_root}/sapi/rtos/freertos_wrapper/rsi_os_wrapper.c", +rs911x_inc_plat = [ + "${examples_plat_dir}/rs911x", + "${examples_plat_dir}/rs911x/hal", + "${wifi_sdk_root}/components/si91x/ble/inc", + + # si91x component + "${wifi_sdk_root}/components/si91x/inc", + "${wifi_sdk_root}/components/si91x/memory", + "${wifi_sdk_root}/components/si91x/sl_net/inc", + + # wifi component + "${wifi_sdk_root}/components/protocol/wifi/inc", + + # si91x_support component + "${wifi_sdk_root}/components/si91x_support/inc", + + # wifi_resources component + "${wifi_sdk_root}/resources/certificates", + "${wifi_sdk_root}/resources/defaults", + "${wifi_sdk_root}/resources/other", + + # network_manager component + "${wifi_sdk_root}/components/service/network_manager/inc", - # Apparently - the rsi library needs this (though we may not use use it) - "${wisemcu_sdk_root}/sapi/network/socket/rsi_socket.c", - "${wisemcu_sdk_root}/sapi/network/socket/rsi_socket_rom.c", + "${wifi_sdk_root}/components/protocol/wifi/si91x", ] rs911x_cflags = [ "-Wno-empty-body" ] +rs911x_src_sapi = [ + "${wifi_sdk_root}/components/si91x/src/sl_si91x_driver.c", + "${wifi_sdk_root}/components/si91x/spi_interface/sl_si91x_spi_driver.c", + "${wifi_sdk_root}/components/si91x/src/sl_rsi_utility.c", + "${wifi_sdk_root}/components/si91x/src/sl_si91x_callback_framework.c", + "${wifi_sdk_root}/components/si91x/threading/sli_si91x_multithreaded.c", + "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x.c", + "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_rsi_utility.c", + "${wifi_sdk_root}/components/si91x/sl_net/src/sl_net_si91x_integration_handler.c", -rs911x_inc_plat = [ - "${examples_plat_dir}/rs911x", - "${examples_plat_dir}/rs911x/hal", - "${wisemcu_sdk_root}/sapi/include", + # wifi component + "${wifi_sdk_root}/components/protocol/wifi/src/sl_wifi_callback_framework.c", + "${wifi_sdk_root}/components/protocol/wifi/si91x/sl_wifi.c", + + # basic_network_manager component + "${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_credentials.c", + "${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_profiles.c", + + # si91x_basic_buffers component + "${wifi_sdk_root}/components/si91x/memory/malloc_buffers.c", + + # si91x_support component + "${wifi_sdk_root}/components/si91x_support/src/sl_utility.c", + + # network_manager component + "${wifi_sdk_root}/components/service/network_manager/src/sl_net_basic_certificate_store.c", + "${wifi_sdk_root}/components/service/network_manager/src/sl_net.c", + "${wifi_sdk_root}/components/si91x/platforms/efx32/efx32_ncp_host.c", ] diff --git a/examples/platform/silabs/efr32/rs911x/sl_wifi_if.c b/examples/platform/silabs/efr32/rs911x/sl_wifi_if.c new file mode 120000 index 00000000000000..eae406da321152 --- /dev/null +++ b/examples/platform/silabs/efr32/rs911x/sl_wifi_if.c @@ -0,0 +1 @@ +../../SiWx917/SiWx917/sl_wifi_if.c \ No newline at end of file diff --git a/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h b/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h new file mode 100644 index 00000000000000..91acde1ecbcb2a --- /dev/null +++ b/examples/platform/silabs/efr32/rs911x/sl_wlan_config.h @@ -0,0 +1,109 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef RSI_CONFIG_H +#define RSI_CONFIG_H + +#include "ble_config.h" +#include "sl_wifi_device.h" + +//! Enable feature +#define RSI_ENABLE 1 +//! Disable feature +#define RSI_DISABLE 0 + +static const sl_wifi_device_configuration_t config = { + .boot_option = LOAD_NWP_FW, + .mac_address = NULL, + .band = SL_SI91X_WIFI_BAND_2_4GHZ, + .region_code = US, + .boot_config = { .oper_mode = SL_SI91X_CLIENT_MODE, + .coex_mode = SL_SI91X_WLAN_BLE_MODE, + .feature_bit_map = +#ifdef RSI_M4_INTERFACE + (SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE), +#else + (SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_AGGREGATION), +#endif + .tcp_ip_feature_bit_map = (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT | SL_SI91X_TCP_IP_FEAT_DNS_CLIENT | + SL_SI91X_TCP_IP_FEAT_SSL | SL_SI91X_TCP_IP_FEAT_BYPASS +#ifdef ipv6_FEATURE_REQUIRED + | SL_SI91X_TCP_IP_FEAT_DHCPV6_CLIENT | SL_SI91X_TCP_IP_FEAT_IPV6 +#endif + | SL_SI91X_TCP_IP_FEAT_ICMP | SL_SI91X_TCP_IP_FEAT_EXTENSION_VALID), + .custom_feature_bit_map = (SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID | RSI_CUSTOM_FEATURE_BIT_MAP), + .ext_custom_feature_bit_map = ( +#ifdef CHIP_917 + (RSI_EXT_CUSTOM_FEATURE_BIT_MAP) +#else // defaults +#ifdef RSI_M4_INTERFACE + (SL_SI91X_EXT_FEAT_256K_MODE | RSI_EXT_CUSTOM_FEATURE_BIT_MAP) +#else + (SL_SI91X_EXT_FEAT_384K_MODE | RSI_EXT_CUSTOM_FEATURE_BIT_MAP) +#endif +#endif + | (SL_SI91X_EXT_FEAT_BT_CUSTOM_FEAT_ENABLE) +#if (defined A2DP_POWER_SAVE_ENABLE) + | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2) +#endif + ), + .bt_feature_bit_map = (RSI_BT_FEATURE_BITMAP +#if (RSI_BT_GATT_ON_CLASSIC) + | SL_SI91X_BT_ATT_OVER_CLASSIC_ACL /* to support att over classic acl link */ +#endif + ), +#ifdef RSI_PROCESS_MAX_RX_DATA + .ext_tcp_ip_feature_bit_map = + (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID | SL_SI91X_EXT_TCP_MAX_RECV_LENGTH), +#else + .ext_tcp_ip_feature_bit_map = (RSI_EXT_TCPIP_FEATURE_BITMAP | SL_SI91X_CONFIG_FEAT_EXTENTION_VALID), +#endif + //! ENABLE_BLE_PROTOCOL in bt_feature_bit_map + .ble_feature_bit_map = + ((SL_SI91X_BLE_MAX_NBR_PERIPHERALS(RSI_BLE_MAX_NBR_PERIPHERALS) | + SL_SI91X_BLE_MAX_NBR_CENTRALS(RSI_BLE_MAX_NBR_CENTRALS) | + SL_SI91X_BLE_MAX_NBR_ATT_SERV(RSI_BLE_MAX_NBR_ATT_SERV) | + SL_SI91X_BLE_MAX_NBR_ATT_REC(RSI_BLE_MAX_NBR_ATT_REC)) | + SL_SI91X_FEAT_BLE_CUSTOM_FEAT_EXTENTION_VALID | SL_SI91X_BLE_PWR_INX(RSI_BLE_PWR_INX) | + SL_SI91X_BLE_PWR_SAVE_OPTIONS(RSI_BLE_PWR_SAVE_OPTIONS) | SL_SI91X_916_BLE_COMPATIBLE_FEAT_ENABLE +#if RSI_BLE_GATT_ASYNC_ENABLE + | SL_SI91X_BLE_GATT_ASYNC_ENABLE +#endif + ), + + .ble_ext_feature_bit_map = ((SL_SI91X_BLE_NUM_CONN_EVENTS(RSI_BLE_NUM_CONN_EVENTS) | + SL_SI91X_BLE_NUM_REC_BYTES(RSI_BLE_NUM_REC_BYTES)) +#if RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST + | SL_SI91X_BLE_INDICATE_CONFIRMATION_FROM_HOST // indication response from app +#endif +#if RSI_BLE_MTU_EXCHANGE_FROM_HOST + | SL_SI91X_BLE_MTU_EXCHANGE_FROM_HOST // MTU Exchange request initiation from app +#endif +#if RSI_BLE_SET_SCAN_RESP_DATA_FROM_HOST + | (SL_SI91X_BLE_SET_SCAN_RESP_DATA_FROM_HOST) // Set SCAN Resp Data from app +#endif +#if RSI_BLE_DISABLE_CODED_PHY_FROM_HOST + | (SL_SI91X_BLE_DISABLE_CODED_PHY_FROM_HOST) // Disable Coded PHY from app +#endif +#if BLE_SIMPLE_GATT + | SL_SI91X_BLE_GATT_INIT +#endif + ), + .config_feature_bit_map = (SL_SI91X_FEAT_SLEEP_GPIO_SEL_BITMAP | RSI_CONFIG_FEATURE_BITMAP) } +}; + +#endif \ No newline at end of file diff --git a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c index 4b75a7b0c30411..c12e4749b21040 100644 --- a/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c +++ b/examples/platform/silabs/efr32/rs911x/wfx_rsi_host.c @@ -32,7 +32,6 @@ #include "event_groups.h" #include "task.h" -#include "rsi_error.h" #include "wfx_host_events.h" #include "wfx_rsi.h" diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 74f1f879056ba5..09a8e898cd6a8d 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -53,11 +53,11 @@ using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; namespace { -constexpr EndpointId kExampleEndpointId = 1; -constexpr uint8_t kDefaultMinLevel = 0; -constexpr uint8_t kDefaultMaxLevel = 254; -constexpr uint8_t kButtonPushEvent = 1; -constexpr uint8_t kButtonReleaseEvent = 0; +inline constexpr EndpointId kExampleEndpointId = 1; +inline constexpr uint8_t kDefaultMinLevel = 0; +inline constexpr uint8_t kDefaultMaxLevel = 254; +inline constexpr uint8_t kButtonPushEvent = 1; +inline constexpr uint8_t kButtonReleaseEvent = 0; } // namespace class AppTaskCommon diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 969f3c14638ae3..bf7c87efe70c33 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -34,11 +34,6 @@ #include "OTAUtil.h" #endif -#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING -#include "ICDUtil.h" -#include -#endif - #include #include @@ -322,10 +317,6 @@ CHIP_ERROR AppTaskCommon::InitCommonParts(void) emberAfEndpointEnableDisable(kNetworkCommissioningEndpointSecondary, false); #endif -#ifdef CONFIG_CHIP_ICD_SUBSCRIPTION_HANDLING - chip::app::InteractionModelEngine::GetInstance()->RegisterReadHandlerAppCallback(&GetICDUtil()); -#endif - // We need to disable OpenThread to prevent writing to the NVS storage when factory reset occurs // The OpenThread thread is running during factory reset. The nvs_clear function is called during // factory reset, which makes the NVS storage innaccessible, but the OpenThread knows nothing diff --git a/examples/platform/telink/common/src/mainCommon.cpp b/examples/platform/telink/common/src/mainCommon.cpp index d88a6a981dd985..5adc0804872c72 100644 --- a/examples/platform/telink/common/src/mainCommon.cpp +++ b/examples/platform/telink/common/src/mainCommon.cpp @@ -142,7 +142,7 @@ int main(void) goto exit; } -#ifdef CONFIG_OPENTHREAD_MTD_SED +#ifdef CONFIG_CHIP_ENABLE_ICD_SUPPORT err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_SleepyEndDevice); #elif CONFIG_OPENTHREAD_MTD err = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice); diff --git a/examples/pump-app/silabs/src/AppTask.cpp b/examples/pump-app/silabs/src/AppTask.cpp index b37d10852d0bd9..2dab9268a9035c 100644 --- a/examples/pump-app/silabs/src/AppTask.cpp +++ b/examples/pump-app/silabs/src/AppTask.cpp @@ -110,7 +110,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/resource-monitoring-app/telink/.gitignore b/examples/resource-monitoring-app/telink/.gitignore new file mode 100644 index 00000000000000..84c048a73cc2e5 --- /dev/null +++ b/examples/resource-monitoring-app/telink/.gitignore @@ -0,0 +1 @@ +/build/ diff --git a/examples/resource-monitoring-app/telink/CMakeLists.txt b/examples/resource-monitoring-app/telink/CMakeLists.txt new file mode 100644 index 00000000000000..3b86c7ef67af8d --- /dev/null +++ b/examples/resource-monitoring-app/telink/CMakeLists.txt @@ -0,0 +1,91 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +cmake_minimum_required(VERSION 3.13.1) + +get_filename_component(CHIP_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/third_party/connectedhomeip REALPATH) +get_filename_component(TELINK_COMMON ${CHIP_ROOT}/examples/platform/telink REALPATH) +get_filename_component(GEN_DIR ${CHIP_ROOT}/zzz_generated/ REALPATH) + +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") + set(LOCAL_DTC_OVERLAY_FILE "${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD}.overlay") +else() + unset(LOCAL_DTC_OVERLAY_FILE) +endif() + +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") + set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay") +else() + unset(GLOBAL_DTC_OVERLAY_FILE) +endif() + +if(DTC_OVERLAY_FILE) + set(DTC_OVERLAY_FILE + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + CACHE STRING "" FORCE + ) +else() + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) +endif() + +set(CONF_FILE ${CHIP_ROOT}/config/telink/app/zephyr.conf prj.conf) + +# Load NCS/Zephyr build system +list(APPEND ZEPHYR_EXTRA_MODULES ${CHIP_ROOT}/config/telink/chip-module) +find_package(Zephyr HINTS $ENV{ZEPHYR_BASE}) + +project(chip-telink-resource-monitoring-example) + +include(${CHIP_ROOT}/config/telink/app/enable-gnu-std.cmake) +include(${CHIP_ROOT}/src/app/chip_data_model.cmake) + +target_compile_options(app PRIVATE -fpermissive) + +target_include_directories(app PRIVATE + include + ${GEN_DIR}/app-common + ${GEN_DIR}/resource-monitoring-app + ${TELINK_COMMON}/common/include + ${TELINK_COMMON}/util/include + ${CMAKE_CURRENT_SOURCE_DIR}/../resource-monitoring-common/include + ${CMAKE_CURRENT_SOURCE_DIR}/../resource-monitoring-common/include/delegates + ) + +add_definitions( + "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=" +) + +target_sources(app PRIVATE + src/AppTask.cpp + src/ZclCallbacks.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../resource-monitoring-common/src/ReplacementProductListManager.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../resource-monitoring-common/src/delegates/ActivatedCarbonFilterMonitoring.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../resource-monitoring-common/src/delegates/HepaFilterMonitoring.cpp + ${TELINK_COMMON}/common/src/mainCommon.cpp + ${TELINK_COMMON}/common/src/AppTaskCommon.cpp + ${TELINK_COMMON}/util/src/LEDWidget.cpp + ${TELINK_COMMON}/util/src/ButtonManager.cpp + ${TELINK_COMMON}/util/src/ThreadUtil.cpp + ${TELINK_COMMON}/util/src/PWMDevice.cpp + ) + +chip_configure_data_model(app + INCLUDE_SERVER + ZAP_FILE ${CMAKE_CURRENT_SOURCE_DIR}/../resource-monitoring-common/resource-monitoring-app.zap +) + +if(CONFIG_CHIP_OTA_REQUESTOR) + target_sources(app PRIVATE ${TELINK_COMMON}/util/src/OTAUtil.cpp) +endif() diff --git a/examples/resource-monitoring-app/telink/README.md b/examples/resource-monitoring-app/telink/README.md new file mode 100644 index 00000000000000..4512f038fb053c --- /dev/null +++ b/examples/resource-monitoring-app/telink/README.md @@ -0,0 +1,175 @@ +# Matter Telink Resource Monitoring Example Application + +You can use this example as a reference for creating your own application. + +![Telink B91 EVK](http://wiki.telink-semi.cn/wiki/assets/Hardware/B91_Generic_Starter_Kit_Hardware_Guide/connection_chart.png) + +## Build and flash + +1. Pull docker image from repository: + + ```bash + $ docker pull ghcr.io/project-chip/chip-build-telink:10 + ``` + +2. Run docker container: + + ```bash + $ docker run -it --rm -v ${CHIP_BASE}:/root/chip -v /dev/bus/usb:/dev/bus/usb --device-cgroup-rule "c 189:* rmw" ghcr.io/project-chip/chip-build-telink:10 + ``` + + here `${CHIP_BASE}` is directory which contains CHIP repo files **!!!Pay + attention that OUTPUT_DIR should contains ABSOLUTE path to output dir** + +3. Activate the build environment: + + ```bash + $ source ./scripts/activate.sh + ``` + +4. In the example dir run (replace __ with your board name, for + example, `tlsr9518adk80d` or `tlsr9528a`): + + ```bash + $ west build -b + ``` + +5. Flash binary: + + ``` + $ west flash --erase + ``` + +## Usage + +### UART + +To get output from device, connect UART to following pins: + +| Name | Pin | +| :--: | :---------------------------- | +| RX | PB3 (pin 17 of J34 connector) | +| TX | PB2 (pin 16 of J34 connector) | +| GND | GND | + +### Buttons + +The following buttons are available on **tlsr9518adk80d** board: + +| Name | Function | Description | +| :------- | :--------------------- | :----------------------------------------------------------------------------------------------------- | +| Button 1 | Factory reset | Perform factory reset to forget currently commissioned Thread network and back to uncommissioned state | +| Button 2 | NA | NA | +| Button 3 | Thread start | Commission thread with static credentials and enables the Thread on device | +| Button 4 | Open commission window | The button is opening commissioning window to perform commissioning over BLE | + +### LEDs + +#### Indicate current state of Thread network + +**Red** LED indicates current state of Thread network. It is able to be in +following states: + +| State | Description | +| :-------------------------- | :--------------------------------------------------------------------------- | +| Blinks with short pulses | Device is not commissioned to Thread, Thread is disabled | +| Blinks with frequent pulses | Device is commissioned, Thread enabled. Device trying to JOIN thread network | +| Blinks with wide pulses | Device commissioned and joined to thread network as CHILD | + +#### Indicate identify of device + +**Green** LED used to identify the device. The LED starts blinking when the +Identify command of the Identify cluster is received. The command's argument can +be used to specify the the effect. It is able to be in following effects: + +| Effect | Description | +| :------------------------------ | :--------------------------------------------------------------------------- | +| Blinks (200 ms on/200 ms off) | Blink (`Clusters::Identify::EffectIdentifierEnum::kBlink`) | +| Breathe (during 1000 ms) | Breathe (`Clusters::Identify::EffectIdentifierEnum::kBreathe`) | +| Blinks (50 ms on/950 ms off) | Okay (`Clusters::Identify::EffectIdentifierEnum::kOkay`) | +| Blinks (1000 ms on/1000 ms off) | Channel Change ( `Clusters::Identify::EffectIdentifierEnum::kChannelChange`) | +| Blinks (950 ms on/50 ms off) | Finish ( `Clusters::Identify::EffectIdentifierEnum::kFinishEffect`) | +| LED off | Stop (`Clusters::Identify::EffectIdentifierEnum::kStopEffect`) | + +### CHIP tool commands + +1. Build + [chip-tool cli](https://github.com/project-chip/connectedhomeip/blob/master/examples/chip-tool/README.md) + +2. Pair with device + + ``` + ${CHIP_TOOL_DIR}/chip-tool pairing ble-thread ${NODE_ID} hex:${DATASET} ${PIN_CODE} ${DISCRIMINATOR} + ``` + + Example: + + ``` + ./chip-tool pairing ble-thread 1234 hex:0e080000000000010000000300000f35060004001fffe0020811111111222222220708fd61f77bd3df233e051000112233445566778899aabbccddeeff030e4f70656e54687265616444656d6f010212340410445f2b5ca6f2a93a55ce570a70efeecb0c0402a0fff8 20202021 3840 + ``` + +### OTA with Linux OTA Provider + +OTA feature enabled by default only for ota-requestor-app example. To enable OTA +feature for another Telink example: + +- set CONFIG_CHIP_OTA_REQUESTOR=y in corresponding "prj.conf" configuration + file. + +After build application with enabled OTA feature, use next binary files: + +- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr-ota.bin - binary for OTA Provider + +All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have +higher SW version than base SW. Set CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=2 in +corresponding “prj.conf” configuration file. + +Usage of OTA: + +- Build the [Linux OTA Provider](../../ota-provider-app/linux) + + ``` + ./scripts/examples/gn_build_example.sh examples/ota-provider-app/linux out/ota-provider-app chip_config_network_layer_ble=false + ``` + +- Run the Linux OTA Provider with OTA image. + + ``` + ./chip-ota-provider-app -f zephyr-ota.bin + ``` + +- Provision the Linux OTA Provider using chip-tool + + ``` + ./chip-tool pairing onnetwork ${OTA_PROVIDER_NODE_ID} 20202021 + ``` + + here: + + - \${OTA_PROVIDER_NODE_ID} is the node id of Linux OTA Provider + +- Configure the ACL of the ota-provider-app to allow access + + ``` + ./chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null}, {"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": null, "targets": null}]' ${OTA_PROVIDER_NODE_ID} 0 + ``` + + here: + + - \${OTA_PROVIDER_NODE_ID} is the node id of Linux OTA Provider + +- Use the chip-tool to announce the ota-provider-app to start the OTA process + + ``` + ./chip-tool otasoftwareupdaterequestor announce-otaprovider ${OTA_PROVIDER_NODE_ID} 0 0 0 ${DEVICE_NODE_ID} 0 + ``` + + here: + + - \${OTA_PROVIDER_NODE_ID} is the node id of Linux OTA Provider + - \${DEVICE_NODE_ID} is the node id of paired device + +Once the transfer is complete, OTA requestor sends ApplyUpdateRequest command to +OTA provider for applying the image. Device will restart on successful +application of OTA image. diff --git a/examples/resource-monitoring-app/telink/include/AppConfig.h b/examples/resource-monitoring-app/telink/include/AppConfig.h new file mode 100644 index 00000000000000..211c2fb8ef03c0 --- /dev/null +++ b/examples/resource-monitoring-app/telink/include/AppConfig.h @@ -0,0 +1,27 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +// ---- Air Quality Example App Config ---- + +#define APP_USE_EXAMPLE_START_BUTTON 0 +#define APP_USE_THREAD_START_BUTTON 0 +#define APP_SET_DEVICE_INFO_PROVIDER 1 +#define APP_SET_NETWORK_COMM_ENDPOINT_SEC 0 +#define APP_USE_IDENTIFY_PWM 1 diff --git a/src/platform/telink/ICDUtil.h b/examples/resource-monitoring-app/telink/include/AppTask.h similarity index 62% rename from src/platform/telink/ICDUtil.h rename to examples/resource-monitoring-app/telink/include/AppTask.h index 33db1e97a051ac..c0e6c9080143e6 100644 --- a/src/platform/telink/ICDUtil.h +++ b/examples/resource-monitoring-app/telink/include/AppTask.h @@ -1,6 +1,7 @@ /* * * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,17 +18,20 @@ #pragma once -#include +#include "AppTaskCommon.h" -class ICDUtil : public chip::app::ReadHandler::ApplicationCallback +class AppTask : public AppTaskCommon { - CHIP_ERROR OnSubscriptionRequested(chip::app::ReadHandler & aReadHandler, - chip::Transport::SecureSession & aSecureSession) override; - friend ICDUtil & GetICDUtil(); - static ICDUtil sICDUtil; +private: + friend AppTask & GetAppTask(void); + friend class AppTaskCommon; + + CHIP_ERROR Init(void); + + static AppTask sAppTask; }; -inline ICDUtil & GetICDUtil() +inline AppTask & GetAppTask(void) { - return ICDUtil::sICDUtil; + return AppTask::sAppTask; } diff --git a/examples/resource-monitoring-app/telink/include/CHIPProjectConfig.h b/examples/resource-monitoring-app/telink/include/CHIPProjectConfig.h new file mode 100644 index 00000000000000..412932a59c3726 --- /dev/null +++ b/examples/resource-monitoring-app/telink/include/CHIPProjectConfig.h @@ -0,0 +1,39 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * Example project configuration file for CHIP. + * + * This is a place to put application or project-specific overrides + * to the default configuration values for general CHIP features. + * + */ + +#pragma once + +// Use a default pairing code if one hasn't been provisioned in flash. +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_PIN_CODE 20202021 +#define CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR 0xF00 + +/** + * CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE + * + * Reduce packet buffer pool size to 8 (default 15) to reduce ram consumption + */ +#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8 diff --git a/examples/resource-monitoring-app/telink/prj.conf b/examples/resource-monitoring-app/telink/prj.conf new file mode 100644 index 00000000000000..eec66455ef00cc --- /dev/null +++ b/examples/resource-monitoring-app/telink/prj.conf @@ -0,0 +1,66 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# This sample uses sample-defaults.conf to set options common for all +# samples. This file should contain only options specific for this sample +# or overrides of default values. + +# enable GPIO +CONFIG_GPIO=y + +# enable PWM +CONFIG_PWM=y + +# OpenThread configs +CONFIG_OPENTHREAD_MTD=y +CONFIG_CHIP_ENABLE_ICD_SUPPORT=y +CONFIG_CHIP_THREAD_SSED=n + +# Default OpenThread network settings +CONFIG_OPENTHREAD_PANID=4660 +CONFIG_OPENTHREAD_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThreadDemo" +CONFIG_OPENTHREAD_XPANID="11:11:11:11:22:22:22:22" + +# Disable Matter OTA DFU +CONFIG_CHIP_OTA_REQUESTOR=n + +# CHIP configuration +CONFIG_CHIP_PROJECT_CONFIG="include/CHIPProjectConfig.h" +CONFIG_CHIP_OPENTHREAD_CONFIG="../../platform/telink/project_include/OpenThreadConfig.h" + +CONFIG_CHIP_DEVICE_VENDOR_ID=65521 +# CHIP PID: 32769 == 0x8001 (all-clusters-app) +CONFIG_CHIP_DEVICE_PRODUCT_ID=32769 +CONFIG_CHIP_DEVICE_TYPE=65535 + +CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=1 +CONFIG_CHIP_DEVICE_SOFTWARE_VERSION_STRING="2022" + +# Enable CHIP pairing automatically on application start. +CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y + +# CHIP shell +CONFIG_CHIP_LIB_SHELL=n + +# Disable factory data support. +CONFIG_CHIP_FACTORY_DATA=n +CONFIG_CHIP_FACTORY_DATA_BUILD=n +CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n +CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n + +# Enable Power Management +CONFIG_PM=y diff --git a/examples/resource-monitoring-app/telink/src/AppTask.cpp b/examples/resource-monitoring-app/telink/src/AppTask.cpp new file mode 100644 index 00000000000000..bdd9fba11fa60e --- /dev/null +++ b/examples/resource-monitoring-app/telink/src/AppTask.cpp @@ -0,0 +1,72 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppTask.h" + +#include +#include +#include +#include +#include +#include +#include + +LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); + +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; +using namespace chip::app::Clusters::ResourceMonitoring; + +AppTask AppTask::sAppTask; + +constexpr std::bitset<4> gHepaFilterFeatureMap{ static_cast(Feature::kCondition) | + static_cast(Feature::kWarning) | + static_cast(Feature::kReplacementProductList) }; +constexpr std::bitset<4> gActivatedCarbonFeatureMap{ static_cast(Feature::kCondition) | + static_cast(Feature::kWarning) | + static_cast(Feature::kReplacementProductList) }; + +static HepaFilterMonitoringDelegate gHepaFilterDelegate; +static ResourceMonitoring::Instance gHepaFilterInstance(&gHepaFilterDelegate, 0x1, HepaFilterMonitoring::Id, + static_cast(gHepaFilterFeatureMap.to_ulong()), + Clusters::ResourceMonitoring::DegradationDirectionEnum::kDown, true); + +static ActivatedCarbonFilterMonitoringDelegate gActivatedCarbonFilterDelegate; +static ResourceMonitoring::Instance gActivatedCarbonFilterInstance(&gActivatedCarbonFilterDelegate, 0x1, + ActivatedCarbonFilterMonitoring::Id, + static_cast(gActivatedCarbonFeatureMap.to_ulong()), + Clusters::ResourceMonitoring::DegradationDirectionEnum::kDown, + true); + +CHIP_ERROR AppTask::Init(void) +{ + InitCommonParts(); + + gHepaFilterInstance.Init(); + gActivatedCarbonFilterInstance.Init(); + + CHIP_ERROR err = ConnectivityMgr().SetBLEDeviceName("TelinkResMonDevice"); + if (err != CHIP_NO_ERROR) + { + LOG_ERR("SetBLEDeviceName fail"); + return err; + } + + return CHIP_NO_ERROR; +} diff --git a/examples/resource-monitoring-app/telink/src/ZclCallbacks.cpp b/examples/resource-monitoring-app/telink/src/ZclCallbacks.cpp new file mode 100644 index 00000000000000..d622dcbe664407 --- /dev/null +++ b/examples/resource-monitoring-app/telink/src/ZclCallbacks.cpp @@ -0,0 +1,89 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * This file implements the handler for data model messages. + */ + +#include "AppConfig.h" + +#include +#include +#include +#include +#include + +using namespace ::chip; +using namespace ::chip::app::Clusters; + +LOG_MODULE_DECLARE(app, CONFIG_CHIP_APP_LOG_LEVEL); + +void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t type, uint16_t size, + uint8_t * value) +{ + ClusterId clusterId = attributePath.mClusterId; + AttributeId attributeId = attributePath.mAttributeId; + ChipLogProgress(Zcl, "Cluster callback: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); + + if (clusterId == HepaFilterMonitoring::Id && attributeId == HepaFilterMonitoring::Attributes::DegradationDirection::Id) + { + static_assert(sizeof(HepaFilterMonitoring::DegradationDirectionEnum) == 1, "Wrong size"); + HepaFilterMonitoring::DegradationDirectionEnum HepaFilterState = + *(reinterpret_cast(value)); + ChipLogProgress(Zcl, "Hepa Filter Monitoring cluster: " ChipLogFormatMEI " state %d", ChipLogValueMEI(clusterId), + to_underlying(HepaFilterState)); + } + else if (clusterId == ActivatedCarbonFilterMonitoring::Id && + attributeId == ActivatedCarbonFilterMonitoring::Attributes::DegradationDirection::Id) + { + static_assert(sizeof(ActivatedCarbonFilterMonitoring::DegradationDirectionEnum) == 1, "Wrong size"); + ActivatedCarbonFilterMonitoring::DegradationDirectionEnum CarbonFilterState = + *(reinterpret_cast(value)); + ChipLogProgress(Zcl, "Activated Carbon Filter cluster: " ChipLogFormatMEI " state %d", ChipLogValueMEI(clusterId), + to_underlying(CarbonFilterState)); + } +} + +/** @brief Hepa Filter Monitoring Cluster Init + * + * This function is called when a specific cluster is initialized. It gives the + * application an opportunity to take care of cluster initialization procedures. + * It is called exactly once for each endpoint where cluster is present. + * + * @param endpoint Ver.: always + * + */ +void emberAfHepaFilterMonitoringClusterInitCallback(EndpointId endpoint) +{ + // TODO: implement any additional Cluster Server init actions +} + +/** @brief Activated Carbon Filter Monitoring Cluster Init + * + * This function is called when a specific cluster is initialized. It gives the + * application an opportunity to take care of cluster initialization procedures. + * It is called exactly once for each endpoint where cluster is present. + * + * @param endpoint Ver.: always + * + */ +void emberAfActivatedCarbonFilterMonitoringClusterInitCallback(EndpointId endpoint) +{ + // TODO: implement any additional Cluster Server init actions +} diff --git a/examples/resource-monitoring-app/telink/third_party/connectedhomeip b/examples/resource-monitoring-app/telink/third_party/connectedhomeip new file mode 120000 index 00000000000000..c866b86874994d --- /dev/null +++ b/examples/resource-monitoring-app/telink/third_party/connectedhomeip @@ -0,0 +1 @@ +../../../.. \ No newline at end of file diff --git a/examples/rvc-app/README.md b/examples/rvc-app/README.md index a5d68613fc88bc..cd8bc0461fcbc1 100644 --- a/examples/rvc-app/README.md +++ b/examples/rvc-app/README.md @@ -57,7 +57,7 @@ Example command: PIXIT: `PIXIT_ENDPOINT:1 PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2` Example command: -`/scripts/tests/run_python_test.py --script src/python_testing/TC_RVCCLEANM_2_1.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt --int-arg PIXIT_ENDPOINT:1 PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"` +`./scripts/tests/run_python_test.py --script src/python_testing/TC_RVCCLEANM_2_1.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt --int-arg PIXIT_ENDPOINT:1 PIXIT.RVCCLEANM.MODE_CHANGE_FAIL:1 PIXIT.RVCCLEANM.MODE_CHANGE_OK:2"` When asked "Manually put the device in a state from which it will FAIL to transition to mode 1", set the `RvcRunMode` to 1. @@ -69,8 +69,11 @@ transition to mode 2", set the `RvcRunMode` to 0. #### TC 3.2 -This is not applicable because this RVC device does not support the -`StartUpMode` attribute. +PIXIT: `PIXIT_ENDPOINT:1` +Example command: +`./scripts/tests/run_python_test.py --script src/python_testing/TC_RVCCLEANM_3_2.py --script-args "--storage-path admin_storage.json --PICS examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt --int-arg PIXIT_ENDPOINT:1"` + +When asked "Physically power cycle the device", do so. ### RVC Run Mode cluster diff --git a/examples/rvc-app/run_all_yaml_tests.sh b/examples/rvc-app/run_all_yaml_tests.sh index a599a6139cdf95..4bf9e7261a7f9e 100755 --- a/examples/rvc-app/run_all_yaml_tests.sh +++ b/examples/rvc-app/run_all_yaml_tests.sh @@ -8,10 +8,7 @@ NODEID=$1 RVC_DEVICE_ENDPOINT=1 - -PICS_RUN="examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt" -PICS_CLEAN="examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt" -PICS_OP_STATE="examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt" +RVC_DEVICE_PICS="examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt" if [ -z "$NODEID" ]; then echo "Usage: run_all_yaml_tests [Node ID]" @@ -19,12 +16,12 @@ if [ -z "$NODEID" ]; then fi # RVC Clean Mode cluster -./scripts/tests/yaml/chiptool.py tests Test_TC_RVCCLEANM_1_1 --PICS "$PICS_CLEAN" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && +./scripts/tests/yaml/chiptool.py tests Test_TC_RVCCLEANM_1_1 --PICS "$RVC_DEVICE_PICS" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && # RVC Operational State cluster - ./scripts/tests/yaml/chiptool.py tests Test_TC_RVCOPSTATE_1_1 --PICS "$PICS_OP_STATE" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && - ./scripts/tests/yaml/chiptool.py tests Test_TC_RVCOPSTATE_2_2 --PICS "$PICS_OP_STATE" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && + ./scripts/tests/yaml/chiptool.py tests Test_TC_RVCOPSTATE_1_1 --PICS "$RVC_DEVICE_PICS" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && + ./scripts/tests/yaml/chiptool.py tests Test_TC_RVCOPSTATE_2_2 --PICS "$RVC_DEVICE_PICS" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && # RVC Run Mode cluster - ./scripts/tests/yaml/chiptool.py tests Test_TC_RVCRUNM_1_1 --PICS "$PICS_RUN" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && + ./scripts/tests/yaml/chiptool.py tests Test_TC_RVCRUNM_1_1 --PICS "$RVC_DEVICE_PICS" --nodeId "$NODEID" --endpoint "$RVC_DEVICE_ENDPOINT" && echo done diff --git a/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml b/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml index ce0ddaa38b5307..c5776d9553a9bb 100644 --- a/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml +++ b/examples/rvc-app/rvc-common/pics/RVC Clean Mode Cluster Test Plan.xml @@ -61,7 +61,7 @@ Draft Does the device implement the StartUpMode attribute? 89.2.2. Attributes - allclusters.html[pdf] O - false + true RVCCLEANM.S.A0003 diff --git a/examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt b/examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt index d0c8529a83d2e0..c4c5ef7586bdce 100644 --- a/examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt +++ b/examples/rvc-app/rvc-common/pics/RVC_App_Test_Plan.txt @@ -1,7 +1,7 @@ RVCCLEANM.S=1 RVCCLEANM.S.A0000=1 RVCCLEANM.S.A0001=1 -RVCCLEANM.S.A0002=0 +RVCCLEANM.S.A0002=1 RVCCLEANM.S.A0003=0 RVCCLEANM.S.C01.Tx=1 RVCCLEANM.S.C00.Rsp=1 diff --git a/examples/rvc-app/rvc-common/rvc-app.matter b/examples/rvc-app/rvc-common/rvc-app.matter index fae920d56cafae..a337abfc3f47f2 100644 --- a/examples/rvc-app/rvc-common/rvc-app.matter +++ b/examples/rvc-app/rvc-common/rvc-app.matter @@ -929,6 +929,7 @@ server cluster RvcCleanMode = 85 { readonly attribute ModeOptionStruct supportedModes[] = 0; readonly attribute int8u currentMode = 1; + attribute nullable int8u startUpMode = 2; readonly attribute command_id generatedCommandList[] = 65528; readonly attribute command_id acceptedCommandList[] = 65529; readonly attribute event_id eventList[] = 65530; @@ -1174,6 +1175,7 @@ endpoint 1 { server cluster RvcCleanMode { callback attribute supportedModes; callback attribute currentMode; + callback attribute startUpMode; callback attribute generatedCommandList; callback attribute acceptedCommandList; callback attribute eventList; diff --git a/examples/rvc-app/rvc-common/rvc-app.zap b/examples/rvc-app/rvc-common/rvc-app.zap index 34580f98854834..b51d888203a786 100644 --- a/examples/rvc-app/rvc-common/rvc-app.zap +++ b/examples/rvc-app/rvc-common/rvc-app.zap @@ -1,5 +1,5 @@ { - "featureLevel": 97, + "featureLevel": 98, "creator": "zap", "keyValuePairs": [ { @@ -33,10 +33,9 @@ ], "endpointTypes": [ { - "id": 12, + "id": 1, "name": "MA-rootdevice", "deviceTypeRef": { - "id": 177, "code": 22, "profileId": 259, "label": "MA-rootdevice", @@ -44,16 +43,12 @@ }, "deviceTypes": [ { - "id": 177, "code": 22, "profileId": 259, "label": "MA-rootdevice", "name": "MA-rootdevice" } ], - "deviceTypeRefs": [ - 177 - ], "deviceVersions": [ 1 ], @@ -5420,10 +5415,9 @@ ] }, { - "id": 11, + "id": 2, "name": "Anonymous Endpoint Type", "deviceTypeRef": { - "id": 225, "code": 116, "profileId": 259, "label": "MA-robotic-vacuum-cleaner", @@ -5431,16 +5425,12 @@ }, "deviceTypes": [ { - "id": 225, "code": 116, "profileId": 259, "label": "MA-robotic-vacuum-cleaner", "name": "MA-robotic-vacuum-cleaner" } ], - "deviceTypeRefs": [ - 225 - ], "deviceVersions": [ 1 ], @@ -7705,11 +7695,11 @@ "mfgCode": null, "side": "server", "type": "int8u", - "included": 0, + "included": 1, "storageOption": "External", "singleton": 0, "bounded": 0, - "defaultValue": "", + "defaultValue": null, "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/shell/shell_common/include/Globals.h b/examples/shell/shell_common/include/Globals.h index fd2726c3e1f6ef..d91620ca0ad171 100644 --- a/examples/shell/shell_common/include/Globals.h +++ b/examples/shell/shell_common/include/Globals.h @@ -28,10 +28,10 @@ #include #if INET_CONFIG_ENABLE_TCP_ENDPOINT -constexpr size_t kMaxTcpActiveConnectionCount = 4; -constexpr size_t kMaxTcpPendingPackets = 4; +inline constexpr size_t kMaxTcpActiveConnectionCount = 4; +inline constexpr size_t kMaxTcpPendingPackets = 4; #endif -constexpr chip::System::Clock::Timeout kResponseTimeOut = chip::System::Clock::Seconds16(1); +inline constexpr chip::System::Clock::Timeout kResponseTimeOut = chip::System::Clock::Seconds16(1); extern chip::FabricTable gFabricTable; extern chip::secure_channel::MessageCounterManager gMessageCounterManager; diff --git a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp index 153f2e7073bcb7..0ead0862709abd 100644 --- a/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp +++ b/examples/smoke-co-alarm-app/silabs/src/AppTask.cpp @@ -96,7 +96,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/examples/tv-casting-app/linux/CastingUtils.h b/examples/tv-casting-app/linux/CastingUtils.h index 13d9818662e3af..d87a8318948c76 100644 --- a/examples/tv-casting-app/linux/CastingUtils.h +++ b/examples/tv-casting-app/linux/CastingUtils.h @@ -26,7 +26,7 @@ #include "TargetEndpointInfo.h" #include "TargetVideoPlayerInfo.h" -constexpr uint32_t kCommissionerDiscoveryTimeoutInMs = 5 * 1000; +inline constexpr uint32_t kCommissionerDiscoveryTimeoutInMs = 5 * 1000; CHIP_ERROR ProcessClusterCommand(int argc, char ** argv); 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 fd427afc712639..f6078dd1a855f1 100644 --- a/examples/tv-casting-app/tv-casting-common/include/CastingServer.h +++ b/examples/tv-casting-app/tv-casting-common/include/CastingServer.h @@ -40,7 +40,7 @@ #include #include -constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = chip::System::Clock::Seconds16(3 * 60); +inline constexpr chip::System::Clock::Seconds16 kCommissioningWindowTimeout = chip::System::Clock::Seconds16(3 * 60); /** * @brief Represents a TV Casting server that can get the casting app commissioned diff --git a/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h b/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h index f0774c3d0a2c23..2e4b7c90167458 100644 --- a/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h +++ b/examples/tv-casting-app/tv-casting-common/include/PersistenceManager.h @@ -21,7 +21,7 @@ #include "TargetEndpointInfo.h" #include "TargetVideoPlayerInfo.h" -constexpr size_t kMaxCachedVideoPlayers = 32; +inline constexpr size_t kMaxCachedVideoPlayers = 32; class PersistenceManager : public chip::FabricTable::Delegate { diff --git a/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h b/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h index 31cfde0d02b3f6..f93251e327f7a0 100644 --- a/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h +++ b/examples/tv-casting-app/tv-casting-common/include/TargetEndpointInfo.h @@ -20,7 +20,7 @@ #include -constexpr size_t kMaxNumberOfClustersPerEndpoint = 10; +inline constexpr size_t kMaxNumberOfClustersPerEndpoint = 10; class TargetEndpointInfo { 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 bbc086ae64a52d..d027a19edfb512 100644 --- a/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h +++ b/examples/tv-casting-app/tv-casting-common/include/TargetVideoPlayerInfo.h @@ -25,7 +25,7 @@ #include -constexpr size_t kMaxNumberOfEndpoints = 5; +inline constexpr size_t kMaxNumberOfEndpoints = 5; class TargetVideoPlayerInfo; class VideoPlayerConnectionContext diff --git a/examples/window-app/silabs/src/AppTask.cpp b/examples/window-app/silabs/src/AppTask.cpp index 4765c48fa4d987..92c80531080acb 100644 --- a/examples/window-app/silabs/src/AppTask.cpp +++ b/examples/window-app/silabs/src/AppTask.cpp @@ -94,7 +94,7 @@ CHIP_ERROR AppTask::Init() if (!ConnectivityMgr().IsThreadProvisioned()) #endif /* !SL_WIFI */ { - GetLCD().ShowQRCode(true, true); + GetLCD().ShowQRCode(true); } #endif // QR_CODE_ENABLED #endif diff --git a/integrations/docker/images/base/chip-build/version b/integrations/docker/images/base/chip-build/version index 23c2b67d803b65..8bf131112d0c88 100644 --- a/integrations/docker/images/base/chip-build/version +++ b/integrations/docker/images/base/chip-build/version @@ -1 +1 @@ -11 : [ESP32] Update IDF to release v5.1.1 +12 : [Telink] Update Docker image (Zephyr update) diff --git a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile index cd2fdcc1e9c509..040a5b32bba096 100644 --- a/integrations/docker/images/stage-2/chip-build-telink/Dockerfile +++ b/integrations/docker/images/stage-2/chip-build-telink/Dockerfile @@ -24,7 +24,7 @@ RUN set -x \ && : # last line # Setup Zephyr -ARG ZEPHYR_REVISION=333abf31311e73def9db739026d217fca547a01f +ARG ZEPHYR_REVISION=31278e7f9a0103e369e9255f921e04986eb57eb3 WORKDIR /opt/telink/zephyrproject RUN set -x \ && python3 -m pip install -U --no-cache-dir \ diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 7b462089a8f218..10a8da19eba038 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -696,6 +696,7 @@ def BuildTelinkTarget(): TargetPart('ota-requestor', app=TelinkApp.OTA_REQUESTOR), TargetPart('pump', app=TelinkApp.PUMP), TargetPart('pump-controller', app=TelinkApp.PUMP_CONTROLLER), + TargetPart('resource-monitoring', app=TelinkApp.RESOURCE_MONITORING), TargetPart('shell', app=TelinkApp.SHELL), TargetPart('smoke-co-alarm', app=TelinkApp.SMOKE_CO_ALARM), TargetPart('temperature-measurement', diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index 754bc077f46254..5e62a5152bc205 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -31,6 +31,7 @@ class TelinkApp(Enum): OTA_REQUESTOR = auto() PUMP = auto() PUMP_CONTROLLER = auto() + RESOURCE_MONITORING = auto() SHELL = auto() SMOKE_CO_ALARM = auto() TEMPERATURE_MEASUREMENT = auto() @@ -58,6 +59,8 @@ def ExampleName(self): return 'pump-app' elif self == TelinkApp.PUMP_CONTROLLER: return 'pump-controller-app' + elif self == TelinkApp.RESOURCE_MONITORING: + return 'resource-monitoring-app' elif self == TelinkApp.SHELL: return 'shell' elif self == TelinkApp.SMOKE_CO_ALARM: @@ -92,6 +95,8 @@ def AppNamePrefix(self): return 'chip-telink-pump-example' elif self == TelinkApp.PUMP_CONTROLLER: return 'chip-telink-pump-controller-example' + elif self == TelinkApp.RESOURCE_MONITORING: + return 'chip-telink-resource-monitoring-example' elif self == TelinkApp.SHELL: return 'chip-telink-shell-example' elif self == TelinkApp.SMOKE_CO_ALARM: diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 91bbc0a326c831..b501e2fbaff3e7 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -22,5 +22,5 @@ nrf-native-posix-64-tests qpg-qpg6105-{lock,light,shell,persistent-storage} stm32-stm32wb5mm-dk-light tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan] -telink-{tlsr9518adk80d,tlsr9528a}-{all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-shell][-rpc][-factory-data] +telink-{tlsr9518adk80d,tlsr9528a}-{all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,resource-monitoring,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-shell][-rpc][-factory-data] openiotsdk-{shell,lock}[-mbedtls][-psa] diff --git a/scripts/examples/openiotsdk_example.sh b/scripts/examples/openiotsdk_example.sh index ea33d6026526e9..36c748cc8d1aa2 100755 --- a/scripts/examples/openiotsdk_example.sh +++ b/scripts/examples/openiotsdk_example.sh @@ -268,7 +268,7 @@ function run_test() { fi set +e - pytest --json-report --json-report-summary --json-report-file="$EXAMPLE_TEST_PATH"/test_report_"$EXAMPLE".json --binaryPath="$EXAMPLE_EXE_PATH" --fvp="$FVP_BIN" --fvpConfig="$FVP_CONFIG_FILE" "${TEST_OPTIONS[@]}" "$EXAMPLE_TEST_PATH"/test_app.py + pytest --log-level=INFO --json-report --json-report-summary --json-report-file="$EXAMPLE_TEST_PATH"/test_report_"$EXAMPLE".json --binaryPath="$EXAMPLE_EXE_PATH" --fvp="$FVP_BIN" --fvpConfig="$FVP_CONFIG_FILE" "${TEST_OPTIONS[@]}" "$EXAMPLE_TEST_PATH"/test_app.py set -e if [[ ! -f $EXAMPLE_TEST_PATH/test_report_$EXAMPLE.json ]]; then diff --git a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h index 88401280135ed7..039211fb318fc0 100644 --- a/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/all-clusters-app/app-templates/endpoint_config.h @@ -26,7 +26,7 @@ // Default values for the attributes longer than a pointer, // in a form of a binary blob // Separate block is generated for big-endian and little-endian cases. -#if BIGENDIAN_CPU +#if CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS \ { \ \ @@ -145,7 +145,7 @@ 2, 'B', '3', \ } -#else // !BIGENDIAN_CPU +#else // !CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS \ { \ \ @@ -264,7 +264,7 @@ 2, 'B', '3', \ } -#endif // BIGENDIAN_CPU +#endif // CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS_COUNT (32) diff --git a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h index b9f2e8d69093bf..de91e763395913 100644 --- a/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h +++ b/scripts/tools/zap/tests/outputs/lighting-app/app-templates/endpoint_config.h @@ -26,7 +26,7 @@ // Default values for the attributes longer than a pointer, // in a form of a binary blob // Separate block is generated for big-endian and little-endian cases. -#if BIGENDIAN_CPU +#if CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS \ { \ \ @@ -41,7 +41,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } -#else // !BIGENDIAN_CPU +#else // !CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS \ { \ \ @@ -56,7 +56,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \ } -#endif // BIGENDIAN_CPU +#endif // CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS_COUNT (2) diff --git a/src/access/AccessControl.cpp b/src/access/AccessControl.cpp index 5de61422afe68d..0fbda8803968f7 100644 --- a/src/access/AccessControl.cpp +++ b/src/access/AccessControl.cpp @@ -23,18 +23,19 @@ #include "AccessControl.h" +#include + namespace chip { namespace Access { using chip::CATValues; using chip::FabricIndex; using chip::NodeId; -using namespace chip::Access; namespace { -AccessControl defaultAccessControl; -AccessControl * globalAccessControl = &defaultAccessControl; +Global defaultAccessControl; +AccessControl * globalAccessControl = nullptr; // lazily defaulted to defaultAccessControl in GetAccessControl static_assert(((unsigned(Privilege::kAdminister) & unsigned(Privilege::kManage)) == 0) && ((unsigned(Privilege::kAdminister) & unsigned(Privilege::kOperate)) == 0) && @@ -174,8 +175,8 @@ char GetPrivilegeStringForLogging(Privilege privilege) } // namespace -AccessControl::Entry::Delegate AccessControl::Entry::mDefaultDelegate; -AccessControl::EntryIterator::Delegate AccessControl::EntryIterator::mDefaultDelegate; +Global AccessControl::Entry::mDefaultDelegate; +Global AccessControl::EntryIterator::mDefaultDelegate; CHIP_ERROR AccessControl::Init(AccessControl::Delegate * delegate, DeviceTypeResolver & deviceTypeResolver) { @@ -631,7 +632,7 @@ void AccessControl::NotifyEntryChanged(const SubjectDescriptor * subjectDescript AccessControl & GetAccessControl() { - return *globalAccessControl; + return (globalAccessControl) ? *globalAccessControl : defaultAccessControl.get(); } void SetAccessControl(AccessControl & accessControl) @@ -642,7 +643,7 @@ void SetAccessControl(AccessControl & accessControl) void ResetAccessControlToDefault() { - globalAccessControl = &defaultAccessControl; + globalAccessControl = nullptr; } } // namespace Access diff --git a/src/access/AccessControl.h b/src/access/AccessControl.h index 5c8dc929bd64a2..95675845f7f704 100644 --- a/src/access/AccessControl.h +++ b/src/access/AccessControl.h @@ -22,8 +22,9 @@ #include "RequestPath.h" #include "SubjectDescriptor.h" -#include "lib/support/CodeUtils.h" #include +#include +#include // Dump function for use during development only (0 for disabled, non-zero for enabled). #define CHIP_ACCESS_CONTROL_DUMP_ENABLED 0 @@ -104,7 +105,7 @@ class AccessControl Entry() = default; - Entry(Entry && other) : mDelegate(other.mDelegate) { other.mDelegate = &mDefaultDelegate; } + Entry(Entry && other) : mDelegate(other.mDelegate) { other.mDelegate = &mDefaultDelegate.get(); } Entry & operator=(Entry && other) { @@ -112,7 +113,7 @@ class AccessControl { mDelegate->Release(); mDelegate = other.mDelegate; - other.mDelegate = &mDefaultDelegate; + other.mDelegate = &mDefaultDelegate.get(); } return *this; } @@ -208,7 +209,7 @@ class AccessControl */ CHIP_ERROR RemoveTarget(size_t index) { return mDelegate->RemoveTarget(index); } - bool HasDefaultDelegate() const { return mDelegate == &mDefaultDelegate; } + bool HasDefaultDelegate() const { return mDelegate == &mDefaultDelegate.get(); } const Delegate & GetDelegate() const { return *mDelegate; } @@ -223,12 +224,12 @@ class AccessControl void ResetDelegate() { mDelegate->Release(); - mDelegate = &mDefaultDelegate; + mDelegate = &mDefaultDelegate.get(); } private: - static Delegate mDefaultDelegate; - Delegate * mDelegate = &mDefaultDelegate; + static Global mDefaultDelegate; + Delegate * mDelegate = &mDefaultDelegate.get(); }; /** @@ -276,12 +277,12 @@ class AccessControl void ResetDelegate() { mDelegate->Release(); - mDelegate = &mDefaultDelegate; + mDelegate = &mDefaultDelegate.get(); } private: - static Delegate mDefaultDelegate; - Delegate * mDelegate = &mDefaultDelegate; + static Global mDefaultDelegate; + Delegate * mDelegate = &mDefaultDelegate.get(); }; /** diff --git a/src/app/AttributePathParams.h b/src/app/AttributePathParams.h index b03153d71c2e2f..fd97a9c083f414 100644 --- a/src/app/AttributePathParams.h +++ b/src/app/AttributePathParams.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include diff --git a/src/app/BUILD.gn b/src/app/BUILD.gn index a4028a7a7449ef..5f3c1b5a320710 100644 --- a/src/app/BUILD.gn +++ b/src/app/BUILD.gn @@ -14,9 +14,8 @@ import("//build_overrides/chip.gni") import("//build_overrides/nlio.gni") -import("${chip_root}/src/platform/device.gni") - import("${chip_root}/build/chip/buildconfig_header.gni") +import("${chip_root}/src/platform/device.gni") import("common_flags.gni") import("icd/icd.gni") @@ -209,6 +208,21 @@ static_library("app") { ] } + if (chip_build_controller_dynamic_server) { + defines = [ + "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", + "CHIP_DEVICE_CONFIG_DYNAMIC_ENDPOINT_COUNT=1", + ] + sources += [ + "clusters/ota-provider/ota-provider.cpp", + "dynamic_server/AccessControl.cpp", + "dynamic_server/AccessControl.h", + "dynamic_server/DynamicDispatcher.cpp", + "util/privilege-storage.cpp", + "util/privilege-storage.h", + ] + } + if (chip_enable_read_client) { sources += [ "BufferedReadCallback.cpp", diff --git a/src/app/BufferedReadCallback.h b/src/app/BufferedReadCallback.h index 0616bb09958348..f8faaaa1a0fd74 100644 --- a/src/app/BufferedReadCallback.h +++ b/src/app/BufferedReadCallback.h @@ -21,6 +21,7 @@ #include "lib/core/TLV.h" #include "system/SystemPacketBuffer.h" #include "system/TLVPacketBufferBackingStore.h" +#include #include #include #include diff --git a/src/app/ClusterStateCache.h b/src/app/ClusterStateCache.h index 2a96a949193f4f..9bd1cb38dab242 100644 --- a/src/app/ClusterStateCache.h +++ b/src/app/ClusterStateCache.h @@ -21,6 +21,7 @@ #include "lib/core/CHIPError.h" #include "system/SystemPacketBuffer.h" #include "system/TLVPacketBufferBackingStore.h" +#include #include #include #include diff --git a/src/app/CommandSender.cpp b/src/app/CommandSender.cpp index 5daceaf05a088a..d579845d2e5d5a 100644 --- a/src/app/CommandSender.cpp +++ b/src/app/CommandSender.cpp @@ -26,6 +26,7 @@ #include "InteractionModelEngine.h" #include "StatusResponse.h" #include +#include #include #include @@ -36,7 +37,14 @@ CommandSender::CommandSender(Callback * apCallback, Messaging::ExchangeManager * bool aSuppressResponse) : mExchangeCtx(*this), mpCallback(apCallback), mpExchangeMgr(apExchangeMgr), mSuppressResponse(aSuppressResponse), mTimedRequest(aIsTimedRequest) -{} +{ + assertChipStackLockedByCurrentThread(); +} + +CommandSender::~CommandSender() +{ + assertChipStackLockedByCurrentThread(); +} CHIP_ERROR CommandSender::AllocateBuffer() { diff --git a/src/app/CommandSender.h b/src/app/CommandSender.h index 6da9b053856c82..194c4535457562 100644 --- a/src/app/CommandSender.h +++ b/src/app/CommandSender.h @@ -123,6 +123,7 @@ class CommandSender final : public Messaging::ExchangeDelegate */ CommandSender(Callback * apCallback, Messaging::ExchangeManager * apExchangeMgr, bool aIsTimedRequest = false, bool aSuppressResponse = false); + ~CommandSender(); CHIP_ERROR PrepareCommand(const CommandPathParams & aCommandPathParams, bool aStartDataStruct = true); CHIP_ERROR FinishCommand(bool aEndDataStruct = true); TLV::TLVWriter * GetCommandDataIBTLVWriter(); diff --git a/src/app/EventLoggingTypes.h b/src/app/EventLoggingTypes.h index 351774256d2a45..35fd37a25045ca 100644 --- a/src/app/EventLoggingTypes.h +++ b/src/app/EventLoggingTypes.h @@ -26,7 +26,7 @@ #include #include -constexpr size_t kNumPriorityLevel = 3; +inline constexpr size_t kNumPriorityLevel = 3; namespace chip { namespace app { diff --git a/src/app/EventManagement.h b/src/app/EventManagement.h index 2286328214a0c5..228c26cca94a68 100644 --- a/src/app/EventManagement.h +++ b/src/app/EventManagement.h @@ -70,9 +70,9 @@ namespace chip { namespace app { -constexpr const uint32_t kEventManagementProfile = 0x1; -constexpr const uint32_t kFabricIndexTag = 0x1; -constexpr size_t kMaxEventSizeReserve = 512; +inline constexpr const uint32_t kEventManagementProfile = 0x1; +inline constexpr const uint32_t kFabricIndexTag = 0x1; +inline constexpr size_t kMaxEventSizeReserve = 512; constexpr uint16_t kRequiredEventField = (1 << to_underlying(EventDataIB::Tag::kPriority)) | (1 << to_underlying(EventDataIB::Tag::kPath)); diff --git a/src/app/InteractionModelEngine.cpp b/src/app/InteractionModelEngine.cpp index b0a993fb614a1f..d1476c61035c38 100644 --- a/src/app/InteractionModelEngine.cpp +++ b/src/app/InteractionModelEngine.cpp @@ -29,9 +29,11 @@ #include "access/RequestPath.h" #include "access/SubjectDescriptor.h" +#include #include #include #include +#include #include #include #include @@ -41,13 +43,13 @@ namespace app { using Protocols::InteractionModel::Status; -InteractionModelEngine sInteractionModelEngine; +Global sInteractionModelEngine; InteractionModelEngine::InteractionModelEngine() {} InteractionModelEngine * InteractionModelEngine::GetInstance() { - return &sInteractionModelEngine; + return &sInteractionModelEngine.get(); } CHIP_ERROR InteractionModelEngine::Init(Messaging::ExchangeManager * apExchangeMgr, FabricTable * apFabricTable, @@ -335,10 +337,10 @@ void InteractionModelEngine::OnDone(ReadHandler & apReadObj) #if CHIP_CONFIG_PERSIST_SUBSCRIPTIONS && CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION if (!mSubscriptionResumptionScheduled && HasSubscriptionsToResume()) { - mSubscriptionResumptionScheduled = true; - auto timeTillNextResubscriptionSecs = ComputeTimeSecondsTillNextSubscriptionResumption(); - mpExchangeMgr->GetSessionManager()->SystemLayer()->StartTimer(System::Clock::Seconds32(timeTillNextResubscriptionSecs), - ResumeSubscriptionsTimerCallback, this); + mSubscriptionResumptionScheduled = true; + auto timeTillNextSubscriptionResumptionSecs = ComputeTimeSecondsTillNextSubscriptionResumption(); + mpExchangeMgr->GetSessionManager()->SystemLayer()->StartTimer( + System::Clock::Seconds32(timeTillNextSubscriptionResumptionSecs), ResumeSubscriptionsTimerCallback, this); mNumSubscriptionResumptionRetries++; } #endif // CHIP_CONFIG_PERSIST_SUBSCRIPTIONS diff --git a/src/app/InteractionModelEngine.h b/src/app/InteractionModelEngine.h index 57e4c66475757f..e2e42cb0c19b66 100644 --- a/src/app/InteractionModelEngine.h +++ b/src/app/InteractionModelEngine.h @@ -26,6 +26,7 @@ #pragma once #include +#include #include #include #include diff --git a/src/app/InteractionModelRevision.h b/src/app/InteractionModelRevision.h index 9cc9fc66de0796..529ac0f839c80e 100644 --- a/src/app/InteractionModelRevision.h +++ b/src/app/InteractionModelRevision.h @@ -32,4 +32,4 @@ #define CHIP_DEVICE_INTERACTION_MODEL_REVISION 11 #endif -constexpr uint8_t kInteractionModelRevisionTag = 0xFF; +inline constexpr uint8_t kInteractionModelRevisionTag = 0xFF; diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index caac866aeba08c..373d2051d3457f 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -32,6 +32,7 @@ #include #include #include +#include namespace chip { namespace app { @@ -44,6 +45,8 @@ ReadClient::ReadClient(InteractionModelEngine * apImEngine, Messaging::ExchangeM mpCallback(apCallback), mOnConnectedCallback(HandleDeviceConnected, this), mOnConnectionFailureCallback(HandleDeviceConnectionFailure, this) { + assertChipStackLockedByCurrentThread(); + mpExchangeMgr = apExchangeMgr; mInteractionType = aInteractionType; @@ -89,6 +92,8 @@ void ReadClient::StopResubscription() ReadClient::~ReadClient() { + assertChipStackLockedByCurrentThread(); + if (IsSubscriptionType()) { StopResubscription(); diff --git a/src/app/ReadClient.h b/src/app/ReadClient.h index 85bcd124e5190f..8892b65236a5c0 100644 --- a/src/app/ReadClient.h +++ b/src/app/ReadClient.h @@ -24,6 +24,7 @@ #pragma once #include "system/SystemClock.h" +#include #include #include #include diff --git a/src/app/ReadHandler.h b/src/app/ReadHandler.h index ecdc0c1c0696c1..4c9ad469c782eb 100644 --- a/src/app/ReadHandler.h +++ b/src/app/ReadHandler.h @@ -52,7 +52,7 @@ #include // https://github.com/CHIP-Specifications/connectedhomeip-spec/blob/61a9d19e6af12fdfb0872bcff26d19de6c680a1a/src/Ch02_Architecture.adoc#1122-subscribe-interaction-limits -constexpr uint16_t kSubscriptionMaxIntervalPublisherLimit = 3600; // seconds (60 minutes) +inline constexpr uint16_t kSubscriptionMaxIntervalPublisherLimit = 3600; // seconds (60 minutes) namespace chip { namespace app { diff --git a/src/app/WriteClient.h b/src/app/WriteClient.h index 2323adc8a337e9..90f0f3a24b6c1a 100644 --- a/src/app/WriteClient.h +++ b/src/app/WriteClient.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -127,16 +128,22 @@ class WriteClient : public Messaging::ExchangeDelegate mpExchangeMgr(apExchangeMgr), mExchangeCtx(*this), mpCallback(apCallback), mTimedWriteTimeoutMs(aTimedWriteTimeoutMs), mSuppressResponse(aSuppressResponse) - {} + { + assertChipStackLockedByCurrentThread(); + } #if CONFIG_BUILD_FOR_HOST_UNIT_TEST WriteClient(Messaging::ExchangeManager * apExchangeMgr, Callback * apCallback, const Optional & aTimedWriteTimeoutMs, uint16_t aReservedSize) : mpExchangeMgr(apExchangeMgr), mExchangeCtx(*this), mpCallback(apCallback), mTimedWriteTimeoutMs(aTimedWriteTimeoutMs), mReservedSize(aReservedSize) - {} + { + assertChipStackLockedByCurrentThread(); + } #endif + ~WriteClient() { assertChipStackLockedByCurrentThread(); } + /** * Encode an attribute value that can be directly encoded using DataModel::Encode. Will create a new chunk when necessary. */ diff --git a/src/app/app-platform/ContentAppPlatform.h b/src/app/app-platform/ContentAppPlatform.h index 8ab9efab8250c6..593ec0706a5a15 100644 --- a/src/app/app-platform/ContentAppPlatform.h +++ b/src/app/app-platform/ContentAppPlatform.h @@ -49,9 +49,9 @@ EmberAfStatus AppPlatformExternalAttributeReadCallback(EndpointId endpoint, Clus EmberAfStatus AppPlatformExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, const EmberAfAttributeMetadata * attributeMetadata, uint8_t * buffer); -constexpr EndpointId kTargetBindingClusterEndpointId = 0; -constexpr EndpointId kLocalVideoPlayerEndpointId = 1; -constexpr EndpointId kLocalSpeakerEndpointId = 2; +inline constexpr EndpointId kTargetBindingClusterEndpointId = 0; +inline constexpr EndpointId kLocalVideoPlayerEndpointId = 1; +inline constexpr EndpointId kLocalSpeakerEndpointId = 2; class DLL_EXPORT ContentAppFactory { diff --git a/src/app/clusters/operational-state-server/operational-state-cluster-objects.h b/src/app/clusters/operational-state-server/operational-state-cluster-objects.h index 8fdd68cbd3851c..1910e00d20effb 100644 --- a/src/app/clusters/operational-state-server/operational-state-cluster-objects.h +++ b/src/app/clusters/operational-state-server/operational-state-cluster-objects.h @@ -27,10 +27,10 @@ namespace app { namespace Clusters { namespace OperationalState { -constexpr size_t kOperationalStateLabelMaxSize = 64u; -constexpr size_t kOperationalErrorLabelMaxSize = 64u; -constexpr size_t kOperationalErrorDetailsMaxSize = 64u; -constexpr size_t kOperationalPhaseNameMaxSize = 64u; +inline constexpr size_t kOperationalStateLabelMaxSize = 64u; +inline constexpr size_t kOperationalErrorLabelMaxSize = 64u; +inline constexpr size_t kOperationalErrorDetailsMaxSize = 64u; +inline constexpr size_t kOperationalPhaseNameMaxSize = 64u; /** * A class which represents the operational state of an Operational State cluster derivation instance. diff --git a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp index c8d8d44bb59d9a..8f79f39d5d5767 100644 --- a/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp +++ b/src/app/clusters/resource-monitoring-server/resource-monitoring-server.cpp @@ -370,8 +370,7 @@ Status Delegate::OnResetCondition() if (emberAfContainsAttribute(mInstance->GetEndpointId(), mInstance->GetClusterId(), Attributes::LastChangedTime::Id)) { System::Clock::Milliseconds64 currentUnixTimeMS; - System::Clock::ClockImpl clock; - CHIP_ERROR err = clock.GetClock_RealTimeMS(currentUnixTimeMS); + CHIP_ERROR err = System::SystemClock().GetClock_RealTimeMS(currentUnixTimeMS); if (err == CHIP_NO_ERROR) { System::Clock::Seconds32 currentUnixTime = std::chrono::duration_cast(currentUnixTimeMS); diff --git a/src/app/clusters/scenes-server/SceneTable.h b/src/app/clusters/scenes-server/SceneTable.h index b76ade0a15c665..e7fb2328d9ed98 100644 --- a/src/app/clusters/scenes-server/SceneTable.h +++ b/src/app/clusters/scenes-server/SceneTable.h @@ -33,9 +33,9 @@ typedef uint16_t SceneIndex; typedef uint32_t TransitionTimeMs; typedef uint32_t SceneTransitionTime; -constexpr GroupId kGlobalGroupSceneId = 0x0000; -constexpr SceneIndex kUndefinedSceneIndex = 0xffff; -constexpr SceneId kUndefinedSceneId = 0xff; +inline constexpr GroupId kGlobalGroupSceneId = 0x0000; +inline constexpr SceneIndex kUndefinedSceneIndex = 0xffff; +inline constexpr SceneId kUndefinedSceneId = 0xff; static constexpr size_t kIteratorsMax = CHIP_CONFIG_MAX_SCENES_CONCURRENT_ITERATORS; static constexpr size_t kSceneNameMaxLength = CHIP_CONFIG_SCENES_CLUSTER_MAXIMUM_NAME_LENGTH; diff --git a/src/app/common_flags.gni b/src/app/common_flags.gni index 5e5a82afd7d5e1..7565bfd223ff45 100644 --- a/src/app/common_flags.gni +++ b/src/app/common_flags.gni @@ -16,4 +16,5 @@ declare_args() { # Temporary flag for interaction model and echo protocols, set it to true to enable chip_app_use_echo = false chip_enable_read_client = true + chip_build_controller_dynamic_server = false } diff --git a/src/app/data-model/Encode.h b/src/app/data-model/Encode.h index 84a32cf745983c..7cb8298e47ac72 100644 --- a/src/app/data-model/Encode.h +++ b/src/app/data-model/Encode.h @@ -37,10 +37,10 @@ template using VoidType = void; template -constexpr bool HasUnknownValue = false; +inline constexpr bool HasUnknownValue = false; template -constexpr bool HasUnknownValue> = true; +inline constexpr bool HasUnknownValue> = true; } // namespace detail /* diff --git a/src/app/data-model/Nullable.h b/src/app/data-model/Nullable.h index ad6bdaf9e2c172..dec7fc5eb9ef55 100644 --- a/src/app/data-model/Nullable.h +++ b/src/app/data-model/Nullable.h @@ -30,7 +30,7 @@ namespace DataModel { /** * NullNullable is an alias for NullOptional, for better readability. */ -constexpr auto NullNullable = NullOptional; +inline constexpr auto NullNullable = NullOptional; /* * Dedicated type for nullable things, to differentiate them from optional diff --git a/src/darwin/Framework/CHIP/MTRControllerAccessControl.mm b/src/app/dynamic_server/AccessControl.cpp similarity index 68% rename from src/darwin/Framework/CHIP/MTRControllerAccessControl.mm rename to src/app/dynamic_server/AccessControl.cpp index 8ea39e55fb2bec..38928b52fb0dea 100644 --- a/src/darwin/Framework/CHIP/MTRControllerAccessControl.mm +++ b/src/app/dynamic_server/AccessControl.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2022-2023 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,7 +14,7 @@ * limitations under the License. */ -#import "MTRControllerAccessControl.h" +#include "AccessControl.h" #include #include @@ -23,6 +23,7 @@ #include #include #include +#include using namespace chip; using namespace chip::Access; @@ -30,34 +31,39 @@ namespace { // TODO: Maybe consider making this configurable? See also -// CHIPIMDispatch.mm. +// DynamicDispatch.cpp. constexpr EndpointId kSupportedEndpoint = 0; -class DeviceTypeResolver : public Access::AccessControl::DeviceTypeResolver { +class DeviceTypeResolver : public Access::AccessControl::DeviceTypeResolver +{ public: bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) override { return app::IsDeviceTypeOnEndpoint(deviceType, endpoint); } -} gDeviceTypeResolver; +}; // TODO: Make the policy more configurable by consumers. -class AccessControlDelegate : public Access::AccessControl::Delegate { - CHIP_ERROR Check( - const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, Privilege requestPrivilege) override +class AccessControlDelegate : public Access::AccessControl::Delegate +{ + CHIP_ERROR Check(const SubjectDescriptor & subjectDescriptor, const RequestPath & requestPath, + Privilege requestPrivilege) override { - if (requestPath.endpoint != kSupportedEndpoint || requestPath.cluster != OtaSoftwareUpdateProvider::Id) { + if (requestPath.endpoint != kSupportedEndpoint || requestPath.cluster != OtaSoftwareUpdateProvider::Id) + { // We only allow access to OTA software update provider. return CHIP_ERROR_ACCESS_DENIED; } - if (requestPrivilege != Privilege::kOperate) { + if (requestPrivilege != Privilege::kOperate) + { // The commands on OtaSoftwareUpdateProvider all require // Operate; we should not be asked for anything else. return CHIP_ERROR_ACCESS_DENIED; } - if (subjectDescriptor.authMode != AuthMode::kCase && subjectDescriptor.authMode != AuthMode::kPase) { + if (subjectDescriptor.authMode != AuthMode::kCase && subjectDescriptor.authMode != AuthMode::kPase) + { // No idea who is asking; deny for now. return CHIP_ERROR_ACCESS_DENIED; } @@ -68,17 +74,24 @@ CHIP_ERROR Check( } }; -AccessControlDelegate gDelegate; -} // anonymous namespace +struct ControllerAccessControl +{ + DeviceTypeResolver mDeviceTypeResolver; + AccessControlDelegate mDelegate; + ControllerAccessControl() { GetAccessControl().Init(&mDelegate, mDeviceTypeResolver); } +}; + +Global gControllerAccessControl; -@implementation MTRControllerAccessControl +} // anonymous namespace -+ (void)init +namespace chip { +namespace app { +namespace dynamic_server { +void InitAccessControl() { - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - GetAccessControl().Init(&gDelegate, gDeviceTypeResolver); - }); + gControllerAccessControl.get(); // force initialization } - -@end +} // namespace dynamic_server +} // namespace app +} // namespace chip diff --git a/src/darwin/Framework/CHIP/MTRControllerAccessControl.h b/src/app/dynamic_server/AccessControl.h similarity index 66% rename from src/darwin/Framework/CHIP/MTRControllerAccessControl.h rename to src/app/dynamic_server/AccessControl.h index 81060ddca6d0b4..e5be582797e671 100644 --- a/src/darwin/Framework/CHIP/MTRControllerAccessControl.h +++ b/src/app/dynamic_server/AccessControl.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2022-2023 Project CHIP Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,24 +15,16 @@ */ #pragma once -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -MTR_HIDDEN -@interface MTRControllerAccessControl : NSObject - -- (instancetype)init NS_UNAVAILABLE; -+ (instancetype)new NS_UNAVAILABLE; -+ (instancetype)alloc NS_UNAVAILABLE; +// Experimental API for Access Control +namespace chip { +namespace app { +namespace dynamic_server { /** * Initialize the access control module. Must be called on the Matter task * queue. */ -+ (void)init; - -@end - -NS_ASSUME_NONNULL_END +void InitAccessControl(); +} // namespace dynamic_server +} // namespace app +} // namespace chip diff --git a/src/app/dynamic_server/DynamicDispatcher.cpp b/src/app/dynamic_server/DynamicDispatcher.cpp new file mode 100644 index 00000000000000..05521627364d31 --- /dev/null +++ b/src/app/dynamic_server/DynamicDispatcher.cpp @@ -0,0 +1,390 @@ +/* + * + * Copyright (c) 2022-2023 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + * This file defines the APIs needed to handle interaction model dispatch. + * These are the APIs normally defined in + * src/app/util/ember-compatibility-functions.cpp and the generated + * IMClusterCommandHandler.cpp but we want a different implementation of these + * to enable more dynamic behavior, since not all framework consumers will be + * implementing the same server clusters. + */ +using namespace chip; +using namespace chip::app; +using namespace chip::app::Clusters; + +namespace { + +// TODO: Maybe consider making this configurable? See also +// AccessControl.cpp. +constexpr EndpointId kSupportedEndpoint = 0; + +} // anonymous namespace + +namespace chip { +namespace app { + +using Access::SubjectDescriptor; +using Protocols::InteractionModel::Status; + +namespace { + +bool IsSupportedGlobalAttribute(AttributeId aAttribute) +{ + // We don't have any non-global attributes. + using namespace Globals::Attributes; + + for (auto & attr : GlobalAttributesNotInMetadata) + { + if (attr == aAttribute) + { + return true; + } + } + + switch (aAttribute) + { + case FeatureMap::Id: + FALLTHROUGH; + case ClusterRevision::Id: + return true; + } + + return false; +} + +Status DetermineAttributeStatus(const ConcreteAttributePath & aPath, bool aIsWrite) +{ + // TODO: Consider making this configurable for applications that are not + // trying to be an OTA provider, though in practice it just affects which + // error is returned. + if (aPath.mEndpointId != kSupportedEndpoint) + { + return Status::UnsupportedEndpoint; + } + + // TODO: Consider making this configurable for applications that are not + // trying to be an OTA provider, though in practice it just affects which + // error is returned. + if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) + { + return Status::UnsupportedCluster; + } + + if (!IsSupportedGlobalAttribute(aPath.mAttributeId)) + { + return Status::UnsupportedAttribute; + } + + // No permissions for this for read, and none of these are writable for + // write. The writable-or-not check happens before the ACL check. + return aIsWrite ? Status::UnsupportedWrite : Status::UnsupportedAccess; +} + +} // anonymous namespace + +CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, + const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, + AttributeValueEncoder::AttributeEncodeState * aEncoderState) +{ + Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ false); + return aAttributeReports.EncodeAttributeStatus(aPath, StatusIB(status)); +} + +bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) +{ + return DetermineAttributeStatus(aPath, /* aIsWrite = */ false) == Status::UnsupportedAccess; +} + +Status ServerClusterCommandExists(const ConcreteCommandPath & aPath) +{ + // TODO: Consider making this configurable for applications that are not + // trying to be an OTA provider. + using namespace OtaSoftwareUpdateProvider::Commands; + + if (aPath.mEndpointId != kSupportedEndpoint) + { + return Status::UnsupportedEndpoint; + } + + if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) + { + return Status::UnsupportedCluster; + } + + switch (aPath.mCommandId) + { + case QueryImage::Id: + FALLTHROUGH; + case ApplyUpdateRequest::Id: + FALLTHROUGH; + case NotifyUpdateApplied::Id: + return Status::Success; + } + + return Status::UnsupportedCommand; +} + +bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) +{ + // Will never be called anyway; we have no attributes. + return false; +} + +const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) +{ + // Note: This test does not make use of the real attribute metadata. + static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; + return &stub; +} + +bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) +{ + return false; +} + +CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, + TLV::TLVReader & aReader, WriteHandler * aWriteHandler) +{ + Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ true); + return aWriteHandler->AddStatus(aPath, status); +} + +// No attribute access overrides on iOS and Android for now. +// TODO (#16806): This function can be moved to InteractionModelEngine. +AttributeAccessInterface * GetAttributeAccessOverride(EndpointId endpointId, ClusterId clusterId) +{ + return nullptr; +} + +void DispatchSingleClusterCommand(const ConcreteCommandPath & aPath, TLV::TLVReader & aReader, CommandHandler * aCommandObj) +{ + // This command passed ServerClusterCommandExists so we know it's one of our + // supported commands. + using namespace OtaSoftwareUpdateProvider::Commands; + + bool wasHandled = false; + CHIP_ERROR err = CHIP_NO_ERROR; + + switch (aPath.mCommandId) + { + case QueryImage::Id: { + QueryImage::DecodableType commandData; + err = DataModel::Decode(aReader, commandData); + if (err == CHIP_NO_ERROR) + { + wasHandled = emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(aCommandObj, aPath, commandData); + } + break; + } + case ApplyUpdateRequest::Id: { + ApplyUpdateRequest::DecodableType commandData; + err = DataModel::Decode(aReader, commandData); + if (err == CHIP_NO_ERROR) + { + wasHandled = emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(aCommandObj, aPath, commandData); + } + break; + } + case NotifyUpdateApplied::Id: { + NotifyUpdateApplied::DecodableType commandData; + err = DataModel::Decode(aReader, commandData); + if (err == CHIP_NO_ERROR) + { + wasHandled = emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(aCommandObj, aPath, commandData); + } + break; + } + default: + break; + } + + if (CHIP_NO_ERROR != err || !wasHandled) + { + aCommandObj->AddStatus(aPath, Status::InvalidCommand); + } +} + +Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) +{ + return Protocols::InteractionModel::Status::UnsupportedEvent; +} + +} // namespace app +} // namespace chip + +/** + * Called by the OTA provider cluster server to determine an index + * into its array. + */ +uint16_t emberAfGetClusterServerEndpointIndex(EndpointId endpoint, ClusterId cluster, uint16_t fixedClusterServerEndpointCount) +{ + if (endpoint == kSupportedEndpoint && cluster == OtaSoftwareUpdateProvider::Id) + { + return 0; + } + + return UINT16_MAX; +} + +/** + * Methods used by AttributePathExpandIterator, which need to exist + * because it is part of libCHIP. For AttributePathExpandIterator + * purposes, for now, we just pretend like we have just our one + * endpoint, the OTA Provider cluster, and no attributes (because we + * would be erroring out from them anyway). + */ +uint16_t emberAfGetServerAttributeCount(EndpointId endpoint, ClusterId cluster) +{ + return 0; +} + +uint16_t emberAfEndpointCount(void) +{ + return 1; +} + +uint16_t emberAfIndexFromEndpoint(EndpointId endpoint) +{ + if (endpoint == kSupportedEndpoint) + { + return 0; + } + + return UINT16_MAX; +} + +EndpointId emberAfEndpointFromIndex(uint16_t index) +{ + // Index must be valid here, so 0. + return kSupportedEndpoint; +} + +Optional emberAfGetNthClusterId(EndpointId endpoint, uint8_t n, bool server) +{ + if (endpoint == kSupportedEndpoint && n == 0 && server) + { + return MakeOptional(OtaSoftwareUpdateProvider::Id); + } + + return NullOptional; +} + +uint16_t emberAfGetServerAttributeIndexByAttributeId(EndpointId endpoint, ClusterId cluster, AttributeId attributeId) +{ + return UINT16_MAX; +} + +bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId) +{ + return false; +} + +uint8_t emberAfClusterCount(EndpointId endpoint, bool server) +{ + if (endpoint == kSupportedEndpoint && server) + { + return 1; + } + + return 0; +} + +Optional emberAfGetServerAttributeIdByIndex(EndpointId endpoint, ClusterId cluster, uint16_t attributeIndex) +{ + return NullOptional; +} + +uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClusterMask mask) +{ + if (endpoint == kSupportedEndpoint && clusterId == OtaSoftwareUpdateProvider::Id && (mask & CLUSTER_MASK_SERVER)) + { + return 0; + } + + return UINT8_MAX; +} + +bool emberAfEndpointIndexIsEnabled(uint16_t index) +{ + return index == 0; +} + +namespace { +const CommandId acceptedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Id, + Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id, + Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id, kInvalidCommandId }; +const CommandId generatedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id, + Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id, kInvalidCommandId }; +const EmberAfCluster otaProviderCluster{ + .clusterId = Clusters::OtaSoftwareUpdateProvider::Id, + .attributes = nullptr, + .attributeCount = 0, + .clusterSize = 0, + .mask = CLUSTER_MASK_SERVER, + .functions = nullptr, + .acceptedCommandList = acceptedCommands, + .generatedCommandList = generatedCommands, + .eventList = nullptr, + .eventCount = 0, +}; +const EmberAfEndpointType otaProviderEndpoint{ .cluster = &otaProviderCluster, .clusterCount = 1, .endpointSize = 0 }; +} // namespace + +const EmberAfEndpointType * emberAfFindEndpointType(EndpointId endpoint) +{ + if (endpoint == kSupportedEndpoint) + { + return &otaProviderEndpoint; + } + + return nullptr; +} + +const EmberAfCluster * emberAfFindServerCluster(EndpointId endpoint, ClusterId cluster) +{ + if (endpoint == kSupportedEndpoint && cluster == Clusters::OtaSoftwareUpdateProvider::Id) + { + return &otaProviderCluster; + } + + return nullptr; +} diff --git a/src/app/icd/IcdMonitoringTable.h b/src/app/icd/IcdMonitoringTable.h index 0bfb311207c0d5..86186aec594d07 100644 --- a/src/app/icd/IcdMonitoringTable.h +++ b/src/app/icd/IcdMonitoringTable.h @@ -25,7 +25,7 @@ namespace chip { -constexpr size_t kIcdMonitoringBufferSize = 40; +inline constexpr size_t kIcdMonitoringBufferSize = 40; struct IcdMonitoringEntry : public PersistentData { diff --git a/src/app/server/Server.h b/src/app/server/Server.h index e2bcbe83d363a8..2d9a78c58737b1 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -74,7 +74,7 @@ namespace chip { -constexpr size_t kMaxBlePendingPackets = 1; +inline constexpr size_t kMaxBlePendingPackets = 1; // // NOTE: Please do not alter the order of template specialization here as the logic diff --git a/src/app/tests/integration/common.h b/src/app/tests/integration/common.h index 4766b9d6160500..5d232476981a17 100644 --- a/src/app/tests/integration/common.h +++ b/src/app/tests/integration/common.h @@ -43,18 +43,18 @@ extern chip::SessionHolder gSession; extern chip::TestPersistentStorageDelegate gStorage; extern chip::Crypto::DefaultSessionKeystore gSessionKeystore; -constexpr chip::NodeId kTestNodeId = 0x1ULL; -constexpr chip::NodeId kTestNodeId1 = 0x2ULL; -constexpr chip::ClusterId kTestClusterId = 6; -constexpr chip::CommandId kTestCommandId = 40; -constexpr chip::EndpointId kTestEndpointId = 1; -constexpr chip::GroupId kTestGroupId = 0; -constexpr chip::FieldId kTestFieldId1 = 1; -constexpr chip::FieldId kTestFieldId2 = 2; -constexpr uint8_t kTestFieldValue1 = 1; -constexpr uint8_t kTestFieldValue2 = 2; -constexpr chip::EventId kTestChangeEvent1 = 1; -constexpr chip::EventId kTestChangeEvent2 = 2; +inline constexpr chip::NodeId kTestNodeId = 0x1ULL; +inline constexpr chip::NodeId kTestNodeId1 = 0x2ULL; +inline constexpr chip::ClusterId kTestClusterId = 6; +inline constexpr chip::CommandId kTestCommandId = 40; +inline constexpr chip::EndpointId kTestEndpointId = 1; +inline constexpr chip::GroupId kTestGroupId = 0; +inline constexpr chip::FieldId kTestFieldId1 = 1; +inline constexpr chip::FieldId kTestFieldId2 = 2; +inline constexpr uint8_t kTestFieldValue1 = 1; +inline constexpr uint8_t kTestFieldValue2 = 2; +inline constexpr chip::EventId kTestChangeEvent1 = 1; +inline constexpr chip::EventId kTestChangeEvent2 = 2; void InitializeChip(void); void ShutdownChip(void); void TLVPrettyPrinter(const char * aFormat, ...); diff --git a/src/app/tests/suites/commands/interaction_model/InteractionModel.h b/src/app/tests/suites/commands/interaction_model/InteractionModel.h index c52ff744fac791..da3c3378a45d90 100644 --- a/src/app/tests/suites/commands/interaction_model/InteractionModel.h +++ b/src/app/tests/suites/commands/interaction_model/InteractionModel.h @@ -28,7 +28,7 @@ #include #include -constexpr uint8_t kMaxAllowedPaths = 64; +inline constexpr uint8_t kMaxAllowedPaths = 64; namespace chip { namespace test_utils { diff --git a/src/app/util/attribute-storage-null-handling.h b/src/app/util/attribute-storage-null-handling.h index 207cea1c0bdfdb..8db72a2321bf7b 100644 --- a/src/app/util/attribute-storage-null-handling.h +++ b/src/app/util/attribute-storage-null-handling.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include @@ -30,13 +31,13 @@ namespace app { template struct NumericAttributeTraits { diff --git a/src/app/util/attribute-storage.cpp b/src/app/util/attribute-storage.cpp index 0662ddcaa008b2..58730f19cb05d5 100644 --- a/src/app/util/attribute-storage.cpp +++ b/src/app/util/attribute-storage.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1312,7 +1313,7 @@ void emAfLoadAttributeDefaults(EndpointId endpoint, bool ignoreStorage, Optional // At this point, ptr either points to a default value, or is NULL, in which case // it should be treated as if it is pointing to an array of all zeroes. -#if (BIGENDIAN_CPU) +#if (CHIP_CONFIG_BIG_ENDIAN_TARGET) // The default values for attributes that are less than or equal to // defaultValueSizeForBigEndianNudger in bytes are stored in an // uint32_t. On big-endian platforms, a pointer to the default value diff --git a/src/app/util/attribute-table.cpp b/src/app/util/attribute-table.cpp index 89806abba798a3..a97dbbc6985645 100644 --- a/src/app/util/attribute-table.cpp +++ b/src/app/util/attribute-table.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -208,13 +209,13 @@ EmberAfStatus emAfWriteAttribute(EndpointId endpoint, ClusterId cluster, Attribu minBytes = reinterpret_cast(&(minv.defaultValue)); maxBytes = reinterpret_cast(&(maxv.defaultValue)); // On big endian cpu with length 1 only the second byte counts -#if (BIGENDIAN_CPU) +#if (CHIP_CONFIG_BIG_ENDIAN_TARGET) if (dataLen == 1) { minBytes++; maxBytes++; } -#endif // BIGENDIAN_CPU +#endif // CHIP_CONFIG_BIG_ENDIAN_TARGET } else { diff --git a/src/app/util/mock/Constants.h b/src/app/util/mock/Constants.h index a9017a58fba2da..803dff5b7f8f12 100644 --- a/src/app/util/mock/Constants.h +++ b/src/app/util/mock/Constants.h @@ -30,10 +30,10 @@ namespace chip { namespace Test { -constexpr EndpointId kMockEndpoint1 = 0xFFFE; -constexpr EndpointId kMockEndpoint2 = 0xFFFD; -constexpr EndpointId kMockEndpoint3 = 0xFFFC; -constexpr EndpointId kMockEndpointMin = 0xFFF1; +inline constexpr EndpointId kMockEndpoint1 = 0xFFFE; +inline constexpr EndpointId kMockEndpoint2 = 0xFFFD; +inline constexpr EndpointId kMockEndpoint3 = 0xFFFC; +inline constexpr EndpointId kMockEndpointMin = 0xFFF1; constexpr AttributeId MockAttributeId(const uint16_t & id) { diff --git a/src/app/util/privilege-storage.h b/src/app/util/privilege-storage.h index 5253769e019ea3..02d55488fd0780 100644 --- a/src/app/util/privilege-storage.h +++ b/src/app/util/privilege-storage.h @@ -18,11 +18,11 @@ #include -constexpr int kMatterAccessPrivilegeView = 0; -constexpr int kMatterAccessPrivilegeOperate = 1; -constexpr int kMatterAccessPrivilegeManage = 2; -constexpr int kMatterAccessPrivilegeAdminister = 3; -constexpr int kMatterAccessPrivilegeMaxValue = kMatterAccessPrivilegeAdminister; +inline constexpr int kMatterAccessPrivilegeView = 0; +inline constexpr int kMatterAccessPrivilegeOperate = 1; +inline constexpr int kMatterAccessPrivilegeManage = 2; +inline constexpr int kMatterAccessPrivilegeAdminister = 3; +inline constexpr int kMatterAccessPrivilegeMaxValue = kMatterAccessPrivilegeAdminister; int MatterGetAccessPrivilegeForReadAttribute(chip::ClusterId cluster, chip::AttributeId attribute); int MatterGetAccessPrivilegeForWriteAttribute(chip::ClusterId cluster, chip::AttributeId attribute); diff --git a/src/app/util/util.cpp b/src/app/util/util.cpp index dd2085a2a827cb..619ecdcd923dcc 100644 --- a/src/app/util/util.cpp +++ b/src/app/util/util.cpp @@ -23,6 +23,7 @@ #include #include #include +#include // TODO: figure out a clear path for compile-time codegen #include @@ -79,7 +80,7 @@ EmberAfDifferenceType emberAfGetDifference(uint8_t * pData, EmberAfDifferenceTyp for (i = 0; i < dataSize; i++) { value2 = value2 << 8; -#if (BIGENDIAN_CPU) +#if (CHIP_CONFIG_BIG_ENDIAN_TARGET) value2 += pData[i]; #else // BIGENDIAN value2 += pData[dataSize - i - 1]; @@ -224,7 +225,7 @@ void emberAfCopyLongString(uint8_t * dest, const uint8_t * src, size_t size) } } -#if (BIGENDIAN_CPU) +#if (CHIP_CONFIG_BIG_ENDIAN_TARGET) #define EM_BIG_ENDIAN true #else #define EM_BIG_ENDIAN false diff --git a/src/app/zap-templates/templates/app/endpoint_config.zapt b/src/app/zap-templates/templates/app/endpoint_config.zapt index 4722f4c456d237..f67c779089a1f2 100644 --- a/src/app/zap-templates/templates/app/endpoint_config.zapt +++ b/src/app/zap-templates/templates/app/endpoint_config.zapt @@ -11,12 +11,12 @@ // Default values for the attributes longer than a pointer, // in a form of a binary blob // Separate block is generated for big-endian and little-endian cases. -#if BIGENDIAN_CPU +#if CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS {{endpoint_attribute_long_defaults endian="big"}} -#else // !BIGENDIAN_CPU +#else // !CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS {{endpoint_attribute_long_defaults endian="little"}} -#endif // BIGENDIAN_CPU +#endif // CHIP_CONFIG_BIG_ENDIAN_TARGET #define GENERATED_DEFAULTS_COUNT ({{endpoint_attribute_long_defaults_count}}) diff --git a/src/ble/BleLayer.h b/src/ble/BleLayer.h index 1f9dec2860a696..5ded6c82cc2b46 100644 --- a/src/ble/BleLayer.h +++ b/src/ble/BleLayer.h @@ -92,17 +92,17 @@ typedef enum kBleTransportProtocolVersion_V4 = 4 // BTP as defined by CHIP v1.0 } BleTransportProtocolVersion; -constexpr size_t kCapabilitiesRequestMagicnumLength = 2; -constexpr size_t kCapabilitiesRequestL2capMtuLength = 2; -constexpr size_t kCapabilitiesRequestSupportedVersionsLength = 4; -constexpr size_t kCapabilitiesRequestWindowSizeLength = 1; +inline constexpr size_t kCapabilitiesRequestMagicnumLength = 2; +inline constexpr size_t kCapabilitiesRequestL2capMtuLength = 2; +inline constexpr size_t kCapabilitiesRequestSupportedVersionsLength = 4; +inline constexpr size_t kCapabilitiesRequestWindowSizeLength = 1; constexpr size_t kCapabilitiesRequestLength = (kCapabilitiesRequestMagicnumLength + kCapabilitiesRequestL2capMtuLength + kCapabilitiesRequestSupportedVersionsLength + kCapabilitiesRequestWindowSizeLength); -constexpr size_t kCapabilitiesResponseMagicnumLength = 2; -constexpr size_t kCapabilitiesResponseL2capMtuLength = 2; -constexpr size_t kCapabilitiesResponseSelectedProtocolVersionLength = 1; -constexpr size_t kCapabilitiesResponseWindowSizeLength = 1; +inline constexpr size_t kCapabilitiesResponseMagicnumLength = 2; +inline constexpr size_t kCapabilitiesResponseL2capMtuLength = 2; +inline constexpr size_t kCapabilitiesResponseSelectedProtocolVersionLength = 1; +inline constexpr size_t kCapabilitiesResponseWindowSizeLength = 1; constexpr size_t kCapabilitiesResponseLength(kCapabilitiesResponseMagicnumLength + kCapabilitiesResponseL2capMtuLength + kCapabilitiesResponseSelectedProtocolVersionLength + kCapabilitiesResponseWindowSizeLength); diff --git a/src/ble/BtpEngine.h b/src/ble/BtpEngine.h index 4d32cf7342da94..7ec59e35a60c62 100644 --- a/src/ble/BtpEngine.h +++ b/src/ble/BtpEngine.h @@ -43,10 +43,10 @@ namespace chip { namespace Ble { -constexpr size_t kTransferProtocolHeaderFlagsSize = 1; // Size in bytes of enocded BTP fragment header flag bits -constexpr size_t kTransferProtocolSequenceNumSize = 1; // Size in bytes of encoded BTP sequence number -constexpr size_t kTransferProtocolAckSize = 1; // Size in bytes of encoded BTP fragment acknowledgement number -constexpr size_t kTransferProtocolMsgLenSize = 2; // Size in byte of encoded BTP total fragmented message length +inline constexpr size_t kTransferProtocolHeaderFlagsSize = 1; // Size in bytes of enocded BTP fragment header flag bits +inline constexpr size_t kTransferProtocolSequenceNumSize = 1; // Size in bytes of encoded BTP sequence number +inline constexpr size_t kTransferProtocolAckSize = 1; // Size in bytes of encoded BTP fragment acknowledgement number +inline constexpr size_t kTransferProtocolMsgLenSize = 2; // Size in byte of encoded BTP total fragmented message length constexpr size_t kTransferProtocolMaxHeaderSize = kTransferProtocolHeaderFlagsSize + kTransferProtocolAckSize + kTransferProtocolSequenceNumSize + kTransferProtocolMsgLenSize; diff --git a/src/controller/CHIPCluster.h b/src/controller/CHIPCluster.h index 4324092871424b..fd355e6f0d473c 100644 --- a/src/controller/CHIPCluster.h +++ b/src/controller/CHIPCluster.h @@ -27,6 +27,7 @@ #pragma once #include "app/ConcreteCommandPath.h" +#include #include #include #include diff --git a/src/controller/CHIPDeviceController.h b/src/controller/CHIPDeviceController.h index b328ef68d9a47c..ab3e972b62ec80 100644 --- a/src/controller/CHIPDeviceController.h +++ b/src/controller/CHIPDeviceController.h @@ -28,6 +28,7 @@ #pragma once +#include #include #include #include @@ -81,7 +82,7 @@ namespace Controller { using namespace chip::Protocols::UserDirectedCommissioning; -constexpr uint16_t kNumMaxActiveDevices = CHIP_CONFIG_CONTROLLER_MAX_ACTIVE_DEVICES; +inline constexpr uint16_t kNumMaxActiveDevices = CHIP_CONFIG_CONTROLLER_MAX_ACTIVE_DEVICES; // Raw functions for cluster callbacks void OnBasicFailure(void * context, CHIP_ERROR err); diff --git a/src/controller/CHIPDeviceControllerSystemState.h b/src/controller/CHIPDeviceControllerSystemState.h index 6692fc6ecbc308..5c1731651cd2a1 100644 --- a/src/controller/CHIPDeviceControllerSystemState.h +++ b/src/controller/CHIPDeviceControllerSystemState.h @@ -54,7 +54,7 @@ namespace chip { -constexpr size_t kMaxDeviceTransportBlePendingPackets = 1; +inline constexpr size_t kMaxDeviceTransportBlePendingPackets = 1; using DeviceTransportMgr = TransportMgr networkCommissioningStatus; }; -constexpr uint16_t kDefaultFailsafeTimeout = 60; +inline constexpr uint16_t kDefaultFailsafeTimeout = 60; // Per spec, all commands that are sent with the failsafe armed need at least // a 30s timeout. -constexpr System::Clock::Timeout kMinimumCommissioningStepTimeout = System::Clock::Seconds16(30); +inline constexpr System::Clock::Timeout kMinimumCommissioningStepTimeout = System::Clock::Seconds16(30); class CommissioningParameters { diff --git a/src/controller/OperationalCredentialsDelegate.h b/src/controller/OperationalCredentialsDelegate.h index 5d51f820bf7ef7..1a7a8c45b64696 100644 --- a/src/controller/OperationalCredentialsDelegate.h +++ b/src/controller/OperationalCredentialsDelegate.h @@ -33,8 +33,8 @@ typedef void (*OnNOCChainGeneration)(void * context, CHIP_ERROR status, const By const ByteSpan & rcac, Optional ipk, Optional adminSubject); -constexpr uint32_t kMaxCHIPDERCertLength = 600; -constexpr size_t kCSRNonceLength = 32; +inline constexpr uint32_t kMaxCHIPDERCertLength = 600; +inline constexpr size_t kCSRNonceLength = 32; /// Callbacks for CHIP operational credentials generation class DLL_EXPORT OperationalCredentialsDelegate diff --git a/src/controller/ReadInteraction.h b/src/controller/ReadInteraction.h index 34491dd9edfebf..f6254f3df4cee4 100644 --- a/src/controller/ReadInteraction.h +++ b/src/controller/ReadInteraction.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include diff --git a/src/controller/TypedReadCallback.h b/src/controller/TypedReadCallback.h index f35a39670ee8e7..7823ad312123b1 100644 --- a/src/controller/TypedReadCallback.h +++ b/src/controller/TypedReadCallback.h @@ -18,6 +18,7 @@ #pragma once +#include #include #include #include diff --git a/src/controller/java/AndroidCommissioningWindowOpener.cpp b/src/controller/java/AndroidCommissioningWindowOpener.cpp index 6679887444427d..c1a2c5ae09c164 100644 --- a/src/controller/java/AndroidCommissioningWindowOpener.cpp +++ b/src/controller/java/AndroidCommissioningWindowOpener.cpp @@ -25,7 +25,6 @@ #include #include #include -#include using namespace chip::app::Clusters; using namespace chip::System::Clock; diff --git a/src/controller/java/AndroidDeviceControllerWrapper.cpp b/src/controller/java/AndroidDeviceControllerWrapper.cpp index f81d8c1c0efdb8..0c6ae04e7d2e37 100644 --- a/src/controller/java/AndroidDeviceControllerWrapper.cpp +++ b/src/controller/java/AndroidDeviceControllerWrapper.cpp @@ -403,8 +403,8 @@ CHIP_ERROR AndroidDeviceControllerWrapper::ApplyNetworkCredentials(chip::Control passwordStr = static_cast(env->NewGlobalRef(env->CallObjectMethod(wifiCredentialsJava, getPassword))); VerifyOrReturnError(ssidStr != nullptr && !env->ExceptionCheck(), CHIP_JNI_ERROR_EXCEPTION_THROWN); - ssid = env->GetStringUTFChars(ssidStr, 0); - password = env->GetStringUTFChars(passwordStr, 0); + ssid = env->GetStringUTFChars(ssidStr, nullptr); + password = env->GetStringUTFChars(passwordStr, nullptr); jsize ssidLength = env->GetStringUTFLength(ssidStr); jsize passwordLength = env->GetStringUTFLength(passwordStr); @@ -601,7 +601,7 @@ void AndroidDeviceControllerWrapper::OnScanNetworksSuccess( std::string NetworkingStatusCtorSignature = "(I)V"; jint jniNetworkingStatus = static_cast(dataResponse.networkingStatus); chip::JniReferences::GetInstance().CreateBoxedObject( - NetworkingStatusClassName.c_str(), NetworkingStatusCtorSignature.c_str(), jniNetworkingStatus, NetworkingStatus); + NetworkingStatusClassName, NetworkingStatusCtorSignature, jniNetworkingStatus, NetworkingStatus); jobject DebugText; if (!dataResponse.debugText.HasValue()) { @@ -633,8 +633,8 @@ void AndroidDeviceControllerWrapper::OnScanNetworksSuccess( std::string newElement_securityClassName = "java/lang/Integer"; std::string newElement_securityCtorSignature = "(I)V"; jint jniNewElementSecurity = static_cast(entry.security.Raw()); - chip::JniReferences::GetInstance().CreateBoxedObject(newElement_securityClassName.c_str(), - newElement_securityCtorSignature.c_str(), + chip::JniReferences::GetInstance().CreateBoxedObject(newElement_securityClassName, + newElement_securityCtorSignature, jniNewElementSecurity, newElement_security); jobject newElement_ssid; jbyteArray newElement_ssidByteArray = env->NewByteArray(static_cast(entry.ssid.size())); diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 2cbb402a512f87..5afa13c7f092a0 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -17,6 +17,8 @@ import("//build_overrides/chip.gni") import("${chip_root}/build/chip/java/config.gni") import("${chip_root}/build/chip/java/rules.gni") import("${chip_root}/build/chip/tests.gni") +import("${chip_root}/src/app/common_flags.gni") +import("${chip_root}/src/platform/device.gni") if (!matter_enable_java_compilation) { import("${build_root}/config/android_abi.gni") @@ -87,6 +89,10 @@ shared_library("jni") { deps += [ "${chip_root}/src/controller/data_model:java-jni-sources" ] } + if (chip_build_controller_dynamic_server) { + defines += [ "CHIP_DEVICE_CONFIG_DYNAMIC_SERVER" ] + } + if (matter_enable_java_compilation) { defines += [ "JAVA_MATTER_CONTROLLER_TEST" ] diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index 900440c7ce865c..8bedec602381e0 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -55,6 +55,10 @@ #include #include +#ifdef CHIP_DEVICE_CONFIG_DYNAMIC_SERVER +#include +#endif // CHIP_DEVICE_CONFIG_DYNAMIC_SERVER + #ifdef JAVA_MATTER_CONTROLLER_TEST #include #else @@ -136,6 +140,10 @@ jint JNI_OnLoad(JavaVM * jvm, void * reserved) SuccessOrExit(err); #endif // JAVA_MATTER_CONTROLLER_TEST +#ifdef CHIP_DEVICE_CONFIG_DYNAMIC_SERVER + chip::app::dynamic_server::InitAccessControl(); +#endif // CHIP_DEVICE_CONFIG_DYNAMIC_SERVER + exit: if (err != CHIP_NO_ERROR) { diff --git a/src/credentials/DeviceAttestationConstructor.h b/src/credentials/DeviceAttestationConstructor.h index b8404ef57577cc..7880199a6bb94d 100644 --- a/src/credentials/DeviceAttestationConstructor.h +++ b/src/credentials/DeviceAttestationConstructor.h @@ -24,10 +24,10 @@ namespace chip { namespace Credentials { // As per specifications section 11.22.5.1. Constant RESP_MAX -constexpr size_t kMaxRspLen = 900; +inline constexpr size_t kMaxRspLen = 900; // CSRNonce and AttestationNonce need to be this size -constexpr size_t kExpectedAttestationNonceSize = 32; +inline constexpr size_t kExpectedAttestationNonceSize = 32; /** * @brief Take the attestation elements buffer and return each component separately. diff --git a/src/credentials/PersistentStorageOpCertStore.h b/src/credentials/PersistentStorageOpCertStore.h index 4beb93b4e3b29a..41ddc096f861e3 100644 --- a/src/credentials/PersistentStorageOpCertStore.h +++ b/src/credentials/PersistentStorageOpCertStore.h @@ -36,7 +36,7 @@ namespace Credentials { * to refactors to use `OperationalCertificateStore` and exists as a baseline example * of how to use the interface. */ -class PersistentStorageOpCertStore : public OperationalCertificateStore +class PersistentStorageOpCertStore final : public OperationalCertificateStore { public: PersistentStorageOpCertStore() {} diff --git a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp index 75c2135cf33799..7a5ac72b203168 100644 --- a/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp +++ b/src/credentials/attestation_verifier/DefaultDeviceAttestationVerifier.cpp @@ -22,21 +22,21 @@ #include #include #include -#include #include +#include #include #include #include namespace chip { namespace TestCerts { -extern const ByteSpan sTestCert_PAA_FFF1_Cert; -extern const ByteSpan sTestCert_PAA_NoVID_Cert; +extern const Span kTestAttestationTrustStoreRoots; } // namespace TestCerts } // namespace chip using namespace chip::Crypto; +using chip::TestCerts::kTestAttestationTrustStoreRoots; namespace chip { namespace Credentials { @@ -46,11 +46,6 @@ namespace { // As per specifications section 11.22.5.1. Constant RESP_MAX constexpr size_t kMaxResponseLength = 900; -static const ByteSpan kTestPaaRoots[] = { - TestCerts::sTestCert_PAA_FFF1_Cert, - TestCerts::sTestCert_PAA_NoVID_Cert, -}; - // Test CD Signing Key from `credentials/test/certification-declaration/Chip-Test-CD-Signing-Cert.pem` // used to verify any in-SDK development CDs. The associated keypair to do actual signing is in // `credentials/test/certification-declaration/Chip-Test-CD-Signing-Key.pem`. @@ -268,7 +263,7 @@ struct MatterCDSigningKey const P256PublicKeySpan mPubkey; }; -std::array gCdSigningKeys = { { +constexpr std::array gCdSigningKeys = { { { FixedByteSpan<20>{ gTestCdPubkeyKid }, FixedByteSpan<65>{ gTestCdPubkeyBytes } }, { FixedByteSpan<20>{ gCdSigningKey001Kid }, FixedByteSpan<65>{ gCdSigningKey001PubkeyBytes } }, { FixedByteSpan<20>{ gCdSigningKey002Kid }, FixedByteSpan<65>{ gCdSigningKey002PubkeyBytes } }, @@ -277,7 +272,13 @@ std::array gCdSigningKeys = { { { FixedByteSpan<20>{ gCdSigningKey005Kid }, FixedByteSpan<65>{ gCdSigningKey005PubkeyBytes } }, } }; -const ArrayAttestationTrustStore kTestAttestationTrustStore{ &kTestPaaRoots[0], ArraySize(kTestPaaRoots) }; +struct TestAttestationTrustStore final : public ArrayAttestationTrustStore +{ + TestAttestationTrustStore() : + ArrayAttestationTrustStore(kTestAttestationTrustStoreRoots.data(), kTestAttestationTrustStoreRoots.size()) + {} +}; +Global gTestAttestationTrustStore; AttestationVerificationResult MapError(CertificateChainValidationResult certificateChainValidationResult) { @@ -397,7 +398,7 @@ void DefaultDACVerifier::VerifyAttestationInformation(const DeviceAttestationVer if (err == CHIP_ERROR_NOT_IMPLEMENTED) { - VerifyOrExit(kTestAttestationTrustStore.GetProductAttestationAuthorityCert(akid, paaDerBuffer) == CHIP_NO_ERROR, + VerifyOrExit(gTestAttestationTrustStore->GetProductAttestationAuthorityCert(akid, paaDerBuffer) == CHIP_NO_ERROR, attestationError = AttestationVerificationResult::kPaaNotFound); } @@ -686,7 +687,7 @@ CHIP_ERROR CsaCdKeysTrustStore::LookupVerifyingKey(const ByteSpan & kid, Crypto: const AttestationTrustStore * GetTestAttestationTrustStore() { - return &kTestAttestationTrustStore; + return &gTestAttestationTrustStore.get(); } DeviceAttestationVerifier * GetDefaultDACVerifier(const AttestationTrustStore * paaRootStore) diff --git a/src/credentials/tests/CHIPAttCert_test_vectors.cpp b/src/credentials/tests/CHIPAttCert_test_vectors.cpp index 8185e95e0c8608..84d35f4f194f01 100644 --- a/src/credentials/tests/CHIPAttCert_test_vectors.cpp +++ b/src/credentials/tests/CHIPAttCert_test_vectors.cpp @@ -4289,5 +4289,10 @@ constexpr uint8_t sTestCert_PAI_FFF2_NoPID_Resigned_SKID_Array[] = { extern const ByteSpan sTestCert_PAI_FFF2_NoPID_Resigned_SKID = ByteSpan(sTestCert_PAI_FFF2_NoPID_Resigned_SKID_Array); +extern constexpr Span kTestAttestationTrustStoreRoots((const ByteSpan[]){ + sTestCert_PAA_FFF1_Cert, + sTestCert_PAA_NoVID_Cert, +}); + } // namespace TestCerts } // namespace chip diff --git a/src/credentials/tests/CHIPAttCert_test_vectors.h b/src/credentials/tests/CHIPAttCert_test_vectors.h index 936cf00bddcd3d..8be73c4a38f09d 100644 --- a/src/credentials/tests/CHIPAttCert_test_vectors.h +++ b/src/credentials/tests/CHIPAttCert_test_vectors.h @@ -23,6 +23,9 @@ namespace chip { namespace TestCerts { +// Root CA certs for chip::Credentials::GetTestAttestationTrustStore() +extern const Span kTestAttestationTrustStoreRoots; + extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_Cert; extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_SKID; extern const ByteSpan sTestCert_DAC_FFF1_8000_0000_2CDPs_PublicKey; diff --git a/src/crypto/CHIPCryptoPAL.h b/src/crypto/CHIPCryptoPAL.h index 9e276b9eea4359..5b661f189f2964 100644 --- a/src/crypto/CHIPCryptoPAL.h +++ b/src/crypto/CHIPCryptoPAL.h @@ -42,78 +42,78 @@ namespace chip { namespace Crypto { -constexpr size_t kMax_x509_Certificate_Length = 600; - -constexpr size_t kP256_FE_Length = 32; -constexpr size_t kP256_ECDSA_Signature_Length_Raw = (2 * kP256_FE_Length); -constexpr size_t kP256_Point_Length = (2 * kP256_FE_Length + 1); -constexpr size_t kSHA256_Hash_Length = 32; -constexpr size_t kSHA1_Hash_Length = 20; -constexpr size_t kSubjectKeyIdentifierLength = kSHA1_Hash_Length; -constexpr size_t kAuthorityKeyIdentifierLength = kSHA1_Hash_Length; -constexpr size_t kMaxCertificateSerialNumberLength = 20; -constexpr size_t kMaxCertificateDistinguishedNameLength = 200; -constexpr size_t kMaxCRLDistributionPointURLLength = 100; - -constexpr const char * kValidCDPURIHttpPrefix = "http://"; -constexpr const char * kValidCDPURIHttpsPrefix = "https://"; - -constexpr size_t CHIP_CRYPTO_GROUP_SIZE_BYTES = kP256_FE_Length; -constexpr size_t CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES = kP256_Point_Length; - -constexpr size_t CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES = 16; -constexpr size_t CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES = 16; - -constexpr size_t kMax_ECDH_Secret_Length = kP256_FE_Length; -constexpr size_t kMax_ECDSA_Signature_Length = kP256_ECDSA_Signature_Length_Raw; -constexpr size_t kMAX_FE_Length = kP256_FE_Length; -constexpr size_t kMAX_Point_Length = kP256_Point_Length; -constexpr size_t kMAX_Hash_Length = kSHA256_Hash_Length; +inline constexpr size_t kMax_x509_Certificate_Length = 600; + +inline constexpr size_t kP256_FE_Length = 32; +inline constexpr size_t kP256_ECDSA_Signature_Length_Raw = (2 * kP256_FE_Length); +inline constexpr size_t kP256_Point_Length = (2 * kP256_FE_Length + 1); +inline constexpr size_t kSHA256_Hash_Length = 32; +inline constexpr size_t kSHA1_Hash_Length = 20; +inline constexpr size_t kSubjectKeyIdentifierLength = kSHA1_Hash_Length; +inline constexpr size_t kAuthorityKeyIdentifierLength = kSHA1_Hash_Length; +inline constexpr size_t kMaxCertificateSerialNumberLength = 20; +inline constexpr size_t kMaxCertificateDistinguishedNameLength = 200; +inline constexpr size_t kMaxCRLDistributionPointURLLength = 100; + +inline constexpr const char * kValidCDPURIHttpPrefix = "http://"; +inline constexpr const char * kValidCDPURIHttpsPrefix = "https://"; + +inline constexpr size_t CHIP_CRYPTO_GROUP_SIZE_BYTES = kP256_FE_Length; +inline constexpr size_t CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES = kP256_Point_Length; + +inline constexpr size_t CHIP_CRYPTO_AEAD_MIC_LENGTH_BYTES = 16; +inline constexpr size_t CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES = 16; + +inline constexpr size_t kMax_ECDH_Secret_Length = kP256_FE_Length; +inline constexpr size_t kMax_ECDSA_Signature_Length = kP256_ECDSA_Signature_Length_Raw; +inline constexpr size_t kMAX_FE_Length = kP256_FE_Length; +inline constexpr size_t kMAX_Point_Length = kP256_Point_Length; +inline constexpr size_t kMAX_Hash_Length = kSHA256_Hash_Length; // Minimum required CSR length buffer length is relatively small since it's a single // P256 key and no metadata/extensions are expected to be honored by the CA. -constexpr size_t kMIN_CSR_Buffer_Size = 255; +inline constexpr size_t kMIN_CSR_Buffer_Size = 255; [[deprecated("This constant is no longer used by common code and should be replaced by kMIN_CSR_Buffer_Size. Checks that a CSR is " "<= kMAX_CSR_Buffer_size must be updated. This remains to keep valid buffers working from previous public API " "usage.")]] constexpr size_t kMAX_CSR_Buffer_Size = 255; -constexpr size_t CHIP_CRYPTO_HASH_LEN_BYTES = kSHA256_Hash_Length; +inline constexpr size_t CHIP_CRYPTO_HASH_LEN_BYTES = kSHA256_Hash_Length; -constexpr size_t kSpake2p_Min_PBKDF_Salt_Length = 16; -constexpr size_t kSpake2p_Max_PBKDF_Salt_Length = 32; -constexpr uint32_t kSpake2p_Min_PBKDF_Iterations = 1000; -constexpr uint32_t kSpake2p_Max_PBKDF_Iterations = 100000; +inline constexpr size_t kSpake2p_Min_PBKDF_Salt_Length = 16; +inline constexpr size_t kSpake2p_Max_PBKDF_Salt_Length = 32; +inline constexpr uint32_t kSpake2p_Min_PBKDF_Iterations = 1000; +inline constexpr uint32_t kSpake2p_Max_PBKDF_Iterations = 100000; -constexpr size_t kP256_PrivateKey_Length = CHIP_CRYPTO_GROUP_SIZE_BYTES; -constexpr size_t kP256_PublicKey_Length = CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES; +inline constexpr size_t kP256_PrivateKey_Length = CHIP_CRYPTO_GROUP_SIZE_BYTES; +inline constexpr size_t kP256_PublicKey_Length = CHIP_CRYPTO_PUBLIC_KEY_SIZE_BYTES; -constexpr size_t kAES_CCM128_Key_Length = 128u / 8u; -constexpr size_t kAES_CCM128_Block_Length = kAES_CCM128_Key_Length; -constexpr size_t kAES_CCM128_Nonce_Length = 13; -constexpr size_t kAES_CCM128_Tag_Length = 16; +inline constexpr size_t kAES_CCM128_Key_Length = 128u / 8u; +inline constexpr size_t kAES_CCM128_Block_Length = kAES_CCM128_Key_Length; +inline constexpr size_t kAES_CCM128_Nonce_Length = 13; +inline constexpr size_t kAES_CCM128_Tag_Length = 16; -constexpr size_t CHIP_CRYPTO_AEAD_NONCE_LENGTH_BYTES = kAES_CCM128_Nonce_Length; +inline constexpr size_t CHIP_CRYPTO_AEAD_NONCE_LENGTH_BYTES = kAES_CCM128_Nonce_Length; /* These sizes are hardcoded here to remove header dependency on underlying crypto library * in a public interface file. The validity of these sizes is verified by static_assert in * the implementation files. */ -constexpr size_t kMAX_Spake2p_Context_Size = 1024; -constexpr size_t kMAX_P256Keypair_Context_Size = 512; +inline constexpr size_t kMAX_Spake2p_Context_Size = 1024; +inline constexpr size_t kMAX_P256Keypair_Context_Size = 512; -constexpr size_t kEmitDerIntegerWithoutTagOverhead = 1; // 1 sign stuffer -constexpr size_t kEmitDerIntegerOverhead = 3; // Tag + Length byte + 1 sign stuffer +inline constexpr size_t kEmitDerIntegerWithoutTagOverhead = 1; // 1 sign stuffer +inline constexpr size_t kEmitDerIntegerOverhead = 3; // Tag + Length byte + 1 sign stuffer -constexpr size_t kMAX_Hash_SHA256_Context_Size = CHIP_CONFIG_SHA256_CONTEXT_SIZE; +inline constexpr size_t kMAX_Hash_SHA256_Context_Size = CHIP_CONFIG_SHA256_CONTEXT_SIZE; -constexpr size_t kSpake2p_WS_Length = kP256_FE_Length + 8; -constexpr size_t kSpake2p_VerifierSerialized_Length = kP256_FE_Length + kP256_Point_Length; +inline constexpr size_t kSpake2p_WS_Length = kP256_FE_Length + 8; +inline constexpr size_t kSpake2p_VerifierSerialized_Length = kP256_FE_Length + kP256_Point_Length; -constexpr char kVIDPrefixForCNEncoding[] = "Mvid:"; -constexpr char kPIDPrefixForCNEncoding[] = "Mpid:"; -constexpr size_t kVIDandPIDHexLength = sizeof(uint16_t) * 2; -constexpr size_t kMax_CommonNameAttr_Length = 64; +inline constexpr char kVIDPrefixForCNEncoding[] = "Mvid:"; +inline constexpr char kPIDPrefixForCNEncoding[] = "Mpid:"; +inline constexpr size_t kVIDandPIDHexLength = sizeof(uint16_t) * 2; +inline constexpr size_t kMax_CommonNameAttr_Length = 64; /* * Overhead to encode a raw ECDSA signature in X9.62 format in ASN.1 DER @@ -131,14 +131,14 @@ constexpr size_t kMax_CommonNameAttr_Length = 64; * * There is 1 sequence of 2 integers. Overhead is SEQ_OVERHEAD + (2 * INT_OVERHEAD) = 3 + (2 * 3) = 9. */ -constexpr size_t kMax_ECDSA_X9Dot62_Asn1_Overhead = 9; -constexpr size_t kMax_ECDSA_Signature_Length_Der = kMax_ECDSA_Signature_Length + kMax_ECDSA_X9Dot62_Asn1_Overhead; +inline constexpr size_t kMax_ECDSA_X9Dot62_Asn1_Overhead = 9; +inline constexpr size_t kMax_ECDSA_Signature_Length_Der = kMax_ECDSA_Signature_Length + kMax_ECDSA_X9Dot62_Asn1_Overhead; static_assert(kMax_ECDH_Secret_Length >= kP256_FE_Length, "ECDH shared secret is too short for crypto suite"); static_assert(kMax_ECDSA_Signature_Length >= kP256_ECDSA_Signature_Length_Raw, "ECDSA signature buffer length is too short for crypto suite"); -constexpr size_t kCompressedFabricIdentifierSize = 8; +inline constexpr size_t kCompressedFabricIdentifierSize = 8; /** * Spake2+ parameters for P256 diff --git a/src/darwin/Framework/CHIP/BUILD.gn b/src/darwin/Framework/CHIP/BUILD.gn index c9174dd064f1b0..502e9a26f8322d 100644 --- a/src/darwin/Framework/CHIP/BUILD.gn +++ b/src/darwin/Framework/CHIP/BUILD.gn @@ -27,7 +27,6 @@ static_library("framework") { sources = [ "${chip_root}/src/app/clusters/ota-provider/ota-provider.cpp", "MTRError.mm", - "MTRIMDispatch.mm", ] public_deps = [ diff --git a/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.h b/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.h index 346af1edfd7fcf..4615c143da6ed7 100644 --- a/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.h +++ b/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.h @@ -15,7 +15,7 @@ * limitations under the License. */ -#import +#import NS_ASSUME_NONNULL_BEGIN @@ -23,59 +23,27 @@ NS_ASSUME_NONNULL_BEGIN typedef void (^MTRAsyncCallbackReadyHandler)(id context, NSUInteger retryCount); -// MTRAsyncCallbackQueue high level description -// The MTRAsyncCallbackQueue was made to call one readyHandler -// block at a time asynchronously, and the readyHandler is -// expected to start/schedule a task. When the task finishes -// asynchronously in the future (at any time, from any queue -// or thread), it is expected to ask the workItem object to -// either endWork or retryWork. - -// Sequence of steps when queuing a work item: -// - Create MTRAsyncCallbackQueueWorkItem object -// - Create ready handler block (MTRAsyncCallbackReadyHandler) -// - block is called when it's the WorkItem's turn to do work -// - its body is to perform a task that is expected to end asynchronously in the future -// - at the end of work, call on the work item object: -// - endWork for success or failure -// - retryWork for temporary failures -// - Set the readyHandler block on the WorkItem object -// - Call enqueueWorkItem on a MTRAsyncCallbackQueue - -// A serial one-at-a-time queue for performing work items +MTR_NEWLY_DEPRECATED("This class was not intended to be part of the public Matter API") @interface MTRAsyncCallbackWorkQueue : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; -// The context object is only held and passed back as a reference and is opaque to the work queue - (instancetype)initWithContext:(id _Nullable)context queue:(dispatch_queue_t)queue; - -// Called by the work queue owner to clean up and cancel work items - (void)invalidate; - -// Work items may be enqueued from any queue or thread -// Note: Once a work item is enqueued, its handlers cannot be modified - (void)enqueueWorkItem:(MTRAsyncCallbackQueueWorkItem *)item; @end -// An item in the work queue +MTR_NEWLY_DEPRECATED("This class was not intended to be part of the public Matter API") @interface MTRAsyncCallbackQueueWorkItem : NSObject - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; -// Both readyHandler and cancelHander will be called on the queue given to initWithQueue - (instancetype)initWithQueue:(dispatch_queue_t)queue; + @property (nonatomic, strong) MTRAsyncCallbackReadyHandler readyHandler; @property (nonatomic, strong) dispatch_block_t cancelHandler; -// Called by the creater of the work item when async work is done and should -// be removed from the queue. The work queue will run the next work item. -// Note: This must only be called from within the readyHandler - (void)endWork; - -// Called by the creater of the work item when async work should be retried. -// The work queue will call this workItem's readyHandler again. -// Note: This must only be called from within the readyHandler - (void)retryWork; @end diff --git a/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.mm b/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.mm index 193a4ce7a038d2..ad6900a001f41e 100644 --- a/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.mm +++ b/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue.mm @@ -18,8 +18,8 @@ #import #import -#import "MTRAsyncCallbackWorkQueue_Internal.h" #import "MTRLogging_Internal.h" +#import #pragma mark - Class extensions @@ -62,7 +62,6 @@ - (instancetype)initWithContext:(id)context queue:(dispatch_queue_t)queue _context = context; _queue = queue; _items = [NSMutableArray array]; - MTR_LOG_INFO("MTRAsyncCallbackWorkQueue init for context %@", context); } return self; } @@ -103,8 +102,6 @@ - (void)invalidate _items = nil; os_unfair_lock_unlock(&_lock); - MTR_LOG_INFO( - "MTRAsyncCallbackWorkQueue invalidate for context %@ items count: %lu", _context, (unsigned long) invalidateItems.count); for (MTRAsyncCallbackQueueWorkItem * item in invalidateItems) { [item cancel]; } @@ -169,50 +166,10 @@ - (void)_callNextReadyWorkItem self.runningWorkItemCount = 1; MTRAsyncCallbackQueueWorkItem * workItem = self.items.firstObject; - - // Check if batching is possible or needed. Only ask work item to batch once for simplicity - if (workItem.batchable && workItem.batchingHandler && (workItem.retryCount == 0)) { - while (self.items.count >= 2) { - MTRAsyncCallbackQueueWorkItem * nextWorkItem = self.items[1]; - if (!nextWorkItem.batchable || (nextWorkItem.batchingID != workItem.batchingID)) { - // next item is not eligible to merge with this one - break; - } - - BOOL fullyMerged = NO; - workItem.batchingHandler(workItem.batchableData, nextWorkItem.batchableData, &fullyMerged); - if (!fullyMerged) { - // We can't remove the next work item, so we can't merge anything else into this one. - break; - } - - [self.items removeObjectAtIndex:1]; - } - } - [workItem callReadyHandlerWithContext:self.context]; } } -- (BOOL)isDuplicateForTypeID:(NSUInteger)opaqueDuplicateTypeID workItemData:(id)opaqueWorkItemData -{ - os_unfair_lock_lock(&_lock); - // Start from the last item - for (NSUInteger i = self.items.count; i > 0; i--) { - MTRAsyncCallbackQueueWorkItem * item = self.items[i - 1]; - BOOL isDuplicate = NO; - BOOL stop = NO; - if (item.supportsDuplicateCheck && (item.duplicateTypeID == opaqueDuplicateTypeID) && item.duplicateCheckHandler) { - item.duplicateCheckHandler(opaqueWorkItemData, &isDuplicate, &stop); - if (stop) { - os_unfair_lock_unlock(&_lock); - return isDuplicate; - } - } - } - os_unfair_lock_unlock(&_lock); - return NO; -} @end @implementation MTRAsyncCallbackQueueWorkItem @@ -319,23 +276,4 @@ - (void)cancel } } -- (void)setBatchingID:(NSUInteger)opaqueBatchingID - data:(id)opaqueBatchableData - handler:(MTRAsyncCallbackBatchingHandler)batchingHandler -{ - os_unfair_lock_lock(&self->_lock); - _batchable = YES; - _batchingID = opaqueBatchingID; - _batchableData = opaqueBatchableData; - _batchingHandler = batchingHandler; - os_unfair_lock_unlock(&self->_lock); -} - -- (void)setDuplicateTypeID:(NSUInteger)opaqueDuplicateTypeID handler:(MTRAsyncCallbackDuplicateCheckHandler)duplicateCheckHandler -{ - _supportsDuplicateCheck = YES; - _duplicateTypeID = opaqueDuplicateTypeID; - _duplicateCheckHandler = duplicateCheckHandler; -} - @end diff --git a/src/darwin/Framework/CHIP/MTRAsyncWorkQueue.h b/src/darwin/Framework/CHIP/MTRAsyncWorkQueue.h new file mode 100644 index 00000000000000..259bf1dbc78a25 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRAsyncWorkQueue.h @@ -0,0 +1,84 @@ +/** + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import "MTRDefines_Internal.h" + +NS_ASSUME_NONNULL_BEGIN + +@class MTRAsyncWorkItem; + +typedef void (^MTRAsyncWorkReadyHandler)(id context, NSUInteger retryCount); + +// MTRAsyncWorkQueue high level description +// The MTRAsyncWorkQueue was made to call one readyHandler +// block at a time asynchronously, and the readyHandler is +// expected to start/schedule a task. When the task finishes +// asynchronously in the future (at any time, from any queue +// or thread), it is expected to ask the workItem object to +// either endWork or retryWork. + +// Sequence of steps when queuing a work item: +// - Create MTRAsyncWorkItem object +// - Create ready handler block (MTRAsyncWorkReadyHandler) +// - block is called when it's the WorkItem's turn to do work +// - its body is to perform a task that is expected to end asynchronously in the future +// - at the end of work, call on the work item object: +// - endWork for success or failure +// - retryWork for temporary failures +// - Set the readyHandler block on the WorkItem object +// - Call enqueueWorkItem on a MTRAsyncWorkQueue + +// A serial one-at-a-time queue for performing work items +MTR_TESTABLE +@interface MTRAsyncWorkQueue : NSObject +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +// The context object is only held and passed back as a reference and is opaque to the work queue +- (instancetype)initWithContext:(id _Nullable)context queue:(dispatch_queue_t)queue; + +// Called by the work queue owner to clean up and cancel work items +- (void)invalidate; + +// Work items may be enqueued from any queue or thread +// Note: Once a work item is enqueued, its handlers cannot be modified +- (void)enqueueWorkItem:(MTRAsyncWorkItem *)item; +@end + +// An item in the work queue +MTR_TESTABLE +@interface MTRAsyncWorkItem : NSObject +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +// Both readyHandler and cancelHander will be called on the queue given to initWithQueue +- (instancetype)initWithQueue:(dispatch_queue_t)queue; +@property (nonatomic, strong) MTRAsyncWorkReadyHandler readyHandler; +@property (nonatomic, strong) dispatch_block_t cancelHandler; + +// Called by the creater of the work item when async work is done and should +// be removed from the queue. The work queue will run the next work item. +// Note: This must only be called from within the readyHandler +- (void)endWork; + +// Called by the creater of the work item when async work should be retried. +// The work queue will call this workItem's readyHandler again. +// Note: This must only be called from within the readyHandler +- (void)retryWork; +@end + +NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRAsyncWorkQueue.mm b/src/darwin/Framework/CHIP/MTRAsyncWorkQueue.mm new file mode 100644 index 00000000000000..98291126a31728 --- /dev/null +++ b/src/darwin/Framework/CHIP/MTRAsyncWorkQueue.mm @@ -0,0 +1,339 @@ +/** + * + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import +#import + +#import "MTRAsyncWorkQueue_Internal.h" +#import "MTRLogging_Internal.h" + +#pragma mark - Class extensions + +@interface MTRAsyncWorkQueue () +// The lock protects the internal state of the work queue so that these may be called from any queue or thread: +// -enqueueWorkItem: +// -invalidate +// -endWork: +// -retryWork: +@property (nonatomic, readonly) os_unfair_lock lock; +@property (nonatomic, strong, readonly) id context; +@property (nonatomic, strong, readonly) dispatch_queue_t queue; +@property (nonatomic, strong, readonly) NSMutableArray * items; +@property (nonatomic, readwrite) NSUInteger runningWorkItemCount; + +// For WorkItem's use only - the parameter is for sanity check +- (void)endWork:(MTRAsyncWorkItem *)workItem; +- (void)retryWork:(MTRAsyncWorkItem *)workItem; +@end + +@interface MTRAsyncWorkItem () +@property (nonatomic, readonly) os_unfair_lock lock; +@property (nonatomic, strong, readonly) dispatch_queue_t queue; +@property (nonatomic, readwrite) NSUInteger retryCount; +@property (nonatomic, strong) MTRAsyncWorkQueue * workQueue; +@property (nonatomic, readonly) BOOL enqueued; +// Called by the queue +- (void)markedEnqueued; +- (void)callReadyHandlerWithContext:(id)context; +- (void)cancel; +@end + +#pragma mark - Class implementations + +@implementation MTRAsyncWorkQueue +- (instancetype)initWithContext:(id)context queue:(dispatch_queue_t)queue +{ + if (self = [super init]) { + _lock = OS_UNFAIR_LOCK_INIT; + _context = context; + _queue = queue; + _items = [NSMutableArray array]; + MTR_LOG_INFO("MTRAsyncCallbackWorkQueue init for context %@", context); + } + return self; +} + +- (NSString *)description +{ + os_unfair_lock_lock(&_lock); + + auto * desc = [NSString + stringWithFormat:@"MTRAsyncCallbackWorkQueue context: %@ items count: %lu", self.context, (unsigned long) self.items.count]; + + os_unfair_lock_unlock(&_lock); + + return desc; +} + +- (void)enqueueWorkItem:(MTRAsyncWorkItem *)item +{ + if (item.enqueued) { + MTR_LOG_ERROR("MTRAsyncCallbackWorkQueue enqueueWorkItem: item cannot be enqueued twice"); + return; + } + + [item markedEnqueued]; + + os_unfair_lock_lock(&_lock); + item.workQueue = self; + [self.items addObject:item]; + + [self _callNextReadyWorkItem]; + os_unfair_lock_unlock(&_lock); +} + +- (void)invalidate +{ + os_unfair_lock_lock(&_lock); + NSMutableArray * invalidateItems = _items; + _items = nil; + os_unfair_lock_unlock(&_lock); + + MTR_LOG_INFO( + "MTRAsyncCallbackWorkQueue invalidate for context %@ items count: %lu", _context, (unsigned long) invalidateItems.count); + for (MTRAsyncWorkItem * item in invalidateItems) { + [item cancel]; + } + [invalidateItems removeAllObjects]; +} + +// called after executing a work item +- (void)_postProcessWorkItem:(MTRAsyncWorkItem *)workItem retry:(BOOL)retry +{ + os_unfair_lock_lock(&_lock); + // sanity check if running + if (!self.runningWorkItemCount) { + // something is wrong with state - nothing is currently running + os_unfair_lock_unlock(&_lock); + MTR_LOG_ERROR("MTRAsyncCallbackWorkQueue endWork: no work is running on work queue"); + return; + } + + // sanity check the same work item is running + // when "concurrency width" is implemented need to check first N items + MTRAsyncWorkItem * firstWorkItem = self.items.firstObject; + if (firstWorkItem != workItem) { + // something is wrong with this work item - should not be currently running + os_unfair_lock_unlock(&_lock); + MTR_LOG_ERROR("MTRAsyncCallbackWorkQueue endWork: work item is not first on work queue"); + return; + } + + // if work item is done (no need to retry), remove from queue and call ready on the next item + if (!retry) { + [self.items removeObjectAtIndex:0]; + } + + // when "concurrency width" is implemented this will be decremented instead + self.runningWorkItemCount = 0; + [self _callNextReadyWorkItem]; + os_unfair_lock_unlock(&_lock); +} + +- (void)endWork:(MTRAsyncWorkItem *)workItem +{ + [self _postProcessWorkItem:workItem retry:NO]; +} + +- (void)retryWork:(MTRAsyncWorkItem *)workItem +{ + [self _postProcessWorkItem:workItem retry:YES]; +} + +// assume lock is held while calling this +- (void)_callNextReadyWorkItem +{ + // when "concurrency width" is implemented this will be checked against the width + if (self.runningWorkItemCount) { + // can't run next work item until the current one is done + return; + } + + // only proceed to mark queue as running if there are items to run + if (self.items.count) { + // when "concurrency width" is implemented this will be incremented instead + self.runningWorkItemCount = 1; + + MTRAsyncWorkItem * workItem = self.items.firstObject; + + // Check if batching is possible or needed. Only ask work item to batch once for simplicity + if (workItem.batchable && workItem.batchingHandler && (workItem.retryCount == 0)) { + while (self.items.count >= 2) { + MTRAsyncWorkItem * nextWorkItem = self.items[1]; + if (!nextWorkItem.batchable || (nextWorkItem.batchingID != workItem.batchingID)) { + // next item is not eligible to merge with this one + break; + } + + BOOL fullyMerged = NO; + workItem.batchingHandler(workItem.batchableData, nextWorkItem.batchableData, &fullyMerged); + if (!fullyMerged) { + // We can't remove the next work item, so we can't merge anything else into this one. + break; + } + + [self.items removeObjectAtIndex:1]; + } + } + + [workItem callReadyHandlerWithContext:self.context]; + } +} + +- (BOOL)isDuplicateForTypeID:(NSUInteger)opaqueDuplicateTypeID workItemData:(id)opaqueWorkItemData +{ + os_unfair_lock_lock(&_lock); + // Start from the last item + for (NSUInteger i = self.items.count; i > 0; i--) { + MTRAsyncWorkItem * item = self.items[i - 1]; + BOOL isDuplicate = NO; + BOOL stop = NO; + if (item.supportsDuplicateCheck && (item.duplicateTypeID == opaqueDuplicateTypeID) && item.duplicateCheckHandler) { + item.duplicateCheckHandler(opaqueWorkItemData, &isDuplicate, &stop); + if (stop) { + os_unfair_lock_unlock(&_lock); + return isDuplicate; + } + } + } + os_unfair_lock_unlock(&_lock); + return NO; +} +@end + +@implementation MTRAsyncWorkItem + +- (instancetype)initWithQueue:(dispatch_queue_t)queue +{ + if (self = [super init]) { + _lock = OS_UNFAIR_LOCK_INIT; + _queue = queue; + } + return self; +} + +// assume lock is held +- (void)_invalidate +{ + // Make sure we don't leak via handlers that close over us, as ours must. + // This is a bit odd, since these are supposed to be non-nullable + // properties, but it's the best we can do given our API surface, unless we + // assume that all consumers consistently use __weak refs to us inside their + // handlers. + // + // Setting the attributes to nil will not compile; set the ivars directly. + _readyHandler = nil; + _cancelHandler = nil; +} + +- (void)invalidate +{ + os_unfair_lock_lock(&_lock); + [self _invalidate]; + os_unfair_lock_unlock(&_lock); +} + +- (void)markedEnqueued +{ + os_unfair_lock_lock(&_lock); + _enqueued = YES; + os_unfair_lock_unlock(&_lock); +} + +- (void)setReadyHandler:(MTRAsyncWorkReadyHandler)readyHandler +{ + os_unfair_lock_lock(&_lock); + if (!_enqueued) { + _readyHandler = readyHandler; + } + os_unfair_lock_unlock(&_lock); +} + +- (void)setCancelHandler:(dispatch_block_t)cancelHandler +{ + os_unfair_lock_lock(&_lock); + if (!_enqueued) { + _cancelHandler = cancelHandler; + } + os_unfair_lock_unlock(&_lock); +} + +- (void)endWork +{ + [self.workQueue endWork:self]; + [self invalidate]; +} + +- (void)retryWork +{ + [self.workQueue retryWork:self]; +} + +// Called by the work queue +- (void)callReadyHandlerWithContext:(id)context +{ + dispatch_async(self.queue, ^{ + os_unfair_lock_lock(&self->_lock); + MTRAsyncWorkReadyHandler readyHandler = self->_readyHandler; + NSUInteger retryCount = self->_retryCount; + if (readyHandler) { + self->_retryCount++; + } + os_unfair_lock_unlock(&self->_lock); + + if (readyHandler == nil) { + // Nothing to do here. + [self endWork]; + } else { + readyHandler(context, retryCount); + } + }); +} + +// Called by the work queue +- (void)cancel +{ + os_unfair_lock_lock(&self->_lock); + dispatch_block_t cancelHandler = self->_cancelHandler; + [self _invalidate]; + os_unfair_lock_unlock(&self->_lock); + + if (cancelHandler) { + dispatch_async(self.queue, ^{ + cancelHandler(); + }); + } +} + +- (void)setBatchingID:(NSUInteger)opaqueBatchingID data:(id)opaqueBatchableData handler:(MTRAsyncWorkBatchingHandler)batchingHandler +{ + os_unfair_lock_lock(&self->_lock); + _batchable = YES; + _batchingID = opaqueBatchingID; + _batchableData = opaqueBatchableData; + _batchingHandler = batchingHandler; + os_unfair_lock_unlock(&self->_lock); +} + +- (void)setDuplicateTypeID:(NSUInteger)opaqueDuplicateTypeID handler:(MTRAsyncWorkDuplicateCheckHandler)duplicateCheckHandler +{ + _supportsDuplicateCheck = YES; + _duplicateTypeID = opaqueDuplicateTypeID; + _duplicateCheckHandler = duplicateCheckHandler; +} + +@end diff --git a/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue_Internal.h b/src/darwin/Framework/CHIP/MTRAsyncWorkQueue_Internal.h similarity index 84% rename from src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue_Internal.h rename to src/darwin/Framework/CHIP/MTRAsyncWorkQueue_Internal.h index 7abbb9cf10a83c..54995effd8a8c7 100644 --- a/src/darwin/Framework/CHIP/MTRAsyncCallbackWorkQueue_Internal.h +++ b/src/darwin/Framework/CHIP/MTRAsyncWorkQueue_Internal.h @@ -17,7 +17,7 @@ #import -#import "MTRAsyncCallbackWorkQueue.h" +#import "MTRAsyncWorkQueue.h" NS_ASSUME_NONNULL_BEGIN @@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN // - The "batching ID" is used for grouping mergeable work items with unique merging strategies. The ID value is opaque to this // API, and the API client is responsible for assigning them. // - Each work item will only be asked to batch before it's first dequeued to run readyHandler. -// See the MTRAsyncCallbackBatchingHandler definition for more details. +// See the MTRAsyncWorkBatchingHandler definition for more details. // The batching handler is called by the work queue when all of the following are true: // @@ -47,14 +47,14 @@ NS_ASSUME_NONNULL_BEGIN // // If *fullyMerged is set to YES, this handler may be called again to possibly also batch the work item // after the one that was dropped. -typedef void (^MTRAsyncCallbackBatchingHandler)(id opaqueDataCurrent, id opaqueDataNext, BOOL * fullyMerged); +typedef void (^MTRAsyncWorkBatchingHandler)(id opaqueDataCurrent, id opaqueDataNext, BOOL * fullyMerged); // Optional feature: Duplicate Filtering // This is a facility that enables the API client to check if a potential work item has already been enqueued. By providing a // handler that can answer if a work item's relevant data is a duplicate, it can avoid redundant queuing of requests. // - The "duplicate type ID" is used for grouping different types of work items for duplicate checking. The ID value is opaque // to this API, and the API client is responsible for assigning them. -// See the MTRAsyncCallbackDuplicateCheckHandler definition and the WorkQueue's -isDuplicateForTypeID:workItemData: method +// See the MTRAsyncWorkDuplicateCheckHandler definition and the WorkQueue's -isDuplicateForTypeID:workItemData: method // descriptions for more details. // The duplicate check handler is called by the work queue when the client wishes to check whether a work item is a duplicate of an @@ -68,9 +68,9 @@ typedef void (^MTRAsyncCallbackBatchingHandler)(id opaqueDataCurrent, id opaqueD // // If the handler is unable to determine if the data is duplicate work, it should set *stop to NO. // In this case, the value of *isDuplicate is not examined. -typedef void (^MTRAsyncCallbackDuplicateCheckHandler)(id opaqueItemData, BOOL * isDuplicate, BOOL * stop); +typedef void (^MTRAsyncWorkDuplicateCheckHandler)(id opaqueItemData, BOOL * isDuplicate, BOOL * stop); -@interface MTRAsyncCallbackWorkQueue () +@interface MTRAsyncWorkQueue () // The MTRDevice object is only held and passed back as a reference and is opaque to the queue - (instancetype)initWithContext:(id _Nullable)context queue:(dispatch_queue_t)queue; @@ -82,21 +82,21 @@ typedef void (^MTRAsyncCallbackDuplicateCheckHandler)(id opaqueItemData, BOOL * - (BOOL)isDuplicateForTypeID:(NSUInteger)opaqueDuplicateTypeID workItemData:(id)opaqueWorkItemData; @end -@interface MTRAsyncCallbackQueueWorkItem () +@interface MTRAsyncWorkItem () // Batching @property (nonatomic, readonly) BOOL batchable; @property (nonatomic, readonly) NSUInteger batchingID; @property (nonatomic, readonly) id batchableData; -@property (nonatomic, readonly) MTRAsyncCallbackBatchingHandler batchingHandler; +@property (nonatomic, readonly) MTRAsyncWorkBatchingHandler batchingHandler; - (void)setBatchingID:(NSUInteger)opaqueBatchingID data:(id)opaqueBatchableData - handler:(MTRAsyncCallbackBatchingHandler)batchingHandler; + handler:(MTRAsyncWorkBatchingHandler)batchingHandler; // Duplicate check @property (nonatomic, readonly) BOOL supportsDuplicateCheck; @property (nonatomic, readonly) NSUInteger duplicateTypeID; -@property (nonatomic, readonly) MTRAsyncCallbackDuplicateCheckHandler duplicateCheckHandler; -- (void)setDuplicateTypeID:(NSUInteger)opaqueDuplicateTypeID handler:(MTRAsyncCallbackDuplicateCheckHandler)duplicateCheckHandler; +@property (nonatomic, readonly) MTRAsyncWorkDuplicateCheckHandler duplicateCheckHandler; +- (void)setDuplicateTypeID:(NSUInteger)opaqueDuplicateTypeID handler:(MTRAsyncWorkDuplicateCheckHandler)duplicateCheckHandler; @end NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRDefines_Internal.h b/src/darwin/Framework/CHIP/MTRDefines_Internal.h index f8a6a9329a5cc9..674d52f60fdb2c 100644 --- a/src/darwin/Framework/CHIP/MTRDefines_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDefines_Internal.h @@ -27,3 +27,9 @@ #else #define MTR_DIRECT_MEMBERS #endif + +#ifdef DEBUG +#define MTR_TESTABLE MTR_EXPORT +#else +#define MTR_TESTABLE MTR_HIDDEN +#endif diff --git a/src/darwin/Framework/CHIP/MTRDevice.h b/src/darwin/Framework/CHIP/MTRDevice.h index aadcb569d8f833..1241d21601e8b6 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.h +++ b/src/darwin/Framework/CHIP/MTRDevice.h @@ -22,7 +22,6 @@ NS_ASSUME_NONNULL_BEGIN @class MTRDeviceController; -@class MTRAsyncCallbackWorkQueue; typedef NS_ENUM(NSUInteger, MTRDeviceState) { MTRDeviceStateUnknown = 0, diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index ce68f134260bb1..a2f5f795389776 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -18,7 +18,7 @@ #import #import -#import "MTRAsyncCallbackWorkQueue_Internal.h" +#import "MTRAsyncWorkQueue_Internal.h" #import "MTRAttributeSpecifiedCheck.h" #import "MTRBaseDevice_Internal.h" #import "MTRBaseSubscriptionCallback.h" @@ -200,7 +200,7 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle = dispatch_queue_create("org.csa-iot.matter.framework.device.workqueue", DISPATCH_QUEUE_SERIAL_WITH_AUTORELEASE_POOL); _readCache = [NSMutableDictionary dictionary]; _expectedValueCache = [NSMutableDictionary dictionary]; - _asyncCallbackWorkQueue = [[MTRAsyncCallbackWorkQueue alloc] initWithContext:self queue:_queue]; + _asyncCallbackWorkQueue = [[MTRAsyncWorkQueue alloc] initWithContext:self queue:_queue]; _state = MTRDeviceStateUnknown; MTR_LOG_INFO("%@ init with hex nodeID 0x%016llX", self, _nodeID.unsignedLongLongValue); } @@ -869,8 +869,8 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) NSMutableArray * readRequests = [NSMutableArray arrayWithObject:readRequestData]; // Create work item, set ready handler to perform task, then enqueue the work - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.queue]; - MTRAsyncCallbackBatchingHandler batchingHandler = ^(id opaqueDataCurrent, id opaqueDataNext, BOOL * fullyMerged) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; + MTRAsyncWorkBatchingHandler batchingHandler = ^(id opaqueDataCurrent, id opaqueDataNext, BOOL * fullyMerged) { NSMutableArray * readRequestsCurrent = opaqueDataCurrent; NSMutableArray * readRequestsNext = opaqueDataNext; @@ -908,7 +908,7 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) *fullyMerged = YES; } }; - MTRAsyncCallbackDuplicateCheckHandler duplicateCheckHandler = ^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { + MTRAsyncWorkDuplicateCheckHandler duplicateCheckHandler = ^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { for (NSArray * readItem in readRequests) { if ([readItem isEqual:opaqueItemData]) { MTR_LOG_DEFAULT("%@ duplicate check found %@ - report duplicate", logPrefix, readItem); @@ -919,7 +919,7 @@ static BOOL AttributeHasChangesOmittedQuality(MTRAttributePath * attributePath) } *stop = NO; }; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, self->_asyncCallbackWorkQueue); // Sanity check @@ -1000,14 +1000,14 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID expectedValueInterval:expectedValueInterval expectedValueID:&expectedValueID]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.queue]; + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; // The write operation will install a duplicate check handler, to return NO for "isDuplicate". Since a write operation may // change values, only read requests after this should be considered for duplicate requests. - MTRAsyncCallbackDuplicateCheckHandler duplicateCheckHandler = ^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { + MTRAsyncWorkDuplicateCheckHandler duplicateCheckHandler = ^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { *isDuplicate = NO; *stop = YES; }; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, self->_asyncCallbackWorkQueue); MTRBaseDevice * baseDevice = [self newBaseDevice]; [baseDevice @@ -1060,14 +1060,14 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID [attributePaths addObject:expectedValue[MTRAttributePathKey]]; } } - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.queue]; + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.queue]; // The command operation will install a duplicate check handler, to return NO for "isDuplicate". Since a command operation may // change values, only read requests after this should be considered for duplicate requests. - MTRAsyncCallbackDuplicateCheckHandler duplicateCheckHandler = ^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { + MTRAsyncWorkDuplicateCheckHandler duplicateCheckHandler = ^(id opaqueItemData, BOOL * isDuplicate, BOOL * stop) { *isDuplicate = NO; *stop = YES; }; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, self->_asyncCallbackWorkQueue); MTRBaseDevice * baseDevice = [self newBaseDevice]; [baseDevice diff --git a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm index 21660828e25847..4f73834b261b03 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceControllerFactory.mm @@ -26,7 +26,6 @@ #endif // MTR_PER_CONTROLLER_STORAGE_ENABLED #import "MTRCertificates.h" -#import "MTRControllerAccessControl.h" #import "MTRDemuxingStorage.h" #import "MTRDeviceController.h" #import "MTRDeviceControllerStartupParams.h" @@ -45,6 +44,7 @@ #import +#include #include #include #include @@ -405,7 +405,7 @@ - (BOOL)startControllerFactory:(MTRDeviceControllerFactoryParams *)startupParams return; } - [MTRControllerAccessControl init]; + app::dynamic_server::InitAccessControl(); if (startupParams.hasStorage) { _persistentStorageDelegate = new (std::nothrow) MTRPersistentStorageDelegateBridge(startupParams.storage); diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index 8da4cecb60f7bd..7815fe2e5d44c2 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -16,14 +16,15 @@ */ #import - -#import "MTRBaseDevice.h" -#import "MTRDevice.h" +#import +#import #include NS_ASSUME_NONNULL_BEGIN +@class MTRAsyncWorkQueue; + typedef void (^MTRDevicePerformAsyncBlock)(MTRBaseDevice * baseDevice); @interface MTRDevice () @@ -47,7 +48,7 @@ typedef void (^MTRDevicePerformAsyncBlock)(MTRBaseDevice * baseDevice); // on work items should happen on this queue, so we don't block progress of the // asyncCallbackWorkQueue on any client code. @property (nonatomic) dispatch_queue_t queue; -@property (nonatomic, readonly) MTRAsyncCallbackWorkQueue * asyncCallbackWorkQueue; +@property (nonatomic, readonly) MTRAsyncWorkQueue * asyncCallbackWorkQueue; @end diff --git a/src/darwin/Framework/CHIP/MTRIMDispatch.mm b/src/darwin/Framework/CHIP/MTRIMDispatch.mm deleted file mode 100644 index 3b9c62c9e503d4..00000000000000 --- a/src/darwin/Framework/CHIP/MTRIMDispatch.mm +++ /dev/null @@ -1,352 +0,0 @@ -/* - * - * Copyright (c) 2022 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#import - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/** - * This file defines the APIs needed to handle interaction model dispatch. - * These are the APIs normally defined in - * src/app/util/ember-compatibility-functions.cpp and the generated - * IMClusterCommandHandler.cpp but we want a different implementation of these - * to enable more dynamic behavior, since not all framework consumers will be - * implementing the same server clusters. - */ -using namespace chip; -using namespace chip::app; -using namespace chip::app::Clusters; - -namespace { - -// TODO: Maybe consider making this configurable? See also -// CHIPControllerAccessControl.mm. -constexpr EndpointId kSupportedEndpoint = 0; - -} // anonymous namespace - -namespace chip { -namespace app { - - using Access::SubjectDescriptor; - using Protocols::InteractionModel::Status; - - namespace { - - bool IsSupportedGlobalAttribute(AttributeId aAttribute) - { - // We don't have any non-global attributes. - using namespace Globals::Attributes; - - for (auto & attr : GlobalAttributesNotInMetadata) { - if (attr == aAttribute) { - return true; - } - } - - switch (aAttribute) { - case FeatureMap::Id: - FALLTHROUGH; - case ClusterRevision::Id: - return true; - } - - return false; - } - - Status DetermineAttributeStatus(const ConcreteAttributePath & aPath, bool aIsWrite) - { - // TODO: Consider making this configurable for applications that are not - // trying to be an OTA provider, though in practice it just affects which - // error is returned. - if (aPath.mEndpointId != kSupportedEndpoint) { - return Status::UnsupportedEndpoint; - } - - // TODO: Consider making this configurable for applications that are not - // trying to be an OTA provider, though in practice it just affects which - // error is returned. - if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) { - return Status::UnsupportedCluster; - } - - if (!IsSupportedGlobalAttribute(aPath.mAttributeId)) { - return Status::UnsupportedAttribute; - } - - // No permissions for this for read, and none of these are writable for - // write. The writable-or-not check happens before the ACL check. - return aIsWrite ? Status::UnsupportedWrite : Status::UnsupportedAccess; - } - - } // anonymous namespace - - CHIP_ERROR ReadSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, bool aIsFabricFiltered, - const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports, - AttributeValueEncoder::AttributeEncodeState * aEncoderState) - { - Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ false); - return aAttributeReports.EncodeAttributeStatus(aPath, StatusIB(status)); - } - - bool ConcreteAttributePathExists(const ConcreteAttributePath & aPath) - { - return DetermineAttributeStatus(aPath, /* aIsWrite = */ false) == Status::UnsupportedAccess; - } - - Status ServerClusterCommandExists(const ConcreteCommandPath & aPath) - { - // TODO: Consider making this configurable for applications that are not - // trying to be an OTA provider. - using namespace OtaSoftwareUpdateProvider::Commands; - - if (aPath.mEndpointId != kSupportedEndpoint) { - return Status::UnsupportedEndpoint; - } - - if (aPath.mClusterId != OtaSoftwareUpdateProvider::Id) { - return Status::UnsupportedCluster; - } - - switch (aPath.mCommandId) { - case QueryImage::Id: - FALLTHROUGH; - case ApplyUpdateRequest::Id: - FALLTHROUGH; - case NotifyUpdateApplied::Id: - return Status::Success; - } - - return Status::UnsupportedCommand; - } - - bool IsClusterDataVersionEqual(const ConcreteClusterPath & aConcreteClusterPath, DataVersion aRequiredVersion) - { - // Will never be called anyway; we have no attributes. - return false; - } - - const EmberAfAttributeMetadata * GetAttributeMetadata(const ConcreteAttributePath & aConcreteClusterPath) - { - // Note: This test does not make use of the real attribute metadata. - static EmberAfAttributeMetadata stub = { .defaultValue = EmberAfDefaultOrMinMaxAttributeValue(uint32_t(0)) }; - return &stub; - } - - bool IsDeviceTypeOnEndpoint(DeviceTypeId deviceType, EndpointId endpoint) { return false; } - - CHIP_ERROR WriteSingleClusterData(const SubjectDescriptor & aSubjectDescriptor, const ConcreteDataAttributePath & aPath, - TLV::TLVReader & aReader, WriteHandler * aWriteHandler) - { - Status status = DetermineAttributeStatus(aPath, /* aIsWrite = */ true); - return aWriteHandler->AddStatus(aPath, status); - } - - // No attribute access overrides on iOS for now. - // TODO (#16806): This function can be moved to InteractionModelEngine. - AttributeAccessInterface * GetAttributeAccessOverride(EndpointId endpointId, ClusterId clusterId) { return nullptr; } - - void DispatchSingleClusterCommand(const ConcreteCommandPath & aPath, TLV::TLVReader & aReader, CommandHandler * aCommandObj) - { - // This command passed ServerClusterCommandExists so we know it's one of our - // supported commands. - using namespace OtaSoftwareUpdateProvider::Commands; - - bool wasHandled = false; - CHIP_ERROR err = CHIP_NO_ERROR; - - switch (aPath.mCommandId) { - case QueryImage::Id: { - QueryImage::DecodableType commandData; - err = DataModel::Decode(aReader, commandData); - if (err == CHIP_NO_ERROR) { - wasHandled = emberAfOtaSoftwareUpdateProviderClusterQueryImageCallback(aCommandObj, aPath, commandData); - } - break; - } - case ApplyUpdateRequest::Id: { - ApplyUpdateRequest::DecodableType commandData; - err = DataModel::Decode(aReader, commandData); - if (err == CHIP_NO_ERROR) { - wasHandled = emberAfOtaSoftwareUpdateProviderClusterApplyUpdateRequestCallback(aCommandObj, aPath, commandData); - } - break; - } - case NotifyUpdateApplied::Id: { - NotifyUpdateApplied::DecodableType commandData; - err = DataModel::Decode(aReader, commandData); - if (err == CHIP_NO_ERROR) { - wasHandled = emberAfOtaSoftwareUpdateProviderClusterNotifyUpdateAppliedCallback(aCommandObj, aPath, commandData); - } - break; - } - default: - break; - } - - if (CHIP_NO_ERROR != err || !wasHandled) { - aCommandObj->AddStatus(aPath, Status::InvalidCommand); - } - } - - Protocols::InteractionModel::Status CheckEventSupportStatus(const ConcreteEventPath & aPath) - { - return Protocols::InteractionModel::Status::UnsupportedEvent; - } - -} // namespace app -} // namespace chip - -/** - * Called by the OTA provider cluster server to determine an index - * into its array. - */ -uint16_t emberAfGetClusterServerEndpointIndex(EndpointId endpoint, ClusterId cluster, uint16_t fixedClusterServerEndpointCount) -{ - if (endpoint == kSupportedEndpoint && cluster == OtaSoftwareUpdateProvider::Id) { - return 0; - } - - return UINT16_MAX; -} - -/** - * Methods used by AttributePathExpandIterator, which need to exist - * because it is part of libCHIP. For AttributePathExpandIterator - * purposes, for now, we just pretend like we have just our one - * endpoint, the OTA Provider cluster, and no attributes (because we - * would be erroring out from them anyway). - */ -uint16_t emberAfGetServerAttributeCount(EndpointId endpoint, ClusterId cluster) { return 0; } - -uint16_t emberAfEndpointCount(void) { return 1; } - -uint16_t emberAfIndexFromEndpoint(EndpointId endpoint) -{ - if (endpoint == kSupportedEndpoint) { - return 0; - } - - return UINT16_MAX; -} - -EndpointId emberAfEndpointFromIndex(uint16_t index) -{ - // Index must be valid here, so 0. - return kSupportedEndpoint; -} - -Optional emberAfGetNthClusterId(EndpointId endpoint, uint8_t n, bool server) -{ - if (endpoint == kSupportedEndpoint && n == 0 && server) { - return MakeOptional(OtaSoftwareUpdateProvider::Id); - } - - return NullOptional; -} - -uint16_t emberAfGetServerAttributeIndexByAttributeId(EndpointId endpoint, ClusterId cluster, AttributeId attributeId) -{ - return UINT16_MAX; -} - -bool emberAfContainsAttribute(chip::EndpointId endpoint, chip::ClusterId clusterId, chip::AttributeId attributeId) { return false; } - -uint8_t emberAfClusterCount(EndpointId endpoint, bool server) -{ - if (endpoint == kSupportedEndpoint && server) { - return 1; - } - - return 0; -} - -Optional emberAfGetServerAttributeIdByIndex(EndpointId endpoint, ClusterId cluster, uint16_t attributeIndex) -{ - return NullOptional; -} - -uint8_t emberAfClusterIndex(EndpointId endpoint, ClusterId clusterId, EmberAfClusterMask mask) -{ - if (endpoint == kSupportedEndpoint && clusterId == OtaSoftwareUpdateProvider::Id && (mask & CLUSTER_MASK_SERVER)) { - return 0; - } - - return UINT8_MAX; -} - -bool emberAfEndpointIndexIsEnabled(uint16_t index) { return index == 0; } - -namespace { -const CommandId acceptedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImage::Id, - Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateRequest::Id, - Clusters::OtaSoftwareUpdateProvider::Commands::NotifyUpdateApplied::Id, kInvalidCommandId }; -const CommandId generatedCommands[] = { Clusters::OtaSoftwareUpdateProvider::Commands::QueryImageResponse::Id, - Clusters::OtaSoftwareUpdateProvider::Commands::ApplyUpdateResponse::Id, kInvalidCommandId }; -const EmberAfCluster otaProviderCluster { - .clusterId = Clusters::OtaSoftwareUpdateProvider::Id, - .attributes = nullptr, - .attributeCount = 0, - .clusterSize = 0, - .mask = CLUSTER_MASK_SERVER, - .functions = nullptr, - .acceptedCommandList = acceptedCommands, - .generatedCommandList = generatedCommands, - .eventList = nullptr, - .eventCount = 0, -}; -const EmberAfEndpointType otaProviderEndpoint { .cluster = &otaProviderCluster, .clusterCount = 1, .endpointSize = 0 }; -} - -const EmberAfEndpointType * emberAfFindEndpointType(EndpointId endpoint) -{ - if (endpoint == kSupportedEndpoint) { - return &otaProviderEndpoint; - } - - return nullptr; -} - -const EmberAfCluster * emberAfFindServerCluster(EndpointId endpoint, ClusterId cluster) -{ - if (endpoint == kSupportedEndpoint && cluster == Clusters::OtaSoftwareUpdateProvider::Id) { - return &otaProviderCluster; - } - - return nullptr; -} diff --git a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm index 1b9f436751b2a5..7553e665668d27 100644 --- a/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm +++ b/src/darwin/Framework/CHIP/MTROTAProviderDelegateBridge.mm @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -492,29 +493,29 @@ CHIP_ERROR ConfigureState(chip::FabricIndex fabricIndex, chip::NodeId nodeId) }; namespace { -BdxOTASender gOtaSender; +Global gOtaSender; -NSInteger const kOtaProviderEndpoint = 0; +NSInteger constexpr kOtaProviderEndpoint = 0; } // anonymous namespace MTROTAProviderDelegateBridge::MTROTAProviderDelegateBridge() { Clusters::OTAProvider::SetDelegate(kOtaProviderEndpoint, this); } MTROTAProviderDelegateBridge::~MTROTAProviderDelegateBridge() { - gOtaSender.ResetState(); + gOtaSender->ResetState(); Clusters::OTAProvider::SetDelegate(kOtaProviderEndpoint, nullptr); } CHIP_ERROR MTROTAProviderDelegateBridge::Init(System::Layer * systemLayer, Messaging::ExchangeManager * exchangeManager) { - return gOtaSender.Init(systemLayer, exchangeManager); + return gOtaSender->Init(systemLayer, exchangeManager); } -void MTROTAProviderDelegateBridge::Shutdown() { gOtaSender.Shutdown(); } +void MTROTAProviderDelegateBridge::Shutdown() { gOtaSender->Shutdown(); } void MTROTAProviderDelegateBridge::ControllerShuttingDown(MTRDeviceController * controller) { - gOtaSender.ControllerShuttingDown(controller); + gOtaSender->ControllerShuttingDown(controller); } namespace { @@ -675,7 +676,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath } // If there is an update available, try to prepare for a transfer. - CHIP_ERROR err = gOtaSender.PrepareForTransfer(fabricIndex, nodeId); + CHIP_ERROR err = gOtaSender->PrepareForTransfer(fabricIndex, nodeId); if (CHIP_NO_ERROR != err) { // Handle busy error separately as we have a query image response status that maps to busy @@ -698,7 +699,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath handle.Release(); // We need to reset state here to clean up any initialization we might have done including starting the BDX // timeout timer while preparing for transfer if any failure occurs afterwards. - gOtaSender.ResetState(); + gOtaSender->ResetState(); return; } @@ -709,7 +710,7 @@ bool GetPeerNodeInfo(CommandHandler * commandHandler, const ConcreteCommandPath LogErrorOnFailure(err); handler->AddStatus(cachedCommandPath, StatusIB(err).mStatus); handle.Release(); - gOtaSender.ResetState(); + gOtaSender->ResetState(); return; } delegateResponse.imageURI.SetValue(uri); diff --git a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt index 8432e20679bc3f..7cafe765538483 100644 --- a/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRBaseClusters.zapt @@ -19,6 +19,10 @@ NS_ASSUME_NONNULL_BEGIN {{availability (asUpperCamelCase name preserveAcronyms=true)}} @interface MTRBaseCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt index 6ae259be2877e2..a4afcd5c8bace0 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt @@ -3,7 +3,7 @@ #import #import -#import "MTRAsyncCallbackWorkQueue.h" +#import "MTRAsyncWorkQueue.h" #import "MTRBaseClusterUtils.h" #import "MTRBaseDevice_Internal.h" #import "MTRClusterConstants.h" @@ -28,11 +28,11 @@ using chip::Optional; using chip::System::Clock::Timeout; using chip::System::Clock::Seconds16; -static void MTRClustersLogEnqueue(NSString *logPrefix, MTRAsyncCallbackWorkQueue *workQueue) { +static void MTRClustersLogEnqueue(NSString *logPrefix, MTRAsyncWorkQueue *workQueue) { MTR_LOG_DEFAULT("%@ enqueueWorkItem %@", logPrefix, workQueue); } -static void MTRClustersLogDequeue(NSString *logPrefix, MTRAsyncCallbackWorkQueue *workQueue) { +static void MTRClustersLogDequeue(NSString *logPrefix, MTRAsyncWorkQueue *workQueue) { MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, workQueue); } @@ -113,8 +113,8 @@ completionHandler NSString * logPrefix = [NSString stringWithFormat:@"MTRDevice command %u %u %u %u", self.device.deviceController.fabricIndex, self.endpoint, (unsigned int){{> clusterId}}, (unsigned int){{> commandId}}]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[{{> baseCluster}} alloc] initWithDevice:baseDevice endpointID:@(self.endpoint) queue:self.device.queue]; diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters.zapt index 3285e3cba52cea..563ab090b7cd59 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters.zapt @@ -19,6 +19,17 @@ NS_ASSUME_NONNULL_BEGIN {{availability (asUpperCamelCase name preserveAcronyms=true)}} @interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} : MTRCluster +/** +{{#zcl_commands}} +{{#first}} + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. +{{/first}} +{{else}} + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. +{{/zcl_commands}} + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}}; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h index 8c3d082798aa46..3777a49c291399 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRBaseClusters.h @@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterIdentify : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -171,6 +175,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterGroups : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -331,6 +339,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterScenes : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -615,6 +627,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterOnOff : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -850,6 +866,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterOnOffSwitchConfiguration : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -976,6 +996,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterLevelControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1363,6 +1387,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterBinaryInputBasic : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1609,6 +1637,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterPulseWidthModulation : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -1700,6 +1732,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterDescriptor : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1855,6 +1891,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterBinding : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1973,6 +2013,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterAccessControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2154,6 +2198,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterActions : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2378,6 +2426,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterBasicInformation : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2764,6 +2816,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterOTASoftwareUpdateProvider : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2886,6 +2942,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterOTASoftwareUpdateRequestor : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -3053,6 +3113,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterLocalizationConfiguration : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -3183,6 +3247,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterTimeFormatLocalization : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -3335,6 +3403,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterUnitLocalization : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -3450,6 +3522,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterPowerSourceConfiguration : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -3557,6 +3633,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterPowerSource : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4075,6 +4155,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterGeneralCommissioning : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4284,6 +4368,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterNetworkCommissioning : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4546,6 +4634,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterDiagnosticLogs : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4652,6 +4744,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterGeneralDiagnostics : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4875,6 +4971,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterSoftwareDiagnostics : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5035,6 +5135,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterThreadNetworkDiagnostics : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5966,6 +6070,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterWiFiNetworkDiagnostics : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -6238,6 +6346,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterEthernetNetworkDiagnostics : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -6450,6 +6562,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterTimeSynchronization : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6741,6 +6857,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterBridgedDeviceBasicInformation : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7055,6 +7175,10 @@ light or a window shade. API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterSwitch : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7188,6 +7312,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterAdministratorCommissioning : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7351,6 +7479,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterOperationalCredentials : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7600,6 +7732,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterGroupKeyManagement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7793,6 +7929,10 @@ labels. API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterFixedLabel : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7900,6 +8040,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterUserLabel : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -8014,6 +8158,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterBooleanState : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -8121,6 +8269,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterICDManagement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -8310,6 +8462,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterModeSelect : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -8501,6 +8657,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterLaundryWasherMode : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -8659,6 +8819,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -8820,6 +8984,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterLaundryWasherControls : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -8968,6 +9136,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterRVCRunMode : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -9126,6 +9298,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterRVCCleanMode : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -9284,6 +9460,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterTemperatureControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -9458,6 +9638,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterRefrigeratorAlarm : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -9584,6 +9768,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterDishwasherMode : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -9742,6 +9930,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterAirQuality : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -9844,6 +10036,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterSmokeCOAlarm : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -10106,6 +10302,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterDishwasherAlarm : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -10260,6 +10460,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterOperationalState : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -10466,6 +10670,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterRVCOperationalState : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -10673,6 +10881,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterHEPAFilterMonitoring : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -10851,6 +11063,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterActivatedCarbonFilterMonitoring : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -11029,6 +11245,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterDoorLock : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -11904,6 +12124,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterWindowCovering : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -12380,6 +12604,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterBarrierControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -12675,6 +12903,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterPumpConfigurationAndControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -13088,6 +13320,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterThermostat : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -14092,6 +14328,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterFanControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -14387,6 +14627,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterThermostatUserInterfaceConfiguration : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -14546,6 +14790,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterColorControl : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -15542,6 +15790,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterBallastConfiguration : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -15887,6 +16139,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterIlluminanceMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -16045,6 +16301,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterTemperatureMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -16190,6 +16450,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterPressureMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -16396,6 +16660,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterFlowMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -16541,6 +16809,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterRelativeHumidityMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -16686,6 +16958,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterOccupancySensing : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -17036,6 +17312,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterCarbonMonoxideConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -17263,6 +17543,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterCarbonDioxideConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -17490,6 +17774,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterNitrogenDioxideConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -17717,6 +18005,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterOzoneConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -17944,6 +18236,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterPM25ConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -18171,6 +18467,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterFormaldehydeConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -18398,6 +18698,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterPM1ConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -18625,6 +18929,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterPM10ConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -18852,6 +19160,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterTotalVolatileOrganicCompoundsConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -19079,6 +19391,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterRadonConcentrationMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -19306,6 +19622,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterWakeOnLAN : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -19413,6 +19733,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterChannel : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -19578,6 +19902,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterTargetNavigator : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -19707,6 +20035,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterMediaPlayback : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20012,6 +20344,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterMediaInput : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20165,6 +20501,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterLowPower : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20269,6 +20609,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterKeypadInput : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20373,6 +20717,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterContentLauncher : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20521,6 +20869,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterAudioOutput : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20656,6 +21008,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterApplicationLauncher : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -20815,6 +21171,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterApplicationBasic : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -21015,6 +21375,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterAccountLogin : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -21141,6 +21505,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRBaseClusterElectricalMeasurement : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -23098,6 +23466,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRBaseClusterUnitTesting : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -25042,6 +25414,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) MTR_PROVISIONALLY_AVAILABLE @interface MTRBaseClusterSampleMEI : MTRCluster +/** + * For all instance methods (reads, writes, commands) that take a completion, + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h index c3ad09b1751900..3d6810e6961d35 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.h @@ -30,6 +30,10 @@ NS_ASSUME_NONNULL_BEGIN API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterIdentify : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -86,6 +90,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterGroups : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -160,6 +168,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterScenes : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -276,6 +288,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterOnOff : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -385,6 +401,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterOnOffSwitchConfiguration : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -432,6 +452,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterLevelControl : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -596,6 +620,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterBinaryInputBasic : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -699,6 +727,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterPulseWidthModulation : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -732,6 +764,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterDescriptor : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -780,6 +816,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterBinding : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -827,6 +867,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterAccessControl : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -890,6 +934,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterActions : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -989,6 +1037,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterBasicInformation : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1107,6 +1159,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterOTASoftwareUpdateProvider : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1159,6 +1215,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterOTASoftwareUpdateRequestor : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1221,6 +1281,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterLocalizationConfiguration : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1271,6 +1335,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterTimeFormatLocalization : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1331,6 +1399,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterUnitLocalization : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1375,6 +1447,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterPowerSourceConfiguration : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1413,6 +1489,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterPowerSource : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1542,6 +1622,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterGeneralCommissioning : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1625,6 +1709,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterNetworkCommissioning : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1727,6 +1815,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterDiagnosticLogs : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1769,6 +1861,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterGeneralDiagnostics : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1836,6 +1932,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterSoftwareDiagnostics : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -1892,6 +1992,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterThreadNetworkDiagnostics : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2125,6 +2229,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterWiFiNetworkDiagnostics : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2208,6 +2316,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterEthernetNetworkDiagnostics : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2278,6 +2390,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterTimeSynchronization : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -2367,6 +2483,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterBridgedDeviceBasicInformation : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2461,6 +2581,10 @@ light or a window shade. API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterSwitch : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2504,6 +2628,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterAdministratorCommissioning : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2568,6 +2696,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterOperationalCredentials : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2667,6 +2799,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterGroupKeyManagement : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2748,6 +2884,10 @@ labels. API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterFixedLabel : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2785,6 +2925,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterUserLabel : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2829,6 +2973,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterBooleanState : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -2866,6 +3014,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterICDManagement : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -2932,6 +3084,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterModeSelect : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -3003,6 +3159,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterLaundryWasherMode : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3060,6 +3220,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterRefrigeratorAndTemperatureControlledCabinetMode : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3120,6 +3284,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterLaundryWasherControls : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3173,6 +3341,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterRVCRunMode : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3230,6 +3402,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterRVCCleanMode : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3287,6 +3463,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterTemperatureControl : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3341,6 +3521,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterRefrigeratorAlarm : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3379,6 +3563,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterDishwasherMode : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3436,6 +3624,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterAirQuality : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3470,6 +3662,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterSmokeCOAlarm : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3549,6 +3745,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterDishwasherAlarm : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3599,6 +3799,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterOperationalState : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3684,6 +3888,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterRVCOperationalState : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3769,6 +3977,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterHEPAFilterMonitoring : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3831,6 +4043,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterActivatedCarbonFilterMonitoring : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -3893,6 +4109,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterDoorLock : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4255,6 +4475,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterWindowCovering : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4404,6 +4628,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterBarrierControl : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4525,6 +4753,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterPumpConfigurationAndControl : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -4656,6 +4888,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterThermostat : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5051,6 +5287,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterFanControl : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5173,6 +5413,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterThermostatUserInterfaceConfiguration : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5237,6 +5481,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterColorControl : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5600,6 +5848,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterBallastConfiguration : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5746,6 +5998,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterIlluminanceMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5795,6 +6051,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterTemperatureMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5841,6 +6101,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterPressureMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5902,6 +6166,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterFlowMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5948,6 +6216,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterRelativeHumidityMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -5994,6 +6266,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterOccupancySensing : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -6127,6 +6403,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterCarbonMonoxideConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6190,6 +6470,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterCarbonDioxideConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6253,6 +6537,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterNitrogenDioxideConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6316,6 +6604,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterOzoneConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6379,6 +6671,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterPM25ConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6442,6 +6738,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterFormaldehydeConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6505,6 +6805,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterPM1ConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6568,6 +6872,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterPM10ConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6631,6 +6939,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterTotalVolatileOrganicCompoundsConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6694,6 +7006,10 @@ MTR_PROVISIONALLY_AVAILABLE MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterRadonConcentrationMeasurement : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; @@ -6757,6 +7073,10 @@ MTR_PROVISIONALLY_AVAILABLE API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterWakeOnLAN : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -6794,6 +7114,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterChannel : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -6853,6 +7177,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterTargetNavigator : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -6901,6 +7229,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterMediaPlayback : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7057,6 +7389,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterMediaInput : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7122,6 +7458,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterLowPower : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7164,6 +7504,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterKeypadInput : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7204,6 +7548,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterContentLauncher : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7264,6 +7612,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterAudioOutput : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7313,6 +7665,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterApplicationLauncher : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7378,6 +7734,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterApplicationBasic : MTRCluster +/** + * The queue is currently unused, but may be used in the future for calling completions + * for command invocations if commands are added to this cluster. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7438,6 +7798,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterAccountLogin : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7491,6 +7855,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) @interface MTRClusterElectricalMeasurement : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -7980,6 +8348,10 @@ API_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1)) API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRClusterUnitTesting : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER @@ -8991,6 +9363,10 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) MTR_PROVISIONALLY_AVAILABLE @interface MTRClusterSampleMEI : MTRCluster +/** + * For all instance methods that take a completion (i.e. command invocations), + * the completion will be called on the provided queue. + */ - (instancetype _Nullable)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER MTR_PROVISIONALLY_AVAILABLE; diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index b012fde1e2ee20..6588f0db6f4c79 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -18,7 +18,7 @@ #import #import -#import "MTRAsyncCallbackWorkQueue.h" +#import "MTRAsyncWorkQueue.h" #import "MTRBaseClusterUtils.h" #import "MTRBaseDevice_Internal.h" #import "MTRCallbackBridge.h" @@ -43,12 +43,12 @@ using chip::System::Clock::Seconds16; using chip::System::Clock::Timeout; -static void MTRClustersLogEnqueue(NSString * logPrefix, MTRAsyncCallbackWorkQueue * workQueue) +static void MTRClustersLogEnqueue(NSString * logPrefix, MTRAsyncWorkQueue * workQueue) { MTR_LOG_DEFAULT("%@ enqueueWorkItem %@", logPrefix, workQueue); } -static void MTRClustersLogDequeue(NSString * logPrefix, MTRAsyncCallbackWorkQueue * workQueue) +static void MTRClustersLogDequeue(NSString * logPrefix, MTRAsyncWorkQueue * workQueue) { MTR_LOG_DEFAULT("%@ dequeueWorkItem %@", logPrefix, workQueue); } @@ -86,8 +86,8 @@ - (void)identifyWithParams:(MTRIdentifyClusterIdentifyParams *)params (unsigned int) MTRClusterIDTypeIdentifyID, (unsigned int) MTRCommandIDTypeClusterIdentifyCommandIdentifyID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:baseDevice @@ -126,8 +126,8 @@ - (void)triggerEffectWithParams:(MTRIdentifyClusterTriggerEffectParams *)params (unsigned int) MTRClusterIDTypeIdentifyID, (unsigned int) MTRCommandIDTypeClusterIdentifyCommandTriggerEffectID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterIdentify alloc] initWithDevice:baseDevice @@ -294,8 +294,8 @@ - (void)addGroupWithParams:(MTRGroupsClusterAddGroupParams *)params (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandAddGroupID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:baseDevice @@ -335,8 +335,8 @@ - (void)viewGroupWithParams:(MTRGroupsClusterViewGroupParams *)params (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandViewGroupID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:baseDevice @@ -376,8 +376,8 @@ - (void)getGroupMembershipWithParams:(MTRGroupsClusterGetGroupMembershipParams * (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandGetGroupMembershipID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:baseDevice @@ -418,8 +418,8 @@ - (void)removeGroupWithParams:(MTRGroupsClusterRemoveGroupParams *)params (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandRemoveGroupID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:baseDevice @@ -467,8 +467,8 @@ - (void)removeAllGroupsWithParams:(MTRGroupsClusterRemoveAllGroupsParams * _Null (unsigned int) MTRClusterIDTypeGroupsID, (unsigned int) MTRCommandIDTypeClusterGroupsCommandRemoveAllGroupsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:baseDevice @@ -507,8 +507,8 @@ - (void)addGroupIfIdentifyingWithParams:(MTRGroupsClusterAddGroupIfIdentifyingPa (unsigned int) MTRCommandIDTypeClusterGroupsCommandAddGroupIfIdentifyingID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroups alloc] initWithDevice:baseDevice @@ -714,8 +714,8 @@ - (void)addSceneWithParams:(MTRScenesClusterAddSceneParams *)params (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandAddSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -755,8 +755,8 @@ - (void)viewSceneWithParams:(MTRScenesClusterViewSceneParams *)params (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandViewSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -796,8 +796,8 @@ - (void)removeSceneWithParams:(MTRScenesClusterRemoveSceneParams *)params (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandRemoveSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -837,8 +837,8 @@ - (void)removeAllScenesWithParams:(MTRScenesClusterRemoveAllScenesParams *)param (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandRemoveAllScenesID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -879,8 +879,8 @@ - (void)storeSceneWithParams:(MTRScenesClusterStoreSceneParams *)params (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandStoreSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -919,8 +919,8 @@ - (void)recallSceneWithParams:(MTRScenesClusterRecallSceneParams *)params (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandRecallSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -960,8 +960,8 @@ - (void)getSceneMembershipWithParams:(MTRScenesClusterGetSceneMembershipParams * (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandGetSceneMembershipID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -1002,8 +1002,8 @@ - (void)enhancedAddSceneWithParams:(MTRScenesClusterEnhancedAddSceneParams *)par (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandEnhancedAddSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -1044,8 +1044,8 @@ - (void)enhancedViewSceneWithParams:(MTRScenesClusterEnhancedViewSceneParams *)p (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandEnhancedViewSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -1086,8 +1086,8 @@ - (void)copySceneWithParams:(MTRScenesClusterCopySceneParams *)params (unsigned int) MTRClusterIDTypeScenesID, (unsigned int) MTRCommandIDTypeClusterScenesCommandCopySceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterScenes alloc] initWithDevice:baseDevice @@ -1407,8 +1407,8 @@ - (void)offWithParams:(MTROnOffClusterOffParams * _Nullable)params (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOffID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:baseDevice @@ -1453,8 +1453,8 @@ - (void)onWithParams:(MTROnOffClusterOnParams * _Nullable)params (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOnID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:baseDevice @@ -1499,8 +1499,8 @@ - (void)toggleWithParams:(MTROnOffClusterToggleParams * _Nullable)params (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandToggleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:baseDevice @@ -1539,8 +1539,8 @@ - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOffWithEffectID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:baseDevice @@ -1588,8 +1588,8 @@ - (void)onWithRecallGlobalSceneWithParams:(MTROnOffClusterOnWithRecallGlobalScen (unsigned int) MTRCommandIDTypeClusterOnOffCommandOnWithRecallGlobalSceneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:baseDevice @@ -1628,8 +1628,8 @@ - (void)onWithTimedOffWithParams:(MTROnOffClusterOnWithTimedOffParams *)params (unsigned int) MTRClusterIDTypeOnOffID, (unsigned int) MTRCommandIDTypeClusterOnOffCommandOnWithTimedOffID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOnOff alloc] initWithDevice:baseDevice @@ -2044,8 +2044,8 @@ - (void)moveToLevelWithParams:(MTRLevelControlClusterMoveToLevelParams *)params (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveToLevelID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2084,8 +2084,8 @@ - (void)moveWithParams:(MTRLevelControlClusterMoveParams *)params (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2124,8 +2124,8 @@ - (void)stepWithParams:(MTRLevelControlClusterStepParams *)params (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStepID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2164,8 +2164,8 @@ - (void)stopWithParams:(MTRLevelControlClusterStopParams *)params (unsigned int) MTRClusterIDTypeLevelControlID, (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStopID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2204,8 +2204,8 @@ - (void)moveToLevelWithOnOffWithParams:(MTRLevelControlClusterMoveToLevelWithOnO (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveToLevelWithOnOffID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2244,8 +2244,8 @@ - (void)moveWithOnOffWithParams:(MTRLevelControlClusterMoveWithOnOffParams *)par (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveWithOnOffID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2284,8 +2284,8 @@ - (void)stepWithOnOffWithParams:(MTRLevelControlClusterStepWithOnOffParams *)par (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStepWithOnOffID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2324,8 +2324,8 @@ - (void)stopWithOnOffWithParams:(MTRLevelControlClusterStopWithOnOffParams *)par (unsigned int) MTRCommandIDTypeClusterLevelControlCommandStopWithOnOffID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -2364,8 +2364,8 @@ - (void)moveToClosestFrequencyWithParams:(MTRLevelControlClusterMoveToClosestFre (unsigned int) MTRCommandIDTypeClusterLevelControlCommandMoveToClosestFrequencyID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLevelControl alloc] initWithDevice:baseDevice @@ -3520,8 +3520,8 @@ - (void)instantActionWithParams:(MTRActionsClusterInstantActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandInstantActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3560,8 +3560,8 @@ - (void)instantActionWithTransitionWithParams:(MTRActionsClusterInstantActionWit (unsigned int) MTRCommandIDTypeClusterActionsCommandInstantActionWithTransitionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3600,8 +3600,8 @@ - (void)startActionWithParams:(MTRActionsClusterStartActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandStartActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3640,8 +3640,8 @@ - (void)startActionWithDurationWithParams:(MTRActionsClusterStartActionWithDurat (unsigned int) MTRCommandIDTypeClusterActionsCommandStartActionWithDurationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3680,8 +3680,8 @@ - (void)stopActionWithParams:(MTRActionsClusterStopActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandStopActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3720,8 +3720,8 @@ - (void)pauseActionWithParams:(MTRActionsClusterPauseActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandPauseActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3760,8 +3760,8 @@ - (void)pauseActionWithDurationWithParams:(MTRActionsClusterPauseActionWithDurat (unsigned int) MTRCommandIDTypeClusterActionsCommandPauseActionWithDurationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3800,8 +3800,8 @@ - (void)resumeActionWithParams:(MTRActionsClusterResumeActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandResumeActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3840,8 +3840,8 @@ - (void)enableActionWithParams:(MTRActionsClusterEnableActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandEnableActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3880,8 +3880,8 @@ - (void)enableActionWithDurationWithParams:(MTRActionsClusterEnableActionWithDur (unsigned int) MTRCommandIDTypeClusterActionsCommandEnableActionWithDurationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3920,8 +3920,8 @@ - (void)disableActionWithParams:(MTRActionsClusterDisableActionParams *)params (unsigned int) MTRClusterIDTypeActionsID, (unsigned int) MTRCommandIDTypeClusterActionsCommandDisableActionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -3960,8 +3960,8 @@ - (void)disableActionWithDurationWithParams:(MTRActionsClusterDisableActionWithD (unsigned int) MTRCommandIDTypeClusterActionsCommandDisableActionWithDurationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActions alloc] initWithDevice:baseDevice @@ -4225,8 +4225,8 @@ - (void)mfgSpecificPingWithParams:(MTRBasicClusterMfgSpecificPingParams * _Nulla self.endpoint, (unsigned int) 0x00000028, (unsigned int) 0x10020000]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterBasic alloc] initWithDevice:baseDevice @@ -4585,8 +4585,8 @@ - (void)queryImageWithParams:(MTROTASoftwareUpdateProviderClusterQueryImageParam (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandQueryImageID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:baseDevice @@ -4627,8 +4627,8 @@ - (void)applyUpdateRequestWithParams:(MTROTASoftwareUpdateProviderClusterApplyUp (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandApplyUpdateRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:baseDevice @@ -4668,8 +4668,8 @@ - (void)notifyUpdateAppliedWithParams:(MTROTASoftwareUpdateProviderClusterNotify (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateProviderCommandNotifyUpdateAppliedID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOTASoftwareUpdateProvider alloc] initWithDevice:baseDevice @@ -4826,8 +4826,8 @@ - (void)announceOTAProviderWithParams:(MTROTASoftwareUpdateRequestorClusterAnnou (unsigned int) MTRCommandIDTypeClusterOTASoftwareUpdateRequestorCommandAnnounceOTAProviderID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOTASoftwareUpdateRequestor alloc] initWithDevice:baseDevice @@ -5783,8 +5783,8 @@ - (void)armFailSafeWithParams:(MTRGeneralCommissioningClusterArmFailSafeParams * (unsigned int) MTRCommandIDTypeClusterGeneralCommissioningCommandArmFailSafeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:baseDevice @@ -5825,8 +5825,8 @@ - (void)setRegulatoryConfigWithParams:(MTRGeneralCommissioningClusterSetRegulato (unsigned int) MTRCommandIDTypeClusterGeneralCommissioningCommandSetRegulatoryConfigID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:baseDevice @@ -5880,8 +5880,8 @@ - (void)commissioningCompleteWithParams:(MTRGeneralCommissioningClusterCommissio (unsigned int) MTRCommandIDTypeClusterGeneralCommissioningCommandCommissioningCompleteID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGeneralCommissioning alloc] initWithDevice:baseDevice @@ -6117,8 +6117,8 @@ - (void)scanNetworksWithParams:(MTRNetworkCommissioningClusterScanNetworksParams (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandScanNetworksID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:baseDevice @@ -6159,8 +6159,8 @@ - (void)addOrUpdateWiFiNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpd (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandAddOrUpdateWiFiNetworkID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:baseDevice @@ -6201,8 +6201,8 @@ - (void)addOrUpdateThreadNetworkWithParams:(MTRNetworkCommissioningClusterAddOrU (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandAddOrUpdateThreadNetworkID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:baseDevice @@ -6243,8 +6243,8 @@ - (void)removeNetworkWithParams:(MTRNetworkCommissioningClusterRemoveNetworkPara (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandRemoveNetworkID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:baseDevice @@ -6285,8 +6285,8 @@ - (void)connectNetworkWithParams:(MTRNetworkCommissioningClusterConnectNetworkPa (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandConnectNetworkID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:baseDevice @@ -6327,8 +6327,8 @@ - (void)reorderNetworkWithParams:(MTRNetworkCommissioningClusterReorderNetworkPa (unsigned int) MTRCommandIDTypeClusterNetworkCommissioningCommandReorderNetworkID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterNetworkCommissioning alloc] initWithDevice:baseDevice @@ -6619,8 +6619,8 @@ - (void)retrieveLogsRequestWithParams:(MTRDiagnosticLogsClusterRetrieveLogsReque (unsigned int) MTRCommandIDTypeClusterDiagnosticLogsCommandRetrieveLogsRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDiagnosticLogs alloc] initWithDevice:baseDevice @@ -6748,8 +6748,8 @@ - (void)testEventTriggerWithParams:(MTRGeneralDiagnosticsClusterTestEventTrigger (unsigned int) MTRCommandIDTypeClusterGeneralDiagnosticsCommandTestEventTriggerID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGeneralDiagnostics alloc] initWithDevice:baseDevice @@ -6957,8 +6957,8 @@ - (void)resetWatermarksWithParams:(MTRSoftwareDiagnosticsClusterResetWatermarksP (unsigned int) MTRCommandIDTypeClusterSoftwareDiagnosticsCommandResetWatermarksID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterSoftwareDiagnostics alloc] initWithDevice:baseDevice @@ -7131,8 +7131,8 @@ - (void)resetCountsWithParams:(MTRThreadNetworkDiagnosticsClusterResetCountsPara (unsigned int) MTRCommandIDTypeClusterThreadNetworkDiagnosticsCommandResetCountsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterThreadNetworkDiagnostics alloc] initWithDevice:baseDevice @@ -7802,8 +7802,8 @@ - (void)resetCountsWithParams:(MTRWiFiNetworkDiagnosticsClusterResetCountsParams (unsigned int) MTRCommandIDTypeClusterWiFiNetworkDiagnosticsCommandResetCountsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWiFiNetworkDiagnostics alloc] initWithDevice:baseDevice @@ -8060,8 +8060,8 @@ - (void)resetCountsWithParams:(MTREthernetNetworkDiagnosticsClusterResetCountsPa (unsigned int) MTRCommandIDTypeClusterEthernetNetworkDiagnosticsCommandResetCountsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterEthernetNetworkDiagnostics alloc] initWithDevice:baseDevice @@ -8266,8 +8266,8 @@ - (void)setUTCTimeWithParams:(MTRTimeSynchronizationClusterSetUTCTimeParams *)pa (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetUTCTimeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:baseDevice @@ -8306,8 +8306,8 @@ - (void)setTrustedTimeSourceWithParams:(MTRTimeSynchronizationClusterSetTrustedT (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetTrustedTimeSourceID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:baseDevice @@ -8347,8 +8347,8 @@ - (void)setTimeZoneWithParams:(MTRTimeSynchronizationClusterSetTimeZoneParams *) (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetTimeZoneID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:baseDevice @@ -8388,8 +8388,8 @@ - (void)setDSTOffsetWithParams:(MTRTimeSynchronizationClusterSetDSTOffsetParams (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetDSTOffsetID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:baseDevice @@ -8428,8 +8428,8 @@ - (void)setDefaultNTPWithParams:(MTRTimeSynchronizationClusterSetDefaultNTPParam (unsigned int) MTRCommandIDTypeClusterTimeSynchronizationCommandSetDefaultNTPID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTimeSynchronization alloc] initWithDevice:baseDevice @@ -8966,8 +8966,8 @@ - (void)openCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterO (unsigned int) MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenCommissioningWindowID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:baseDevice @@ -9007,8 +9007,8 @@ - (void)openBasicCommissioningWindowWithParams:(MTRAdministratorCommissioningClu (unsigned int) MTRCommandIDTypeClusterAdministratorCommissioningCommandOpenBasicCommissioningWindowID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:baseDevice @@ -9056,8 +9056,8 @@ - (void)revokeCommissioningWithParams:(MTRAdministratorCommissioningClusterRevok (unsigned int) MTRCommandIDTypeClusterAdministratorCommissioningCommandRevokeCommissioningID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAdministratorCommissioning alloc] initWithDevice:baseDevice @@ -9236,8 +9236,8 @@ - (void)attestationRequestWithParams:(MTROperationalCredentialsClusterAttestatio (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandAttestationRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9278,8 +9278,8 @@ - (void)certificateChainRequestWithParams:(MTROperationalCredentialsClusterCerti (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandCertificateChainRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9321,8 +9321,8 @@ - (void)CSRRequestWithParams:(MTROperationalCredentialsClusterCSRRequestParams * (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandCSRRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9363,8 +9363,8 @@ - (void)addNOCWithParams:(MTROperationalCredentialsClusterAddNOCParams *)params (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandAddNOCID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9405,8 +9405,8 @@ - (void)updateNOCWithParams:(MTROperationalCredentialsClusterUpdateNOCParams *)p (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandUpdateNOCID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9447,8 +9447,8 @@ - (void)updateFabricLabelWithParams:(MTROperationalCredentialsClusterUpdateFabri (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandUpdateFabricLabelID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9489,8 +9489,8 @@ - (void)removeFabricWithParams:(MTROperationalCredentialsClusterRemoveFabricPara (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandRemoveFabricID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9531,8 +9531,8 @@ - (void)addTrustedRootCertificateWithParams:(MTROperationalCredentialsClusterAdd (unsigned int) MTRCommandIDTypeClusterOperationalCredentialsCommandAddTrustedRootCertificateID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalCredentials alloc] initWithDevice:baseDevice @@ -9808,8 +9808,8 @@ - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)p (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetWriteID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:baseDevice @@ -9849,8 +9849,8 @@ - (void)keySetReadWithParams:(MTRGroupKeyManagementClusterKeySetReadParams *)par (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetReadID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:baseDevice @@ -9890,8 +9890,8 @@ - (void)keySetRemoveWithParams:(MTRGroupKeyManagementClusterKeySetRemoveParams * (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetRemoveID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:baseDevice @@ -9942,8 +9942,8 @@ - (void)keySetReadAllIndicesWithParams:(MTRGroupKeyManagementClusterKeySetReadAl (unsigned int) MTRCommandIDTypeClusterGroupKeyManagementCommandKeySetReadAllIndicesID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterGroupKeyManagement alloc] initWithDevice:baseDevice @@ -10420,8 +10420,8 @@ - (void)registerClientWithParams:(MTRICDManagementClusterRegisterClientParams *) (unsigned int) MTRCommandIDTypeClusterICDManagementCommandRegisterClientID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:baseDevice @@ -10461,8 +10461,8 @@ - (void)unregisterClientWithParams:(MTRICDManagementClusterUnregisterClientParam (unsigned int) MTRCommandIDTypeClusterICDManagementCommandUnregisterClientID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:baseDevice @@ -10510,8 +10510,8 @@ - (void)stayActiveRequestWithParams:(MTRICDManagementClusterStayActiveRequestPar (unsigned int) MTRCommandIDTypeClusterICDManagementCommandStayActiveRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterICDManagement alloc] initWithDevice:baseDevice @@ -10662,8 +10662,8 @@ - (void)changeToModeWithParams:(MTRModeSelectClusterChangeToModeParams *)params (unsigned int) MTRCommandIDTypeClusterModeSelectCommandChangeToModeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterModeSelect alloc] initWithDevice:baseDevice @@ -10872,8 +10872,8 @@ - (void)changeToModeWithParams:(MTRLaundryWasherModeClusterChangeToModeParams *) (unsigned int) MTRCommandIDTypeClusterLaundryWasherModeCommandChangeToModeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLaundryWasherMode alloc] initWithDevice:baseDevice @@ -11051,8 +11051,8 @@ - (void)changeToModeWithParams:(MTRRefrigeratorAndTemperatureControlledCabinetMo (unsigned int) MTRCommandIDTypeClusterRefrigeratorAndTemperatureControlledCabinetModeCommandChangeToModeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRefrigeratorAndTemperatureControlledCabinetMode alloc] initWithDevice:baseDevice @@ -11383,8 +11383,8 @@ - (void)changeToModeWithParams:(MTRRVCRunModeClusterChangeToModeParams *)params (unsigned int) MTRCommandIDTypeClusterRVCRunModeCommandChangeToModeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRVCRunMode alloc] initWithDevice:baseDevice @@ -11559,8 +11559,8 @@ - (void)changeToModeWithParams:(MTRRVCCleanModeClusterChangeToModeParams *)param (unsigned int) MTRCommandIDTypeClusterRVCCleanModeCommandChangeToModeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRVCCleanMode alloc] initWithDevice:baseDevice @@ -11734,8 +11734,8 @@ - (void)setTemperatureWithParams:(MTRTemperatureControlClusterSetTemperaturePara (unsigned int) MTRCommandIDTypeClusterTemperatureControlCommandSetTemperatureID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTemperatureControl alloc] initWithDevice:baseDevice @@ -11977,8 +11977,8 @@ - (void)changeToModeWithParams:(MTRDishwasherModeClusterChangeToModeParams *)par (unsigned int) MTRCommandIDTypeClusterDishwasherModeCommandChangeToModeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDishwasherMode alloc] initWithDevice:baseDevice @@ -12233,8 +12233,8 @@ - (void)selfTestRequestWithParams:(MTRSmokeCOAlarmClusterSelfTestRequestParams * (unsigned int) MTRCommandIDTypeClusterSmokeCOAlarmCommandSelfTestRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterSmokeCOAlarm alloc] initWithDevice:baseDevice @@ -12462,8 +12462,8 @@ - (void)resetWithParams:(MTRDishwasherAlarmClusterResetParams *)params (unsigned int) MTRCommandIDTypeClusterDishwasherAlarmCommandResetID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:baseDevice @@ -12502,8 +12502,8 @@ - (void)modifyEnabledAlarmsWithParams:(MTRDishwasherAlarmClusterModifyEnabledAla (unsigned int) MTRCommandIDTypeClusterDishwasherAlarmCommandModifyEnabledAlarmsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDishwasherAlarm alloc] initWithDevice:baseDevice @@ -12646,8 +12646,8 @@ - (void)pauseWithParams:(MTROperationalStateClusterPauseParams * _Nullable)param (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandPauseID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:baseDevice @@ -12695,8 +12695,8 @@ - (void)stopWithParams:(MTROperationalStateClusterStopParams * _Nullable)params (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandStopID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:baseDevice @@ -12744,8 +12744,8 @@ - (void)startWithParams:(MTROperationalStateClusterStartParams * _Nullable)param (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandStartID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:baseDevice @@ -12793,8 +12793,8 @@ - (void)resumeWithParams:(MTROperationalStateClusterResumeParams * _Nullable)par (unsigned int) MTRCommandIDTypeClusterOperationalStateCommandResumeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterOperationalState alloc] initWithDevice:baseDevice @@ -12954,8 +12954,8 @@ - (void)pauseWithParams:(MTRRVCOperationalStateClusterPauseParams * _Nullable)pa (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandPauseID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:baseDevice @@ -13003,8 +13003,8 @@ - (void)stopWithParams:(MTRRVCOperationalStateClusterStopParams * _Nullable)para (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandStopID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:baseDevice @@ -13052,8 +13052,8 @@ - (void)startWithParams:(MTRRVCOperationalStateClusterStartParams * _Nullable)pa (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandStartID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:baseDevice @@ -13101,8 +13101,8 @@ - (void)resumeWithParams:(MTRRVCOperationalStateClusterResumeParams * _Nullable) (unsigned int) MTRCommandIDTypeClusterRVCOperationalStateCommandResumeID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterRVCOperationalState alloc] initWithDevice:baseDevice @@ -13263,8 +13263,8 @@ - (void)resetConditionWithParams:(MTRHEPAFilterMonitoringClusterResetConditionPa (unsigned int) MTRCommandIDTypeClusterHEPAFilterMonitoringCommandResetConditionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:baseDevice @@ -13444,8 +13444,8 @@ - (void)resetConditionWithParams:(MTRActivatedCarbonFilterMonitoringClusterReset (unsigned int) MTRCommandIDTypeClusterActivatedCarbonFilterMonitoringCommandResetConditionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:baseDevice @@ -13624,8 +13624,8 @@ - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandLockDoorID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13664,8 +13664,8 @@ - (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)par (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandUnlockDoorID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13704,8 +13704,8 @@ - (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams * (unsigned int) MTRCommandIDTypeClusterDoorLockCommandUnlockWithTimeoutID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13744,8 +13744,8 @@ - (void)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetWeekDayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13785,8 +13785,8 @@ - (void)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetWeekDayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13826,8 +13826,8 @@ - (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDaySchedulePa (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearWeekDayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13866,8 +13866,8 @@ - (void)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetYearDayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13907,8 +13907,8 @@ - (void)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetYearDayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13948,8 +13948,8 @@ - (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDaySchedulePa (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearYearDayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -13988,8 +13988,8 @@ - (void)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetHolidayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14029,8 +14029,8 @@ - (void)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetHolidayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14070,8 +14070,8 @@ - (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidaySchedulePa (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearHolidayScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14110,8 +14110,8 @@ - (void)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetUserID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14150,8 +14150,8 @@ - (void)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetUserID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14190,8 +14190,8 @@ - (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearUserID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14231,8 +14231,8 @@ - (void)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandSetCredentialID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14273,8 +14273,8 @@ - (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusPara (unsigned int) MTRCommandIDTypeClusterDoorLockCommandGetCredentialStatusID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14314,8 +14314,8 @@ - (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)par (unsigned int) MTRCommandIDTypeClusterDoorLockCommandClearCredentialID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -14354,8 +14354,8 @@ - (void)unboltDoorWithParams:(MTRDoorLockClusterUnboltDoorParams * _Nullable)par (unsigned int) MTRClusterIDTypeDoorLockID, (unsigned int) MTRCommandIDTypeClusterDoorLockCommandUnboltDoorID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterDoorLock alloc] initWithDevice:baseDevice @@ -15328,8 +15328,8 @@ - (void)upOrOpenWithParams:(MTRWindowCoveringClusterUpOrOpenParams * _Nullable)p (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandUpOrOpenID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15377,8 +15377,8 @@ - (void)downOrCloseWithParams:(MTRWindowCoveringClusterDownOrCloseParams * _Null (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandDownOrCloseID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15426,8 +15426,8 @@ - (void)stopMotionWithParams:(MTRWindowCoveringClusterStopMotionParams * _Nullab (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandStopMotionID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15466,8 +15466,8 @@ - (void)goToLiftValueWithParams:(MTRWindowCoveringClusterGoToLiftValueParams *)p (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToLiftValueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15506,8 +15506,8 @@ - (void)goToLiftPercentageWithParams:(MTRWindowCoveringClusterGoToLiftPercentage (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToLiftPercentageID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15546,8 +15546,8 @@ - (void)goToTiltValueWithParams:(MTRWindowCoveringClusterGoToTiltValueParams *)p (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltValueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15586,8 +15586,8 @@ - (void)goToTiltPercentageWithParams:(MTRWindowCoveringClusterGoToTiltPercentage (unsigned int) MTRCommandIDTypeClusterWindowCoveringCommandGoToTiltPercentageID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterWindowCovering alloc] initWithDevice:baseDevice @@ -15997,8 +15997,8 @@ - (void)barrierControlGoToPercentWithParams:(MTRBarrierControlClusterBarrierCont (unsigned int) MTRCommandIDTypeClusterBarrierControlCommandBarrierControlGoToPercentID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:baseDevice @@ -16046,8 +16046,8 @@ - (void)barrierControlStopWithParams:(MTRBarrierControlClusterBarrierControlStop (unsigned int) MTRCommandIDTypeClusterBarrierControlCommandBarrierControlStopID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterBarrierControl alloc] initWithDevice:baseDevice @@ -16733,8 +16733,8 @@ - (void)setpointRaiseLowerWithParams:(MTRThermostatClusterSetpointRaiseLowerPara (unsigned int) MTRCommandIDTypeClusterThermostatCommandSetpointRaiseLowerID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:baseDevice @@ -16773,8 +16773,8 @@ - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams (unsigned int) MTRCommandIDTypeClusterThermostatCommandSetWeeklyScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:baseDevice @@ -16814,8 +16814,8 @@ - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams (unsigned int) MTRCommandIDTypeClusterThermostatCommandGetWeeklyScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:baseDevice @@ -16864,8 +16864,8 @@ - (void)clearWeeklyScheduleWithParams:(MTRThermostatClusterClearWeeklySchedulePa (unsigned int) MTRCommandIDTypeClusterThermostatCommandClearWeeklyScheduleID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterThermostat alloc] initWithDevice:baseDevice @@ -17957,8 +17957,8 @@ - (void)stepWithParams:(MTRFanControlClusterStepParams *)params (unsigned int) MTRClusterIDTypeFanControlID, (unsigned int) MTRCommandIDTypeClusterFanControlCommandStepID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterFanControl alloc] initWithDevice:baseDevice @@ -18473,8 +18473,8 @@ - (void)moveToHueWithParams:(MTRColorControlClusterMoveToHueParams *)params (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToHueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18513,8 +18513,8 @@ - (void)moveHueWithParams:(MTRColorControlClusterMoveHueParams *)params (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveHueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18553,8 +18553,8 @@ - (void)stepHueWithParams:(MTRColorControlClusterStepHueParams *)params (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepHueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18593,8 +18593,8 @@ - (void)moveToSaturationWithParams:(MTRColorControlClusterMoveToSaturationParams (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToSaturationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18633,8 +18633,8 @@ - (void)moveSaturationWithParams:(MTRColorControlClusterMoveSaturationParams *)p (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveSaturationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18673,8 +18673,8 @@ - (void)stepSaturationWithParams:(MTRColorControlClusterStepSaturationParams *)p (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepSaturationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18713,8 +18713,8 @@ - (void)moveToHueAndSaturationWithParams:(MTRColorControlClusterMoveToHueAndSatu (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToHueAndSaturationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18753,8 +18753,8 @@ - (void)moveToColorWithParams:(MTRColorControlClusterMoveToColorParams *)params (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToColorID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18793,8 +18793,8 @@ - (void)moveColorWithParams:(MTRColorControlClusterMoveColorParams *)params (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveColorID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18833,8 +18833,8 @@ - (void)stepColorWithParams:(MTRColorControlClusterStepColorParams *)params (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepColorID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18873,8 +18873,8 @@ - (void)moveToColorTemperatureWithParams:(MTRColorControlClusterMoveToColorTempe (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveToColorTemperatureID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18913,8 +18913,8 @@ - (void)enhancedMoveToHueWithParams:(MTRColorControlClusterEnhancedMoveToHuePara (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedMoveToHueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18953,8 +18953,8 @@ - (void)enhancedMoveHueWithParams:(MTRColorControlClusterEnhancedMoveHueParams * (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedMoveHueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -18993,8 +18993,8 @@ - (void)enhancedStepHueWithParams:(MTRColorControlClusterEnhancedStepHueParams * (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedStepHueID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -19033,8 +19033,8 @@ - (void)enhancedMoveToHueAndSaturationWithParams:(MTRColorControlClusterEnhanced (unsigned int) MTRCommandIDTypeClusterColorControlCommandEnhancedMoveToHueAndSaturationID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -19073,8 +19073,8 @@ - (void)colorLoopSetWithParams:(MTRColorControlClusterColorLoopSetParams *)param (unsigned int) MTRCommandIDTypeClusterColorControlCommandColorLoopSetID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -19113,8 +19113,8 @@ - (void)stopMoveStepWithParams:(MTRColorControlClusterStopMoveStepParams *)param (unsigned int) MTRCommandIDTypeClusterColorControlCommandStopMoveStepID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -19153,8 +19153,8 @@ - (void)moveColorTemperatureWithParams:(MTRColorControlClusterMoveColorTemperatu (unsigned int) MTRCommandIDTypeClusterColorControlCommandMoveColorTemperatureID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -19193,8 +19193,8 @@ - (void)stepColorTemperatureWithParams:(MTRColorControlClusterStepColorTemperatu (unsigned int) MTRCommandIDTypeClusterColorControlCommandStepColorTemperatureID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterColorControl alloc] initWithDevice:baseDevice @@ -23350,8 +23350,8 @@ - (void)changeChannelWithParams:(MTRChannelClusterChangeChannelParams *)params (unsigned int) MTRClusterIDTypeChannelID, (unsigned int) MTRCommandIDTypeClusterChannelCommandChangeChannelID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:baseDevice @@ -23391,8 +23391,8 @@ - (void)changeChannelByNumberWithParams:(MTRChannelClusterChangeChannelByNumberP (unsigned int) MTRCommandIDTypeClusterChannelCommandChangeChannelByNumberID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:baseDevice @@ -23431,8 +23431,8 @@ - (void)skipChannelWithParams:(MTRChannelClusterSkipChannelParams *)params (unsigned int) MTRClusterIDTypeChannelID, (unsigned int) MTRCommandIDTypeClusterChannelCommandSkipChannelID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterChannel alloc] initWithDevice:baseDevice @@ -23603,8 +23603,8 @@ - (void)navigateTargetWithParams:(MTRTargetNavigatorClusterNavigateTargetParams (unsigned int) MTRCommandIDTypeClusterTargetNavigatorCommandNavigateTargetID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterTargetNavigator alloc] initWithDevice:baseDevice @@ -23756,8 +23756,8 @@ - (void)playWithParams:(MTRMediaPlaybackClusterPlayParams * _Nullable)params (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandPlayID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -23804,8 +23804,8 @@ - (void)pauseWithParams:(MTRMediaPlaybackClusterPauseParams * _Nullable)params (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandPauseID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -23852,8 +23852,8 @@ - (void)stopWithParams:(MTRMediaPlaybackClusterStopParams * _Nullable)params (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandStopID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -23903,8 +23903,8 @@ - (void)startOverWithParams:(MTRMediaPlaybackClusterStartOverParams * _Nullable) (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandStartOverID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -23951,8 +23951,8 @@ - (void)previousWithParams:(MTRMediaPlaybackClusterPreviousParams * _Nullable)pa (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandPreviousID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -23999,8 +23999,8 @@ - (void)nextWithParams:(MTRMediaPlaybackClusterNextParams * _Nullable)params (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandNextID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -24047,8 +24047,8 @@ - (void)rewindWithParams:(MTRMediaPlaybackClusterRewindParams * _Nullable)params (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandRewindID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -24098,8 +24098,8 @@ - (void)fastForwardWithParams:(MTRMediaPlaybackClusterFastForwardParams * _Nulla (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandFastForwardID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -24140,8 +24140,8 @@ - (void)skipForwardWithParams:(MTRMediaPlaybackClusterSkipForwardParams *)params (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandSkipForwardID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -24182,8 +24182,8 @@ - (void)skipBackwardWithParams:(MTRMediaPlaybackClusterSkipBackwardParams *)para (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandSkipBackwardID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -24224,8 +24224,8 @@ - (void)seekWithParams:(MTRMediaPlaybackClusterSeekParams *)params (unsigned int) MTRClusterIDTypeMediaPlaybackID, (unsigned int) MTRCommandIDTypeClusterMediaPlaybackCommandSeekID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaPlayback alloc] initWithDevice:baseDevice @@ -24627,8 +24627,8 @@ - (void)selectInputWithParams:(MTRMediaInputClusterSelectInputParams *)params (unsigned int) MTRCommandIDTypeClusterMediaInputCommandSelectInputID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:baseDevice @@ -24676,8 +24676,8 @@ - (void)showInputStatusWithParams:(MTRMediaInputClusterShowInputStatusParams * _ (unsigned int) MTRCommandIDTypeClusterMediaInputCommandShowInputStatusID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:baseDevice @@ -24725,8 +24725,8 @@ - (void)hideInputStatusWithParams:(MTRMediaInputClusterHideInputStatusParams * _ (unsigned int) MTRCommandIDTypeClusterMediaInputCommandHideInputStatusID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:baseDevice @@ -24765,8 +24765,8 @@ - (void)renameInputWithParams:(MTRMediaInputClusterRenameInputParams *)params (unsigned int) MTRCommandIDTypeClusterMediaInputCommandRenameInputID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterMediaInput alloc] initWithDevice:baseDevice @@ -24958,8 +24958,8 @@ - (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params (unsigned int) MTRClusterIDTypeLowPowerID, (unsigned int) MTRCommandIDTypeClusterLowPowerCommandSleepID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterLowPower alloc] initWithDevice:baseDevice @@ -25091,8 +25091,8 @@ - (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params (unsigned int) MTRClusterIDTypeKeypadInputID, (unsigned int) MTRCommandIDTypeClusterKeypadInputCommandSendKeyID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterKeypadInput alloc] initWithDevice:baseDevice @@ -25219,8 +25219,8 @@ - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *) (unsigned int) MTRCommandIDTypeClusterContentLauncherCommandLaunchContentID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:baseDevice @@ -25261,8 +25261,8 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params (unsigned int) MTRCommandIDTypeClusterContentLauncherCommandLaunchURLID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterContentLauncher alloc] initWithDevice:baseDevice @@ -25441,8 +25441,8 @@ - (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params (unsigned int) MTRCommandIDTypeClusterAudioOutputCommandSelectOutputID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:baseDevice @@ -25481,8 +25481,8 @@ - (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params (unsigned int) MTRCommandIDTypeClusterAudioOutputCommandRenameOutputID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAudioOutput alloc] initWithDevice:baseDevice @@ -25631,8 +25631,8 @@ - (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams * _Nul (unsigned int) MTRCommandIDTypeClusterApplicationLauncherCommandLaunchAppID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:baseDevice @@ -25673,8 +25673,8 @@ - (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams * _Nullabl (unsigned int) MTRCommandIDTypeClusterApplicationLauncherCommandStopAppID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:baseDevice @@ -25715,8 +25715,8 @@ - (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams * _Nullabl (unsigned int) MTRCommandIDTypeClusterApplicationLauncherCommandHideAppID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterApplicationLauncher alloc] initWithDevice:baseDevice @@ -26044,8 +26044,8 @@ - (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params (unsigned int) MTRCommandIDTypeClusterAccountLoginCommandGetSetupPINID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:baseDevice @@ -26085,8 +26085,8 @@ - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params (unsigned int) MTRClusterIDTypeAccountLoginID, (unsigned int) MTRCommandIDTypeClusterAccountLoginCommandLoginID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:baseDevice @@ -26131,8 +26131,8 @@ - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params (unsigned int) MTRClusterIDTypeAccountLoginID, (unsigned int) MTRCommandIDTypeClusterAccountLoginCommandLogoutID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterAccountLogin alloc] initWithDevice:baseDevice @@ -26296,8 +26296,8 @@ - (void)getProfileInfoCommandWithParams:(MTRElectricalMeasurementClusterGetProfi (unsigned int) MTRCommandIDTypeClusterElectricalMeasurementCommandGetProfileInfoCommandID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:baseDevice @@ -26337,8 +26337,8 @@ - (void)getMeasurementProfileCommandWithParams:(MTRElectricalMeasurementClusterG (unsigned int) MTRCommandIDTypeClusterElectricalMeasurementCommandGetMeasurementProfileCommandID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterElectricalMeasurement alloc] initWithDevice:baseDevice @@ -27722,8 +27722,8 @@ - (void)testWithParams:(MTRUnitTestingClusterTestParams * _Nullable)params (unsigned int) MTRClusterIDTypeUnitTestingID, (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -27771,8 +27771,8 @@ - (void)testNotHandledWithParams:(MTRUnitTestingClusterTestNotHandledParams * _N (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNotHandledID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -27822,8 +27822,8 @@ - (void)testSpecificWithParams:(MTRUnitTestingClusterTestSpecificParams * _Nulla (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestSpecificID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -27872,8 +27872,8 @@ - (void)testUnknownCommandWithParams:(MTRUnitTestingClusterTestUnknownCommandPar (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestUnknownCommandID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -27913,8 +27913,8 @@ - (void)testAddArgumentsWithParams:(MTRUnitTestingClusterTestAddArgumentsParams (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestAddArgumentsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -27955,8 +27955,8 @@ - (void)testSimpleArgumentRequestWithParams:(MTRUnitTestingClusterTestSimpleArgu (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestSimpleArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -27998,8 +27998,8 @@ - (void)testStructArrayArgumentRequestWithParams:(MTRUnitTestingClusterTestStruc (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestStructArrayArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28041,8 +28041,8 @@ - (void)testStructArgumentRequestWithParams:(MTRUnitTestingClusterTestStructArgu (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestStructArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28083,8 +28083,8 @@ - (void)testNestedStructArgumentRequestWithParams:(MTRUnitTestingClusterTestNest (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNestedStructArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28125,8 +28125,8 @@ - (void)testListStructArgumentRequestWithParams:(MTRUnitTestingClusterTestListSt (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListStructArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28167,8 +28167,8 @@ - (void)testListInt8UArgumentRequestWithParams:(MTRUnitTestingClusterTestListInt (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28209,8 +28209,8 @@ - (void)testNestedStructListArgumentRequestWithParams:(MTRUnitTestingClusterTest (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNestedStructListArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28253,8 +28253,8 @@ - (void)testListNestedStructListArgumentRequestWithParams: (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListNestedStructListArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28295,8 +28295,8 @@ - (void)testListInt8UReverseRequestWithParams:(MTRUnitTestingClusterTestListInt8 (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestListInt8UReverseRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28337,8 +28337,8 @@ - (void)testEnumsRequestWithParams:(MTRUnitTestingClusterTestEnumsRequestParams (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestEnumsRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28379,8 +28379,8 @@ - (void)testNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestNullable (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestNullableOptionalRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28423,8 +28423,8 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRUnitTestingClusterTestC (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestComplexNullableOptionalRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28467,8 +28467,8 @@ - (void)simpleStructEchoRequestWithParams:(MTRUnitTestingClusterSimpleStructEcho (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandSimpleStructEchoRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28517,8 +28517,8 @@ - (void)timedInvokeRequestWithParams:(MTRUnitTestingClusterTimedInvokeRequestPar (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTimedInvokeRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28557,8 +28557,8 @@ - (void)testSimpleOptionalArgumentRequestWithParams:(MTRUnitTestingClusterTestSi (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestSimpleOptionalArgumentRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28598,8 +28598,8 @@ - (void)testEmitTestEventRequestWithParams:(MTRUnitTestingClusterTestEmitTestEve (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestEmitTestEventRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -28644,8 +28644,8 @@ - (void)testEmitTestEventRequestWithParams:(MTRUnitTestingClusterTestEmitTestEve (unsigned int) MTRCommandIDTypeClusterUnitTestingCommandTestEmitTestFabricScopedEventRequestID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterUnitTesting alloc] initWithDevice:baseDevice @@ -31377,8 +31377,8 @@ - (void)pingWithParams:(MTRSampleMEIClusterPingParams * _Nullable)params (unsigned int) MTRClusterIDTypeSampleMEIID, (unsigned int) MTRCommandIDTypeClusterSampleMEICommandPingID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:baseDevice @@ -31418,8 +31418,8 @@ - (void)addArgumentsWithParams:(MTRSampleMEIClusterAddArgumentsParams *)params (unsigned int) MTRClusterIDTypeSampleMEIID, (unsigned int) MTRCommandIDTypeClusterSampleMEICommandAddArgumentsID]; // Make a copy of params before we go async. params = [params copy]; - MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:self.device.queue]; - MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { + MTRAsyncWorkItem * workItem = [[MTRAsyncWorkItem alloc] initWithQueue:self.device.queue]; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { MTRClustersLogDequeue(logPrefix, self.device.asyncCallbackWorkQueue); auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; auto * cluster = [[MTRBaseClusterSampleMEI alloc] initWithDevice:baseDevice diff --git a/src/darwin/Framework/CHIPTests/MTRAsyncCallbackQueueTests.m b/src/darwin/Framework/CHIPTests/MTRAsyncCallbackQueueTests.m index 01651afa5a1edb..bf8041ccd10fbc 100644 --- a/src/darwin/Framework/CHIPTests/MTRAsyncCallbackQueueTests.m +++ b/src/darwin/Framework/CHIPTests/MTRAsyncCallbackQueueTests.m @@ -19,8 +19,6 @@ // system dependencies #import -#import "MTRAsyncCallbackWorkQueue_Internal.h" - @interface MTRAsyncCallbackQueueTests : XCTestCase @end @@ -256,219 +254,4 @@ - (void)testInvalidation [self waitForExpectations:@[ expectation, cancelExpectation ] timeout:5]; } -- (void)testBatching -{ - XCTestExpectation * workItem1ReadyExpectation = [self expectationWithDescription:@"Work item 1 called"]; - __block BOOL workItem2BatchingCalled = NO; - __block BOOL workItem2ReadyCalled = NO; - XCTestExpectation * workItem3ReadyExpectation = [self expectationWithDescription:@"Work item 3 called"]; - - MTRAsyncCallbackWorkQueue * workQueue = [[MTRAsyncCallbackWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; - - // Have a work item sleep so the testing items can queue - MTRAsyncCallbackQueueWorkItem * workItem0 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler0 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - // While processing item 0, enqueue additional items to test batching - MTRAsyncCallbackQueueWorkItem * workItem1 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem1ReadyExpectation fulfill]; - [workItem1 endWork]; - }; - workItem1.readyHandler = readyHandler1; - [workItem1 setBatchingID:1 - data:@(1) - handler:^(id _Nonnull opaqueDataFirst, id _Nonnull opaqueDataSecond, BOOL * _Nonnull fullyMerged) { - XCTAssertEqualObjects(opaqueDataFirst, @(1)); - XCTAssertEqualObjects(opaqueDataSecond, @(2)); - *fullyMerged = YES; - }]; - // No cancel handler on purpose. - [workQueue enqueueWorkItem:workItem1]; - - MTRAsyncCallbackQueueWorkItem * workItem2 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - workItem2ReadyCalled = YES; - [workItem2 endWork]; - }; - workItem2.readyHandler = readyHandler2; - [workItem2 setBatchingID:1 - data:@(2) - handler:^(id _Nonnull opaqueDataFirst, id _Nonnull opaqueDataSecond, BOOL * _Nonnull fullyMerged) { - workItem2BatchingCalled = YES; - }]; - // No cancel handler on purpose. - [workQueue enqueueWorkItem:workItem2]; - - MTRAsyncCallbackQueueWorkItem * workItem3 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler3 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem3ReadyExpectation fulfill]; - [workItem3 endWork]; - }; - workItem3.readyHandler = readyHandler3; - [workQueue enqueueWorkItem:workItem3]; - - [workItem0 endWork]; - }; - workItem0.readyHandler = readyHandler0; - // No cancel handler on purpose. - [workQueue enqueueWorkItem:workItem0]; - - [self waitForExpectations:@[ workItem1ReadyExpectation, workItem3ReadyExpectation ] timeout:5]; - - XCTAssertFalse(workItem2BatchingCalled); - XCTAssertFalse(workItem2ReadyCalled); -} - -- (void)testDuplicate -{ - XCTestExpectation * workItem0ReadyExpectation = [self expectationWithDescription:@"Work item 0 called"]; - XCTestExpectation * workItem6ReadyExpectation = [self expectationWithDescription:@"Work item 6 called"]; - - MTRAsyncCallbackWorkQueue * workQueue = [[MTRAsyncCallbackWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; - - // Have a work item sleep so the testing items can queue - MTRAsyncCallbackQueueWorkItem * workItem0 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler0 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - // While processing item 0, enqueue additional items to test duplicate checking - MTRAsyncCallbackQueueWorkItem * workItem1 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem1 endWork]; - }; - workItem1.readyHandler = readyHandler1; - [workItem1 setDuplicateTypeID:1 - handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { - if ([opaqueItemData isEqual:@(1)]) { - *isDuplicate = YES; - *stop = YES; - } else { - *stop = NO; - } - }]; - [workQueue enqueueWorkItem:workItem1]; - - MTRAsyncCallbackQueueWorkItem * workItem2 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem2 endWork]; - }; - workItem2.readyHandler = readyHandler2; - [workItem2 setDuplicateTypeID:1 - handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { - if ([opaqueItemData isEqual:@(2)]) { - *isDuplicate = YES; - *stop = YES; - } else { - *stop = NO; - } - }]; - [workQueue enqueueWorkItem:workItem2]; - - MTRAsyncCallbackQueueWorkItem * workItem3 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler3 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem3 endWork]; - }; - workItem3.readyHandler = readyHandler3; - [workItem3 setDuplicateTypeID:2 - handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { - if ([opaqueItemData isEqual:@(1)]) { - *isDuplicate = YES; - *stop = YES; - } else { - *stop = NO; - } - }]; - [workQueue enqueueWorkItem:workItem3]; - - // At this point we should have duplicate type 1 with data @(1) and @(2), and type 2 with data @(1). - XCTAssertTrue([workQueue isDuplicateForTypeID:1 workItemData:@(1)]); - XCTAssertTrue([workQueue isDuplicateForTypeID:1 workItemData:@(2)]); - XCTAssertTrue([workQueue isDuplicateForTypeID:2 workItemData:@(1)]); - - XCTAssertFalse([workQueue isDuplicateForTypeID:0 workItemData:@(1)]); - XCTAssertFalse([workQueue isDuplicateForTypeID:0 workItemData:@(2)]); - XCTAssertFalse([workQueue isDuplicateForTypeID:1 workItemData:@(0)]); - XCTAssertFalse([workQueue isDuplicateForTypeID:1 workItemData:@(3)]); - XCTAssertFalse([workQueue isDuplicateForTypeID:2 workItemData:@(2)]); - - // Test returning *isDuplicate=NO and queuing one extra duplicate item, and that the extra item runs - - // First have a regular item with ID/data == 3/1 - MTRAsyncCallbackQueueWorkItem * workItem4 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler4 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem4 endWork]; - }; - workItem4.readyHandler = readyHandler4; - [workItem4 setDuplicateTypeID:3 - handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { - if ([opaqueItemData isEqual:@(1)]) { - *isDuplicate = YES; - *stop = YES; - } else { - *stop = NO; - } - }]; - [workQueue enqueueWorkItem:workItem4]; - - XCTAssertTrue([workQueue isDuplicateForTypeID:3 workItemData:@(1)]); - - // Have a barrier item with ID/data == 3/1 that returns *isDuplicate=NO - MTRAsyncCallbackQueueWorkItem * workItem5 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler5 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem5 endWork]; - }; - workItem5.readyHandler = readyHandler5; - [workItem5 setDuplicateTypeID:3 - handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { - if ([opaqueItemData isEqual:@(1)]) { - *isDuplicate = NO; - *stop = YES; - } else { - *stop = NO; - } - }]; - [workQueue enqueueWorkItem:workItem5]; - - // After the above, the same ID/data should no longer be considered duplicate - XCTAssertFalse([workQueue isDuplicateForTypeID:3 workItemData:@(1)]); - - // Now add regular regular item with ID/data == 3/1 - MTRAsyncCallbackQueueWorkItem * workItem6 = - [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; - MTRAsyncCallbackReadyHandler readyHandler6 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { - [workItem6 endWork]; - [workItem6ReadyExpectation fulfill]; - }; - workItem6.readyHandler = readyHandler6; - [workItem6 setDuplicateTypeID:3 - handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { - if ([opaqueItemData isEqual:@(1)]) { - *isDuplicate = YES; - *stop = YES; - } else { - *stop = NO; - } - }]; - [workQueue enqueueWorkItem:workItem6]; - - // After the above, the same ID/data should no longer be considered duplicate - XCTAssertTrue([workQueue isDuplicateForTypeID:3 workItemData:@(1)]); - - [workItem0 endWork]; - [workItem0ReadyExpectation fulfill]; - }; - workItem0.readyHandler = readyHandler0; - [workQueue enqueueWorkItem:workItem0]; - - [self waitForExpectations:@[ workItem0ReadyExpectation, workItem6ReadyExpectation ] timeout:5]; -} - @end diff --git a/src/darwin/Framework/CHIPTests/MTRAsyncWorkQueueTests.m b/src/darwin/Framework/CHIPTests/MTRAsyncWorkQueueTests.m new file mode 100644 index 00000000000000..4fbb1c44468652 --- /dev/null +++ b/src/darwin/Framework/CHIPTests/MTRAsyncWorkQueueTests.m @@ -0,0 +1,451 @@ +/** + * Copyright (c) 2022 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +// system dependencies +#import + +#import "MTRAsyncWorkQueue_Internal.h" + +@interface MTRAsyncWorkQueueTests : XCTestCase + +@end + +@implementation MTRAsyncWorkQueueTests + +- (void)testRunItem +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Work item called"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + __block int counter = 0; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + counter++; + [expectation fulfill]; + [workItem1 endWork]; + }; + workItem1.readyHandler = readyHandler; + workItem1.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem1]; + + // Check for leaks. + MTRAsyncWorkItem * __weak weakItem = workItem1; + [self addTeardownBlock:^() { + XCTAssertNil(weakItem); + }]; + + [self waitForExpectationsWithTimeout:5 handler:nil]; + + // see that it only ran once + XCTAssertEqual(counter, 1); +} + +- (void)testRunItemsSerialized +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Work item called in order"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + __block int counter = 0; + MTRAsyncWorkReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + sleep(1); + counter++; + [workItem1 endWork]; + }; + workItem1.readyHandler = readyHandler1; + workItem1.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem1]; + + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // expect this to have waited until workItem1's sleep(1) finished and incremented counter + if (counter == 1) { + [expectation fulfill]; + } + [workItem2 endWork]; + }; + workItem2.readyHandler = readyHandler2; + workItem2.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem2]; + + [self waitForExpectationsWithTimeout:5 handler:nil]; + + // see that workItem1 only ran once + XCTAssertEqual(counter, 1); +} + +- (void)testRunItemsRetry +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Work item called in order"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + __block int counter = 0; + MTRAsyncWorkReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + sleep(1); + counter++; + + if (retryCount) { + // only end after retried once + [workItem1 endWork]; + } else { + [workItem1 retryWork]; + } + }; + workItem1.readyHandler = readyHandler1; + workItem1.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem1]; + + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // expect this to have waited until workItem1's sleep(1) finished and incremented counter twice + if (counter == 2) { + [expectation fulfill]; + } + [workItem2 endWork]; + }; + workItem2.readyHandler = readyHandler2; + workItem2.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem2]; + + [self waitForExpectationsWithTimeout:5 handler:nil]; + + // see that workItem1 ran twice after the retry + XCTAssertEqual(counter, 2); +} + +- (void)testRunItemsAfterDrain +{ + XCTestExpectation * expectation1 = [self expectationWithDescription:@"First work item caled"]; + XCTestExpectation * expectation2 = [self expectationWithDescription:@"Second work item called after drain"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem1 endWork]; + [expectation1 fulfill]; + }; + workItem1.readyHandler = readyHandler1; + workItem1.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem1]; + + [self waitForExpectations:@[ expectation1 ] timeout:5]; + + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [expectation2 fulfill]; + [workItem2 endWork]; + }; + workItem2.readyHandler = readyHandler2; + workItem2.cancelHandler = ^{ + }; + [workQueue enqueueWorkItem:workItem2]; + + [self waitForExpectationsWithTimeout:5 handler:nil]; +} + +- (void)testRunItemNoHandlers +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Work item called"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + + __block int counter = 0; + MTRAsyncWorkReadyHandler readyHandler = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + counter++; + [workItem2 endWork]; + [expectation fulfill]; + }; + workItem2.readyHandler = readyHandler; + workItem2.cancelHandler = ^{ + }; + + // Check that trying to run workItem1 does not crash. + [workQueue enqueueWorkItem:workItem1]; + [workQueue enqueueWorkItem:workItem2]; + + [self waitForExpectationsWithTimeout:5 handler:nil]; + + // see that it only ran once + XCTAssertEqual(counter, 1); +} + +- (void)testInvalidation +{ + XCTestExpectation * expectation = [self expectationWithDescription:@"Work item called"]; + XCTestExpectation * cancelExpectation = [self expectationWithDescription:@"Work item canceled"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // Give the code enqueing the other items a chance to run, so they can + // actually get canceled. + sleep(1); + [workQueue invalidate]; + [workItem1 endWork]; + [expectation fulfill]; + }; + workItem1.readyHandler = readyHandler1; + // No cancel handler on purpose. + [workQueue enqueueWorkItem:workItem1]; + + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // This should never get called. + XCTAssertFalse(YES); + [workItem2 endWork]; + }; + workItem2.readyHandler = readyHandler2; + // No cancel handler on purpose. + [workQueue enqueueWorkItem:workItem2]; + + MTRAsyncWorkItem * workItem3 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler3 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // This should never get called. + XCTAssertFalse(YES); + [workItem3 endWork]; + }; + dispatch_block_t cancelHandler3 = ^() { + [cancelExpectation fulfill]; + }; + workItem3.readyHandler = readyHandler3; + workItem3.cancelHandler = cancelHandler3; + [workQueue enqueueWorkItem:workItem3]; + + [self waitForExpectations:@[ expectation, cancelExpectation ] timeout:5]; +} + +- (void)testBatching +{ + XCTestExpectation * workItem1ReadyExpectation = [self expectationWithDescription:@"Work item 1 called"]; + __block BOOL workItem2BatchingCalled = NO; + __block BOOL workItem2ReadyCalled = NO; + XCTestExpectation * workItem3ReadyExpectation = [self expectationWithDescription:@"Work item 3 called"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + // Have a work item sleep so the testing items can queue + MTRAsyncWorkItem * workItem0 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler0 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // While processing item 0, enqueue additional items to test batching + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem1ReadyExpectation fulfill]; + [workItem1 endWork]; + }; + workItem1.readyHandler = readyHandler1; + [workItem1 setBatchingID:1 + data:@(1) + handler:^(id _Nonnull opaqueDataFirst, id _Nonnull opaqueDataSecond, BOOL * _Nonnull fullyMerged) { + XCTAssertEqualObjects(opaqueDataFirst, @(1)); + XCTAssertEqualObjects(opaqueDataSecond, @(2)); + *fullyMerged = YES; + }]; + // No cancel handler on purpose. + [workQueue enqueueWorkItem:workItem1]; + + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + workItem2ReadyCalled = YES; + [workItem2 endWork]; + }; + workItem2.readyHandler = readyHandler2; + [workItem2 setBatchingID:1 + data:@(2) + handler:^(id _Nonnull opaqueDataFirst, id _Nonnull opaqueDataSecond, BOOL * _Nonnull fullyMerged) { + workItem2BatchingCalled = YES; + }]; + // No cancel handler on purpose. + [workQueue enqueueWorkItem:workItem2]; + + MTRAsyncWorkItem * workItem3 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler3 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem3ReadyExpectation fulfill]; + [workItem3 endWork]; + }; + workItem3.readyHandler = readyHandler3; + [workQueue enqueueWorkItem:workItem3]; + + [workItem0 endWork]; + }; + workItem0.readyHandler = readyHandler0; + // No cancel handler on purpose. + [workQueue enqueueWorkItem:workItem0]; + + [self waitForExpectations:@[ workItem1ReadyExpectation, workItem3ReadyExpectation ] timeout:5]; + + XCTAssertFalse(workItem2BatchingCalled); + XCTAssertFalse(workItem2ReadyCalled); +} + +- (void)testDuplicate +{ + XCTestExpectation * workItem0ReadyExpectation = [self expectationWithDescription:@"Work item 0 called"]; + XCTestExpectation * workItem6ReadyExpectation = [self expectationWithDescription:@"Work item 6 called"]; + + MTRAsyncWorkQueue * workQueue = [[MTRAsyncWorkQueue alloc] initWithContext:nil queue:dispatch_get_main_queue()]; + + // Have a work item sleep so the testing items can queue + MTRAsyncWorkItem * workItem0 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler0 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + // While processing item 0, enqueue additional items to test duplicate checking + MTRAsyncWorkItem * workItem1 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler1 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem1 endWork]; + }; + workItem1.readyHandler = readyHandler1; + [workItem1 setDuplicateTypeID:1 + handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { + if ([opaqueItemData isEqual:@(1)]) { + *isDuplicate = YES; + *stop = YES; + } else { + *stop = NO; + } + }]; + [workQueue enqueueWorkItem:workItem1]; + + MTRAsyncWorkItem * workItem2 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler2 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem2 endWork]; + }; + workItem2.readyHandler = readyHandler2; + [workItem2 setDuplicateTypeID:1 + handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { + if ([opaqueItemData isEqual:@(2)]) { + *isDuplicate = YES; + *stop = YES; + } else { + *stop = NO; + } + }]; + [workQueue enqueueWorkItem:workItem2]; + + MTRAsyncWorkItem * workItem3 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler3 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem3 endWork]; + }; + workItem3.readyHandler = readyHandler3; + [workItem3 setDuplicateTypeID:2 + handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { + if ([opaqueItemData isEqual:@(1)]) { + *isDuplicate = YES; + *stop = YES; + } else { + *stop = NO; + } + }]; + [workQueue enqueueWorkItem:workItem3]; + + // At this point we should have duplicate type 1 with data @(1) and @(2), and type 2 with data @(1). + XCTAssertTrue([workQueue isDuplicateForTypeID:1 workItemData:@(1)]); + XCTAssertTrue([workQueue isDuplicateForTypeID:1 workItemData:@(2)]); + XCTAssertTrue([workQueue isDuplicateForTypeID:2 workItemData:@(1)]); + + XCTAssertFalse([workQueue isDuplicateForTypeID:0 workItemData:@(1)]); + XCTAssertFalse([workQueue isDuplicateForTypeID:0 workItemData:@(2)]); + XCTAssertFalse([workQueue isDuplicateForTypeID:1 workItemData:@(0)]); + XCTAssertFalse([workQueue isDuplicateForTypeID:1 workItemData:@(3)]); + XCTAssertFalse([workQueue isDuplicateForTypeID:2 workItemData:@(2)]); + + // Test returning *isDuplicate=NO and queuing one extra duplicate item, and that the extra item runs + + // First have a regular item with ID/data == 3/1 + MTRAsyncWorkItem * workItem4 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler4 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem4 endWork]; + }; + workItem4.readyHandler = readyHandler4; + [workItem4 setDuplicateTypeID:3 + handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { + if ([opaqueItemData isEqual:@(1)]) { + *isDuplicate = YES; + *stop = YES; + } else { + *stop = NO; + } + }]; + [workQueue enqueueWorkItem:workItem4]; + + XCTAssertTrue([workQueue isDuplicateForTypeID:3 workItemData:@(1)]); + + // Have a barrier item with ID/data == 3/1 that returns *isDuplicate=NO + MTRAsyncWorkItem * workItem5 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler5 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem5 endWork]; + }; + workItem5.readyHandler = readyHandler5; + [workItem5 setDuplicateTypeID:3 + handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { + if ([opaqueItemData isEqual:@(1)]) { + *isDuplicate = NO; + *stop = YES; + } else { + *stop = NO; + } + }]; + [workQueue enqueueWorkItem:workItem5]; + + // After the above, the same ID/data should no longer be considered duplicate + XCTAssertFalse([workQueue isDuplicateForTypeID:3 workItemData:@(1)]); + + // Now add regular regular item with ID/data == 3/1 + MTRAsyncWorkItem * workItem6 = [[MTRAsyncWorkItem alloc] initWithQueue:dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0)]; + MTRAsyncWorkReadyHandler readyHandler6 = ^(MTRDevice * _Nonnull device, NSUInteger retryCount) { + [workItem6 endWork]; + [workItem6ReadyExpectation fulfill]; + }; + workItem6.readyHandler = readyHandler6; + [workItem6 setDuplicateTypeID:3 + handler:^(id _Nonnull opaqueItemData, BOOL * _Nonnull isDuplicate, BOOL * stop) { + if ([opaqueItemData isEqual:@(1)]) { + *isDuplicate = YES; + *stop = YES; + } else { + *stop = NO; + } + }]; + [workQueue enqueueWorkItem:workItem6]; + + // After the above, the same ID/data should no longer be considered duplicate + XCTAssertTrue([workQueue isDuplicateForTypeID:3 workItemData:@(1)]); + + [workItem0 endWork]; + [workItem0ReadyExpectation fulfill]; + }; + workItem0.readyHandler = readyHandler0; + [workQueue enqueueWorkItem:workItem0]; + + [self waitForExpectations:@[ workItem0ReadyExpectation, workItem6ReadyExpectation ] timeout:5]; +} + +@end diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 6f901de32ab3d5..400976afbc5339 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -72,9 +72,6 @@ 039546BD2991E1CB006D42A8 /* SystemCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 039546B32991E194006D42A8 /* SystemCommands.cpp */; }; 039546BE2991E1CB006D42A8 /* DelayCommands.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 039546AC2991E185006D42A8 /* DelayCommands.cpp */; }; 039547012992D461006D42A8 /* generic-callback-stubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */; }; - 039547022992D952006D42A8 /* privilege-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D84374A29498BAE0070D20A /* privilege-storage.cpp */; }; - 039547032992D991006D42A8 /* MTRIMDispatch.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */; }; - 039547042992D9BF006D42A8 /* ota-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51431AFA27D29CA4008A7943 /* ota-provider.cpp */; }; 0395470F2992DB37006D42A8 /* complete.c in Sources */ = {isa = PBXBuildFile; fileRef = 0395470C2992DB37006D42A8 /* complete.c */; }; 03F430A7299410C000166449 /* ExamplePersistentStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 03F430A6299410C000166449 /* ExamplePersistentStorage.cpp */; }; 03F430A82994112B00166449 /* editline.c in Sources */ = {isa = PBXBuildFile; fileRef = 0395470B2992DB37006D42A8 /* editline.c */; }; @@ -123,9 +120,12 @@ 3D843713294977000070D20A /* NSDataSpanConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843710294977000070D20A /* NSDataSpanConversion.h */; }; 3D843716294979230070D20A /* MTRCallbackBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843714294979230070D20A /* MTRCallbackBridge.h */; }; 3D843717294979230070D20A /* MTRClusters_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843715294979230070D20A /* MTRClusters_Internal.h */; }; - 3D84374B29498BAE0070D20A /* privilege-storage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3D84374A29498BAE0070D20A /* privilege-storage.cpp */; }; 3D843756294AD25A0070D20A /* MTRCertificateInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D843754294AD25A0070D20A /* MTRCertificateInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3D843757294AD25A0070D20A /* MTRCertificateInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D843755294AD25A0070D20A /* MTRCertificateInfo.mm */; }; + 3DA1A3542ABAB3B4004F0BB9 /* MTRAsyncWorkQueue_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DA1A3512ABAB3B4004F0BB9 /* MTRAsyncWorkQueue_Internal.h */; }; + 3DA1A3552ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DA1A3522ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.h */; }; + 3DA1A3562ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3DA1A3532ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.mm */; }; + 3DA1A3582ABABF6A004F0BB9 /* MTRAsyncWorkQueueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DA1A3572ABABF69004F0BB9 /* MTRAsyncWorkQueueTests.m */; }; 3DECCB6E29347D2D00585AEC /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DECCB6D29347D2C00585AEC /* Security.framework */; }; 3DECCB702934AECD00585AEC /* MTRLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = 3DECCB6F2934AC1C00585AEC /* MTRLogging.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3DECCB722934AFE200585AEC /* MTRLogging.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3DECCB712934AFE200585AEC /* MTRLogging.mm */; }; @@ -150,8 +150,6 @@ 513DDB8A2761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm in Sources */ = {isa = PBXBuildFile; fileRef = 513DDB892761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm */; }; 5142E39829D377F000A206F0 /* MTROTAProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 5142E39729D377F000A206F0 /* MTROTAProviderTests.m */; }; 514304202914CED9004DC7FE /* generic-callback-stubs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */; }; - 51431AF927D2973E008A7943 /* MTRIMDispatch.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */; }; - 51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51431AFA27D29CA4008A7943 /* ota-provider.cpp */; }; 5143851E2A65885500EDC8E6 /* MTRSwiftPairingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5143851D2A65885500EDC8E6 /* MTRSwiftPairingTests.swift */; }; 514654492A72F9DF00904E61 /* MTRDemuxingStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514654482A72F9DF00904E61 /* MTRDemuxingStorage.mm */; }; 5146544B2A72F9F500904E61 /* MTRDemuxingStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 5146544A2A72F9F500904E61 /* MTRDemuxingStorage.h */; }; @@ -183,8 +181,6 @@ 51C8E3F82825CDB600D47D00 /* MTRTestKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 51C8E3F72825CDB600D47D00 /* MTRTestKeys.m */; }; 51C984622A61CE2A00B0AD9A /* MTRFabricInfoChecker.m in Sources */ = {isa = PBXBuildFile; fileRef = 51C984602A61CE2A00B0AD9A /* MTRFabricInfoChecker.m */; }; 51D10D2E2808E2CA00E8CA3D /* MTRTestStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = 51D10D2D2808E2CA00E8CA3D /* MTRTestStorage.m */; }; - 51E0310027EA20D20083DC9C /* MTRControllerAccessControl.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E030FE27EA20D20083DC9C /* MTRControllerAccessControl.h */; }; - 51E0310127EA20D20083DC9C /* MTRControllerAccessControl.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E030FF27EA20D20083DC9C /* MTRControllerAccessControl.mm */; }; 51E24E73274E0DAC007CCF6E /* MTRErrorTestUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E24E72274E0DAC007CCF6E /* MTRErrorTestUtils.mm */; }; 51E4D121291D0EB400C8C535 /* MTRBaseClusterUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E4D120291D0EB400C8C535 /* MTRBaseClusterUtils.h */; }; 51E51FBF282AD37A00FC978D /* MTRDeviceControllerStartupParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 51E51FBC282AD37A00FC978D /* MTRDeviceControllerStartupParams.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -220,7 +216,6 @@ 7596A84828762783004DAE0E /* MTRAsyncCallbackWorkQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A84628762783004DAE0E /* MTRAsyncCallbackWorkQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 7596A84928762783004DAE0E /* MTRAsyncCallbackWorkQueue.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7596A84728762783004DAE0E /* MTRAsyncCallbackWorkQueue.mm */; }; 7596A84B287636C1004DAE0E /* MTRDevice_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A84A287636C1004DAE0E /* MTRDevice_Internal.h */; }; - 7596A84D287782EF004DAE0E /* MTRAsyncCallbackWorkQueue_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A84C287782E8004DAE0E /* MTRAsyncCallbackWorkQueue_Internal.h */; }; 7596A84F2877E6A9004DAE0E /* MTRCluster_Internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 7596A84E2877E6A9004DAE0E /* MTRCluster_Internal.h */; }; 7596A8512878709F004DAE0E /* MTRAsyncCallbackQueueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7596A8502878709F004DAE0E /* MTRAsyncCallbackQueueTests.m */; }; 7596A85528788557004DAE0E /* MTRClusters.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7596A85228788557004DAE0E /* MTRClusters.mm */; }; @@ -479,9 +474,12 @@ 3D84372D294984AF0070D20A /* decode_value.zapt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = decode_value.zapt; sourceTree = ""; }; 3D84372E294984AF0070D20A /* MTRCallbackBridge.zapt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MTRCallbackBridge.zapt; sourceTree = ""; }; 3D84372F294984AF0070D20A /* command_completion_type.zapt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = command_completion_type.zapt; sourceTree = ""; }; - 3D84374A29498BAE0070D20A /* privilege-storage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "privilege-storage.cpp"; path = "util/privilege-storage.cpp"; sourceTree = ""; }; 3D843754294AD25A0070D20A /* MTRCertificateInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRCertificateInfo.h; sourceTree = ""; }; 3D843755294AD25A0070D20A /* MTRCertificateInfo.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCertificateInfo.mm; sourceTree = ""; }; + 3DA1A3512ABAB3B4004F0BB9 /* MTRAsyncWorkQueue_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRAsyncWorkQueue_Internal.h; sourceTree = ""; }; + 3DA1A3522ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRAsyncWorkQueue.h; sourceTree = ""; }; + 3DA1A3532ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRAsyncWorkQueue.mm; sourceTree = ""; }; + 3DA1A3572ABABF69004F0BB9 /* MTRAsyncWorkQueueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRAsyncWorkQueueTests.m; sourceTree = ""; }; 3DECCB6D29347D2C00585AEC /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; }; 3DECCB6F2934AC1C00585AEC /* MTRLogging.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRLogging.h; sourceTree = ""; }; 3DECCB712934AFE200585AEC /* MTRLogging.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRLogging.mm; sourceTree = ""; }; @@ -507,8 +505,6 @@ 513DDB892761F6F900DAA01A /* MTRAttributeTLVValueDecoder.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRAttributeTLVValueDecoder.mm; sourceTree = ""; }; 5142E39729D377F000A206F0 /* MTROTAProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTROTAProviderTests.m; sourceTree = ""; }; 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "generic-callback-stubs.cpp"; path = "util/generic-callback-stubs.cpp"; sourceTree = ""; }; - 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRIMDispatch.mm; sourceTree = ""; }; - 51431AFA27D29CA4008A7943 /* ota-provider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = "ota-provider.cpp"; path = "clusters/ota-provider/ota-provider.cpp"; sourceTree = ""; }; 5143851C2A65885400EDC8E6 /* MatterTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MatterTests-Bridging-Header.h"; sourceTree = ""; }; 5143851D2A65885500EDC8E6 /* MTRSwiftPairingTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTRSwiftPairingTests.swift; sourceTree = ""; }; 514654482A72F9DF00904E61 /* MTRDemuxingStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRDemuxingStorage.mm; sourceTree = ""; }; @@ -544,8 +540,6 @@ 51C984602A61CE2A00B0AD9A /* MTRFabricInfoChecker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRFabricInfoChecker.m; sourceTree = ""; }; 51C984612A61CE2A00B0AD9A /* MTRFabricInfoChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRFabricInfoChecker.h; sourceTree = ""; }; 51D10D2D2808E2CA00E8CA3D /* MTRTestStorage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRTestStorage.m; sourceTree = ""; }; - 51E030FE27EA20D20083DC9C /* MTRControllerAccessControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRControllerAccessControl.h; sourceTree = ""; }; - 51E030FF27EA20D20083DC9C /* MTRControllerAccessControl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRControllerAccessControl.mm; sourceTree = ""; }; 51E24E72274E0DAC007CCF6E /* MTRErrorTestUtils.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRErrorTestUtils.mm; sourceTree = ""; }; 51E4D120291D0EB400C8C535 /* MTRBaseClusterUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRBaseClusterUtils.h; sourceTree = ""; }; 51E51FBC282AD37A00FC978D /* MTRDeviceControllerStartupParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRDeviceControllerStartupParams.h; sourceTree = ""; }; @@ -581,7 +575,6 @@ 7596A84628762783004DAE0E /* MTRAsyncCallbackWorkQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRAsyncCallbackWorkQueue.h; sourceTree = ""; }; 7596A84728762783004DAE0E /* MTRAsyncCallbackWorkQueue.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRAsyncCallbackWorkQueue.mm; sourceTree = ""; }; 7596A84A287636C1004DAE0E /* MTRDevice_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRDevice_Internal.h; sourceTree = ""; }; - 7596A84C287782E8004DAE0E /* MTRAsyncCallbackWorkQueue_Internal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MTRAsyncCallbackWorkQueue_Internal.h; sourceTree = ""; }; 7596A84E2877E6A9004DAE0E /* MTRCluster_Internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRCluster_Internal.h; sourceTree = ""; }; 7596A8502878709F004DAE0E /* MTRAsyncCallbackQueueTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MTRAsyncCallbackQueueTests.m; sourceTree = ""; }; 7596A85228788557004DAE0E /* MTRClusters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRClusters.mm; sourceTree = ""; }; @@ -965,8 +958,6 @@ isa = PBXGroup; children = ( 5143041F2914CED9004DC7FE /* generic-callback-stubs.cpp */, - 51431AFA27D29CA4008A7943 /* ota-provider.cpp */, - 3D84374A29498BAE0070D20A /* privilege-storage.cpp */, ); name = app; path = ../../../app; @@ -1107,8 +1098,10 @@ B20252912459E34F00F97062 /* Info.plist */, B2E0D7A8245B0B5C003C5B48 /* Matter.h */, 7596A84628762783004DAE0E /* MTRAsyncCallbackWorkQueue.h */, - 7596A84C287782E8004DAE0E /* MTRAsyncCallbackWorkQueue_Internal.h */, 7596A84728762783004DAE0E /* MTRAsyncCallbackWorkQueue.mm */, + 3DA1A3522ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.h */, + 3DA1A3512ABAB3B4004F0BB9 /* MTRAsyncWorkQueue_Internal.h */, + 3DA1A3532ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.mm */, 3CF134AA289D8DF70017A19E /* MTRDeviceAttestationInfo.h */, 3CF134AC289D8E570017A19E /* MTRDeviceAttestationInfo.mm */, 27A53C1527FBC6920053F131 /* MTRAttestationTrustStoreBridge.h */, @@ -1137,8 +1130,6 @@ 5A60370727EA1FF60020DB79 /* MTRClusterStateCacheContainer+XPC.h */, 99D466E02798936D0089A18F /* MTRCommissioningParameters.h */, 99AECC7F2798A57E00B6355B /* MTRCommissioningParameters.mm */, - 51E030FE27EA20D20083DC9C /* MTRControllerAccessControl.h */, - 51E030FF27EA20D20083DC9C /* MTRControllerAccessControl.mm */, 3DFCB32B29678C9500332B35 /* MTRConversion.h */, 51565CAD2A79D42100469F18 /* MTRConversion.mm */, 3CF134A6289D8AD90017A19E /* MTRCSRInfo.h */, @@ -1186,7 +1177,6 @@ 754F3DF327FBB94B00E60580 /* MTREventTLVValueDecoder_Internal.h */, 515C1C6E284F9FFB00A48F0C /* MTRFramework.h */, 515C1C6D284F9FFB00A48F0C /* MTRFramework.mm */, - 51431AF827D2973E008A7943 /* MTRIMDispatch.mm */, 998F286C26D55E10001846C6 /* MTRKeypair.h */, 3DECCB6F2934AC1C00585AEC /* MTRLogging.h */, 991DC08A247704DC00C13860 /* MTRLogging_Internal.h */, @@ -1247,6 +1237,7 @@ 997DED1926955D0200975E97 /* MTRThreadOperationalDatasetTests.mm */, 517BF3F2282B62CB00A8B7DB /* MTRCertificateTests.m */, 7596A8502878709F004DAE0E /* MTRAsyncCallbackQueueTests.m */, + 3DA1A3572ABABF69004F0BB9 /* MTRAsyncWorkQueueTests.m */, 51669AEF2913204400F4AA36 /* MTRBackwardsCompatTests.m */, 510CECA6297F72470064E0B3 /* MTROperationalCertificateIssuerTests.m */, 5173A47829C0E82300F67F48 /* MTRFabricInfoTests.m */, @@ -1415,6 +1406,7 @@ 515C1C70284F9FFB00A48F0C /* MTRFramework.h in Headers */, 7534F12928BFF20300390851 /* MTRDeviceAttestationDelegate_Internal.h in Headers */, D4772A46285AE98400383630 /* MTRClusterConstants.h in Headers */, + 3DA1A3552ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.h in Headers */, B289D4212639C0D300D4E314 /* MTROnboardingPayloadParser.h in Headers */, 513DDB862761F69300DAA01A /* MTRAttributeTLVValueDecoder_Internal.h in Headers */, 2CB7163F252F731E0026E2BB /* MTRDeviceControllerDelegate.h in Headers */, @@ -1433,7 +1425,6 @@ 7596A84428762729004DAE0E /* MTRDevice.h in Headers */, B2E0D7B8245B0B5C003C5B48 /* MTRSetupPayload.h in Headers */, 1E4D654F29C208DD00BC3478 /* MTRCommissionableBrowser.h in Headers */, - 7596A84D287782EF004DAE0E /* MTRAsyncCallbackWorkQueue_Internal.h in Headers */, 3D843756294AD25A0070D20A /* MTRCertificateInfo.h in Headers */, 7596A83E28751220004DAE0E /* MTRBaseClusters_Internal.h in Headers */, 997DED182695344800975E97 /* MTRThreadOperationalDataset.h in Headers */, @@ -1465,10 +1456,10 @@ 998F286F26D55EC5001846C6 /* MTRP256KeypairBridge.h in Headers */, 2C222ADF255C811800E446B9 /* MTRBaseDevice_Internal.h in Headers */, 511913FC28C100EF009235E9 /* MTRBaseSubscriptionCallback.h in Headers */, - 51E0310027EA20D20083DC9C /* MTRControllerAccessControl.h in Headers */, 51565CB12A7AD77600469F18 /* MTRDeviceControllerDataStore.h in Headers */, 3D843713294977000070D20A /* NSDataSpanConversion.h in Headers */, 991DC08B247704DC00C13860 /* MTRLogging_Internal.h in Headers */, + 3DA1A3542ABAB3B4004F0BB9 /* MTRAsyncWorkQueue_Internal.h in Headers */, 1E4D655029C208DD00BC3478 /* MTRCommissionableBrowserDelegate.h in Headers */, 7596A84828762783004DAE0E /* MTRAsyncCallbackWorkQueue.h in Headers */, 5A7947E527C0129F00434CF2 /* MTRDeviceController+XPC.h in Headers */, @@ -1647,8 +1638,6 @@ B45373EF2A9FEBFE00807602 /* ops-raw-skt.c in Sources */, 037C3DD52991C2E200B7EEE2 /* CHIPCommandBridge.mm in Sources */, 039546BC2991E1CB006D42A8 /* LogCommands.cpp in Sources */, - 039547042992D9BF006D42A8 /* ota-provider.cpp in Sources */, - 039547022992D952006D42A8 /* privilege-storage.cpp in Sources */, B45373E12A9FEB7F00807602 /* ops-h1.c in Sources */, B45373EB2A9FEBDB00807602 /* ops-listen.c in Sources */, 0382FA2C2992F06C00247BBB /* Commands.cpp in Sources */, @@ -1660,7 +1649,6 @@ B45373E62A9FEBA400807602 /* header.c in Sources */, B45374002A9FEC4F00807602 /* unix-init.c in Sources */, B45373DF2A9FEB6F00807602 /* system.c in Sources */, - 039547032992D991006D42A8 /* MTRIMDispatch.mm in Sources */, 039546BD2991E1CB006D42A8 /* SystemCommands.cpp in Sources */, B45373FC2A9FEC4F00807602 /* unix-caps.c in Sources */, B4E262162AA0CF1C00DBA5BC /* RemoteDataModelLogger.mm in Sources */, @@ -1722,7 +1710,6 @@ 51B22C2A2740CB47008D5055 /* MTRCommandPayloadsObjc.mm in Sources */, 75B765C32A1D82D30014719B /* MTRAttributeSpecifiedCheck.mm in Sources */, AF5F90FF2878D351005503FA /* MTROTAProviderDelegateBridge.mm in Sources */, - 3D84374B29498BAE0070D20A /* privilege-storage.cpp in Sources */, 51E95DFC2A78443C00A434F0 /* MTRSessionResumptionStorageBridge.mm in Sources */, 7534F12828BFF20300390851 /* MTRDeviceAttestationDelegate.mm in Sources */, 2C5EEEF7268A85C400CAE3D3 /* MTRDeviceConnectionBridge.mm in Sources */, @@ -1736,7 +1723,6 @@ 1EDCE546289049A100E41EC9 /* MTROTAHeader.mm in Sources */, 1EC4CE5D25CC26E900D7304F /* MTRBaseClusters.mm in Sources */, 51565CB22A7AD77600469F18 /* MTRDeviceControllerDataStore.mm in Sources */, - 51E0310127EA20D20083DC9C /* MTRControllerAccessControl.mm in Sources */, 1ED276E226C5812A00547A89 /* MTRCluster.mm in Sources */, B2E0D7B3245B0B5C003C5B48 /* MTRError.mm in Sources */, 51E51FC1282AD37A00FC978D /* MTRDeviceControllerStartupParams.mm in Sources */, @@ -1764,9 +1750,8 @@ 88EBF8CF27FABDD500686BC1 /* MTRDeviceAttestationDelegateBridge.mm in Sources */, 5A6FEC9827B5C6AF00F25F42 /* MTRDeviceOverXPC.mm in Sources */, 514654492A72F9DF00904E61 /* MTRDemuxingStorage.mm in Sources */, - 51431AF927D2973E008A7943 /* MTRIMDispatch.mm in Sources */, 1E4D655229C30A8700BC3478 /* MTRCommissionableBrowser.mm in Sources */, - 51431AFB27D29CA4008A7943 /* ota-provider.cpp in Sources */, + 3DA1A3562ABAB3B4004F0BB9 /* MTRAsyncWorkQueue.mm in Sources */, 3DECCB722934AFE200585AEC /* MTRLogging.mm in Sources */, 7596A84528762729004DAE0E /* MTRDevice.mm in Sources */, ); @@ -1793,6 +1778,7 @@ 5173A47929C0E82300F67F48 /* MTRFabricInfoTests.m in Sources */, 5143851E2A65885500EDC8E6 /* MTRSwiftPairingTests.swift in Sources */, 3D0C484B29DA4FA0006D811F /* MTRErrorTests.m in Sources */, + 3DA1A3582ABABF6A004F0BB9 /* MTRAsyncWorkQueueTests.m in Sources */, 51742B4A29CB5FC1009974FE /* MTRTestResetCommissioneeHelper.m in Sources */, 5AE6D4E427A99041001F2493 /* MTRDeviceTests.m in Sources */, 510CECA8297F72970064E0B3 /* MTROperationalCertificateIssuerTests.m in Sources */, @@ -1839,9 +1825,9 @@ CHIP_HAVE_CONFIG_H, "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", CONFIG_BUILD_FOR_HOST_UNIT_TEST, - CONFIG_USE_LOCAL_STORAGE, "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", "CONFIG_USE_INTERACTIVE_MODE=1", + "CHIP_DISABLE_PLATFORM_KVS=1", ); "HEADER_SEARCH_PATHS[arch=*]" = ( "$(CHIP_ROOT)/examples/darwin-framework-tool", @@ -1909,9 +1895,9 @@ CHIP_HAVE_CONFIG_H, "CHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=", CONFIG_BUILD_FOR_HOST_UNIT_TEST, - CONFIG_USE_LOCAL_STORAGE, "CHIP_CONFIG_SKIP_APP_SPECIFIC_GENERATED_HEADER_INCLUDES=1", "CONFIG_USE_INTERACTIVE_MODE=1", + "CHIP_DISABLE_PLATFORM_KVS=1", ); "HEADER_SEARCH_PATHS[arch=*]" = ( "$(CHIP_ROOT)/examples//darwin-framework-tool", @@ -1999,7 +1985,6 @@ CURRENT_PROJECT_VERSION = 1; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -2022,7 +2007,7 @@ OTHER_LDFLAGS = "-Wl,-unexported_symbol,\"__Z*\""; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "macosx iphonesimulator iphoneos appletvos appletvsimulator watchos watchsimulator"; - SUPPORTS_TEXT_BASED_API = YES; + SUPPORTS_TEXT_BASED_API = NO; TARGETED_DEVICE_FAMILY = "1,2,3,4"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh index 120496c146e2c0..54e3594dfda2a2 100755 --- a/src/darwin/Framework/chip_xcode_build_connector.sh +++ b/src/darwin/Framework/chip_xcode_build_connector.sh @@ -93,6 +93,7 @@ done declare -a args=( 'default_configs_cosmetic=[]' # suppress colorization 'chip_crypto="boringssl"' + 'chip_build_controller_dynamic_server=true' 'chip_build_tools=false' 'chip_build_tests=false' 'chip_enable_wifi=false' diff --git a/src/include/platform/CommissionableDataProvider.h b/src/include/platform/CommissionableDataProvider.h index 6a51023f1aef03..95fa3faf5d99d4 100644 --- a/src/include/platform/CommissionableDataProvider.h +++ b/src/include/platform/CommissionableDataProvider.h @@ -22,10 +22,10 @@ namespace chip { // The largest value of the 12-bit Payload discriminator -constexpr uint16_t kMaxDiscriminatorValue = 0xFFF; +inline constexpr uint16_t kMaxDiscriminatorValue = 0xFFF; -constexpr uint32_t kMinSetupPasscode = 1; -constexpr uint32_t kMaxSetupPasscode = 0x5F5E0FE; +inline constexpr uint32_t kMinSetupPasscode = 1; +inline constexpr uint32_t kMaxSetupPasscode = 0x5F5E0FE; namespace DeviceLayer { diff --git a/src/include/platform/DiagnosticDataProvider.h b/src/include/platform/DiagnosticDataProvider.h index 04820d3488debb..12eacf0a6d2b60 100644 --- a/src/include/platform/DiagnosticDataProvider.h +++ b/src/include/platform/DiagnosticDataProvider.h @@ -36,12 +36,12 @@ namespace DeviceLayer { static constexpr size_t kMaxThreadNameLength = 8; // 48-bit IEEE MAC Address or a 64-bit IEEE MAC Address (e.g. EUI-64). -constexpr size_t kMaxHardwareAddrSize = 8; +inline constexpr size_t kMaxHardwareAddrSize = 8; -constexpr size_t kMaxIPv4AddrSize = 4; -constexpr size_t kMaxIPv6AddrSize = 16; -constexpr size_t kMaxIPv4AddrCount = 4; -constexpr size_t kMaxIPv6AddrCount = 8; +inline constexpr size_t kMaxIPv4AddrSize = 4; +inline constexpr size_t kMaxIPv6AddrSize = 16; +inline constexpr size_t kMaxIPv4AddrCount = 4; +inline constexpr size_t kMaxIPv6AddrCount = 8; using BootReasonType = app::Clusters::GeneralDiagnostics::BootReasonEnum; diff --git a/src/include/platform/NetworkCommissioning.h b/src/include/platform/NetworkCommissioning.h index 7a9cbc3c6db8c0..8ae56f3cd80d0b 100644 --- a/src/include/platform/NetworkCommissioning.h +++ b/src/include/platform/NetworkCommissioning.h @@ -47,7 +47,7 @@ namespace DeviceLayer { */ namespace NetworkCommissioning { -constexpr size_t kMaxNetworkIDLen = 32; +inline constexpr size_t kMaxNetworkIDLen = 32; // TODO: This is exactly the same as the one in GroupDataProvider, this could be moved to src/lib/support template diff --git a/src/include/platform/PersistedStorage.h b/src/include/platform/PersistedStorage.h index 91a8eae88981e8..f6bebd2e32050c 100644 --- a/src/include/platform/PersistedStorage.h +++ b/src/include/platform/PersistedStorage.h @@ -57,7 +57,7 @@ struct EmptyKey } // namespace internal -constexpr Key kEmptyKey = internal::EmptyKey::value; +inline constexpr Key kEmptyKey = internal::EmptyKey::value; /** * @brief diff --git a/src/include/platform/internal/DeviceNetworkInfo.h b/src/include/platform/internal/DeviceNetworkInfo.h index 7e218914066e76..62c8d72a75858d 100644 --- a/src/include/platform/internal/DeviceNetworkInfo.h +++ b/src/include/platform/internal/DeviceNetworkInfo.h @@ -30,9 +30,9 @@ namespace Internal { * Constants for common network metadata entries */ // ---- WiFi-specific Limits ---- -constexpr size_t kMaxWiFiSSIDLength = 32; -constexpr size_t kMaxWiFiKeyLength = 64; -constexpr size_t kWiFiBSSIDLength = 6; +inline constexpr size_t kMaxWiFiSSIDLength = 32; +inline constexpr size_t kMaxWiFiKeyLength = 64; +inline constexpr size_t kWiFiBSSIDLength = 6; /** * Ids for well-known network provision types. diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp index bbfd5dcaf25348..c0c511e473ee03 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.cpp @@ -400,10 +400,7 @@ void Resolver::ReArmTimer() if (nextTimeout == kInvalidTimeout) { -#if CHIP_MINMDNS_HIGH_VERBOSITY // Generally this is only expected when no active lookups exist - ChipLogProgress(Discovery, "Discovery does not require any more timeouts"); -#endif return; } diff --git a/src/lib/address_resolve/AddressResolve_DefaultImpl.h b/src/lib/address_resolve/AddressResolve_DefaultImpl.h index ac6d7dd8d1f4d0..5445b6d1b89995 100644 --- a/src/lib/address_resolve/AddressResolve_DefaultImpl.h +++ b/src/lib/address_resolve/AddressResolve_DefaultImpl.h @@ -26,7 +26,7 @@ namespace chip { namespace AddressResolve { namespace Impl { -constexpr uint8_t kNodeLookupResultsLen = CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS; +inline constexpr uint8_t kNodeLookupResultsLen = CHIP_CONFIG_MDNS_RESOLVE_LOOKUP_RESULTS; enum class NodeLookupResult { diff --git a/src/lib/core/BUILD.gn b/src/lib/core/BUILD.gn index 60f56af7e5850b..1f7f2769f3c5cd 100644 --- a/src/lib/core/BUILD.gn +++ b/src/lib/core/BUILD.gn @@ -64,6 +64,8 @@ buildconfig_header("chip_buildconfig") { "CHIP_CONFIG_TRANSPORT_PW_TRACE_ENABLED=${chip_enable_transport_pw_trace}", "CHIP_CONFIG_MINMDNS_DYNAMIC_OPERATIONAL_RESPONDER_LIST=${chip_config_minmdns_dynamic_operational_responder_list}", "CHIP_CONFIG_MINMDNS_MAX_PARALLEL_RESOLVES=${chip_config_minmdns_max_parallel_resolves}", + "CHIP_CONFIG_CANCELABLE_HAS_INFO_STRING_FIELD=${chip_config_cancelable_has_info_string_field}", + "CHIP_CONFIG_BIG_ENDIAN_TARGET=${chip_target_is_big_endian}", ] } diff --git a/src/lib/core/CHIPCallback.h b/src/lib/core/CHIPCallback.h index dd010eaa04abc3..9b73078886a492 100644 --- a/src/lib/core/CHIPCallback.h +++ b/src/lib/core/CHIPCallback.h @@ -26,6 +26,8 @@ #include #include +#include + namespace chip { namespace Callback { @@ -49,7 +51,13 @@ class Cancelable */ Cancelable * mNext; Cancelable * mPrev; + + // CHIP_CONFIG_CANCELABLE_HAS_INFO_STRING_FIELD allows consumers that were + // using this field to opt into having it (and the resulting memory bloat) + // while allowing everyone else to save the memory. +#if CHIP_CONFIG_CANCELABLE_HAS_INFO_STRING_FIELD alignas(uint64_t) char mInfo[24]; +#endif // CHIP_CONFIG_CANCELABLE_HAS_INFO_STRING_FIELD /** * @brief when non-null, indicates the Callback is registered with diff --git a/src/lib/core/CHIPConfig.h b/src/lib/core/CHIPConfig.h index 59a6e8252356bf..da5e3c9aebca97 100644 --- a/src/lib/core/CHIPConfig.h +++ b/src/lib/core/CHIPConfig.h @@ -163,6 +163,30 @@ #define CHIP_CONFIG_MEMORY_DEBUG_DMALLOC 0 #endif // CHIP_CONFIG_MEMORY_DEBUG_DMALLOC +/** + * @def CHIP_CONFIG_GLOBALS_LAZY_INIT + * + * @brief + * Whether to perform chip::Global initialization lazily (1) or eagerly (0). + * + * The default is standard (eager) C++ global initialization behavior. + */ +#ifndef CHIP_CONFIG_GLOBALS_LAZY_INIT +#define CHIP_CONFIG_GLOBALS_LAZY_INIT 0 +#endif // CHIP_CONFIG_GLOBALS_LAZY_INIT + +/** + * @def CHIP_CONFIG_GLOBALS_NO_DESTRUCT + * + * @brief + * Whether to omit calling destructors for chip::Global objects. + * + * The default is to call destructors. + */ +#ifndef CHIP_CONFIG_GLOBALS_NO_DESTRUCT +#define CHIP_CONFIG_GLOBALS_NO_DESTRUCT 0 +#endif // CHIP_CONFIG_GLOBALS_NO_DESTRUCT + /** * @def CHIP_CONFIG_SHA256_CONTEXT_SIZE * diff --git a/src/lib/core/DataModelTypes.h b/src/lib/core/DataModelTypes.h index 5ae16fa51f6544..dfbc5ef16ad400 100644 --- a/src/lib/core/DataModelTypes.h +++ b/src/lib/core/DataModelTypes.h @@ -49,21 +49,21 @@ typedef uint8_t InteractionModelRevision; typedef uint32_t SubscriptionId; typedef uint8_t SceneId; -constexpr CompressedFabricId kUndefinedCompressedFabricId = 0ULL; -constexpr FabricId kUndefinedFabricId = 0ULL; +inline constexpr CompressedFabricId kUndefinedCompressedFabricId = 0ULL; +inline constexpr FabricId kUndefinedFabricId = 0ULL; -constexpr FabricIndex kUndefinedFabricIndex = 0; -constexpr FabricIndex kMinValidFabricIndex = 1; -constexpr FabricIndex kMaxValidFabricIndex = UINT8_MAX - 1; +inline constexpr FabricIndex kUndefinedFabricIndex = 0; +inline constexpr FabricIndex kMinValidFabricIndex = 1; +inline constexpr FabricIndex kMaxValidFabricIndex = UINT8_MAX - 1; -constexpr EndpointId kInvalidEndpointId = 0xFFFF; -constexpr EndpointId kRootEndpointId = 0; -constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. -constexpr KeysetId kInvalidKeysetId = 0xFFFF; +inline constexpr EndpointId kInvalidEndpointId = 0xFFFF; +inline constexpr EndpointId kRootEndpointId = 0; +inline constexpr ListIndex kInvalidListIndex = 0xFFFF; // List index is a uint16 thus 0xFFFF is a invalid list index. +inline constexpr KeysetId kInvalidKeysetId = 0xFFFF; // Invalid IC identifier is provisional. Value will most likely change when identifying token is defined // https://github.com/project-chip/connectedhomeip/issues/24251 -constexpr uint64_t kInvalidIcId = 0; +inline constexpr uint64_t kInvalidIcId = 0; // These are MEIs, 0xFFFF is not a valid manufacturer code, // thus 0xFFFF'FFFF is not a valid MEI. diff --git a/src/lib/core/Global.h b/src/lib/core/Global.h new file mode 100644 index 00000000000000..26de6b58381ccd --- /dev/null +++ b/src/lib/core/Global.h @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include + +#include + +namespace chip { + +/** + * A wrapper for global object that enables initialization and destruction to + * be configured by the platform via `CHIP_CONFIG_GLOBALS_*` options. + * + * The contained object of type T is default constructed, possibly lazily. + * + * This class is generally NOT thread-safe; external synchronization is required. + */ +template +class Global +{ +public: + /// Returns the global object, initializing it if necessary. + /// NOT thread-safe, external synchronization is required. + T & get() { return _get(); } + T * operator->() { return &_get(); } + +#if CHIP_CONFIG_GLOBALS_LAZY_INIT +public: + constexpr Global() = default; + ~Global() = default; + +private: + // Zero-initialize everything. We should technically leave mStorage uninitialized, + // but that can sometimes cause clang to be unable to constant-initialize the object. + alignas(T) unsigned char mStorage[sizeof(T)] = {}; + bool mInitialized = false; + + T & _value() { return *reinterpret_cast(mStorage); } + + T & _get() + { + if (!mInitialized) + { + new (mStorage) T(); + mInitialized = true; +#if !CHIP_CONFIG_GLOBALS_NO_DESTRUCT + CHIP_CXA_ATEXIT(&destroy, this); +#endif // CHIP_CONFIG_GLOBALS_NO_DESTRUCT + } + return _value(); + } + + static void destroy(void * context) { static_cast *>(context)->_value().~T(); } + +#else // CHIP_CONFIG_GLOBALS_LAZY_INIT +public: + constexpr Global() : mValue() {} + +private: + T & _get() { return mValue; } + +#if CHIP_CONFIG_GLOBALS_NO_DESTRUCT +public: + // For not-trivially-destructible T, hiding it inside a union means the destructor + // won't get called automatically, however our own default destructor will be implicitly + // deleted. So Global is technically not trivially-destructible, however the compiler + // tends to be able to optimize away the empty destructor call in practice. Getting around + // this cleanly requires using the "storage" approach used in the lazy variant, however + // this would require std::construct_at from C++20 to get constexpr initialization. + ~Global() {} // not "= default" + +private: + union + { + T mValue; + }; +#else // CHIP_CONFIG_GLOBALS_NO_DESTRUCT +public: + ~Global() = default; + +private: + T mValue; +#endif // CHIP_CONFIG_GLOBALS_NO_DESTRUCT +#endif // CHIP_CONFIG_GLOBALS_LAZY_INIT +}; + +} // namespace chip diff --git a/src/lib/core/GroupId.h b/src/lib/core/GroupId.h index c1168b1cd71f3a..598a02d6a512a8 100644 --- a/src/lib/core/GroupId.h +++ b/src/lib/core/GroupId.h @@ -23,20 +23,20 @@ namespace chip { using GroupId = uint16_t; -constexpr GroupId kUndefinedGroupId = 0; +inline constexpr GroupId kUndefinedGroupId = 0; -constexpr GroupId kMinUniversalGroupId = 0xFF00; -constexpr GroupId kMaxUniversalGroupId = 0xFFFF; +inline constexpr GroupId kMinUniversalGroupId = 0xFF00; +inline constexpr GroupId kMaxUniversalGroupId = 0xFFFF; -constexpr GroupId kMinApplicationGroupId = 0x0001; -constexpr GroupId kMaxApplicationGroupId = 0xFEFF; +inline constexpr GroupId kMinApplicationGroupId = 0x0001; +inline constexpr GroupId kMaxApplicationGroupId = 0xFEFF; -constexpr GroupId kAllNodes = 0xFFFF; -constexpr GroupId kAllNonSleepy = 0xFFFE; -constexpr GroupId kAllProxies = 0xFFFD; +inline constexpr GroupId kAllNodes = 0xFFFF; +inline constexpr GroupId kAllNonSleepy = 0xFFFE; +inline constexpr GroupId kAllProxies = 0xFFFD; -constexpr GroupId kMinUniversalGroupIdReserved = 0xFF00; -constexpr GroupId kMaxUniversalGroupIdReserved = 0xFFFC; +inline constexpr GroupId kMinUniversalGroupIdReserved = 0xFF00; +inline constexpr GroupId kMaxUniversalGroupIdReserved = 0xFFFC; constexpr bool IsOperationalGroupId(GroupId aGroupId) { diff --git a/src/lib/core/InPlace.h b/src/lib/core/InPlace.h index 6ac2cb0c9b2c62..14ce5773101412 100644 --- a/src/lib/core/InPlace.h +++ b/src/lib/core/InPlace.h @@ -31,7 +31,7 @@ struct InPlaceType { explicit InPlaceType() = default; }; -constexpr InPlaceType InPlace{}; +inline constexpr InPlaceType InPlace{}; template struct InPlaceTemplateType @@ -39,6 +39,6 @@ struct InPlaceTemplateType explicit InPlaceTemplateType() = default; }; template -constexpr InPlaceTemplateType InPlaceTemplate{}; +inline constexpr InPlaceTemplateType InPlaceTemplate{}; } // namespace chip diff --git a/src/lib/core/NodeId.h b/src/lib/core/NodeId.h index a16868ccb900ba..7b518f09f0cc28 100644 --- a/src/lib/core/NodeId.h +++ b/src/lib/core/NodeId.h @@ -28,35 +28,35 @@ namespace chip { // methods. using NodeId = uint64_t; -constexpr NodeId kUndefinedNodeId = 0ULL; +inline constexpr NodeId kUndefinedNodeId = 0ULL; // The range of possible NodeId values has some pieces carved out for special // uses. -constexpr NodeId kMinGroupNodeId = 0xFFFF'FFFF'FFFF'0000ULL; +inline constexpr NodeId kMinGroupNodeId = 0xFFFF'FFFF'FFFF'0000ULL; // The max group id is complicated, depending on how we want to count the // various special group ids. Let's not define it for now, until we have use // cases. -constexpr NodeId kMaskGroupId = 0x0000'0000'0000'FFFFULL; +inline constexpr NodeId kMaskGroupId = 0x0000'0000'0000'FFFFULL; -constexpr NodeId kMinTemporaryLocalId = 0xFFFF'FFFE'0000'0000ULL; +inline constexpr NodeId kMinTemporaryLocalId = 0xFFFF'FFFE'0000'0000ULL; // We use the largest available temporary local id to represent // kPlaceholderNodeId, so the range is narrowed compared to the spec. -constexpr NodeId kMaxTemporaryLocalId = 0xFFFF'FFFE'FFFF'FFFEULL; -constexpr NodeId kPlaceholderNodeId = 0xFFFF'FFFE'FFFF'FFFFULL; +inline constexpr NodeId kMaxTemporaryLocalId = 0xFFFF'FFFE'FFFF'FFFEULL; +inline constexpr NodeId kPlaceholderNodeId = 0xFFFF'FFFE'FFFF'FFFFULL; -constexpr NodeId kMinCASEAuthTag = 0xFFFF'FFFD'0000'0000ULL; -constexpr NodeId kMaxCASEAuthTag = 0xFFFF'FFFD'FFFF'FFFFULL; -constexpr NodeId kMaskCASEAuthTag = 0x0000'0000'FFFF'FFFFULL; +inline constexpr NodeId kMinCASEAuthTag = 0xFFFF'FFFD'0000'0000ULL; +inline constexpr NodeId kMaxCASEAuthTag = 0xFFFF'FFFD'FFFF'FFFFULL; +inline constexpr NodeId kMaskCASEAuthTag = 0x0000'0000'FFFF'FFFFULL; -constexpr NodeId kMinPAKEKeyId = 0xFFFF'FFFB'0000'0000ULL; -constexpr NodeId kMaxPAKEKeyId = 0xFFFF'FFFB'FFFF'FFFFULL; -constexpr NodeId kMaskPAKEKeyId = 0x0000'0000'0000'FFFFULL; -constexpr NodeId kMaskUnusedPAKEKeyId = 0x0000'0000'FFFF'0000ULL; +inline constexpr NodeId kMinPAKEKeyId = 0xFFFF'FFFB'0000'0000ULL; +inline constexpr NodeId kMaxPAKEKeyId = 0xFFFF'FFFB'FFFF'FFFFULL; +inline constexpr NodeId kMaskPAKEKeyId = 0x0000'0000'0000'FFFFULL; +inline constexpr NodeId kMaskUnusedPAKEKeyId = 0x0000'0000'FFFF'0000ULL; // There are more reserved ranges here, not assigned to anything yet, going down // all the way to 0xFFFF'FFF0'0000'0000ULL -constexpr NodeId kMaxOperationalNodeId = 0xFFFF'FFEF'FFFF'FFFFULL; +inline constexpr NodeId kMaxOperationalNodeId = 0xFFFF'FFEF'FFFF'FFFFULL; constexpr bool IsOperationalNodeId(NodeId aNodeId) { diff --git a/src/lib/core/OTAImageHeader.h b/src/lib/core/OTAImageHeader.h index 4d3eea420432c6..f9fa8868530fd8 100644 --- a/src/lib/core/OTAImageHeader.h +++ b/src/lib/core/OTAImageHeader.h @@ -26,7 +26,7 @@ namespace chip { /// File signature (aka magic number) of a valid Matter OTA image -constexpr uint32_t kOTAImageFileIdentifier = 0x1BEEF11E; +inline constexpr uint32_t kOTAImageFileIdentifier = 0x1BEEF11E; enum class OTAImageDigestType : uint8_t { diff --git a/src/lib/core/Optional.h b/src/lib/core/Optional.h index 4edae30093c038..3b673e36fa7071 100644 --- a/src/lib/core/Optional.h +++ b/src/lib/core/Optional.h @@ -35,7 +35,7 @@ struct NullOptionalType { explicit NullOptionalType() = default; }; -constexpr NullOptionalType NullOptional{}; +inline constexpr NullOptionalType NullOptional{}; /** * Pairs an object with a boolean value to determine if the object value diff --git a/src/lib/core/PasscodeId.h b/src/lib/core/PasscodeId.h index f49aa19ea26b0e..e1322978f249e0 100644 --- a/src/lib/core/PasscodeId.h +++ b/src/lib/core/PasscodeId.h @@ -25,6 +25,6 @@ namespace chip { // methods. using PasscodeId = uint16_t; -constexpr PasscodeId kDefaultCommissioningPasscodeId = 0; +inline constexpr PasscodeId kDefaultCommissioningPasscodeId = 0; } // namespace chip diff --git a/src/lib/core/core.gni b/src/lib/core/core.gni index 46c7b3ce72ad7b..839f9b6507b734 100644 --- a/src/lib/core/core.gni +++ b/src/lib/core/core.gni @@ -84,6 +84,13 @@ declare_args() { # When using minmdns, set the number of parallel resolves chip_config_minmdns_max_parallel_resolves = 2 + + # If set to true, adds a string "info" field to Cancelable. + # Only here for backwards compat. Generally, THIS SHOULD NOT BE SET TO TRUE. + chip_config_cancelable_has_info_string_field = false + + # Whether the target architecture is big-endian (true) or little-endian (false). + chip_target_is_big_endian = false } if (chip_target_style == "") { diff --git a/src/lib/dnssd/Constants.h b/src/lib/dnssd/Constants.h index d1805058b1e8ba..f34bdfa3da52b8 100644 --- a/src/lib/dnssd/Constants.h +++ b/src/lib/dnssd/Constants.h @@ -29,18 +29,18 @@ namespace Dnssd { * Matter DNS host settings */ -constexpr size_t kHostNameMaxLength = 16; // MAC or 802.15.4 Extended Address in hex +inline constexpr size_t kHostNameMaxLength = 16; // MAC or 802.15.4 Extended Address in hex /* * Matter DNS service subtypes */ -constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S
-constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L -constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V -constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T -constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _CM -constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits> +inline constexpr size_t kSubTypeShortDiscriminatorMaxLength = 4; // _S
+inline constexpr size_t kSubTypeLongDiscriminatorMaxLength = 6; // _L +inline constexpr size_t kSubTypeVendorIdMaxLength = 7; // _V +inline constexpr size_t kSubTypeDeviceTypeMaxLength = 12; // _T +inline constexpr size_t kSubTypeCommissioningModeMaxLength = 3; // _CM +inline constexpr size_t kSubTypeCompressedFabricIdMaxLength = 18; // _I<16-hex-digits> /* * Matter operational node service settings @@ -50,10 +50,10 @@ namespace Operational { #define SUBTYPES (std::initializer_list{ kSubTypeCompressedFabricIdMaxLength }) -constexpr size_t kInstanceNameMaxLength = 33; // - in hex (16 + 1 + 16) -constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); -constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); -constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); +inline constexpr size_t kInstanceNameMaxLength = 33; // - in hex (16 + 1 + 16) +inline constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); +inline constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); +inline constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); #undef SUBTYPES @@ -69,10 +69,10 @@ namespace Commission { (std::initializer_list{ kSubTypeShortDiscriminatorMaxLength, kSubTypeLongDiscriminatorMaxLength, \ kSubTypeVendorIdMaxLength, kSubTypeDeviceTypeMaxLength, kSubTypeCommissioningModeMaxLength }) -constexpr size_t kInstanceNameMaxLength = 16; // 64-bit random number in hex -constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); -constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); -constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); +inline constexpr size_t kInstanceNameMaxLength = 16; // 64-bit random number in hex +inline constexpr size_t kSubTypeMaxNumber = SUBTYPES.size(); +inline constexpr size_t kSubTypeMaxLength = std::max(SUBTYPES); +inline constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); #undef SUBTYPES @@ -84,10 +84,10 @@ constexpr size_t kSubTypeTotalLength = chip::Sum(SUBTYPES); namespace Common { -constexpr size_t kInstanceNameMaxLength = std::max(Operational::kInstanceNameMaxLength, Commission::kInstanceNameMaxLength); -constexpr size_t kSubTypeMaxNumber = std::max(Operational::kSubTypeMaxNumber, Commission::kSubTypeMaxNumber); -constexpr size_t kSubTypeMaxLength = std::max(Operational::kSubTypeMaxLength, Commission::kSubTypeMaxLength); -constexpr size_t kSubTypeTotalLength = std::max(Operational::kSubTypeTotalLength, Commission::kSubTypeTotalLength); +inline constexpr size_t kInstanceNameMaxLength = std::max(Operational::kInstanceNameMaxLength, Commission::kInstanceNameMaxLength); +inline constexpr size_t kSubTypeMaxNumber = std::max(Operational::kSubTypeMaxNumber, Commission::kSubTypeMaxNumber); +inline constexpr size_t kSubTypeMaxLength = std::max(Operational::kSubTypeMaxLength, Commission::kSubTypeMaxLength); +inline constexpr size_t kSubTypeTotalLength = std::max(Operational::kSubTypeTotalLength, Commission::kSubTypeTotalLength); } // namespace Common diff --git a/src/lib/dnssd/Discovery_ImplPlatform.cpp b/src/lib/dnssd/Discovery_ImplPlatform.cpp index cf6c127599bf25..b3fc61914a5c4d 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.cpp +++ b/src/lib/dnssd/Discovery_ImplPlatform.cpp @@ -55,70 +55,6 @@ static void HandleNodeResolve(void * context, DnssdService * result, const Span< proxy->Release(); } -static void HandleNodeIdResolve(void * context, DnssdService * result, const Span & addresses, CHIP_ERROR error) -{ - ResolverDelegateProxy * proxy = static_cast(context); - if (CHIP_NO_ERROR != error) - { - proxy->OnOperationalNodeResolutionFailed(PeerId(), error); - proxy->Release(); - return; - } - - VerifyOrDie(proxy != nullptr); - - if (result == nullptr) - { - proxy->OnOperationalNodeResolutionFailed(PeerId(), CHIP_ERROR_UNKNOWN_RESOURCE_ID); - proxy->Release(); - return; - } - - VerifyOrDie(proxy != nullptr); - - PeerId peerId; - error = ExtractIdFromInstanceName(result->mName, &peerId); - if (CHIP_NO_ERROR != error) - { - proxy->OnOperationalNodeResolutionFailed(PeerId(), error); - proxy->Release(); - return; - } - - VerifyOrDie(proxy != nullptr); - - ResolvedNodeData nodeData; - Platform::CopyString(nodeData.resolutionData.hostName, result->mHostName); - nodeData.resolutionData.interfaceId = result->mInterface; - nodeData.resolutionData.port = result->mPort; - nodeData.operationalData.peerId = peerId; - - size_t addressesFound = 0; - for (auto & ip : addresses) - { - if (addressesFound == ArraySize(nodeData.resolutionData.ipAddress)) - { - // Out of space. - ChipLogProgress(Discovery, "Can't add more IPs to ResolvedNodeData"); - break; - } - nodeData.resolutionData.ipAddress[addressesFound] = ip; - ++addressesFound; - } - nodeData.resolutionData.numIPs = addressesFound; - - for (size_t i = 0; i < result->mTextEntrySize; ++i) - { - ByteSpan key(reinterpret_cast(result->mTextEntries[i].mKey), strlen(result->mTextEntries[i].mKey)); - ByteSpan val(result->mTextEntries[i].mData, result->mTextEntries[i].mDataSize); - FillNodeDataFromTxt(key, val, nodeData.resolutionData); - } - - nodeData.LogNodeIdResolved(); - proxy->OnOperationalNodeResolved(nodeData); - proxy->Release(); -} - static void HandleNodeBrowse(void * context, DnssdService * services, size_t servicesSize, bool finalBrowse, CHIP_ERROR error) { ResolverDelegateProxy * proxy = static_cast(context); @@ -336,6 +272,68 @@ CHIP_ERROR AddTxtRecord(TxtFieldKey key, TextEntry * entries, size_t & entriesCo } // namespace +void DiscoveryImplPlatform::HandleNodeIdResolve(void * context, DnssdService * result, const Span & addresses, + CHIP_ERROR error) +{ + DiscoveryImplPlatform * impl = static_cast(context); + + if (impl->mOperationalDelegate == nullptr) + { + ChipLogError(Discovery, "No delegate to handle node resolution data."); + return; + } + + if (CHIP_NO_ERROR != error) + { + impl->mOperationalDelegate->OnOperationalNodeResolutionFailed(PeerId(), error); + return; + } + + if (result == nullptr) + { + impl->mOperationalDelegate->OnOperationalNodeResolutionFailed(PeerId(), CHIP_ERROR_UNKNOWN_RESOURCE_ID); + return; + } + + PeerId peerId; + error = ExtractIdFromInstanceName(result->mName, &peerId); + if (CHIP_NO_ERROR != error) + { + impl->mOperationalDelegate->OnOperationalNodeResolutionFailed(PeerId(), error); + return; + } + + ResolvedNodeData nodeData; + Platform::CopyString(nodeData.resolutionData.hostName, result->mHostName); + nodeData.resolutionData.interfaceId = result->mInterface; + nodeData.resolutionData.port = result->mPort; + nodeData.operationalData.peerId = peerId; + + size_t addressesFound = 0; + for (auto & ip : addresses) + { + if (addressesFound == ArraySize(nodeData.resolutionData.ipAddress)) + { + // Out of space. + ChipLogProgress(Discovery, "Can't add more IPs to ResolvedNodeData"); + break; + } + nodeData.resolutionData.ipAddress[addressesFound] = ip; + ++addressesFound; + } + nodeData.resolutionData.numIPs = addressesFound; + + for (size_t i = 0; i < result->mTextEntrySize; ++i) + { + ByteSpan key(reinterpret_cast(result->mTextEntries[i].mKey), strlen(result->mTextEntries[i].mKey)); + ByteSpan val(result->mTextEntries[i].mData, result->mTextEntries[i].mDataSize); + FillNodeDataFromTxt(key, val, nodeData.resolutionData); + } + + nodeData.LogNodeIdResolved(); + impl->mOperationalDelegate->OnOperationalNodeResolved(nodeData); +} + void DnssdService::ToDiscoveredNodeData(const Span & addresses, DiscoveredNodeData & nodeData) { auto & resolutionData = nodeData.resolutionData; @@ -372,9 +370,7 @@ void DnssdService::ToDiscoveredNodeData(const Span & addresses, } } -DiscoveryImplPlatform DiscoveryImplPlatform::sManager; - -DiscoveryImplPlatform::DiscoveryImplPlatform() = default; +Global DiscoveryImplPlatform::sManager; CHIP_ERROR DiscoveryImplPlatform::InitImpl() { @@ -633,15 +629,27 @@ bool DiscoveryImplPlatform::IsInitialized() CHIP_ERROR DiscoveryImplPlatform::ResolveNodeId(const PeerId & peerId) { - ReturnErrorOnFailure(InitImpl()); - return mResolverProxy.ResolveNodeId(peerId); + // Resolve requests can only be issued once DNSSD is initialized and there is + // no caching currently + VerifyOrReturnError(mState == State::kInitialized, CHIP_ERROR_INCORRECT_STATE); + + ChipLogProgress(Discovery, "Resolving " ChipLogFormatX64 ":" ChipLogFormatX64 " ...", + ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId())); + + DnssdService service; + + ReturnErrorOnFailure(MakeInstanceName(service.mName, sizeof(service.mName), peerId)); + Platform::CopyString(service.mType, kOperationalServiceName); + service.mProtocol = DnssdServiceProtocol::kDnssdProtocolTcp; + service.mAddressType = Inet::IPAddressType::kAny; + + return ChipDnssdResolve(&service, Inet::InterfaceId::Null(), HandleNodeIdResolve, this); } void DiscoveryImplPlatform::NodeIdResolutionNoLongerNeeded(const PeerId & peerId) { char name[Common::kInstanceNameMaxLength + 1]; ReturnOnFailure(MakeInstanceName(name, sizeof(name), peerId)); - ChipDnssdResolveNoLongerNeeded(name); } @@ -671,7 +679,7 @@ CHIP_ERROR DiscoveryImplPlatform::ReconfirmRecord(const char * hostname, Inet::I DiscoveryImplPlatform & DiscoveryImplPlatform::GetInstance() { - return sManager; + return sManager.get(); } ServiceAdvertiser & chip::Dnssd::ServiceAdvertiser::Instance() @@ -684,38 +692,6 @@ Resolver & chip::Dnssd::Resolver::Instance() return DiscoveryImplPlatform::GetInstance(); } -CHIP_ERROR ResolverProxy::ResolveNodeId(const PeerId & peerId) -{ - VerifyOrReturnError(mDelegate != nullptr, CHIP_ERROR_INCORRECT_STATE); - - ChipLogProgress(Discovery, "Resolving " ChipLogFormatX64 ":" ChipLogFormatX64 " ...", - ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId())); - - DnssdService service; - - ReturnErrorOnFailure(MakeInstanceName(service.mName, sizeof(service.mName), peerId)); - Platform::CopyString(service.mType, kOperationalServiceName); - service.mProtocol = DnssdServiceProtocol::kDnssdProtocolTcp; - service.mAddressType = Inet::IPAddressType::kAny; - - mDelegate->Retain(); - - CHIP_ERROR err = ChipDnssdResolve(&service, Inet::InterfaceId::Null(), HandleNodeIdResolve, mDelegate); - if (err != CHIP_NO_ERROR) - { - mDelegate->Release(); - } - return err; -} - -void ResolverProxy::NodeIdResolutionNoLongerNeeded(const PeerId & peerId) -{ - char name[Common::kInstanceNameMaxLength + 1]; - ReturnOnFailure(MakeInstanceName(name, sizeof(name), peerId)); - - ChipDnssdResolveNoLongerNeeded(name); -} - ResolverProxy::~ResolverProxy() { Shutdown(); diff --git a/src/lib/dnssd/Discovery_ImplPlatform.h b/src/lib/dnssd/Discovery_ImplPlatform.h index 1bc75f105d0efd..81db71c71b9c67 100644 --- a/src/lib/dnssd/Discovery_ImplPlatform.h +++ b/src/lib/dnssd/Discovery_ImplPlatform.h @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -50,7 +51,7 @@ class DiscoveryImplPlatform : public ServiceAdvertiser, public Resolver CHIP_ERROR UpdateCommissionableInstanceName() override; // Members that implement Resolver interface. - void SetOperationalDelegate(OperationalResolveDelegate * delegate) override { mResolverProxy.SetOperationalDelegate(delegate); } + void SetOperationalDelegate(OperationalResolveDelegate * delegate) override { mOperationalDelegate = delegate; } void SetCommissioningDelegate(CommissioningResolveDelegate * delegate) override { mResolverProxy.SetCommissioningDelegate(delegate); @@ -72,7 +73,7 @@ class DiscoveryImplPlatform : public ServiceAdvertiser, public Resolver kInitialized }; - DiscoveryImplPlatform(); + DiscoveryImplPlatform() = default; DiscoveryImplPlatform(const DiscoveryImplPlatform &) = delete; DiscoveryImplPlatform & operator=(const DiscoveryImplPlatform &) = delete; @@ -91,11 +92,16 @@ class DiscoveryImplPlatform : public ServiceAdvertiser, public Resolver size_t subTypeSize, uint16_t port, Inet::InterfaceId interfaceId, const chip::ByteSpan & mac, DnssdServiceProtocol procotol, PeerId peerId); + static void HandleNodeIdResolve(void * context, DnssdService * result, const Span & addresses, + CHIP_ERROR error); + State mState = State::kUninitialized; uint8_t mCommissionableInstanceName[sizeof(uint64_t)]; ResolverProxy mResolverProxy; + OperationalResolveDelegate * mOperationalDelegate = nullptr; - static DiscoveryImplPlatform sManager; + friend class Global; + static Global sManager; }; } // namespace Dnssd diff --git a/src/lib/dnssd/Resolver.h b/src/lib/dnssd/Resolver.h index a9039352c64b36..81c8e975480347 100644 --- a/src/lib/dnssd/Resolver.h +++ b/src/lib/dnssd/Resolver.h @@ -139,9 +139,9 @@ struct OperationalNodeData void Reset() { peerId = PeerId(); } }; -constexpr size_t kMaxDeviceNameLen = 32; -constexpr size_t kMaxRotatingIdLen = 50; -constexpr size_t kMaxPairingInstructionLen = 128; +inline constexpr size_t kMaxDeviceNameLen = 32; +inline constexpr size_t kMaxRotatingIdLen = 50; +inline constexpr size_t kMaxPairingInstructionLen = 128; /// Data that is specific to commisionable/commissioning node discovery struct CommissionNodeData diff --git a/src/lib/dnssd/ResolverProxy.h b/src/lib/dnssd/ResolverProxy.h index feff0a6bb4da73..176316ef8cd053 100644 --- a/src/lib/dnssd/ResolverProxy.h +++ b/src/lib/dnssd/ResolverProxy.h @@ -23,40 +23,12 @@ namespace chip { namespace Dnssd { -class ResolverDelegateProxy : public ReferenceCounted, - public OperationalResolveDelegate, - public CommissioningResolveDelegate +class ResolverDelegateProxy : public ReferenceCounted, public CommissioningResolveDelegate { public: - void SetOperationalDelegate(OperationalResolveDelegate * delegate) { mOperationalDelegate = delegate; } void SetCommissioningDelegate(CommissioningResolveDelegate * delegate) { mCommissioningDelegate = delegate; } - // OperationalResolveDelegate - void OnOperationalNodeResolved(const ResolvedNodeData & nodeData) override - { - if (mOperationalDelegate != nullptr) - { - mOperationalDelegate->OnOperationalNodeResolved(nodeData); - } - else - { - ChipLogError(Discovery, "Missing operational delegate. Data discarded."); - } - } - - void OnOperationalNodeResolutionFailed(const PeerId & peerId, CHIP_ERROR error) override - { - if (mOperationalDelegate != nullptr) - { - mOperationalDelegate->OnOperationalNodeResolutionFailed(peerId, error); - } - else - { - ChipLogError(Discovery, "Missing operational delegate. Failure info discarded."); - } - } - // CommissioningResolveDelegate void OnNodeDiscovered(const DiscoveredNodeData & nodeData) override { @@ -71,7 +43,6 @@ class ResolverDelegateProxy : public ReferenceCounted, } private: - OperationalResolveDelegate * mOperationalDelegate = nullptr; CommissioningResolveDelegate * mCommissioningDelegate = nullptr; }; @@ -90,13 +61,6 @@ class ResolverProxy : public Resolver if (mDelegate != nullptr) { - if (mPreInitOperationalDelegate != nullptr) - { - ChipLogProgress(Discovery, "Setting operational delegate post init"); - mDelegate->SetOperationalDelegate(mPreInitOperationalDelegate); - mPreInitOperationalDelegate = nullptr; - } - if (mPreInitCommissioningDelegate != nullptr) { ChipLogProgress(Discovery, "Setting commissioning delegate post init"); @@ -112,18 +76,10 @@ class ResolverProxy : public Resolver void SetOperationalDelegate(OperationalResolveDelegate * delegate) override { - if (mDelegate != nullptr) - { - mDelegate->SetOperationalDelegate(delegate); - } - else - { - if (delegate != nullptr) - { - ChipLogProgress(Discovery, "Delaying proxy of operational discovery: missing delegate"); - } - mPreInitOperationalDelegate = delegate; - } + /// Unfortunately cannot remove this method since it is in a Resolver interface. + ChipLogError(Discovery, "!!! Operational proxy does NOT support operational discovery"); + ChipLogError(Discovery, "!!! Please use AddressResolver or DNSSD Resolver directly"); + chipDie(); // force detection of invalid usages. } void SetCommissioningDelegate(CommissioningResolveDelegate * delegate) override @@ -145,22 +101,23 @@ class ResolverProxy : public Resolver void Shutdown() override { VerifyOrReturn(mDelegate != nullptr); - mDelegate->SetOperationalDelegate(nullptr); mDelegate->SetCommissioningDelegate(nullptr); mDelegate->Release(); mDelegate = nullptr; } - CHIP_ERROR ResolveNodeId(const PeerId & peerId) override; - void NodeIdResolutionNoLongerNeeded(const PeerId & peerId) override; CHIP_ERROR DiscoverCommissionableNodes(DiscoveryFilter filter = DiscoveryFilter()) override; CHIP_ERROR DiscoverCommissioners(DiscoveryFilter filter = DiscoveryFilter()) override; CHIP_ERROR StopDiscovery() override; CHIP_ERROR ReconfirmRecord(const char * hostname, Inet::IPAddress address, Inet::InterfaceId interfaceId) override; + // TODO: ResolverProxy should not be used anymore to implement operational node resolution + // This method still here because Resolver interface requires it + CHIP_ERROR ResolveNodeId(const PeerId & peerId) override { return CHIP_ERROR_NOT_IMPLEMENTED; } + void NodeIdResolutionNoLongerNeeded(const PeerId & peerId) override {} + private: ResolverDelegateProxy * mDelegate = nullptr; - OperationalResolveDelegate * mPreInitOperationalDelegate = nullptr; CommissioningResolveDelegate * mPreInitCommissioningDelegate = nullptr; // While discovery (commissionable or commissioner) is ongoing, diff --git a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp index 36ead8c9e5cb75..416c747d830cc6 100644 --- a/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp +++ b/src/lib/dnssd/Resolver_ImplMinimalMdns.cpp @@ -748,25 +748,6 @@ ResolverProxy::~ResolverProxy() Shutdown(); } -// Minimal implementation does not support associating a context to a request (while platforms implementations do). So keep -// updating the delegate that ends up being used by the server by calling 'SetOperationalDelegate'. -// This effectively allow minimal to have multiple controllers issuing requests as long the requests are serialized, but -// it won't work well if requests are issued in parallel. -CHIP_ERROR ResolverProxy::ResolveNodeId(const PeerId & peerId) -{ - VerifyOrReturnError(mDelegate != nullptr, CHIP_ERROR_INCORRECT_STATE); - - ChipLogProgress(Discovery, "Resolving " ChipLogFormatX64 ":" ChipLogFormatX64 " ...", - ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId())); - chip::Dnssd::Resolver::Instance().SetOperationalDelegate(mDelegate); - return chip::Dnssd::Resolver::Instance().ResolveNodeId(peerId); -} - -void ResolverProxy::NodeIdResolutionNoLongerNeeded(const PeerId & peerId) -{ - return chip::Dnssd::Resolver::Instance().NodeIdResolutionNoLongerNeeded(peerId); -} - CHIP_ERROR ResolverProxy::DiscoverCommissionableNodes(DiscoveryFilter filter) { VerifyOrReturnError(mDelegate != nullptr, CHIP_ERROR_INCORRECT_STATE); diff --git a/src/lib/dnssd/Resolver_ImplNone.cpp b/src/lib/dnssd/Resolver_ImplNone.cpp index 2dd591aa4ad759..3d0d97f57cd449 100644 --- a/src/lib/dnssd/Resolver_ImplNone.cpp +++ b/src/lib/dnssd/Resolver_ImplNone.cpp @@ -68,13 +68,6 @@ ResolverProxy::~ResolverProxy() Shutdown(); } -CHIP_ERROR ResolverProxy::ResolveNodeId(const PeerId & peerId) -{ - return CHIP_ERROR_NOT_IMPLEMENTED; -} - -void ResolverProxy::NodeIdResolutionNoLongerNeeded(const PeerId & peerId) {} - CHIP_ERROR ResolverProxy::DiscoverCommissionableNodes(DiscoveryFilter filter) { return CHIP_ERROR_NOT_IMPLEMENTED; diff --git a/src/lib/dnssd/ServiceNaming.h b/src/lib/dnssd/ServiceNaming.h index 10e5abba465774..5f4c2e6c2ea948 100644 --- a/src/lib/dnssd/ServiceNaming.h +++ b/src/lib/dnssd/ServiceNaming.h @@ -28,13 +28,13 @@ namespace chip { namespace Dnssd { -constexpr char kSubtypeServiceNamePart[] = "_sub"; -constexpr char kCommissionableServiceName[] = "_matterc"; -constexpr char kOperationalServiceName[] = "_matter"; -constexpr char kCommissionerServiceName[] = "_matterd"; -constexpr char kOperationalProtocol[] = "_tcp"; -constexpr char kCommissionProtocol[] = "_udp"; -constexpr char kLocalDomain[] = "local"; +inline constexpr char kSubtypeServiceNamePart[] = "_sub"; +inline constexpr char kCommissionableServiceName[] = "_matterc"; +inline constexpr char kOperationalServiceName[] = "_matter"; +inline constexpr char kCommissionerServiceName[] = "_matterd"; +inline constexpr char kOperationalProtocol[] = "_tcp"; +inline constexpr char kCommissionProtocol[] = "_udp"; +inline constexpr char kLocalDomain[] = "local"; // each includes space for a null terminator, which becomes a . when the names are appended. constexpr size_t kMaxCommissionableServiceNameSize = diff --git a/src/lib/dnssd/minimal_mdns/core/Constants.h b/src/lib/dnssd/minimal_mdns/core/Constants.h index 30f2d4b0ddd0b9..bf2a309143cd7c 100644 --- a/src/lib/dnssd/minimal_mdns/core/Constants.h +++ b/src/lib/dnssd/minimal_mdns/core/Constants.h @@ -44,10 +44,10 @@ enum class QType : uint16_t }; /// Flag encoded in QCLASS requesting unicast answers -constexpr uint16_t kQClassUnicastAnswerFlag = 0x8000; +inline constexpr uint16_t kQClassUnicastAnswerFlag = 0x8000; // Flag used to indicate receiver should flush cache rather than appending. Used for Response RR's. // See https://datatracker.ietf.org/doc/html/rfc6762#section-10.2. -constexpr uint16_t kQClassResponseFlushBit = 0x8000; +inline constexpr uint16_t kQClassResponseFlushBit = 0x8000; enum class QClass : uint16_t { diff --git a/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h b/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h index e82dc5ee6c3492..f7b34f10591e9d 100644 --- a/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h +++ b/src/lib/dnssd/minimal_mdns/tests/CheckOnlyServer.h @@ -38,7 +38,7 @@ namespace mdns { namespace Minimal { namespace test { -constexpr QNamePart kIgnoreQNameParts[] = { "IGNORE", "THIS" }; +inline constexpr QNamePart kIgnoreQNameParts[] = { "IGNORE", "THIS" }; namespace { bool StringMatches(const BytesRange & br, const char * str) { diff --git a/src/lib/format/protocol_messages.matter b/src/lib/format/protocol_messages.matter index 30ffa0e1d7704e..81ca44e701cd55 100644 --- a/src/lib/format/protocol_messages.matter +++ b/src/lib/format/protocol_messages.matter @@ -109,6 +109,7 @@ client cluster SecureChannelProtocol = 0xFFFF0000 { readonly attribute CaseSigma3 case_sigma3 = 0x32; readonly attribute CaseSigma2Resume case_sigma2_resume = 0x33; readonly attribute protocol_binary_data status_report = 0x40; + readonly attribute protocol_binary_data icd_checkin = 0x50; } /// Fake cluster for defining structures for IM data encoding. diff --git a/src/lib/shell/commands/BUILD.gn b/src/lib/shell/commands/BUILD.gn index 20ec201984678b..05a6a0e2660ff4 100644 --- a/src/lib/shell/commands/BUILD.gn +++ b/src/lib/shell/commands/BUILD.gn @@ -50,6 +50,7 @@ source_set("commands") { if (chip_device_platform != "none") { sources += [ "Dns.cpp" ] + public_deps += [ "${chip_root}/src/lib/address_resolve" ] } if (chip_enable_ota_requestor && chip_device_platform != "none" && diff --git a/src/lib/shell/commands/Dns.cpp b/src/lib/shell/commands/Dns.cpp index 0717d4235f4d9b..83fd12fc0b3ff1 100644 --- a/src/lib/shell/commands/Dns.cpp +++ b/src/lib/shell/commands/Dns.cpp @@ -16,6 +16,7 @@ */ #include +#include #include #include #include @@ -39,40 +40,47 @@ Shell::Engine sShellDnsBrowseSubcommands; Shell::Engine sShellDnsSubcommands; Dnssd::ResolverProxy sResolverProxy; -class DnsShellResolverDelegate : public Dnssd::OperationalResolveDelegate, public Dnssd::CommissioningResolveDelegate +class DnsShellResolverDelegate : public Dnssd::CommissioningResolveDelegate, public AddressResolve::NodeListener { public: - void OnOperationalNodeResolved(const Dnssd::ResolvedNodeData & nodeData) override + DnsShellResolverDelegate() { mSelfHandle.SetListener(this); } + + void OnNodeAddressResolved(const PeerId & peerId, const AddressResolve::ResolveResult & result) override { - sResolverProxy.NodeIdResolutionNoLongerNeeded(nodeData.operationalData.peerId); streamer_printf(streamer_get(), "DNS resolve for " ChipLogFormatX64 "-" ChipLogFormatX64 " succeeded:\r\n", - ChipLogValueX64(nodeData.operationalData.peerId.GetCompressedFabricId()), - ChipLogValueX64(nodeData.operationalData.peerId.GetNodeId())); - streamer_printf(streamer_get(), " Hostname: %s\r\n", nodeData.resolutionData.hostName); - for (size_t i = 0; i < nodeData.resolutionData.numIPs; ++i) - { - streamer_printf(streamer_get(), " IP address: %s\r\n", nodeData.resolutionData.ipAddress[i].ToString(ipAddressBuf)); - } - streamer_printf(streamer_get(), " Port: %u\r\n", nodeData.resolutionData.port); - - auto retryInterval = nodeData.resolutionData.GetMrpRetryIntervalIdle(); - - if (retryInterval.HasValue()) - streamer_printf(streamer_get(), " MRP retry interval (idle): %" PRIu32 "ms\r\n", retryInterval.Value()); - - retryInterval = nodeData.resolutionData.GetMrpRetryIntervalActive(); - - if (retryInterval.HasValue()) - streamer_printf(streamer_get(), " MRP retry interval (active): %" PRIu32 "ms\r\n", retryInterval.Value()); - - streamer_printf(streamer_get(), " Supports TCP: %s\r\n", nodeData.resolutionData.supportsTcp ? "yes" : "no"); + ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId())); + + char addr_string[Transport::PeerAddress::kMaxToStringSize]; + result.address.ToString(addr_string); + + streamer_printf(streamer_get(), "Resolve completed: %s\r\n", addr_string); + streamer_printf(streamer_get(), " Supports TCP: %s\r\n", result.supportsTcp ? "YES" : "NO"); + streamer_printf(streamer_get(), " MRP IDLE retransmit timeout: %u ms\r\n", + result.mrpRemoteConfig.mIdleRetransTimeout.count()); + streamer_printf(streamer_get(), " MRP ACTIVE retransmit timeout: %u ms\r\n", + result.mrpRemoteConfig.mActiveRetransTimeout.count()); + streamer_printf(streamer_get(), " MRP ACTIVE Threshold timet: %u ms\r\n", + result.mrpRemoteConfig.mActiveThresholdTime.count()); + + // Schedule a retry. Not called directly so we do not recurse in OnNodeAddressResolved + DeviceLayer::SystemLayer().ScheduleLambda([this] { + CHIP_ERROR err = AddressResolve::Resolver::Instance().TryNextResult(Handle()); + if (err != CHIP_NO_ERROR && err != CHIP_ERROR_WELL_EMPTY) + { + ChipLogError(Discovery, "Failed to list next result: %" CHIP_ERROR_FORMAT, err.Format()); + } + }); } - void OnOperationalNodeResolutionFailed(const PeerId & peerId, CHIP_ERROR error) override + void OnNodeAddressResolutionFailed(const PeerId & peerId, CHIP_ERROR reason) override { - sResolverProxy.NodeIdResolutionNoLongerNeeded(peerId); + streamer_printf(streamer_get(), + "DNS resolve for " ChipLogFormatX64 "-" ChipLogFormatX64 " failed: %" CHIP_ERROR_FORMAT "\r\n", + ChipLogValueX64(peerId.GetCompressedFabricId()), ChipLogValueX64(peerId.GetNodeId()), reason.Format()); } + AddressResolve::NodeLookupHandle & Handle() { return mSelfHandle; } + void OnNodeDiscovered(const Dnssd::DiscoveredNodeData & nodeData) override { if (!nodeData.resolutionData.IsValid()) @@ -118,6 +126,7 @@ class DnsShellResolverDelegate : public Dnssd::OperationalResolveDelegate, publi private: char ipAddressBuf[Inet::IPAddress::kMaxStringLength]; + AddressResolve::NodeLookupHandle mSelfHandle; }; DnsShellResolverDelegate sDnsShellResolverDelegate; @@ -126,13 +135,19 @@ CHIP_ERROR ResolveHandler(int argc, char ** argv) { VerifyOrReturnError(argc == 2, CHIP_ERROR_INVALID_ARGUMENT); + if (sDnsShellResolverDelegate.Handle().IsActive()) + { + streamer_printf(streamer_get(), "Cancelling previous resolve...\r\n"); + LogErrorOnFailure(AddressResolve::Resolver::Instance().CancelLookup(sDnsShellResolverDelegate.Handle(), + AddressResolve::Resolver::FailureCallback::Call)); + } + streamer_printf(streamer_get(), "Resolving ...\r\n"); - PeerId peerId; - peerId.SetCompressedFabricId(strtoull(argv[0], nullptr, 10)); - peerId.SetNodeId(strtoull(argv[1], nullptr, 10)); + AddressResolve::NodeLookupRequest request( + PeerId().SetCompressedFabricId(strtoull(argv[0], nullptr, 10)).SetNodeId(strtoull(argv[1], nullptr, 10))); - return sResolverProxy.ResolveNodeId(peerId); + return AddressResolve::Resolver::Instance().LookupNode(request, sDnsShellResolverDelegate.Handle()); } bool ParseSubType(int argc, char ** argv, Dnssd::DiscoveryFilter & filter) @@ -230,7 +245,6 @@ CHIP_ERROR DnsHandler(int argc, char ** argv) } sResolverProxy.Init(DeviceLayer::UDPEndPointManager()); - sResolverProxy.SetOperationalDelegate(&sDnsShellResolverDelegate); sResolverProxy.SetCommissioningDelegate(&sDnsShellResolverDelegate); return sShellDnsSubcommands.ExecCommand(argc, argv); diff --git a/src/lib/support/CommonPersistentData.h b/src/lib/support/CommonPersistentData.h index df0acff14616e4..64056a69dbe290 100644 --- a/src/lib/support/CommonPersistentData.h +++ b/src/lib/support/CommonPersistentData.h @@ -27,7 +27,7 @@ namespace chip { namespace CommonPersistentData { -constexpr uint8_t kdefaultUndefinedEntry = 0; +inline constexpr uint8_t kdefaultUndefinedEntry = 0; /// @brief Generic class to implement storage of a list persistently /// @tparam EntryType : Type of entry depends on the stored data @@ -74,7 +74,7 @@ struct StoredDataList : public PersistentData } }; -constexpr size_t kPersistentFabricBufferMax = 32; +inline constexpr size_t kPersistentFabricBufferMax = 32; struct FabricList : StoredDataList { // Subclasses need to define UpdateKey to be whatever fabric list key they diff --git a/src/lib/support/PrivateHeap.h b/src/lib/support/PrivateHeap.h index 864497a845a226..33334265d5e080 100644 --- a/src/lib/support/PrivateHeap.h +++ b/src/lib/support/PrivateHeap.h @@ -67,6 +67,6 @@ struct PrivateHeapBlockHeader } // namespace internal -constexpr size_t kPrivateHeapAllocationAlignment = std::alignment_of::value; +inline constexpr size_t kPrivateHeapAllocationAlignment = std::alignment_of::value; #endif // ifdef __cplusplus diff --git a/src/lib/support/ThreadOperationalDataset.h b/src/lib/support/ThreadOperationalDataset.h index 9fbfd1b1b3c547..e4de3ddaa8d2c5 100644 --- a/src/lib/support/ThreadOperationalDataset.h +++ b/src/lib/support/ThreadOperationalDataset.h @@ -29,16 +29,16 @@ namespace Thread { class ThreadTLV; -constexpr size_t kChannel_NotSpecified = UINT8_MAX; -constexpr size_t kPANId_NotSpecified = UINT16_MAX; +inline constexpr size_t kChannel_NotSpecified = UINT8_MAX; +inline constexpr size_t kPANId_NotSpecified = UINT16_MAX; -constexpr size_t kSizeOperationalDataset = 254; +inline constexpr size_t kSizeOperationalDataset = 254; -constexpr size_t kSizeNetworkName = 16; -constexpr size_t kSizeExtendedPanId = 8; -constexpr size_t kSizeMasterKey = 16; -constexpr size_t kSizeMeshLocalPrefix = 8; -constexpr size_t kSizePSKc = 16; +inline constexpr size_t kSizeNetworkName = 16; +inline constexpr size_t kSizeExtendedPanId = 8; +inline constexpr size_t kSizeMasterKey = 16; +inline constexpr size_t kSizeMeshLocalPrefix = 8; +inline constexpr size_t kSizePSKc = 16; /** * This class provides methods to manipulate Thread operational dataset. diff --git a/src/messaging/ExchangeMgr.cpp b/src/messaging/ExchangeMgr.cpp index 1ffce3e3de0316..dddc9c6fd4ce8f 100644 --- a/src/messaging/ExchangeMgr.cpp +++ b/src/messaging/ExchangeMgr.cpp @@ -300,9 +300,17 @@ void ExchangeManager::OnMessageReceived(const PacketHeader & packetHeader, const // an ack to the peer. else if (!payloadHeader.NeedsAck()) { - // Using same error message for all errors to reduce code size. - ChipLogError(ExchangeManager, "OnMessageReceived failed, err = %" CHIP_ERROR_FORMAT, - CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR.Format()); + // We can easily get standalone acks here: any time we fail to get a + // timely ack for the last message in an exchange and retransmit it, + // then get acks for both the message and the retransmit, the second ack + // will end up in this block. That's not really an error condition, so + // there is no need to log an error in that case. + if (!payloadHeader.HasMessageType(Protocols::SecureChannel::MsgType::StandaloneAck)) + { + // Using same error message for all errors to reduce code size. + ChipLogError(ExchangeManager, "OnMessageReceived failed, err = %" CHIP_ERROR_FORMAT, + CHIP_ERROR_UNSOLICITED_MSG_NO_ORIGINATOR.Format()); + } return; } diff --git a/src/messaging/README.md b/src/messaging/README.md index af5357e5dece2f..bfb379e22aa49c 100644 --- a/src/messaging/README.md +++ b/src/messaging/README.md @@ -16,7 +16,7 @@ will be expanded are denoted with `$` . Unless specified, numerical values are represented in decimal notation. ``` -<<< [E:$exchange_id S:$session_id M:$msg_id (Ack: $ack_msg_id)] ($msg_category) Msg TX to $fabric_index:$destination [$compressed_fabric_id] --- Type $protocol_id:$msg_type ($protocol_name:$msg_type_name) +<<< [E:$exchange_id S:$session_id M:$msg_id (Ack: $ack_msg_id)] ($msg_category) Msg TX to $fabric_index:$destination [$compressed_fabric_id] [$peer_address] --- Type $protocol_id:$msg_type ($protocol_name:$msg_type_name) ``` | Field | Description | @@ -29,6 +29,7 @@ Unless specified, numerical values are represented in decimal notation. | fabric_index | Fabric index on the sending side | | destination | 64-bit Node Identifier that can represent both group, operational and temporary node identifiers depending on `$msg_category` (in hex) | | compressed_fabric_id | If present and valid, lower 16-bits of the compressed fabric ID (in hex). Otherwise, it will be set to 0000. | +| peer_address | The peer address (IP and port) for the session | | protocol_id | 16-bit Protocol ID within the common vendor namespace (in hex) | | msg_type | 8-bit message type ID (in hex) | | protocol_name | If available, a logical name for the protocol | diff --git a/src/messaging/ReliableMessageProtocolConfig.h b/src/messaging/ReliableMessageProtocolConfig.h index 6a570ba25f93e7..bd0e421933a3a1 100644 --- a/src/messaging/ReliableMessageProtocolConfig.h +++ b/src/messaging/ReliableMessageProtocolConfig.h @@ -167,7 +167,7 @@ namespace chip { #endif #endif // CHIP_CONFIG_MRP_RETRY_INTERVAL_SENDER_BOOST -constexpr System::Clock::Milliseconds32 kDefaultActiveTime = System::Clock::Milliseconds16(4000); +inline constexpr System::Clock::Milliseconds32 kDefaultActiveTime = System::Clock::Milliseconds16(4000); /** * @brief diff --git a/src/messaging/tests/echo/common.h b/src/messaging/tests/echo/common.h index 03d2431d3b7a8a..8158884c5c4321 100644 --- a/src/messaging/tests/echo/common.h +++ b/src/messaging/tests/echo/common.h @@ -31,9 +31,9 @@ #include #include -constexpr size_t kMaxTcpActiveConnectionCount = 4; -constexpr size_t kMaxTcpPendingPackets = 4; -constexpr size_t kNetworkSleepTimeMsecs = (100 * 1000); +inline constexpr size_t kMaxTcpActiveConnectionCount = 4; +inline constexpr size_t kMaxTcpPendingPackets = 4; +inline constexpr size_t kNetworkSleepTimeMsecs = (100 * 1000); extern chip::FabricTable gFabricTable; extern chip::SessionManager gSessionManager; diff --git a/src/platform/ASR/ASRFactoryDataProvider.cpp b/src/platform/ASR/ASRFactoryDataProvider.cpp old mode 100644 new mode 100755 index c99fb99936debe..f798d0133a0231 --- a/src/platform/ASR/ASRFactoryDataProvider.cpp +++ b/src/platform/ASR/ASRFactoryDataProvider.cpp @@ -50,7 +50,7 @@ CHIP_ERROR ASRFactoryDataProvider::Init() if (ret != 0) { err = CHIP_ERROR_INTERNAL; - ChipLogError(DeviceLayer, "The hash of factory bin is not correct."); + ChipLogError(DeviceLayer, "ASR factory data check failed."); } #endif return err; diff --git a/src/platform/ASR/NetworkCommissioningDriver.h b/src/platform/ASR/NetworkCommissioningDriver.h index 954f0c886be2d5..7fc9e0c10b49ad 100644 --- a/src/platform/ASR/NetworkCommissioningDriver.h +++ b/src/platform/ASR/NetworkCommissioningDriver.h @@ -33,10 +33,10 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -constexpr uint8_t kWiFiMaxNetworks = 15; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kWiFiMaxNetworks = 15; } // namespace class ASRScanResponseIterator : public Iterator diff --git a/src/platform/Ameba/NetworkCommissioningDriver.h b/src/platform/Ameba/NetworkCommissioningDriver.h index 3942b89627741f..0525ac4910f5ec 100644 --- a/src/platform/Ameba/NetworkCommissioningDriver.h +++ b/src/platform/Ameba/NetworkCommissioningDriver.h @@ -25,9 +25,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class AmebaScanResponseIterator : public Iterator diff --git a/src/platform/Beken/NetworkCommissioningDriver.h b/src/platform/Beken/NetworkCommissioningDriver.h index 5f83d0d928e39d..860a165601c20b 100644 --- a/src/platform/Beken/NetworkCommissioningDriver.h +++ b/src/platform/Beken/NetworkCommissioningDriver.h @@ -26,9 +26,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class BKScanResponseIterator : public Iterator diff --git a/src/platform/Darwin/BLEManagerImpl.cpp b/src/platform/Darwin/BLEManagerImpl.cpp index 712178b49ccfd9..639e8d1e1c4657 100644 --- a/src/platform/Darwin/BLEManagerImpl.cpp +++ b/src/platform/Darwin/BLEManagerImpl.cpp @@ -24,13 +24,12 @@ #include #include +#include #include #include #include #include -#include - #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE using namespace ::chip; @@ -40,7 +39,7 @@ namespace chip { namespace DeviceLayer { namespace Internal { -BLEManagerImpl BLEManagerImpl::sInstance; +Global BLEManagerImpl::sInstance; CHIP_ERROR BLEManagerImpl::_Init() { diff --git a/src/platform/Darwin/BLEManagerImpl.h b/src/platform/Darwin/BLEManagerImpl.h index a1205298f7c1ab..72856ff466c2ac 100644 --- a/src/platform/Darwin/BLEManagerImpl.h +++ b/src/platform/Darwin/BLEManagerImpl.h @@ -23,6 +23,9 @@ #pragma once +#include +#include + #if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE namespace chip { @@ -68,7 +71,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer friend BLEManager & BLEMgr(void); friend BLEManagerImpl & BLEMgrImpl(void); - static BLEManagerImpl sInstance; + static Global sInstance; BleConnectionDelegate * mConnectionDelegate = nullptr; BlePlatformDelegate * mPlatformDelegate = nullptr; @@ -83,7 +86,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer */ inline BLEManager & BLEMgr(void) { - return BLEManagerImpl::sInstance; + return BLEManagerImpl::sInstance.get(); } /** @@ -94,7 +97,7 @@ inline BLEManager & BLEMgr(void) */ inline BLEManagerImpl & BLEMgrImpl(void) { - return BLEManagerImpl::sInstance; + return BLEManagerImpl::sInstance.get(); } } // namespace Internal diff --git a/src/platform/Darwin/CHIPPlatformConfig.h b/src/platform/Darwin/CHIPPlatformConfig.h index e3e1a99aebe5a1..d85194aaecb61e 100644 --- a/src/platform/Darwin/CHIPPlatformConfig.h +++ b/src/platform/Darwin/CHIPPlatformConfig.h @@ -27,6 +27,12 @@ #define CHIP_CONFIG_ABORT() abort() +#include // for __dso_handle +extern "C" int __cxa_atexit(void (*f)(void *), void * p, void * d); +#define CHIP_CXA_ATEXIT(f, p) __cxa_atexit((f), (p), &__dso_handle) + +#define CHIP_CONFIG_GLOBALS_LAZY_INIT 1 + #define CHIP_CONFIG_ERROR_FORMAT_AS_STRING 1 #define CHIP_CONFIG_ERROR_SOURCE 1 diff --git a/src/platform/Darwin/ConfigurationManagerImpl.cpp b/src/platform/Darwin/ConfigurationManagerImpl.cpp index aeb02e63655708..b3cd31b2efde3a 100644 --- a/src/platform/Darwin/ConfigurationManagerImpl.cpp +++ b/src/platform/Darwin/ConfigurationManagerImpl.cpp @@ -23,13 +23,14 @@ * for Darwin platforms. */ -#include +#include #include #include #include #include #include +#include #include #include diff --git a/src/platform/Darwin/DnssdImpl.cpp b/src/platform/Darwin/DnssdImpl.cpp index eb2ebb205e1b31..fb661dd8e2f14d 100644 --- a/src/platform/Darwin/DnssdImpl.cpp +++ b/src/platform/Darwin/DnssdImpl.cpp @@ -131,7 +131,7 @@ std::shared_ptr GetCounterHolder(const char * name) namespace chip { namespace Dnssd { -MdnsContexts MdnsContexts::sInstance; +Global MdnsContexts::sInstance; namespace { diff --git a/src/platform/Darwin/DnssdImpl.h b/src/platform/Darwin/DnssdImpl.h index 0f724747da2fd2..7bd6cdba8a7008 100644 --- a/src/platform/Darwin/DnssdImpl.h +++ b/src/platform/Darwin/DnssdImpl.h @@ -18,6 +18,7 @@ #pragma once #include +#include #include #include "DnssdHostNameRegistrar.h" @@ -65,7 +66,7 @@ class MdnsContexts MdnsContexts(const MdnsContexts &) = delete; MdnsContexts & operator=(const MdnsContexts &) = delete; ~MdnsContexts(); - static MdnsContexts & GetInstance() { return sInstance; } + static MdnsContexts & GetInstance() { return sInstance.get(); } CHIP_ERROR Add(GenericContext * context, DNSServiceRef sdRef); CHIP_ERROR Remove(GenericContext * context); @@ -128,8 +129,9 @@ class MdnsContexts } private: - MdnsContexts(){}; - static MdnsContexts sInstance; + MdnsContexts() = default; + friend class Global; + static Global sInstance; std::vector mContexts; }; diff --git a/src/platform/Darwin/PlatformManagerImpl.cpp b/src/platform/Darwin/PlatformManagerImpl.cpp index 69a95c44673b05..5db5c69f2656b0 100644 --- a/src/platform/Darwin/PlatformManagerImpl.cpp +++ b/src/platform/Darwin/PlatformManagerImpl.cpp @@ -40,7 +40,7 @@ namespace chip { namespace DeviceLayer { -PlatformManagerImpl PlatformManagerImpl::sInstance; +Global PlatformManagerImpl::sInstance; CHIP_ERROR PlatformManagerImpl::_InitChipStack() { diff --git a/src/platform/Darwin/PlatformManagerImpl.h b/src/platform/Darwin/PlatformManagerImpl.h index 2dfa9104e0dab3..7f3aba0b1a7b8e 100644 --- a/src/platform/Darwin/PlatformManagerImpl.h +++ b/src/platform/Darwin/PlatformManagerImpl.h @@ -23,9 +23,11 @@ #pragma once -#include +#include #include +#include + static constexpr const char * const CHIP_CONTROLLER_QUEUE = "org.csa-iot.matter.framework.controller.workqueue"; namespace chip { @@ -77,9 +79,8 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener friend PlatformManager & PlatformMgr(void); friend PlatformManagerImpl & PlatformMgrImpl(void); - friend class Internal::BLEManagerImpl; - static PlatformManagerImpl sInstance; + static Global sInstance; System::Clock::Timestamp mStartTime = System::Clock::kZero; @@ -104,7 +105,7 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener */ inline PlatformManager & PlatformMgr(void) { - return PlatformManagerImpl::sInstance; + return PlatformManagerImpl::sInstance.get(); } /** @@ -115,7 +116,7 @@ inline PlatformManager & PlatformMgr(void) */ inline PlatformManagerImpl & PlatformMgrImpl(void) { - return PlatformManagerImpl::sInstance; + return PlatformManagerImpl::sInstance.get(); } } // namespace DeviceLayer diff --git a/src/platform/ESP32/ConfigurationManagerImpl.cpp b/src/platform/ESP32/ConfigurationManagerImpl.cpp index 45c1cb9a14021a..188fb75a43e86b 100644 --- a/src/platform/ESP32/ConfigurationManagerImpl.cpp +++ b/src/platform/ESP32/ConfigurationManagerImpl.cpp @@ -118,6 +118,15 @@ CHIP_ERROR ConfigurationManagerImpl::Init() err = MapConfigError(esp_err); SuccessOrExit(err); } + + esp_err = nvs_flash_secure_init_partition(CHIP_DEVICE_CONFIG_CHIP_KVS_NAMESPACE_PARTITION, &cfg); + if (esp_err == ESP_ERR_NVS_NO_FREE_PAGES || esp_err == ESP_ERR_NVS_NEW_VERSION_FOUND) + { + ChipLogError(DeviceLayer, "Failed to initialize NVS partition %s err:0x%02x", + CHIP_DEVICE_CONFIG_CHIP_KVS_NAMESPACE_PARTITION, esp_err); + err = MapConfigError(esp_err); + SuccessOrExit(err); + } #else // Initialize the nvs partitions, // nvs_flash_init_partition() will initialize the partition only if it is not already initialized. diff --git a/src/platform/ESP32/NetworkCommissioningDriver.h b/src/platform/ESP32/NetworkCommissioningDriver.h index 7a261654d4f71e..5a2ca8f44d61c1 100644 --- a/src/platform/ESP32/NetworkCommissioningDriver.h +++ b/src/platform/ESP32/NetworkCommissioningDriver.h @@ -26,9 +26,9 @@ namespace chip { namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 30; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 30; } // namespace BitFlags ConvertSecurityType(wifi_auth_mode_t authMode); diff --git a/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h b/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h index d7f5683d516356..3bd1a02f99a91f 100644 --- a/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h +++ b/src/platform/Infineon/PSOC6/NetworkCommissioningDriver.h @@ -26,10 +26,10 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -constexpr uint8_t kWiFiMaxNetworks = 15; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kWiFiMaxNetworks = 15; } // namespace class P6ScanResponseIterator : public Iterator diff --git a/src/platform/Linux/DnssdImpl.cpp b/src/platform/Linux/DnssdImpl.cpp index fa72836ef8b160..5f46dd24d8728f 100644 --- a/src/platform/Linux/DnssdImpl.cpp +++ b/src/platform/Linux/DnssdImpl.cpp @@ -779,18 +779,69 @@ void MdnsAvahi::HandleBrowse(AvahiServiceBrowser * browser, AvahiIfIndex interfa } } +MdnsAvahi::ResolveContext * MdnsAvahi::AllocateResolveContext() +{ + ResolveContext * context = chip::Platform::New(); + if (context == nullptr) + { + return nullptr; + } + + context->mNumber = mResolveCount++; + mAllocatedResolves.push_back(context); + + return context; +} + +MdnsAvahi::ResolveContext * MdnsAvahi::ResolveContextForHandle(size_t handle) +{ + for (auto it : mAllocatedResolves) + { + if (it->mNumber == handle) + { + return it; + } + } + return nullptr; +} + +void MdnsAvahi::FreeResolveContext(size_t handle) +{ + for (auto it = mAllocatedResolves.begin(); it != mAllocatedResolves.end(); it++) + { + if ((*it)->mNumber == handle) + { + chip::Platform::Delete(*it); + mAllocatedResolves.erase(it); + return; + } + } +} + +void MdnsAvahi::StopResolve(const char * name) +{ + auto truncate_end = std::remove_if(mAllocatedResolves.begin(), mAllocatedResolves.end(), + [name](ResolveContext * ctx) { return strcmp(ctx->mName, name) == 0; }); + + for (auto it = truncate_end; it != mAllocatedResolves.end(); it++) + { + (*it)->mCallback((*it)->mContext, nullptr, Span(), CHIP_ERROR_CANCELLED); + chip::Platform::Delete(*it); + } + + mAllocatedResolves.erase(truncate_end, mAllocatedResolves.end()); +} + CHIP_ERROR MdnsAvahi::Resolve(const char * name, const char * type, DnssdServiceProtocol protocol, Inet::IPAddressType addressType, Inet::IPAddressType transportType, Inet::InterfaceId interface, DnssdResolveCallback callback, void * context) { - AvahiServiceResolver * resolver; AvahiIfIndex avahiInterface = static_cast(interface.GetPlatformInterface()); - ResolveContext * resolveContext = chip::Platform::New(); + ResolveContext * resolveContext = AllocateResolveContext(); CHIP_ERROR error = CHIP_NO_ERROR; - - resolveContext->mInstance = this; - resolveContext->mCallback = callback; - resolveContext->mContext = context; + resolveContext->mInstance = this; + resolveContext->mCallback = callback; + resolveContext->mContext = context; if (!interface.IsPresent()) { @@ -803,15 +854,17 @@ CHIP_ERROR MdnsAvahi::Resolve(const char * name, const char * type, DnssdService resolveContext->mAddressType = ToAvahiProtocol(addressType); resolveContext->mFullType = GetFullType(type, protocol); - resolver = avahi_service_resolver_new(mClient, avahiInterface, resolveContext->mTransport, name, - resolveContext->mFullType.c_str(), nullptr, resolveContext->mAddressType, - static_cast(0), HandleResolve, resolveContext); + AvahiServiceResolver * resolver = + avahi_service_resolver_new(mClient, avahiInterface, resolveContext->mTransport, name, resolveContext->mFullType.c_str(), + nullptr, resolveContext->mAddressType, static_cast(0), HandleResolve, + reinterpret_cast(resolveContext->mNumber)); // Otherwise the resolver will be freed in the callback if (resolver == nullptr) { error = CHIP_ERROR_INTERNAL; chip::Platform::Delete(resolveContext); } + resolveContext->mResolver = resolver; return error; } @@ -821,9 +874,16 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte const char * host_name, const AvahiAddress * address, uint16_t port, AvahiStringList * txt, AvahiLookupResultFlags flags, void * userdata) { - ResolveContext * context = reinterpret_cast(userdata); + size_t handle = reinterpret_cast(userdata); + ResolveContext * context = sInstance.ResolveContextForHandle(handle); std::vector textEntries; + if (context == nullptr) + { + ChipLogError(Discovery, "Invalid context for handling resolves: %ld", static_cast(handle)); + return; + } + switch (event) { case AVAHI_RESOLVER_FAILURE: @@ -831,14 +891,14 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte { ChipLogProgress(DeviceLayer, "Re-trying resolve"); avahi_service_resolver_free(resolver); - resolver = avahi_service_resolver_new(context->mInstance->mClient, context->mInterface, context->mTransport, - context->mName, context->mFullType.c_str(), nullptr, context->mAddressType, - static_cast(0), HandleResolve, context); - if (resolver == nullptr) + context->mResolver = avahi_service_resolver_new( + context->mInstance->mClient, context->mInterface, context->mTransport, context->mName, context->mFullType.c_str(), + nullptr, context->mAddressType, static_cast(0), HandleResolve, context); + if (context->mResolver == nullptr) { ChipLogError(DeviceLayer, "Avahi resolve failed on retry"); context->mCallback(context->mContext, nullptr, Span(), CHIP_ERROR_INTERNAL); - chip::Platform::Delete(context); + sInstance.FreeResolveContext(handle); } return; } @@ -930,8 +990,7 @@ void MdnsAvahi::HandleResolve(AvahiServiceResolver * resolver, AvahiIfIndex inte break; } - avahi_service_resolver_free(resolver); - chip::Platform::Delete(context); + sInstance.FreeResolveContext(handle); } CHIP_ERROR ChipDnssdInit(DnssdAsyncReturnCallback initCallback, DnssdAsyncReturnCallback errorCallback, void * context) @@ -988,7 +1047,10 @@ CHIP_ERROR ChipDnssdResolve(DnssdService * browseResult, chip::Inet::InterfaceId browseResult->mAddressType, Inet::IPAddressType::kAny, interface, callback, context); } -void ChipDnssdResolveNoLongerNeeded(const char * instanceName) {} +void ChipDnssdResolveNoLongerNeeded(const char * instanceName) +{ + MdnsAvahi::GetInstance().StopResolve(instanceName); +} CHIP_ERROR ChipDnssdReconfirmRecord(const char * hostname, chip::Inet::IPAddress address, chip::Inet::InterfaceId interface) { diff --git a/src/platform/Linux/DnssdImpl.h b/src/platform/Linux/DnssdImpl.h index e875e97830ebbf..2914a888c29381 100644 --- a/src/platform/Linux/DnssdImpl.h +++ b/src/platform/Linux/DnssdImpl.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -115,6 +116,7 @@ class MdnsAvahi CHIP_ERROR Resolve(const char * name, const char * type, DnssdServiceProtocol protocol, chip::Inet::IPAddressType addressType, chip::Inet::IPAddressType transportType, chip::Inet::InterfaceId interface, DnssdResolveCallback callback, void * context); + void StopResolve(const char * name); Poller & GetPoller() { return mPoller; } @@ -137,6 +139,7 @@ class MdnsAvahi struct ResolveContext { + size_t mNumber; // unique number for this context MdnsAvahi * mInstance; DnssdResolveCallback mCallback; void * mContext; @@ -145,12 +148,29 @@ class MdnsAvahi AvahiProtocol mTransport; AvahiProtocol mAddressType; std::string mFullType; - uint8_t mAttempts = 0; + uint8_t mAttempts = 0; + AvahiServiceResolver * mResolver = nullptr; + + ~ResolveContext() + { + if (mResolver != nullptr) + { + avahi_service_resolver_free(mResolver); + mResolver = nullptr; + } + } }; MdnsAvahi() : mClient(nullptr) {} static MdnsAvahi sInstance; + /// Allocates a new resolve context with a unique `mNumber` + ResolveContext * AllocateResolveContext(); + + ResolveContext * ResolveContextForHandle(size_t handle); + void FreeResolveContext(size_t handle); + void FreeResolveContext(const char * name); + static void HandleClientState(AvahiClient * client, AvahiClientState state, void * context); void HandleClientState(AvahiClient * client, AvahiClientState state); @@ -174,6 +194,10 @@ class MdnsAvahi std::map mPublishedGroups; Poller mPoller; static constexpr size_t kMaxBrowseRetries = 4; + + // Handling of allocated resolves + size_t mResolveCount = 0; + std::list mAllocatedResolves; }; } // namespace Dnssd diff --git a/src/platform/android/DiagnosticDataProviderImpl.h b/src/platform/android/DiagnosticDataProviderImpl.h index 26903d5d3ad3a4..7086b6c1a5a651 100644 --- a/src/platform/android/DiagnosticDataProviderImpl.h +++ b/src/platform/android/DiagnosticDataProviderImpl.h @@ -26,9 +26,9 @@ #include namespace { -constexpr int offPremiseServicesReachableUnknown = 0; -constexpr int offPremiseServicesReachableYes = 1; -constexpr int offPremiseServicesReachableNo = 2; +inline constexpr int offPremiseServicesReachableUnknown = 0; +inline constexpr int offPremiseServicesReachableYes = 1; +inline constexpr int offPremiseServicesReachableNo = 2; } // namespace namespace chip { diff --git a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h index 5ae1c9a610ef73..f6ebab8ea5e443 100644 --- a/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h +++ b/src/platform/bouffalolab/BL602/NetworkCommissioningDriver.h @@ -26,9 +26,9 @@ namespace NetworkCommissioning { void NetworkEventHandler(const ChipDeviceEvent * event, intptr_t arg); namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class BLScanResponseIterator : public Iterator diff --git a/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h b/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h index 5c9e5637857a14..8e5557b8787438 100644 --- a/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h +++ b/src/platform/bouffalolab/BL702/NetworkCommissioningDriver.h @@ -27,9 +27,9 @@ namespace NetworkCommissioning { void NetworkEventHandler(const ChipDeviceEvent * event, intptr_t arg); namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class BLScanResponseIterator : public Iterator diff --git a/src/platform/mbed/NetworkCommissioningDriver.h b/src/platform/mbed/NetworkCommissioningDriver.h index 017f69218267a1..9e61d4640ac4f5 100644 --- a/src/platform/mbed/NetworkCommissioningDriver.h +++ b/src/platform/mbed/NetworkCommissioningDriver.h @@ -29,9 +29,9 @@ namespace NetworkCommissioning { #include namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace class MbedScanResponseIterator : public Iterator diff --git a/src/platform/mt793x/NetworkCommissioningWiFiDriver.h b/src/platform/mt793x/NetworkCommissioningWiFiDriver.h index ac810727d92808..85822801c4212a 100644 --- a/src/platform/mt793x/NetworkCommissioningWiFiDriver.h +++ b/src/platform/mt793x/NetworkCommissioningWiFiDriver.h @@ -25,10 +25,10 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; -constexpr uint8_t kMaxWiFiScanAPs = 30; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiScanAPs = 30; } // namespace template diff --git a/src/platform/nrfconnect/wifi/NrfWiFiDriver.h b/src/platform/nrfconnect/wifi/NrfWiFiDriver.h index 7b57607b306822..d1fc765a72ac26 100644 --- a/src/platform/nrfconnect/wifi/NrfWiFiDriver.h +++ b/src/platform/nrfconnect/wifi/NrfWiFiDriver.h @@ -25,9 +25,9 @@ namespace chip { namespace DeviceLayer { namespace NetworkCommissioning { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 35; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 35; class NrfWiFiScanResponseIterator : public Iterator { diff --git a/src/platform/nxp/k32w/common/OTATlvProcessor.h b/src/platform/nxp/k32w/common/OTATlvProcessor.h index 400e23e8f9a4e1..534da067148da8 100644 --- a/src/platform/nxp/k32w/common/OTATlvProcessor.h +++ b/src/platform/nxp/k32w/common/OTATlvProcessor.h @@ -42,10 +42,10 @@ namespace chip { #define CHIP_OTA_PROCESSOR_START_IMAGE CHIP_ERROR_TLV_PROCESSOR(0x0D) // Descriptor constants -constexpr size_t kVersionStringSize = 64; -constexpr size_t kBuildDateSize = 64; +inline constexpr size_t kVersionStringSize = 64; +inline constexpr size_t kBuildDateSize = 64; -constexpr uint16_t requestedOtaMaxBlockSize = 1024; +inline constexpr uint16_t requestedOtaMaxBlockSize = 1024; /** * Used alongside RegisterDescriptorCallback to register diff --git a/src/platform/openiotsdk/KVPsaPsStore.h b/src/platform/openiotsdk/KVPsaPsStore.h index 7e68bdbd32491b..acd3f695765650 100644 --- a/src/platform/openiotsdk/KVPsaPsStore.h +++ b/src/platform/openiotsdk/KVPsaPsStore.h @@ -44,7 +44,7 @@ using namespace chip::Platform::PersistedStorage; // '01' = Matter region // '02' = the sub region group base offset (Factory, Config, Counter or KVS) // '14' = the id offset inside the group. -constexpr Key kMatterPsaPaKeyRegion = 0x010000U; +inline constexpr Key kMatterPsaPaKeyRegion = 0x010000U; constexpr inline Key GetPsaPaKey(Key group, uint8_t id) { return kMatterPsaPaKeyRegion | (group) << 8 | id; diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.h b/src/platform/silabs/NetworkCommissioningWiFiDriver.h index fd73568a6ba98b..55148e3700091d 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.h +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.h @@ -25,9 +25,9 @@ namespace DeviceLayer { namespace NetworkCommissioning { namespace { -constexpr uint8_t kMaxWiFiNetworks = 1; -constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; -constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; +inline constexpr uint8_t kMaxWiFiNetworks = 1; +inline constexpr uint8_t kWiFiScanNetworksTimeOutSeconds = 10; +inline constexpr uint8_t kWiFiConnectNetworkTimeoutSeconds = 20; } // namespace template diff --git a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp index bc38b874948eb2..0cc0061c6d9b81 100644 --- a/src/platform/silabs/SiWx917/wifi/ethernetif.cpp +++ b/src/platform/silabs/SiWx917/wifi/ethernetif.cpp @@ -217,7 +217,7 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) /* Confirm if packet is allocated */ status = sl_si91x_allocate_command_buffer(&buffer, (void **) &packet, sizeof(sl_si91x_packet_t) + framelength, - SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME); + SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS); VERIFY_STATUS_AND_RETURN(status); if (packet == NULL) { diff --git a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h index c63f358774902f..e153a12c0461ae 100644 --- a/src/platform/silabs/SiWx917/wifi/wfx_host_events.h +++ b/src/platform/silabs/SiWx917/wifi/wfx_host_events.h @@ -32,7 +32,7 @@ #include "sl_status.h" -#define SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME 1000 +#define SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS 1000 /* Wi-Fi events*/ #define SL_WFX_STARTUP_IND_ID (1) #define SL_WFX_CONNECT_IND_ID (2) diff --git a/src/platform/silabs/SilabsConfig.h b/src/platform/silabs/SilabsConfig.h index 391d6a71682e28..d5742c7c077d9d 100644 --- a/src/platform/silabs/SilabsConfig.h +++ b/src/platform/silabs/SilabsConfig.h @@ -62,11 +62,11 @@ namespace Internal { // '08' = Matter nvm3 region // '72' = the sub region group base offset (Factory, Config, Counter or KVS) // '01' = the id offset inside the group. -constexpr uint32_t kUserNvm3KeyDomainLoLimit = 0x000000U; // User Domain NVM3 Key Range lower limit -constexpr uint32_t kUserNvm3KeyDomainHiLimit = 0x00FFFFU; // User Domain NVM3 Key Range Maximum limit -constexpr uint32_t kMatterNvm3KeyDomain = 0x080000U; -constexpr uint32_t kMatterNvm3KeyLoLimit = 0x087200U; // Do not modify without Silabs GSDK team approval -constexpr uint32_t kMatterNvm3KeyHiLimit = 0x087FFFU; // Do not modify without Silabs GSDK team approval +inline constexpr uint32_t kUserNvm3KeyDomainLoLimit = 0x000000U; // User Domain NVM3 Key Range lower limit +inline constexpr uint32_t kUserNvm3KeyDomainHiLimit = 0x00FFFFU; // User Domain NVM3 Key Range Maximum limit +inline constexpr uint32_t kMatterNvm3KeyDomain = 0x080000U; +inline constexpr uint32_t kMatterNvm3KeyLoLimit = 0x087200U; // Do not modify without Silabs GSDK team approval +inline constexpr uint32_t kMatterNvm3KeyHiLimit = 0x087FFFU; // Do not modify without Silabs GSDK team approval constexpr inline uint32_t SilabsConfigKey(uint8_t keyBaseOffset, uint8_t id) { return kMatterNvm3KeyDomain | static_cast(keyBaseOffset) << 8 | id; diff --git a/src/platform/silabs/efr32/Efr32OpaqueKeypair.h b/src/platform/silabs/efr32/Efr32OpaqueKeypair.h index 91dd43d04c312c..9b17d42b590fbe 100644 --- a/src/platform/silabs/efr32/Efr32OpaqueKeypair.h +++ b/src/platform/silabs/efr32/Efr32OpaqueKeypair.h @@ -25,10 +25,10 @@ namespace DeviceLayer { namespace Internal { typedef uint16_t EFR32OpaqueKeyId; -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdUnknown = 0xFFFFU; // Do not modify, will impact existing deployments -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdVolatile = 0xFFFEU; // Do not modify, will impact existing deployments -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMin = 0x0U; // Do not modify, will impact existing deployments -constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMax = 0x1FFU; // Do not decrease, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdUnknown = 0xFFFFU; // Do not modify, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdVolatile = 0xFFFEU; // Do not modify, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMin = 0x0U; // Do not modify, will impact existing deployments +inline constexpr EFR32OpaqueKeyId kEFR32OpaqueKeyIdPersistentMax = 0x1FFU; // Do not decrease, will impact existing deployments enum class EFR32OpaqueKeyUsages : uint8_t { diff --git a/src/platform/silabs/efr32/wifi/ethernetif.cpp b/src/platform/silabs/efr32/wifi/ethernetif.cpp index 8b231c4e8b7898..a7173f38e23e91 100644 --- a/src/platform/silabs/efr32/wifi/ethernetif.cpp +++ b/src/platform/silabs/efr32/wifi/ethernetif.cpp @@ -31,7 +31,24 @@ #include "FreeRTOS.h" #include "event_groups.h" #include "task.h" +#if (SIWX_917 | EXP_BOARD) +#ifdef __cplusplus +extern "C" { +#endif +#include "cmsis_os2.h" +#include "sl_board_configuration.h" +#include "sl_net.h" +#include "sl_si91x_driver.h" +#include "sl_si91x_host_interface.h" +#include "sl_si91x_types.h" +#include "sl_wifi_callback_framework.h" +#include "sl_wifi_constants.h" +#include "sl_wifi_types.h" +#ifdef __cplusplus +} #endif +#endif // (SIWX_917 | EXP_BOARD) +#endif // WF200_WIFI #include "wfx_host_events.h" #include "wifi_config.h" @@ -333,10 +350,18 @@ static SemaphoreHandle_t ethout_sem; ******************************************************************************/ static err_t low_level_output(struct netif * netif, struct pbuf * p) { - void * rsipkt; +#if (SIWX_917 | EXP_BOARD) + sl_wifi_buffer_t * buffer; + sl_si91x_packet_t * packet; + sl_status_t status = SL_STATUS_OK; +#else + void * packet; +#endif struct pbuf * q; uint16_t framelength; - +#ifdef WIFI_DEBUG_ENABLED + SILABS_LOG("LWIP : low_level_output"); +#endif if (xSemaphoreTake(ethout_sem, portMAX_DELAY) != pdTRUE) { return ERR_IF; @@ -351,14 +376,26 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_IF; } /* Confirm if packet is allocated */ - rsipkt = wfx_rsi_alloc_pkt(); - if (!rsipkt) +#if (SIWX_917 | EXP_BOARD) + status = sl_si91x_allocate_command_buffer(&buffer, (void **) &packet, sizeof(sl_si91x_packet_t) + p->len, + SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS); + VERIFY_STATUS_AND_RETURN(status); + if (packet == NULL) +#else // RS9116 + packet = wfx_rsi_alloc_pkt(); + if (!packet) +#endif // SIWX_917 { SILABS_LOG("EN-RSI:No buf"); xSemaphoreGive(ethout_sem); +#if (SIWX_917 | EXP_BOARD) + return SL_STATUS_ALLOCATION_FAILED; + } + memset(packet->desc, 0, sizeof(packet->desc)); +#else // RS9116 return ERR_IF; } - +#endif // SIWX_917 #ifdef WIFI_DEBUG_ENABLED uint8_t * b = (uint8_t *) p->payload; SILABS_LOG("EN-RSI: Out [%02x:%02x:%02x:%02x:%02x:%02x][%02x:%02x:%02x:%02x:%02x:%02x]type=%02x%02x", b[0], b[1], b[2], b[3], @@ -367,22 +404,28 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) /* Generate the packet */ for (q = p, framelength = 0; q != NULL; q = q->next) { - wfx_rsi_pkt_add_data(rsipkt, (uint8_t *) (q->payload), (uint16_t) q->len, framelength); + wfx_rsi_pkt_add_data(packet, (uint8_t *) (q->payload), (uint16_t) q->len, framelength); framelength += q->len; } if (framelength < LWIP_FRAME_ALIGNMENT) { /* Add junk data to the end for frame alignment if framelength is less than 60 */ - wfx_rsi_pkt_add_data(rsipkt, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - framelength, framelength); + wfx_rsi_pkt_add_data(packet, (uint8_t *) (p->payload), LWIP_FRAME_ALIGNMENT - framelength, framelength); } #ifdef WIFI_DEBUG_ENABLED SILABS_LOG("EN-RSI: Sending %d", framelength); #endif +#if (SIWX_917 | EXP_BOARD) + packet->length = p->len & 0xFFF; + packet->command = RSI_SEND_RAW_DATA; + if (sl_si91x_driver_send_data_packet(SI91X_WLAN_CMD_QUEUE, buffer, 1000)) +#else /* forward the generated packet to RSI to * send the data over wifi network */ - if (wfx_rsi_send_data(rsipkt, framelength)) + if (wfx_rsi_send_data(packet, framelength)) +#endif { SILABS_LOG("*ERR*EN-RSI:Send fail"); xSemaphoreGive(ethout_sem); @@ -397,8 +440,9 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) return ERR_OK; } +#if (SIWX_917 | EXP_BOARD) /***************************************************************************** - * @fn void wfx_host_received_sta_frame_cb(uint8_t *buf, int len) + * @fn void sl_si91x_host_process_data_frame(uint8_t *buf, int len) * @brief * host received frame cb * @@ -409,6 +453,33 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) * @return * None ******************************************************************************/ +sl_status_t sl_si91x_host_process_data_frame(sl_wifi_interface_t interface, sl_wifi_buffer_t * buffer) +{ + void * packet; + struct netif * ifp; + sl_si91x_packet_t * rsi_pkt; + packet = sl_si91x_host_get_buffer_data(buffer, 0, NULL); + rsi_pkt = (sl_si91x_packet_t *) packet; + /* get the network interface for STATION interface, + * and forward the received frame buffer to LWIP + */ + if ((ifp = wfx_get_netif(SL_WFX_STA_INTERFACE)) != (struct netif *) 0) + { + low_level_input(ifp, rsi_pkt->data, rsi_pkt->length); + } + return SL_STATUS_OK; +} +#else + +/***************************************************************************** + * @fn void wfx_host_received_sta_frame_cb(uint8_t *buf, int len) + * @brief + * host received frame cb + * + @@ -409,17 +430,21 @@ static err_t low_level_output(struct netif * netif, struct pbuf * p) + * @return + * None + ******************************************************************************/ void wfx_host_received_sta_frame_cb(uint8_t * buf, int len) { struct netif * ifp; @@ -421,6 +492,7 @@ void wfx_host_received_sta_frame_cb(uint8_t * buf, int len) low_level_input(ifp, buf, len); } } +#endif #endif /* RS911x - with LWIP */ diff --git a/src/platform/silabs/efr32/wifi/wfx_host_events.h b/src/platform/silabs/efr32/wifi/wfx_host_events.h index 4fe2d5a96f6cb7..4070cf4ea93700 100644 --- a/src/platform/silabs/efr32/wifi/wfx_host_events.h +++ b/src/platform/silabs/efr32/wifi/wfx_host_events.h @@ -98,6 +98,14 @@ typedef struct __attribute__((__packed__)) sl_wfx_mib_req_s #include "wfx_msgs.h" +#if (SIWX_917 | EXP_BOARD) +#include "sl_si91x_types.h" +#include "sl_status.h" +#include "sl_wifi_constants.h" + +#define SL_WIFI_ALLOCATE_COMMAND_BUFFER_WAIT_TIME_MS 1000 +#endif + /* Wi-Fi events*/ #define SL_WFX_STARTUP_IND_ID 1 #define SL_WFX_CONNECT_IND_ID 2 @@ -350,13 +358,16 @@ void wfx_ip_changed_notify(int got_ip); #endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */ void wfx_ipv6_notify(int got_ip); +#if !(SIWX_917 | EXP_BOARD) +void * wfx_rsi_alloc_pkt(void); +#endif + #ifdef RS911X_WIFI /* RSI Power Save */ #if SL_ICD_ENABLED sl_status_t wfx_power_save(); #endif /* SL_ICD_ENABLED */ /* RSI for LWIP */ -void * wfx_rsi_alloc_pkt(void); void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off); int32_t wfx_rsi_send_data(void * p, uint16_t len); #endif /* RS911X_WIFI */ @@ -368,6 +379,12 @@ void sl_wfx_host_gpio_init(void); sl_status_t sl_wfx_host_process_event(sl_wfx_generic_message_t * event_payload); #endif +#if (SIWX_917 | EXP_BOARD) +void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin); +sl_status_t sl_si91x_driver_send_data_packet(sl_si91x_queue_type_t queue_type, sl_wifi_buffer_t * buffer, uint32_t wait_time); +sl_status_t sl_si91x_allocate_command_buffer(sl_wifi_buffer_t ** host_buffer, void ** buffer, uint32_t requested_buffer_size, + uint32_t wait_duration_ms); +#endif void wfx_retry_interval_handler(bool is_wifi_disconnection_event, uint16_t retryJoin); #ifdef __cplusplus diff --git a/src/platform/silabs/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp index 9b2b543a330055..a1f627bfc03f2a 100644 --- a/src/platform/silabs/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -42,7 +42,7 @@ extern "C" { #include "wfx_host_events.h" #include "wfx_rsi.h" #include "wfx_sl_ble_init.h" -#ifndef SIWX_917 +#if !(SIWX_917 | EXP_BOARD) #include #endif #include @@ -130,6 +130,7 @@ void sl_ble_event_handling_task(void) // Requests the connection parameters change with the remote device rsi_ble_conn_params_update(event_msg.resp_enh_conn.dev_addr, BLE_MIN_CONNECTION_INTERVAL_MS, BLE_MAX_CONNECTION_INTERVAL_MS, BLE_SLAVE_LATENCY_MS, BLE_TIMEOUT_MS); + rsi_ble_set_data_len(event_msg.resp_enh_conn.dev_addr, RSI_BLE_TX_OCTETS, RSI_BLE_TX_TIME); } break; case RSI_BLE_DISCONN_EVENT: { diff --git a/src/platform/silabs/rs911x/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h index 1b6040542ba674..07f50b9528f253 100644 --- a/src/platform/silabs/rs911x/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -19,7 +19,7 @@ #define RSI_BLE_CONFIG_H #include "rsi_ble_apis.h" -#ifdef SIWX_917 +#if (SIWX_917 | EXP_BOARD) #include "rsi_user.h" #else #include @@ -60,6 +60,14 @@ #define ADD_DEVICE_TO_WHITELIST (0x01) #define DELETE_DEVICE_FROM_WHITELIST (0x02) +#define CLEAR_ACCEPTLIST (0x00) +#define ADD_DEVICE_TO_ACCEPTLIST (0x01) +#define DELETE_DEVICE_FROM_ACCEPTLIST (0x02) + +#define RSI_BLE_TX_OCTETS 251 +#define RSI_BLE_TX_TIME 2120 // microseconds +#define RSI_BLE_CS_DATA_LENGTH 240 + #define ALL_PHYS (0x00) #define RSI_BLE_DEV_ADDR_RESOLUTION_ENABLE (0) @@ -82,7 +90,7 @@ #ifdef RSI_M4_INTERFACE #define RSI_BLE_MAX_NBR_ATT_REC (20) -#ifdef SIWX_917 +#if (SIWX_917 | EXP_BOARD) #define RSI_BLE_MAX_NBR_PERIPHERALS (1) #else #define RSI_BLE_MAX_NBR_SLAVES (1) @@ -92,7 +100,7 @@ #else #define RSI_BLE_MAX_NBR_ATT_REC (80) -#ifdef SIWX_917 +#if (SIWX_917 | EXP_BOARD) #define RSI_BLE_MAX_NBR_PERIPHERALS (3) #else #define RSI_BLE_MAX_NBR_SLAVES (3) @@ -103,8 +111,9 @@ #define RSI_BLE_MAX_NBR_ATT_SERV (10) -#ifdef SIWX_917 +#if (SIWX_917 | EXP_BOARD) #define RSI_BLE_MAX_NBR_CENTRALS (1) +#define FRONT_END_SWITCH_SEL2 BIT(30) #else #define RSI_BLE_MAX_NBR_MASTERS (1) #endif @@ -255,15 +264,16 @@ #define BLE_ATT_REC_SIZE (500) #define NO_OF_VAL_ATT (5) //! Attribute value count -#ifdef SIWX_917 +#if (SIWX_917 | EXP_BOARD) #define RSI_FEATURE_BIT_MAP \ (SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE | SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map #define RSI_TCP_IP_FEATURE_BIT_MAP \ (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features #define RSI_CUSTOM_FEATURE_BIT_MAP SL_SI91X_FEAT_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map -#ifdef CHIP_9117 +#ifdef CHIP_917 #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP \ - (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | FRONT_END_SWITCH_SEL2) + (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(1) | RAM_LEVEL_NWP_BASIC_MCU_ADV | \ + SL_SI91X_EXT_FEAT_FRONT_END_SWITCH_PINS_ULP_GPIO_4_5_0) #else #define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (SL_SI91X_EXT_FEAT_LOW_POWER_MODE | SL_SI91X_EXT_FEAT_XTAL_CLK_ENABLE(2)) #endif diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.c b/src/platform/silabs/rs911x/wfx_sl_ble_init.c index 1344847962b5d1..b0e1e2378ef341 100644 --- a/src/platform/silabs/rs911x/wfx_sl_ble_init.c +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.c @@ -185,7 +185,6 @@ int32_t rsi_ble_app_get_event(void) */ void rsi_ble_app_set_event(uint32_t event_num) { - SILABS_LOG("%s: starting", __func__); event_msg.ble_app_event_map |= BIT(event_num); osSemaphoreRelease(sl_ble_event_sem); return; @@ -209,7 +208,6 @@ void rsi_gatt_add_attribute_to_list(rsi_ble_t * p_val, uint16_t handle, uint16_t { if ((p_val->DATA_ix + data_len) >= BLE_ATT_REC_SIZE) { //! Check for max data length for the characteristic value - SILABS_LOG("\r\n no data memory for att rec values \r\n"); return; } @@ -351,10 +349,10 @@ void rsi_ble_add_char_val_att(void * serv_handler, uint16_t handle, uuid_t att_t uint32_t rsi_ble_add_matter_service(void) { - uuid_t custom_service = { RSI_BLE_MATTER_CUSTOM_SERVICE_UUID }; - custom_service.size = RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE; - custom_service.val.val16 = RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16; - uint8_t data[230] = { RSI_BLE_MATTER_CUSTOM_SERVICE_DATA }; + uuid_t custom_service = { RSI_BLE_MATTER_CUSTOM_SERVICE_UUID }; + custom_service.size = RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE; + custom_service.val.val16 = RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16; + uint8_t data[RSI_BLE_CS_DATA_LENGTH] = { RSI_BLE_MATTER_CUSTOM_SERVICE_DATA }; static const uuid_t custom_characteristic_RX = { .size = RSI_BLE_CUSTOM_CHARACTERISTIC_RX_SIZE, .reserved = { RSI_BLE_CUSTOM_CHARACTERISTIC_RX_RESERVED }, diff --git a/src/platform/silabs/rs911x/wfx_sl_ble_init.h b/src/platform/silabs/rs911x/wfx_sl_ble_init.h index 73e29e7fc4d485..2c124f4549caa1 100644 --- a/src/platform/silabs/rs911x/wfx_sl_ble_init.h +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.h @@ -42,7 +42,7 @@ #include #include #include -#ifndef SIWX_917 +#if !(SIWX_917 | EXP_BOARD) #include #include #include diff --git a/src/platform/telink/BUILD.gn b/src/platform/telink/BUILD.gn index 00fe34e81093bc..9864ae4b5dfd09 100644 --- a/src/platform/telink/BUILD.gn +++ b/src/platform/telink/BUILD.gn @@ -43,7 +43,6 @@ static_library("telink") { "ConfigurationManagerImpl.h", "ConnectivityManagerImpl.cpp", "ConnectivityManagerImpl.h", - "ICDUtil.cpp", "InetPlatformConfig.h", "KeyValueStoreManagerImpl.h", "PlatformManagerImpl.h", diff --git a/src/platform/telink/ICDUtil.cpp b/src/platform/telink/ICDUtil.cpp deleted file mode 100644 index b3dc9c80bbc9dd..00000000000000 --- a/src/platform/telink/ICDUtil.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* - * - * Copyright (c) 2023 Project CHIP Authors - * All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ICDUtil.h" - -ICDUtil ICDUtil::sICDUtil; - -CHIP_ERROR ICDUtil::OnSubscriptionRequested(chip::app::ReadHandler & aReadHandler, chip::Transport::SecureSession & aSecureSession) -{ - uint16_t agreedMaxInterval = CONFIG_CHIP_MAX_PREFERRED_SUBSCRIPTION_REPORT_INTERVAL; - uint16_t requestedMinInterval = 0; - uint16_t requestedMaxInterval = 0; - aReadHandler.GetReportingIntervals(requestedMinInterval, requestedMaxInterval); - - if (requestedMaxInterval > agreedMaxInterval) - { - agreedMaxInterval = requestedMaxInterval; - } - else if (agreedMaxInterval > kSubscriptionMaxIntervalPublisherLimit) - { - agreedMaxInterval = kSubscriptionMaxIntervalPublisherLimit; - } - - return aReadHandler.SetMaxReportingInterval(agreedMaxInterval); -} diff --git a/src/protocols/bdx/BdxMessages.h b/src/protocols/bdx/BdxMessages.h index 72e1ad2969ab5d..753520eab455d6 100644 --- a/src/protocols/bdx/BdxMessages.h +++ b/src/protocols/bdx/BdxMessages.h @@ -33,9 +33,9 @@ namespace chip { namespace bdx { -constexpr uint16_t kMaxFileDesignatorLen = 0xFF; +inline constexpr uint16_t kMaxFileDesignatorLen = 0xFF; -constexpr const char * kProtocolName = "BDX"; +inline constexpr const char * kProtocolName = "BDX"; enum class MessageType : uint8_t { diff --git a/src/protocols/bdx/BdxUri.h b/src/protocols/bdx/BdxUri.h index 776ccffe0973b0..8e072892f6fbcd 100644 --- a/src/protocols/bdx/BdxUri.h +++ b/src/protocols/bdx/BdxUri.h @@ -22,7 +22,7 @@ namespace chip { namespace bdx { -constexpr const char kScheme[] = "bdx://"; +inline constexpr const char kScheme[] = "bdx://"; /** * Parses the URI into NodeId and File Designator diff --git a/src/protocols/echo/Echo.h b/src/protocols/echo/Echo.h index 510bad30c24ca9..08690e2ae45abc 100644 --- a/src/protocols/echo/Echo.h +++ b/src/protocols/echo/Echo.h @@ -38,7 +38,7 @@ namespace chip { namespace Protocols { namespace Echo { -constexpr const char * kProtocolName = "Echo"; +inline constexpr const char * kProtocolName = "Echo"; /** * Echo Protocol Message Types diff --git a/src/protocols/interaction_model/Constants.h b/src/protocols/interaction_model/Constants.h index 77839513fa66d1..d5b33e3f23ff2b 100644 --- a/src/protocols/interaction_model/Constants.h +++ b/src/protocols/interaction_model/Constants.h @@ -45,12 +45,12 @@ namespace chip { namespace Protocols { namespace InteractionModel { -constexpr const char * kProtocolName = "IM"; +inline constexpr const char * kProtocolName = "IM"; /** * Version of the Interaction Model used by the node. */ -constexpr uint16_t kVersion = 0; +inline constexpr uint16_t kVersion = 0; /** * Interaction Model Protocol Message Types diff --git a/src/protocols/secure_channel/CASEDestinationId.h b/src/protocols/secure_channel/CASEDestinationId.h index 1be4a7cf88fe22..104d44a76d0715 100644 --- a/src/protocols/secure_channel/CASEDestinationId.h +++ b/src/protocols/secure_channel/CASEDestinationId.h @@ -28,8 +28,8 @@ namespace chip { -constexpr uint16_t kSigmaParamRandomNumberSize = 32; -constexpr uint16_t kIPKSize = Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES; +inline constexpr uint16_t kSigmaParamRandomNumberSize = 32; +inline constexpr uint16_t kIPKSize = Crypto::CHIP_CRYPTO_SYMMETRIC_KEY_LENGTH_BYTES; CHIP_ERROR GenerateCaseDestinationId(const ByteSpan & ipk, const ByteSpan & initiatorRandom, const ByteSpan & rootPubKey, FabricId fabricId, NodeId nodeId, MutableByteSpan & outDestinationId); diff --git a/src/protocols/secure_channel/Constants.h b/src/protocols/secure_channel/Constants.h index 2e0b104599e1dc..f624ee63612af4 100644 --- a/src/protocols/secure_channel/Constants.h +++ b/src/protocols/secure_channel/Constants.h @@ -43,7 +43,7 @@ namespace chip { namespace Protocols { namespace SecureChannel { -constexpr const char * kProtocolName = "SecureChannel"; +inline constexpr const char * kProtocolName = "SecureChannel"; /** * SecureChannel Protocol Message Types @@ -71,18 +71,20 @@ enum class MsgType : uint8_t CASE_Sigma2Resume = 0x33, StatusReport = 0x40, + + ICD_CheckIn = 0x50, }; // Placeholder value for the ProtocolCode field when the GeneralCode is Success or Continue. -constexpr uint16_t kProtocolCodeSuccess = 0x0000; -constexpr uint16_t kProtocolCodeNoSharedRoot = 0x0001; -constexpr uint16_t kProtocolCodeInvalidParam = 0x0002; -constexpr uint16_t kProtocolCodeCloseSession = 0x0003; -constexpr uint16_t kProtocolCodeBusy = 0x0004; -constexpr uint16_t kProtocolCodeSessionNotFound = 0x0005; +inline constexpr uint16_t kProtocolCodeSuccess = 0x0000; +inline constexpr uint16_t kProtocolCodeNoSharedRoot = 0x0001; +inline constexpr uint16_t kProtocolCodeInvalidParam = 0x0002; +inline constexpr uint16_t kProtocolCodeCloseSession = 0x0003; +inline constexpr uint16_t kProtocolCodeBusy = 0x0004; +inline constexpr uint16_t kProtocolCodeSessionNotFound = 0x0005; // Placeholder value for the ProtocolCode field when there is no additional protocol-specific code to provide more information. -constexpr uint16_t kProtocolCodeGeneralFailure = 0xFFFF; +inline constexpr uint16_t kProtocolCodeGeneralFailure = 0xFFFF; /** * Status Report - General Status Codes used to convey protocol-agnostic status info. diff --git a/src/protocols/secure_channel/PASESession.h b/src/protocols/secure_channel/PASESession.h index 39508d8342d7b8..02d8fa7d6636f8 100644 --- a/src/protocols/secure_channel/PASESession.h +++ b/src/protocols/secure_channel/PASESession.h @@ -44,7 +44,7 @@ namespace chip { extern const char * kSpake2pI2RSessionInfo; extern const char * kSpake2pR2ISessionInfo; -constexpr uint16_t kPBKDFParamRandomNumberSize = 32; +inline constexpr uint16_t kPBKDFParamRandomNumberSize = 32; using namespace Crypto; @@ -239,7 +239,7 @@ class DLL_EXPORT PASESession : public Messaging::UnsolicitedMessageHandler, }; // The following constants are node IDs that test devices and test controllers use. -constexpr chip::NodeId kTestControllerNodeId = 112233; -constexpr chip::NodeId kTestDeviceNodeId = 12344321; +inline constexpr chip::NodeId kTestControllerNodeId = 112233; +inline constexpr chip::NodeId kTestDeviceNodeId = 12344321; } // namespace chip diff --git a/src/protocols/secure_channel/RendezvousParameters.h b/src/protocols/secure_channel/RendezvousParameters.h index e563166f8acff0..a82628a483b2e9 100644 --- a/src/protocols/secure_channel/RendezvousParameters.h +++ b/src/protocols/secure_channel/RendezvousParameters.h @@ -33,7 +33,7 @@ namespace chip { const uint16_t kMaxRendezvousDiscriminatorValue = 0xFFF; // The largest supported value for sleepy idle interval and sleepy active interval -constexpr uint32_t kMaxSleepyInterval = 3600000; +inline constexpr uint32_t kMaxSleepyInterval = 3600000; class RendezvousParameters { diff --git a/src/protocols/user_directed_commissioning/UDCClients.h b/src/protocols/user_directed_commissioning/UDCClients.h index 47833bce421274..2edcdf3df2e74c 100644 --- a/src/protocols/user_directed_commissioning/UDCClients.h +++ b/src/protocols/user_directed_commissioning/UDCClients.h @@ -26,7 +26,7 @@ namespace Protocols { namespace UserDirectedCommissioning { // UDC client state times out after 1 hour. This may need to be tweaked. -constexpr const System::Clock::Timestamp kUDCClientTimeout = System::Clock::Milliseconds64(60 * 60 * 1000); +inline constexpr const System::Clock::Timestamp kUDCClientTimeout = System::Clock::Milliseconds64(60 * 60 * 1000); /** * Handles a set of UDC Client Processing States. diff --git a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h index e21c933455e594..8e22014e36aaf6 100644 --- a/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h +++ b/src/protocols/user_directed_commissioning/UserDirectedCommissioning.h @@ -41,10 +41,10 @@ namespace chip { namespace Protocols { namespace UserDirectedCommissioning { -constexpr const char * kProtocolName = "UserDirectedCommissioning"; +inline constexpr const char * kProtocolName = "UserDirectedCommissioning"; // Cache contains 16 clients. This may need to be tweaked. -constexpr uint8_t kMaxUDCClients = 16; +inline constexpr uint8_t kMaxUDCClients = 16; /** * User Directed Commissioning Protocol Message Types diff --git a/src/python_testing/TC_OPSTATE_2_1.py b/src/python_testing/TC_OPSTATE_2_1.py index 1b0e253f4aeb11..f532a1cdfecb08 100644 --- a/src/python_testing/TC_OPSTATE_2_1.py +++ b/src/python_testing/TC_OPSTATE_2_1.py @@ -175,7 +175,7 @@ async def test_TC_OPSTATE_2_1(self): self.print_step("7e", "Manually put the device in the unable to complete operation error state") input("Press Enter when done.\n") await self.read_and_validate_operror(step="7f", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kUnableToCompleteOperation) - if self.check_pics("OPSTATE.S.M.ERR_COMMAND_INVALID_STATE"): + if self.check_pics("OPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE"): self.print_step("7g", "Manually put the device in the command invalid error state") input("Press Enter when done.\n") await self.read_and_validate_operror(step="7h", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState) diff --git a/src/python_testing/TC_RVCOPSTATE_2_1.py b/src/python_testing/TC_RVCOPSTATE_2_1.py index 29d2757363a726..58c012c459ec86 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_1.py +++ b/src/python_testing/TC_RVCOPSTATE_2_1.py @@ -190,11 +190,11 @@ async def test_TC_RVCOPSTATE_2_1(self): self.print_step("7e", "Manually put the device in the unable to complete operation error state") input("Press Enter when done.\n") await self.read_and_validate_operror(step="7f", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kUnableToCompleteOperation) - if self.check_pics("RVCOPSTATE.S.M.ERR_COMMAND_INVALID_STATE"): + if self.check_pics("RVCOPSTATE.S.M.ERR_COMMAND_INVALID_IN_STATE"): self.print_step("7g", "Manually put the device in the command invalid error state") input("Press Enter when done.\n") await self.read_and_validate_operror(step="7h", expected_error=Clusters.OperationalState.Enums.ErrorStateEnum.kCommandInvalidInState) - if self.check_pics("RVCOPSTATE.S.M.ERR_FAILED_FIND_DOCK"): + if self.check_pics("RVCOPSTATE.S.M.ERR_FAILED_TO_FIND_CHARGING_DOCK"): self.print_step("7i", "Manually put the device in the failed to find dock error state") input("Press Enter when done.\n") await self.read_and_validate_operror(step="7j", expected_error=Clusters.RvcOperationalState.Enums.ErrorStateEnum.kFailedToFindChargingDock) diff --git a/src/setup_payload/AdditionalDataPayload.h b/src/setup_payload/AdditionalDataPayload.h index ede62352fadd45..78ba0137100aba 100644 --- a/src/setup_payload/AdditionalDataPayload.h +++ b/src/setup_payload/AdditionalDataPayload.h @@ -40,8 +40,8 @@ namespace chip { namespace SetupPayloadData { -constexpr uint8_t kRotatingDeviceIdLength = 18; -constexpr uint8_t kRotatingDeviceIdTag = 0x00; +inline constexpr uint8_t kRotatingDeviceIdLength = 18; +inline constexpr uint8_t kRotatingDeviceIdTag = 0x00; struct AdditionalDataPayload { diff --git a/src/setup_payload/SetupPayload.h b/src/setup_payload/SetupPayload.h index 4892e9ea0d2a23..0bb21698341279 100644 --- a/src/setup_payload/SetupPayload.h +++ b/src/setup_payload/SetupPayload.h @@ -68,14 +68,14 @@ const int kManualSetupVendorIdCharLength = 5; const int kManualSetupProductIdCharLength = 5; // Spec 5.1.4.2 CHIP-Common Reserved Tags -constexpr uint8_t kSerialNumberTag = 0x00; -constexpr uint8_t kPBKDFIterationsTag = 0x01; -constexpr uint8_t kBPKFSaltTag = 0x02; -constexpr uint8_t kNumberOFDevicesTag = 0x03; -constexpr uint8_t kCommissioningTimeoutTag = 0x04; - -constexpr uint32_t kSetupPINCodeMaximumValue = 99999998; -constexpr uint32_t kSetupPINCodeUndefinedValue = 0; +inline constexpr uint8_t kSerialNumberTag = 0x00; +inline constexpr uint8_t kPBKDFIterationsTag = 0x01; +inline constexpr uint8_t kBPKFSaltTag = 0x02; +inline constexpr uint8_t kNumberOFDevicesTag = 0x03; +inline constexpr uint8_t kCommissioningTimeoutTag = 0x04; + +inline constexpr uint32_t kSetupPINCodeMaximumValue = 99999998; +inline constexpr uint32_t kSetupPINCodeUndefinedValue = 0; // clang-format off const int kTotalPayloadDataSizeInBits = diff --git a/src/setup_payload/tests/TestHelpers.h b/src/setup_payload/tests/TestHelpers.h index dedd9040ae205e..8e83b512df26d1 100644 --- a/src/setup_payload/tests/TestHelpers.h +++ b/src/setup_payload/tests/TestHelpers.h @@ -30,16 +30,16 @@ namespace chip { const uint16_t kSmallBufferSizeInBytes = 1; const uint16_t kDefaultBufferSizeInBytes = 512; -const uint8_t kOptionalDefaultStringTag = 0x82; // Vendor "test" tag -constexpr char kOptionalDefaultStringValue[] = "myData"; +const uint8_t kOptionalDefaultStringTag = 0x82; // Vendor "test" tag +inline constexpr char kOptionalDefaultStringValue[] = "myData"; const uint8_t kOptionalDefaultIntTag = 0x83; // Vendor "test" tag const uint32_t kOptionalDefaultIntValue = 12; -constexpr char kSerialNumberDefaultStringValue[] = "123456789"; -const uint32_t kSerialNumberDefaultUInt32Value = 123456789; +inline constexpr char kSerialNumberDefaultStringValue[] = "123456789"; +const uint32_t kSerialNumberDefaultUInt32Value = 123456789; -constexpr const char * kDefaultPayloadQRCode = "MT:M5L90MP500K64J00000"; +inline constexpr const char * kDefaultPayloadQRCode = "MT:M5L90MP500K64J00000"; inline SetupPayload GetDefaultPayload() { diff --git a/src/system/SocketEvents.h b/src/system/SocketEvents.h index 508bbdcf759483..390fe78f597884 100644 --- a/src/system/SocketEvents.h +++ b/src/system/SocketEvents.h @@ -34,7 +34,7 @@ using SocketEvents = BitFlags; using SocketWatchToken = intptr_t; using SocketWatchCallback = void (*)(SocketEvents events, intptr_t data); -constexpr int kInvalidFd = -1; +inline constexpr int kInvalidFd = -1; } // namespace System } // namespace chip diff --git a/src/system/SystemClock.h b/src/system/SystemClock.h index 566e23d9738bc7..77196f995bbc89 100644 --- a/src/system/SystemClock.h +++ b/src/system/SystemClock.h @@ -68,7 +68,7 @@ using Seconds64 = std::chrono::duration; using Seconds32 = std::chrono::duration; using Seconds16 = std::chrono::duration; -constexpr Seconds16 kZero{ 0 }; +inline constexpr Seconds16 kZero{ 0 }; namespace Literals { diff --git a/src/system/SystemPacketBuffer.h b/src/system/SystemPacketBuffer.h index 6be8a0a2725ded..3c9d9aa1ff5cc0 100644 --- a/src/system/SystemPacketBuffer.h +++ b/src/system/SystemPacketBuffer.h @@ -123,7 +123,7 @@ class DLL_EXPORT PacketBuffer : private pbuf /** * The maximum size buffer an application can allocate with no protocol header reserve. */ -#if CHIP_SYSTEM_PACKETBUFFER_FROM_LWIP_POOL +#if CHIP_SYSTEM_CONFIG_USE_LWIP static constexpr uint16_t kMaxSizeWithoutReserve = LWIP_MEM_ALIGN_SIZE(PBUF_POOL_BUFSIZE); #else static constexpr uint16_t kMaxSizeWithoutReserve = CHIP_SYSTEM_CONFIG_PACKETBUFFER_CAPACITY_MAX; diff --git a/src/test_driver/openiotsdk/integration-tests/common/utils.py b/src/test_driver/openiotsdk/integration-tests/common/utils.py index 5b6e5c7f3d3332..1865cf6274f6ed 100644 --- a/src/test_driver/openiotsdk/integration-tests/common/utils.py +++ b/src/test_driver/openiotsdk/integration-tests/common/utils.py @@ -72,6 +72,7 @@ def discover_device(devCtrl, setupPayload): if not res: log.info("Device not found") return None + log.info("Device found at %r" % res[0]) return res[0] @@ -87,6 +88,8 @@ def connect_device(devCtrl, setupPayload, commissionableDevice, nodeId=None): if nodeId is None: nodeId = random.randint(1, 1000000) + log.info("Connecting to device %d" % nodeId) + pincode = int(setupPayload.attributes['SetUpPINCode']) try: res = devCtrl.CommissionOnNetwork( @@ -95,7 +98,7 @@ def connect_device(devCtrl, setupPayload, commissionableDevice, nodeId=None): log.error("Commission discovered device failed {}".format(str(ex))) return None if not res: - log.info("Commission discovered device failed") + log.info("Commission discovered device failed: %r" % res) return None return nodeId diff --git a/src/transport/SecureSessionTable.h b/src/transport/SecureSessionTable.h index c84fc94ea3a5d8..aff58c4e5fe0b0 100644 --- a/src/transport/SecureSessionTable.h +++ b/src/transport/SecureSessionTable.h @@ -26,8 +26,8 @@ namespace chip { namespace Transport { -constexpr uint16_t kMaxSessionID = UINT16_MAX; -constexpr uint16_t kUnsecuredSessionId = 0; +inline constexpr uint16_t kMaxSessionID = UINT16_MAX; +inline constexpr uint16_t kUnsecuredSessionId = 0; /** * Handles a set of sessions. diff --git a/src/transport/SessionManager.cpp b/src/transport/SessionManager.cpp index 7b9ebaf0ad8f68..63e08822c2343c 100644 --- a/src/transport/SessionManager.cpp +++ b/src/transport/SessionManager.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -47,15 +48,17 @@ #include #include -// Global object -chip::Transport::GroupPeerTable mGroupPeerMsgCounter; - namespace chip { using System::PacketBufferHandle; +using Transport::GroupPeerTable; using Transport::PeerAddress; using Transport::SecureSession; +namespace { +Global gGroupPeerTable; +} // namespace + uint32_t EncryptedPacketBufferHandle::GetMessageCounter() const { PacketHeader header; @@ -139,7 +142,7 @@ void SessionManager::Shutdown() */ void SessionManager::FabricRemoved(FabricIndex fabricIndex) { - mGroupPeerMsgCounter.FabricRemoved(fabricIndex); + gGroupPeerTable->FabricRemoved(fabricIndex); } CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, PayloadHeader & payloadHeader, @@ -159,6 +162,8 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P FabricIndex fabricIndex; #endif // CHIP_PROGRESS_LOGGING + PeerAddress destination_address; + switch (sessionHandle->GetSessionType()) { case Transport::Session::SessionType::kGroupOutgoing: { @@ -181,7 +186,7 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P return CHIP_ERROR_INTERNAL; } - PeerAddress destination_address = Transport::PeerAddress::Multicast(fabric->GetFabricId(), groupSession->GetGroupId()); + destination_address = Transport::PeerAddress::Multicast(fabric->GetFabricId(), groupSession->GetGroupId()); // Trace before any encryption MATTER_LOG_MESSAGE_SEND(chip::Tracing::OutgoingMessageType::kGroupMessage, &payloadHeader, &packetHeader, @@ -221,7 +226,7 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P .SetSessionId(session->GetPeerSessionId()) // .SetSessionType(Header::SessionType::kUnicastSession); - PeerAddress destination_address = session->GetPeerAddress(); + destination_address = session->GetPeerAddress(); // Trace before any encryption MATTER_LOG_MESSAGE_SEND(chip::Tracing::OutgoingMessageType::kSecureSession, &payloadHeader, &packetHeader, @@ -256,8 +261,8 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P break; } - auto unauthenticated = sessionHandle->AsUnauthenticatedSession(); - PeerAddress destination_address = unauthenticated->GetPeerAddress(); + auto unauthenticated = sessionHandle->AsUnauthenticatedSession(); + destination_address = unauthenticated->GetPeerAddress(); // Trace after all headers are settled. MATTER_LOG_MESSAGE_SEND(chip::Tracing::OutgoingMessageType::kUnauthenticated, &payloadHeader, &packetHeader, @@ -301,16 +306,24 @@ CHIP_ERROR SessionManager::PrepareMessage(const SessionHandle & sessionHandle, P snprintf(ackBuf, sizeof(ackBuf), " (Ack:" ChipLogFormatMessageCounter ")", payloadHeader.GetAckMessageCounter().Value()); } + char addressStr[Transport::PeerAddress::kMaxToStringSize] = { 0 }; + destination_address.ToString(addressStr); + + // Work around pigweed not allowing more than 14 format args in a log + // message when using tokenized logs. + char typeStr[4 + 1 + 2 + 1]; + snprintf(typeStr, sizeof(typeStr), "%04X:%02X", payloadHeader.GetProtocolID().GetProtocolId(), payloadHeader.GetMessageType()); + // // Legend that can be used to decode this log line can be found in messaging/README.md // ChipLogProgress(ExchangeManager, "<<< [E:" ChipLogFormatExchangeId " S:%u M:" ChipLogFormatMessageCounter - "%s] (%s) Msg TX to %u:" ChipLogFormatX64 " [%04X] --- Type %04X:%02X (%s:%s)", + "%s] (%s) Msg TX to %u:" ChipLogFormatX64 " [%04X] [%s] --- Type %s (%s:%s)", ChipLogValueExchangeIdFromSentHeader(payloadHeader), sessionHandle->SessionIdForLogging(), packetHeader.GetMessageCounter(), ackBuf, Transport::GetSessionTypeString(sessionHandle), fabricIndex, - ChipLogValueX64(destination), static_cast(compressedFabricId), - payloadHeader.GetProtocolID().GetProtocolId(), payloadHeader.GetMessageType(), protocolName, msgTypeName); + ChipLogValueX64(destination), static_cast(compressedFabricId), addressStr, typeStr, protocolName, + msgTypeName); #endif ReturnErrorOnFailure(packetHeader.EncodeBeforeData(message)); @@ -338,11 +351,6 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand multicastAddress = Transport::PeerAddress::Multicast(fabric->GetFabricId(), groupSession->GetGroupId()); destination = &multicastAddress; - char addressStr[Transport::PeerAddress::kMaxToStringSize]; - multicastAddress.ToString(addressStr, Transport::PeerAddress::kMaxToStringSize); - - ChipLogProgress(Inet, "(G) Sending msg " ChipLogFormatMessageCounter " to Multicast IPV6 address '%s'", - preparedMessage.GetMessageCounter(), addressStr); } break; case Transport::Session::SessionType::kSecure: { @@ -353,23 +361,12 @@ CHIP_ERROR SessionManager::SendPreparedMessage(const SessionHandle & sessionHand secure->MarkActive(); destination = &secure->GetPeerAddress(); - - ChipLogProgress(Inet, "(S) Sending msg " ChipLogFormatMessageCounter " on secure session with LSID: %u", - preparedMessage.GetMessageCounter(), secure->GetLocalSessionId()); } break; case Transport::Session::SessionType::kUnauthenticated: { auto unauthenticated = sessionHandle->AsUnauthenticatedSession(); unauthenticated->MarkActive(); destination = &unauthenticated->GetPeerAddress(); - -#if CHIP_PROGRESS_LOGGING - char addressStr[Transport::PeerAddress::kMaxToStringSize]; - destination->ToString(addressStr); - - ChipLogProgress(Inet, "(U) Sending msg " ChipLogFormatMessageCounter " to IP address '%s'", - preparedMessage.GetMessageCounter(), addressStr); -#endif } break; default: @@ -954,8 +951,8 @@ void SessionManager::SecureGroupMessageDispatch(const PacketHeader & partialPack Transport::PeerMessageCounter * counter = nullptr; if (CHIP_NO_ERROR == - mGroupPeerMsgCounter.FindOrAddPeer(groupContext.fabric_index, packetHeaderCopy.GetSourceNodeId().Value(), - packetHeaderCopy.IsSecureSessionControlMsg(), counter)) + gGroupPeerTable->FindOrAddPeer(groupContext.fabric_index, packetHeaderCopy.GetSourceNodeId().Value(), + packetHeaderCopy.IsSecureSessionControlMsg(), counter)) { if (Credentials::GroupDataProvider::SecurityPolicy::kTrustFirst == groupContext.security_policy) diff --git a/src/transport/SessionManager.h b/src/transport/SessionManager.h index e383c39d27a29c..5f2e6f7603cad0 100644 --- a/src/transport/SessionManager.h +++ b/src/transport/SessionManager.h @@ -528,7 +528,7 @@ namespace MessagePacketBuffer { /** * Maximum size of a message footer, in bytes. */ -constexpr uint16_t kMaxFooterSize = kMaxTagLen; +inline constexpr uint16_t kMaxFooterSize = kMaxTagLen; /** * Allocates a packet buffer with space for message headers and footers. diff --git a/src/transport/TraceMessage.h b/src/transport/TraceMessage.h index bf6cbaef99c861..d2be9478c53408 100644 --- a/src/transport/TraceMessage.h +++ b/src/transport/TraceMessage.h @@ -75,9 +75,9 @@ namespace chip { namespace trace { -constexpr const char * kTraceMessageEvent = "SecureMsg"; -constexpr const char * kTraceMessageSentDataFormat = "SecMsgSent"; -constexpr const char * kTraceMessageReceivedDataFormat = "SecMsgReceived"; +inline constexpr const char * kTraceMessageEvent = "SecureMsg"; +inline constexpr const char * kTraceMessageSentDataFormat = "SecMsgSent"; +inline constexpr const char * kTraceMessageReceivedDataFormat = "SecMsgReceived"; struct TraceSecureMessageSentData { diff --git a/third_party/asr/asr550x/asr_sdk b/third_party/asr/asr550x/asr_sdk index ffa0fdc7ea3b97..17999312cecdf7 160000 --- a/third_party/asr/asr550x/asr_sdk +++ b/third_party/asr/asr550x/asr_sdk @@ -1 +1 @@ -Subproject commit ffa0fdc7ea3b9762af7c2bb623aaac45ececdf8f +Subproject commit 17999312cecdf786ac86ea0554d760b258c8bc00 diff --git a/third_party/asr/asr582x/asr_sdk b/third_party/asr/asr582x/asr_sdk index 3134c59ed1d7cd..667c66a2f69eb6 160000 --- a/third_party/asr/asr582x/asr_sdk +++ b/third_party/asr/asr582x/asr_sdk @@ -1 +1 @@ -Subproject commit 3134c59ed1d7cd7221d730300fd9dee39c820a35 +Subproject commit 667c66a2f69eb6f4adf2e9bede0b6b88cd4378ce diff --git a/third_party/asr/asr595x/asr_sdk b/third_party/asr/asr595x/asr_sdk index e1a75ae0769681..ff434155859d58 160000 --- a/third_party/asr/asr595x/asr_sdk +++ b/third_party/asr/asr595x/asr_sdk @@ -1 +1 @@ -Subproject commit e1a75ae076968166684f68de9b38d3a1fd3122b9 +Subproject commit ff434155859d58b1a9d8294004f3bcfccf878416 diff --git a/third_party/bouffalolab/bl602/bl_iot_sdk.gni b/third_party/bouffalolab/bl602/bl_iot_sdk.gni index 3d649794d168a6..80801c984036ff 100644 --- a/third_party/bouffalolab/bl602/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl602/bl_iot_sdk.gni @@ -203,6 +203,7 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_hosal") { + defines = [ "CFG_BLE_ENABLE" ] sources = [ "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_adc.c", "${bl_iot_sdk_root}/components/platform/hosal/bl602_hal/bl_boot2.c", @@ -282,6 +283,7 @@ template("bl_iot_sdk") { ":${sdk_target_name}_config_fs", ":${sdk_target_name}_config_utils", ":${sdk_target_name}_config_freertos", + ":${sdk_target_name}_config_ble", ] public_configs = [ ":${sdk_target_name}_config", diff --git a/third_party/bouffalolab/bl702/bl_iot_sdk.gni b/third_party/bouffalolab/bl702/bl_iot_sdk.gni index 832e2261f628ef..a4e19a9db15813 100644 --- a/third_party/bouffalolab/bl702/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl702/bl_iot_sdk.gni @@ -260,6 +260,11 @@ template("bl_iot_sdk") { "DISABLE_PRINT=1", ] + if (defined(invoker.chip_config_network_layer_ble) && + invoker.chip_config_network_layer_ble) { + defines += [ "CFG_BLE_ENABLE" ] + } + sources = [ "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_adc.c", "${bl_iot_sdk_root}/components/platform/hosal/bl702_hal/bl_boot2.c", @@ -331,6 +336,12 @@ template("bl_iot_sdk") { ":${sdk_target_name}_config_utils", ":${sdk_target_name}_config_freertos", ] + + if (defined(invoker.chip_config_network_layer_ble) && + invoker.chip_config_network_layer_ble) { + configs += [ ":${sdk_target_name}_config_ble" ] + } + public_configs = [ ":${sdk_target_name}_config", ":${sdk_target_name}_config_hosal", @@ -752,6 +763,8 @@ template("bl_iot_sdk") { include_dirs = [ "${bl_iot_sdk_root}/components/platform/soc/bl702/bl702_ethernet/Inc", ] + + cflags_cc = [ "-Wno-conversion" ] } source_set("${sdk_target_name}_ethernet") { @@ -813,7 +826,6 @@ template("bl_iot_sdk") { public_configs = [ ":${sdk_target_name}_config", ":${sdk_target_name}_config_wifi", - ":${sdk_target_name}_config_lwip", ] cflags = [ diff --git a/third_party/bouffalolab/bl702l/bl_iot_sdk.gni b/third_party/bouffalolab/bl702l/bl_iot_sdk.gni index 391997f3a10ac3..c84a3b2cb8d8af 100644 --- a/third_party/bouffalolab/bl702l/bl_iot_sdk.gni +++ b/third_party/bouffalolab/bl702l/bl_iot_sdk.gni @@ -188,6 +188,11 @@ template("bl_iot_sdk") { } source_set("${sdk_target_name}_hosal") { + if (defined(invoker.chip_config_network_layer_ble) && + invoker.chip_config_network_layer_ble) { + defines = [ "CFG_BLE_ENABLE" ] + } + sources = [ "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_adc.c", "${bl_iot_sdk_root}/components/platform/hosal/bl702l_hal/bl_boot2.c", @@ -258,6 +263,11 @@ template("bl_iot_sdk") { ":${sdk_target_name}_config_fs", ":${sdk_target_name}_config_utils", ] + if (defined(invoker.chip_config_network_layer_ble) && + invoker.chip_config_network_layer_ble) { + configs += [ ":${sdk_target_name}_config_ble" ] + } + public_configs = [ ":${sdk_target_name}_config", ":${sdk_target_name}_config_hosal", @@ -688,7 +698,6 @@ template("bl_iot_sdk") { group(sdk_target_name) { public_deps = [ ":${sdk_target_name}_bl702l_rom_a0", - ":${sdk_target_name}_ble", ":${sdk_target_name}_fs", ":${sdk_target_name}_hosal", ":${sdk_target_name}_libc", @@ -699,6 +708,12 @@ template("bl_iot_sdk") { ":${sdk_target_name}_utils", ] public_configs = [ ":${sdk_target_name}_config_BSP_Driver" ] + + if (defined(invoker.chip_config_network_layer_ble) && + invoker.chip_config_network_layer_ble) { + public_deps += [ ":${sdk_target_name}_ble" ] + } + if (defined(invoker.chip_enable_openthread) && invoker.chip_enable_openthread) { public_deps += [ ":${sdk_target_name}_openthread_port" ] diff --git a/third_party/bouffalolab/repo b/third_party/bouffalolab/repo index 0c5772fb31ad08..098fc68d878777 160000 --- a/third_party/bouffalolab/repo +++ b/third_party/bouffalolab/repo @@ -1 +1 @@ -Subproject commit 0c5772fb31ad083cafdedc9a9de578d3abd5a234 +Subproject commit 098fc68d878777b7fe5eee39b5ab340db54b6af4 diff --git a/third_party/imgui/repo b/third_party/imgui/repo index 3816d478df0e7e..6addf28c4b5d8f 160000 --- a/third_party/imgui/repo +++ b/third_party/imgui/repo @@ -1 +1 @@ -Subproject commit 3816d478df0e7e292545fc7017b3d907c2dfd7a2 +Subproject commit 6addf28c4b5d8fd109a6db73bed6436952b230b2 diff --git a/third_party/java_deps/BUILD.gn b/third_party/java_deps/BUILD.gn index 58260d6d84ceb5..f71ab3702d2a91 100644 --- a/third_party/java_deps/BUILD.gn +++ b/third_party/java_deps/BUILD.gn @@ -26,11 +26,15 @@ java_prebuilt("json") { } java_prebuilt("kotlin-stdlib") { - jar_path = "artifacts/kotlin-stdlib-1.8.10.jar" + jar_path = "artifacts/kotlin-stdlib-1.8.20.jar" } java_prebuilt("kotlin-test") { - jar_path = "artifacts/kotlin-test-1.8.10.jar" + jar_path = "artifacts/kotlin-test-1.8.20.jar" +} + +java_prebuilt("kotlinx-coroutines-core-jvm") { + jar_path = "artifacts/kotlinx-coroutines-core-jvm-1.7.3.jar" } java_prebuilt("protobuf-java") { diff --git a/third_party/java_deps/set_up_java_deps.sh b/third_party/java_deps/set_up_java_deps.sh index e96e48d02e648c..b70438df77b129 100755 --- a/third_party/java_deps/set_up_java_deps.sh +++ b/third_party/java_deps/set_up_java_deps.sh @@ -37,8 +37,9 @@ download_jar "repo1.maven.org" "com/google/code/gson/gson/2.9.1" "gson-2.9.1.jar download_jar "repo1.maven.org" "com/google/protobuf/protobuf-java/3.22.0" "protobuf-java-3.22.0.jar" download_jar "repo1.maven.org" "com/google/truth/truth/1.1.3" "truth-1.1.3.jar" download_jar "repo1.maven.org" "junit/junit/4.13.2" "junit-4.13.2.jar" -download_jar "repo1.maven.org" "org/jetbrains/kotlin/kotlin-stdlib/1.8.10" "kotlin-stdlib-1.8.10.jar" -download_jar "repo1.maven.org" "org/jetbrains/kotlin/kotlin-test/1.8.10" "kotlin-test-1.8.10.jar" +download_jar "repo1.maven.org" "org/jetbrains/kotlin/kotlin-stdlib/1.8.20" "kotlin-stdlib-1.8.20.jar" +download_jar "repo1.maven.org" "org/jetbrains/kotlin/kotlin-test/1.8.20" "kotlin-test-1.8.20.jar" +download_jar "repo1.maven.org" "org/jetbrains/kotlinx/kotlinx-coroutines-core-jvm/1.7.3" "kotlinx-coroutines-core-jvm-1.7.3.jar" download_jar "repo1.maven.org" "org/json/json/20220924" "json-20220924.jar" # Unit test requirements diff --git a/third_party/nanopb/repo b/third_party/nanopb/repo index 9c11463770beab..f5f65a90c8057a 160000 --- a/third_party/nanopb/repo +++ b/third_party/nanopb/repo @@ -1 +1 @@ -Subproject commit 9c11463770beab0c6f244999e66676f9bca866fd +Subproject commit f5f65a90c8057a591f3cc98de40874bd78c9880d diff --git a/third_party/ot-br-posix/repo b/third_party/ot-br-posix/repo index 8a280e3516641f..ff2f24c5689ea4 160000 --- a/third_party/ot-br-posix/repo +++ b/third_party/ot-br-posix/repo @@ -1 +1 @@ -Subproject commit 8a280e3516641f707324bbc83059736d02f68955 +Subproject commit ff2f24c5689ea45d8ab27d3da86c54b6d5d6c83f diff --git a/third_party/pigweed/repo b/third_party/pigweed/repo index 9e4bfb92eb5ad7..e765c4d38e33d4 160000 --- a/third_party/pigweed/repo +++ b/third_party/pigweed/repo @@ -1 +1 @@ -Subproject commit 9e4bfb92eb5ad7458d7d4fd3543fb6f115cc744a +Subproject commit e765c4d38e33d4067f42345710ed6addc8800bce diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 79fbf8516347c6..4a2aad5cc02d75 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -73,26 +73,28 @@ template("siwx917_sdk") { "${wifi_sdk_root}/components/si91x/sl_net/inc", # siwx917_soc component + "${wifi_sdk_root}/components/siwx917_soc/boards/config/${silabs_board_lower}", + "${wifi_sdk_root}/components/siwx917_soc/boards/inc", + "${wifi_sdk_root}/components/siwx917_soc/core/chip/inc", "${wifi_sdk_root}/components/siwx917_soc/core/config", - "${wifi_sdk_root}/components/siwx917_soc/inc", "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver", "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/config", "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/CMSIS/Driver/Include", + "${wifi_sdk_root}/components/siwx917_soc/drivers/service/nvm3/inc", "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/inc", "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/inc", "${wifi_sdk_root}/components/siwx917_soc/drivers/rom_driver/inc", "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/inc", "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/config", - "${wifi_sdk_root}/components/siwx917_soc/boards/brd4325x/inc", - "${wifi_sdk_root}/components/siwx917_soc/wifi_inc", + "${wifi_sdk_root}/components/siwx917_soc/hal/inc", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/inc", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/wifi_inc", # wifi component "${wifi_sdk_root}/components/protocol/wifi/inc", # si91x_support component "${wifi_sdk_root}/components/si91x_support/inc", - "${wifi_sdk_root}/components/si91x_support/brd4325b", - "${wifi_sdk_root}/components/si91x_support/siwx917_soc", # wifi_resources component "${wifi_sdk_root}/resources/certificates", @@ -113,9 +115,27 @@ template("siwx917_sdk") { "${efr32_sdk_root}/util/third_party/freertos/kernel/include", "${wifi_sdk_root}/components/protocol/wifi/si91x", "${efr32_sdk_root}/util/third_party/freertos/kernel/portable/GCC/ARM_CM4F", + + #for LCD + "${efr32_sdk_root}/platform/middleware/glib", + "${efr32_sdk_root}/platform/middleware/glib/config", + "${efr32_sdk_root}/platform/middleware/glib/glib", + "${efr32_sdk_root}/platform/middleware/glib/dmd", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/inc", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/inc/memlcd_917", + "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/sleeptimer/inc", + "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/inc", + "${efr32_sdk_root}/hardware/driver/memlcd/src/ls013b7dh03", + "${efr32_sdk_root}/platform/service/sleeptimer/inc", + "${efr32_sdk_root}/platform/service/sleeptimer/config", + "${efr32_sdk_root}/platform/service/sleeptimer/src", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/inc", ] + if (silabs_board == "BRD4338A") { + _include_dirs += [ "${wifi_sdk_root}/components/siwx917_soc/core/config" ] + } + # Note that we're setting the mbedTLS and PSA configuration files through a # define. This means the build system by default does not pick up changes in # the content of these, only when changing the filename itself. @@ -162,14 +182,15 @@ template("siwx917_sdk") { "TA_DEEP_SLEEP_COMMON_FLASH", "SL_WIFI_COMPONENT_INCLUDED", "CHIP_917=1", - "ROMDRIVER_PRESENT", + "ROMDRIVER_PRESENT=1", "SL_CATALOG_FREERTOS_KERNEL_PRESENT=1", "SL_PLATFORM_EXAMPLES_ENABLE", - "SI91X_DEVICE", - "SI917_RADIO_BOARD", + "SI91X_DEVICE=1", + "SI917_RADIO_BOARD=1", "FLASH_PAGE_SIZE", "SL_NVM3_PRESENT", "ROM_WIRELESS", + "BRD4325A", #TODO: should be removed after SoC macro clean-up ] if (silabs_board == "BRD4325B") { @@ -182,7 +203,18 @@ template("siwx917_sdk") { "EXECUTION_FROM_RAM", ] if (silabs_board == "BRD4338A") { - defines += [ "SI917_RADIO_BOARD_V2=1" ] + defines += [ + "SI917_RADIO_BOARD_V2=1", + "SL_BOARD_NAME=\"BRD4338A\"", + "SL_BOARD_REV=\"A00\"", + "SPI_MULTI_SLAVE=1", + "SYSCALLS_WRITE=1", + "SI91X_PLATFORM=1", + "SI91X_SYSRTC_COUNT=1", + "SI91X_SYSRTC_PRESENT=1", + "SSI_ULP_MASTER=1", + "SL_MEMLCD_EXTCOMIN_PORT=0", + ] } } @@ -222,6 +254,15 @@ template("siwx917_sdk") { if (invoker.enable_dic) { _include_dirs += [ "${chip_root}/third_party/silabs/mqtt/stack" ] } + if (!disable_lcd) { + defines += [ + "CONFIG_ENABLE_UART", + "__STATIC_INLINE=static inline", + "SI91X_SYSRTC_COUNT=1", + "SYSCALLS_WRITE", + "SPI_MULTI_SLAVE", + ] + } # Enabling led interface if (use_wstk_leds) { @@ -326,14 +367,13 @@ template("siwx917_sdk") { # si91x_support component "${wifi_sdk_root}/components/si91x_support/src/sl_utility.c", - "${wifi_sdk_root}/components/siwx917_soc/boards/brd4325x/src/rsi_board.c", + "${wifi_sdk_root}/components/siwx917_soc/boards/src/rsi_board.c", "${wifi_sdk_root}/components/siwx917_soc/core/chip/src/rsi_deepsleep_soc.c", + "${wifi_sdk_root}/components/siwx917_soc/core/chip/src/rsi_system_config.c", "${wifi_sdk_root}/components/siwx917_soc/core/chip/src/system_si91x.c", "${wifi_sdk_root}/components/siwx917_soc/core/config/src/rsi_nvic_priorities_config.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/UDMA.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/USART.c", - "${wifi_sdk_root}/components/siwx917_soc/drivers/ipmu/ipmu_apis.c", - "${wifi_sdk_root}/components/siwx917_soc/drivers/ipmu/rsi_system_config_9117.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/clock_update.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_egpio.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_udma.c", @@ -347,13 +387,13 @@ template("siwx917_sdk") { "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_temp_sensor.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/systemlevel/src/rsi_ulpss_clk.c", "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/src/sl_si91x_usart.c", - "${wifi_sdk_root}/components/siwx917_soc/rsi_hal_mcu_m4_ram.c", - "${wifi_sdk_root}/components/siwx917_soc/rsi_hal_mcu_m4_rom.c", - "${wifi_sdk_root}/components/siwx917_soc/sl_platform.c", - "${wifi_sdk_root}/components/siwx917_soc/sl_platform_wireless.c", - "${wifi_sdk_root}/components/siwx917_soc/sl_si91x_bus.c", - "${wifi_sdk_root}/components/siwx917_soc/sl_si91x_timer.c", - "${wifi_sdk_root}/components/siwx917_soc/sli_siwx917_soc.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/rsi_hal_mcu_m4_ram.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/rsi_hal_mcu_m4_rom.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/sl_platform.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/sl_platform_wireless.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/sl_si91x_bus.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/sl_si91x_timer.c", + "${wifi_sdk_root}/components/siwx917_soc/platform_connectivity/sli_siwx917_soc.c", # modified hal "${efr32_sdk_root}/platform/emdrv/nvm3/src/nvm3_default_common_linker.c", @@ -372,7 +412,7 @@ template("siwx917_sdk") { "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/autogen/sl_event_handler.c", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/hal/rsi_hal_mcu_m4.c", "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/hal/rsi_hal_mcu_platform_init.c", - "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/src/sl_si91x_nvm3_hal_flash.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/service/nvm3/src/sl_si91x_nvm3_hal_flash.c", # mbedtls "${chip_root}/third_party/mbedtls/repo/library/aes.c", @@ -415,14 +455,39 @@ template("siwx917_sdk") { if (silabs_board == "BRD4325B") { sources += [ "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/src/startup_RS1xxxx.c", - "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/src/sl_si91x_dual_flash_intf.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/service/nvm3/src/sl_si91x_dual_flash_intf.c", ] } if (wifi_soc_common_flash) { sources += [ "${sdk_support_root}/matter/si91x/siwx917/${sdk_support_board}/support/src/startup_common_RS1xxxx.c", - "${wifi_sdk_root}/components/siwx917_soc/drivers/middleware/nvm3/src/sl_si91x_common_flash_intf.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/service/nvm3/src/sl_si91x_common_flash_intf.c", + ] + } + + if (!disable_lcd) { + sources += [ + "${efr32_sdk_root}/platform/middleware/glib/dmd/display/dmd_memlcd.c", + "${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_narrow_6x8.c", + "${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_normal_8x8.c", + "${efr32_sdk_root}/platform/middleware/glib/fonts/glib_font_number_16x20.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/bmp.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_bitmap.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_circle.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_line.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_polygon.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_rectangle.c", + "${efr32_sdk_root}/platform/middleware/glib/glib/glib_string.c", + "${efr32_sdk_root}/platform/service/sleeptimer/src/sl_sleeptimer.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/cmsis_driver/SPI.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/memlcd_917/sl_memlcd_spi.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/sl_memlcd.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/hardware_drivers/memlcd/src/sl_memlcd_display.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/peripheral_drivers/src/rsi_sysrtc.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/service/sleeptimer/src/sl_sleeptimer_hal_si91x_sysrtc.c", + "${wifi_sdk_root}/components/siwx917_soc/drivers/unified_api/src/sl_si91x_ulp_timer.c", ] } diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 8ecd5ff4db53cd..0c743ddcd83b39 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -21,8 +21,10 @@ import("${chip_root}/src/app/icd/icd.gni") import("${chip_root}/src/lib/lib.gni") import("silabs_board.gni") -if (use_rs9116 || use_SiWx917) { +if (use_rs9116) { wifi_sapi_root = "${chip_root}/third_party/silabs/wiseconnect-wifi-bt-sdk" +} else if (use_SiWx917) { + wifi_sdk_root = "${chip_root}/third_party/silabs/wifi_sdk" } declare_args() { @@ -195,6 +197,28 @@ template("efr32_sdk") { "${sl_ot_efr32_root}", ] + if (use_SiWx917) { + _include_dirs += [ + "${wifi_sdk_root}/components/si91x/inc", + "${wifi_sdk_root}/components/si91x/memory", + "${wifi_sdk_root}/components/si91x/sl_net/inc", + + # wifi component + "${wifi_sdk_root}/components/protocol/wifi/inc", + + # si91x_support component + "${wifi_sdk_root}/components/si91x_support/inc", + + # wifi_resources component + "${wifi_sdk_root}/resources/certificates", + "${wifi_sdk_root}/resources/defaults", + "${wifi_sdk_root}/resources/other", + + # network_manager component + "${wifi_sdk_root}/components/service/network_manager/inc", + ] + } + if (silabs_family != "mgm24") { _include_dirs += [ "${efr32_sdk_root}/platform/radio/rail_lib/hal", @@ -203,7 +227,11 @@ template("efr32_sdk") { } if (chip_enable_ble_rs911x) { - _include_dirs += [ "${wifi_sapi_root}/sapi/include" ] + if (use_rs9116) { + _include_dirs += [ "${wifi_sapi_root}/sapi/include" ] + } else { + _include_dirs += [ "${wifi_sdk_root}/components/si91x/ble/inc" ] + } _include_dirs += [ "${chip_root}/src/platform/silabs/rs911x" ] } @@ -255,7 +283,11 @@ template("efr32_sdk") { } if (chip_enable_ble_rs911x) { - defines += [ "RSI_BLE_ENABLE=1" ] + defines += [ + "RSI_BLE_ENABLE=1", + "BLE_ENABLE=1", + "RSI_LITTLE_ENDIAN=1", + ] } if (defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi) { @@ -284,7 +316,9 @@ template("efr32_sdk") { if (use_SiWx917) { defines += [ "EXP_BOARD=1", - "CHIP_9117=1", + "CHIP_917", + "CHIP_9117", + "SL_WIFI_COMPONENT_INCLUDED", ] } else if (use_wf200) { defines += [ @@ -703,12 +737,24 @@ template("efr32_sdk") { } if (chip_enable_ble_rs911x) { - sources += [ - "${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gap_apis.c", - "${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gatt_apis.c", - "${wifi_sapi_root}/sapi/bluetooth/rsi_bt_common_apis.c", - "${wifi_sapi_root}/sapi/driver/rsi_bt_ble.c", - ] + if (use_rs9116) { + sources += [ + "${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gap_apis.c", + "${wifi_sapi_root}/sapi/bluetooth/rsi_ble_gatt_apis.c", + "${wifi_sapi_root}/sapi/bluetooth/rsi_bt_common_apis.c", + "${wifi_sapi_root}/sapi/driver/rsi_bt_ble.c", + ] + } else { + sources += [ + "${wifi_sdk_root}/components/si91x/ble/src/rsi_ble_gap_apis.c", + "${wifi_sdk_root}/components/si91x/ble/src/rsi_ble_gatt_apis.c", + "${wifi_sdk_root}/components/si91x/ble/src/rsi_bt_ble.c", + "${wifi_sdk_root}/components/si91x/ble/src/rsi_bt_common_apis.c", + "${wifi_sdk_root}/components/si91x/ble/src/rsi_common_apis.c", + "${wifi_sdk_root}/components/si91x/ble/src/rsi_utils.c", + "${wifi_sdk_root}/components/si91x/ble/src/sl_si91x_ble.c", + ] + } } else { sources += [ "${efr32_sdk_root}/protocol/bluetooth/src/sl_bt_mbedtls_context.c", diff --git a/third_party/silabs/matter_support b/third_party/silabs/matter_support index 32535c94e815b6..d336c71c24b154 160000 --- a/third_party/silabs/matter_support +++ b/third_party/silabs/matter_support @@ -1 +1 @@ -Subproject commit 32535c94e815b60b9efd594abc20372850526c0b +Subproject commit d336c71c24b1541c9099a258216dfd4585ace9fe diff --git a/third_party/silabs/silabs_board.gni b/third_party/silabs/silabs_board.gni index d7dce160de622b..c69a09820d9c7f 100644 --- a/third_party/silabs/silabs_board.gni +++ b/third_party/silabs/silabs_board.gni @@ -15,6 +15,7 @@ declare_args() { # EFR32 board used silabs_board = "" + silabs_board_lower = "" # LCD is enabled by default # Boards BRD4166A, BRD2601B, BRD2703A and BRD4319A do not have a LCD so they disable it explicitly @@ -106,6 +107,7 @@ if (silabs_board == "BRD4304A") { disable_lcd = true show_qr_code = false wifi_soc = true + silabs_board_lower = "brd4325b" } else if (silabs_board == "BRD4325C") { silabs_family = "SiWx917-common" silabs_mcu = "SiWG917M111MGTBA" @@ -113,6 +115,7 @@ if (silabs_board == "BRD4304A") { show_qr_code = false wifi_soc = true wifi_soc_common_flash = true + silabs_board_lower = "brd4325c" } else if (silabs_board == "BRD4325G") { silabs_family = "SiWx917-common" silabs_mcu = "SiWG917M111MGTBA" @@ -120,13 +123,15 @@ if (silabs_board == "BRD4304A") { show_qr_code = false wifi_soc = true wifi_soc_common_flash = true + silabs_board_lower = "brd4325g" } else if (silabs_board == "BRD4338A") { silabs_family = "SiWx917-common" silabs_mcu = "SiWG917M111MGTBA" - disable_lcd = true - show_qr_code = false + disable_lcd = false + show_qr_code = true wifi_soc = true wifi_soc_common_flash = true + silabs_board_lower = "brd4338a" } else if (silabs_board == "BRD4180A") { assert( false, diff --git a/third_party/silabs/wifi_sdk b/third_party/silabs/wifi_sdk index 0f0cdcdc249b8d..f84bf6683b124b 160000 --- a/third_party/silabs/wifi_sdk +++ b/third_party/silabs/wifi_sdk @@ -1 +1 @@ -Subproject commit 0f0cdcdc249b8de03cb57b5095b290125f42030c +Subproject commit f84bf6683b124b62475cd456869c6db7c21ae24e