From 33b4fab4a324ec845a1893f36353d5a7a91749c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20BOU=C3=89?= Date: Tue, 27 Sep 2022 15:44:59 +0200 Subject: [PATCH 01/24] Update README.md (#22880) Fix wrong directory commands --- examples/tv-app/linux/README.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/tv-app/linux/README.md b/examples/tv-app/linux/README.md index 2919d074f461fe..8583b9fbb2de4c 100644 --- a/examples/tv-app/linux/README.md +++ b/examples/tv-app/linux/README.md @@ -46,8 +46,7 @@ Desktop 20.10 (aarch64)** Start the tv-app. Set ports to not conflict with other Matter apps you might run on the same machine (chip-tool, tv-casting-app, etc) - $ ./out/host/chip-tv-app --secured-device-port 5640 - --secured-commissioner-port 5552 + $ ./out/debug/chip-tv-app --secured-device-port 5640 --secured-commissioner-port 5552 Using the tv-app shell, invoke the controller commands: @@ -118,8 +117,8 @@ entry in the UDC cache): You can use chip-tool to launch apps by invoking the Application Launcher cluster on endpoint 1 using chiptool: - $ ./out/host/chip-tool applicationlauncher launch-app Data CatalogVendorId ApplicationId node-id endpoint-id - $ ./out/host/chip-tool applicationlauncher launch-app foo1 1 App2 1234 1 + $ ./out/debug/chip-tool applicationlauncher launch-app Data CatalogVendorId ApplicationId node-id endpoint-id + $ ./out/debug/chip-tool applicationlauncher launch-app foo1 1 App2 1234 1 - Target Navigation from chip-tool @@ -128,14 +127,14 @@ player) and on Content App endpoints: Read targets for a given endpoint: - $ ./out/host/chip-tool targetnavigator read attr-name node-id endpoint-id - $ ./out/host/chip-tool targetnavigator read target-navigator-list 1234 1 (video player endpoint 1) - $ ./out/host/chip-tool targetnavigator read target-navigator-list 1234 6 (content app endpoint 6 - requires app to be launched) + $ ./out/debug/chip-tool targetnavigator read attr-name node-id endpoint-id + $ ./out/debug/chip-tool targetnavigator read target-navigator-list 1234 1 (video player endpoint 1) + $ ./out/debug/chip-tool targetnavigator read target-navigator-list 1234 6 (content app endpoint 6 - requires app to be launched) Navigate to a new target: - $ ./out/host/chip-tool targetnavigator navigate-target Target Data node-id endpoint-id - $ ./out/host/chip-tool targetnavigator navigate-target 2 foo1 1234 6 (target id 2 on endpoint 6) + $ ./out/debug/chip-tool targetnavigator navigate-target Target Data node-id endpoint-id + $ ./out/debug/chip-tool targetnavigator navigate-target 2 foo1 1234 6 (target id 2 on endpoint 6) ## Casting @@ -147,11 +146,11 @@ player and/or a Content App on it. Start the tv-app: - $ ./out/host/chip-tv-app --secured-device-port 5640 --secured-commissioner-port 5552 + $ ./out/debug/chip-tv-app --secured-device-port 5640 --secured-commissioner-port 5552 Start the tv-casting-app: - $ ./out/host/chip-tv-casting-app + $ ./out/debug/chip-tv-casting-app TV casting app should discover video players on the network. Into the shell, enter "1" to select the first one in the list: From d520402e7794a72f9e73c08c885c663593afb4c1 Mon Sep 17 00:00:00 2001 From: manjunath-grl <102359958+manjunath-grl@users.noreply.github.com> Date: Wed, 28 Sep 2022 00:14:31 +0530 Subject: [PATCH 02/24] Modified IDM tests sep 27 (#22893) * Modified tests IDM-2.1 IDM-2.2 IDM-3.2 IDM-4.3 * Added "MCORE.SC.LWIP"high level PICS for TC-SC-4.9 --- .../tests/suites/certification/Test_TC_IDM_2_1.yaml | 2 +- .../tests/suites/certification/Test_TC_IDM_2_2.yaml | 6 +++--- .../tests/suites/certification/Test_TC_IDM_3_2.yaml | 12 ++++++------ .../tests/suites/certification/Test_TC_IDM_4_3.yaml | 4 ++-- .../tests/suites/certification/Test_TC_SC_4_9.yaml | 1 + 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/app/tests/suites/certification/Test_TC_IDM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_IDM_2_1.yaml index 56abae9e8e9738..ee60cf388ac721 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_2_1.yaml @@ -585,7 +585,7 @@ tests: verification: | DUT implementation required to verify read an attribute of data type Float - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: diff --git a/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml index f5aeaeeba553fd..3271a4a958925b 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_2_2.yaml @@ -419,7 +419,7 @@ tests: verification: | DUT implementation required to verify read an attribute of data type Float - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -581,7 +581,7 @@ tests: which is not readable. DUT responds with the report data action." verification: | DUT implementation required to verify read an attribute which is not having a read access - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -1044,7 +1044,7 @@ tests: PICS: MCORE.IDM.S.LargeData verification: | DUT implementation required to verify read an attribute which is is larger than 1 MTU(1280 bytes) - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: diff --git a/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml b/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml index b3e9be24ab838d..213433aa363da7 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_3_2.yaml @@ -219,7 +219,7 @@ tests: verification: | DUT implementation required to verify write an attribute of data type signed integer. - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -229,7 +229,7 @@ tests: verification: | DUT implementation required to verify write an attribute of data type float - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -239,7 +239,7 @@ tests: verification: | DUT implementation required to verify write an attribute of data type Octet String - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -249,7 +249,7 @@ tests: verification: | DUT implementation required to verify write an attribute ofdata type Struct - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -259,7 +259,7 @@ tests: verification: | DUT implementation required to verify write an attribute of data type List - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -842,5 +842,5 @@ tests: verification: | DUT implementation required to verify write an attribute which need NEEDS_TIMED_INTERACTION. - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_IDM_4_3.yaml b/src/app/tests/suites/certification/Test_TC_IDM_4_3.yaml index a12cdf8850d5fa..d6b93862812cb5 100644 --- a/src/app/tests/suites/certification/Test_TC_IDM_4_3.yaml +++ b/src/app/tests/suites/certification/Test_TC_IDM_4_3.yaml @@ -461,7 +461,7 @@ tests: Subscribe to an attribute of type signed integer to the Harness - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: @@ -475,7 +475,7 @@ tests: Subscribe to an attribute of type floating point to the Harness - If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "\Not Applicable\" + If the Vendor DUT doesn"t implement/supported this attribute, Please mark the test step as "Not Applicable" disabled: true - label: diff --git a/src/app/tests/suites/certification/Test_TC_SC_4_9.yaml b/src/app/tests/suites/certification/Test_TC_SC_4_9.yaml index b8d8dbb73d7e78..4d56dd2c32492c 100644 --- a/src/app/tests/suites/certification/Test_TC_SC_4_9.yaml +++ b/src/app/tests/suites/certification/Test_TC_SC_4_9.yaml @@ -19,6 +19,7 @@ name: PICS: - MCORE.ROLE.COMMISSIONEE + - MCORE.SC.LWIP config: nodeId: 0x12344321 From b7cdb2574b1eae0ef56e5c8d67caa024e1b953f9 Mon Sep 17 00:00:00 2001 From: rgoliver Date: Tue, 27 Sep 2022 14:52:53 -0400 Subject: [PATCH 03/24] RPC: Fix console python dependency (#22875) Add missing pw_tokenizer dependency. --- examples/common/pigweed/rpc_console/py/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/common/pigweed/rpc_console/py/BUILD.gn b/examples/common/pigweed/rpc_console/py/BUILD.gn index bcc57f42a7f07a..d250129dca13c5 100644 --- a/examples/common/pigweed/rpc_console/py/BUILD.gn +++ b/examples/common/pigweed/rpc_console/py/BUILD.gn @@ -37,6 +37,7 @@ pw_python_package("chip_rpc") { "$dir_pw_log_tokenized/py", "$dir_pw_protobuf_compiler/py", "$dir_pw_rpc/py", + "$dir_pw_tokenizer/py", "${chip_root}/examples/common/pigweed:attributes_service.python", "${chip_root}/examples/common/pigweed:button_service.python", "${chip_root}/examples/common/pigweed:descriptor_service.python", From 259feae09bd9a1e4f8b398a7c9755aa3b4e9273f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Sep 2022 14:53:43 -0400 Subject: [PATCH 04/24] Bump third_party/mbedtls/repo from `7c7a3ea` to `662b301` (#22860) Bumps [third_party/mbedtls/repo](https://github.com/ARMmbed/mbedtls) from `7c7a3ea` to `662b301`. - [Release notes](https://github.com/ARMmbed/mbedtls/releases) - [Commits](https://github.com/ARMmbed/mbedtls/compare/7c7a3eaab50d8f12832b8ea97f7664b49fc7d74d...662b301c27a55bf53b74e2aa54e16b0721b3bf82) --- updated-dependencies: - dependency-name: third_party/mbedtls/repo dependency-type: direct:production ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- third_party/mbedtls/repo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/mbedtls/repo b/third_party/mbedtls/repo index 7c7a3eaab50d8f..662b301c27a55b 160000 --- a/third_party/mbedtls/repo +++ b/third_party/mbedtls/repo @@ -1 +1 @@ -Subproject commit 7c7a3eaab50d8f12832b8ea97f7664b49fc7d74d +Subproject commit 662b301c27a55bf53b74e2aa54e16b0721b3bf82 From 2d32a70261d29a9b2597f4e27f74ac844d6a9953 Mon Sep 17 00:00:00 2001 From: Marcos B <15697303+gmarcosb@users.noreply.github.com> Date: Tue, 27 Sep 2022 13:56:00 -0600 Subject: [PATCH 05/24] NPE fix (#22886) * Output information about what's being broadcast * Expose/promote QNameString in Logging to allow other logging locations to get a formatted FullQName * Revert inadvertent build_overrides/pigweed_environment.gni This partially reverts commit 15639cf3c5ef3c21480e68b11bdbcd39012a7a11. # Conflicts: # build_overrides/pigweed_environment.gni * Update BUILD.gn deps for QNameString & move it to its own file to avoid circular deps in /responders * Remove unnecessary StringBuilder addition as QNameString is now in its own file * Restyled by whitespace * Restyled by clang-format * Check for null params Co-authored-by: Restyled.io --- .../java/src/chip/devicecontroller/ChipDeviceController.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java index c24d0dd298dd4f..62ed67132871d1 100644 --- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java +++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java @@ -50,6 +50,9 @@ public static void loadJni() { * ID */ public ChipDeviceController(ControllerParams params) { + if (params == null) { + throw new NullPointerException("params cannot be null"); + } deviceControllerPtr = newDeviceController(params); } From ba344ceff3b500aa7cb8241ca512942fa2126c4c Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 27 Sep 2022 15:56:25 -0400 Subject: [PATCH 06/24] Increase -Xmx for android builds from 2G to 4G (#22910) --- examples/tv-app/android/App/gradle.properties | 2 +- examples/tv-casting-app/android/App/gradle.properties | 2 +- src/android/CHIPTest/gradle.properties | 2 +- src/android/CHIPTool/gradle.properties | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/tv-app/android/App/gradle.properties b/examples/tv-app/android/App/gradle.properties index e94cae88f85eaa..7357abbe5e28e8 100644 --- a/examples/tv-app/android/App/gradle.properties +++ b/examples/tv-app/android/App/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/examples/tv-casting-app/android/App/gradle.properties b/examples/tv-casting-app/android/App/gradle.properties index d47c2f04446cf6..9bf7e81826e3d7 100644 --- a/examples/tv-casting-app/android/App/gradle.properties +++ b/examples/tv-casting-app/android/App/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/src/android/CHIPTest/gradle.properties b/src/android/CHIPTest/gradle.properties index 3026069c70e98f..a85d072fd2e1ed 100644 --- a/src/android/CHIPTest/gradle.properties +++ b/src/android/CHIPTest/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects diff --git a/src/android/CHIPTool/gradle.properties b/src/android/CHIPTool/gradle.properties index 164a67d7e5fcd2..71f72db8c81ef2 100644 --- a/src/android/CHIPTool/gradle.properties +++ b/src/android/CHIPTool/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m +org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -28,4 +28,4 @@ matterBuildSrcDir=../../../../out/android_arm64 # Semicolon-separated ABI filter list for building from source (aka IDE build). # Has no effect if matterSdkSourceBuild is false or matterBuildSrcDir is empty. # See https://developer.android.com/ndk/guides/abis#sa for a list of ABIs. -matterSourceBuildAbiFilters=arm64-v8a \ No newline at end of file +matterSourceBuildAbiFilters=arm64-v8a From 00db357f42416ebeca907efe543e177d068463d1 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Tue, 27 Sep 2022 17:35:32 -0400 Subject: [PATCH 07/24] Fix telink examples on vscode image (#22911) * Fix telink builds on vscode: force more env variables set * Fix unit tests --- scripts/build/builders/telink.py | 21 +++++++++------ .../build/testdata/build_all_except_host.txt | 27 ++++++++++++------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index 728d0dfb8338a9..8ec841285175f1 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -67,22 +67,26 @@ def __init__(self, self.app = app self.board = board - def generate(self): - if os.path.exists(self.output_dir): - return - + def get_cmd_prefixes(self): if not self._runner.dry_run: # Zephyr base if 'TELINK_ZEPHYR_BASE' not in os.environ: raise Exception("Telink builds require TELINK_ZEPHYR_BASE") - cmd = 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"\n' + cmd = 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr\n' + cmd += 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE"\n' if 'TELINK_ZEPHYR_SDK_DIR' in os.environ: cmd += 'export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR"\n' + return cmd + + def generate(self): + if os.path.exists(self.output_dir): + return + + cmd = self.get_cmd_prefixes() cmd += ''' -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {outdir} -b {board} {sourcedir} '''.format( @@ -97,8 +101,9 @@ def generate(self): def _build(self): logging.info('Compiling Telink at %s', self.output_dir) - self._Execute(['ninja', '-C', self.output_dir], - title='Building ' + self.identifier) + cmd = self.get_cmd_prefixes() + ("ninja -C %s" % self.output_dir) + + self._Execute(['bash', '-c', cmd], title='Building ' + self.identifier) def build_outputs(self): return { diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index d6548b7e44ffa6..1fa18a6a313842 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -1163,23 +1163,23 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/shell/qpg '--args=qpg_target_ic="qpg6105"' {out}/qpg-shell # Generating telink-tlsr9518adk80d-light -bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-light -b tlsr9518adk80d {root}/examples/lighting-app/telink' # Generating telink-tlsr9518adk80d-light-switch -bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-light-switch -b tlsr9518adk80d {root}/examples/light-switch-app/telink' # Generating telink-tlsr9518adk80d-ota-requestor -bash -c 'export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" -export ZEPHYR_TOOLCHAIN_VARIANT=zephyr source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-ota-requestor -b tlsr9518adk80d {root}/examples/ota-requestor-app/telink' @@ -2402,13 +2402,22 @@ ninja -C {out}/qpg-persistent-storage ninja -C {out}/qpg-shell # Building telink-tlsr9518adk80d-light -ninja -C {out}/telink-tlsr9518adk80d-light +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" +ninja -C {out}/telink-tlsr9518adk80d-light' # Building telink-tlsr9518adk80d-light-switch -ninja -C {out}/telink-tlsr9518adk80d-light-switch +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" +ninja -C {out}/telink-tlsr9518adk80d-light-switch' # Building telink-tlsr9518adk80d-ota-requestor -ninja -C {out}/telink-tlsr9518adk80d-ota-requestor +bash -c 'export ZEPHYR_TOOLCHAIN_VARIANT=zephyr +export ZEPHYR_BASE="$TELINK_ZEPHYR_BASE" +export ZEPHYR_SDK_INSTALL_DIR="$TELINK_ZEPHYR_SDK_DIR" +ninja -C {out}/telink-tlsr9518adk80d-ota-requestor' # Building tizen-arm-all-clusters ninja -C {out}/tizen-arm-all-clusters From 8e18aaa1e2bc39ffdbc45e66e867e95e458caadc Mon Sep 17 00:00:00 2001 From: Martin Turon Date: Wed, 28 Sep 2022 01:11:23 +0000 Subject: [PATCH 08/24] [test] Fix #22903 - fix unit test break when SECURITY_TEST_MODE=1 (#22904) --- src/transport/CryptoContext.cpp | 11 ++++++----- src/transport/tests/TestSessionManagerDispatch.cpp | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/transport/CryptoContext.cpp b/src/transport/CryptoContext.cpp index ac92cb4750e3e8..825aebac579e64 100644 --- a/src/transport/CryptoContext.cpp +++ b/src/transport/CryptoContext.cpp @@ -97,11 +97,12 @@ CHIP_ERROR CryptoContext::InitFromSecret(const ByteSpan & secret, const ByteSpan (void) infoLen; #warning \ - "Warning: CONFIG_SECURITY_TEST_MODE=1 bypassing key negotiation... All sessions will use known, fixed test key, and NodeID=0 in NONCE. Node can only communicate with other nodes built with this flag set. Requires build flag 'treat_warnings_as_errors=false'." - ChipLogError(SecureChannel, - "Warning: CONFIG_SECURITY_TEST_MODE=1 bypassing key negotiation... All sessions will use known, fixed test key, " - "and NodeID=0 in NONCE. " - "Node can only communicate with other nodes built with this flag set."); + "Warning: CHIP_CONFIG_SECURITY_TEST_MODE=1 bypassing key negotiation... All sessions will use known, fixed test key, and NodeID=0 in NONCE. Node can only communicate with other nodes built with this flag set. Requires build flag 'treat_warnings_as_errors=false'." + ChipLogError( + SecureChannel, + "Warning: CHIP_CONFIG_SECURITY_TEST_MODE=1 bypassing key negotiation... All sessions will use known, fixed test key, " + "and NodeID=0 in NONCE. " + "Node can only communicate with other nodes built with this flag set."); ReturnErrorOnFailure(mHKDF.HKDF_SHA256(kTestSharedSecret, CHIP_CONFIG_TEST_SHARED_SECRET_LENGTH, testSalt.data(), testSalt.size(), SEKeysInfo, sizeof(SEKeysInfo), &mKeys[0][0], sizeof(mKeys))); diff --git a/src/transport/tests/TestSessionManagerDispatch.cpp b/src/transport/tests/TestSessionManagerDispatch.cpp index 5cd224c9f4c443..641c568c9e701b 100644 --- a/src/transport/tests/TestSessionManagerDispatch.cpp +++ b/src/transport/tests/TestSessionManagerDispatch.cpp @@ -140,6 +140,7 @@ struct MessageTestEntry theMessageTestVector[] = { .sessionId = 0x0bb8, // 3000 .peerNodeId = 0x0000000000000000ULL, }, +#if !CHIP_CONFIG_SECURITY_TEST_MODE { .name = "secure group message (no privacy)", .peerAddr = "::1", @@ -169,6 +170,7 @@ struct MessageTestEntry theMessageTestVector[] = { .groupId = 2, .sourceNodeId = 0x0000000000000002ULL, }, +#endif // !CHIP_CONFIG_SECURITY_TEST_MODE }; const uint16_t theMessageTestVectorLength = sizeof(theMessageTestVector) / sizeof(theMessageTestVector[0]); From d4d27d94f4dee8db902c11c02416e8bacab535b4 Mon Sep 17 00:00:00 2001 From: Austin Bozowski Date: Tue, 27 Sep 2022 18:20:36 -0700 Subject: [PATCH 09/24] Increase chef GCB Bootstrap timeout to 45 Minutes (#22912) --- integrations/cloudbuild/chef.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index c51fde16de734b..b46ab6a2917f8a 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -10,7 +10,7 @@ steps: volumes: - name: pwenv path: /pwenv - timeout: 900s + timeout: 2700s - name: "connectedhomeip/chip-build-vscode:0.5.99" env: From 2c8dab23db098e471c3fa1c21431339c9d9c31a3 Mon Sep 17 00:00:00 2001 From: Timothy Maes Date: Wed, 28 Sep 2022 03:31:15 +0200 Subject: [PATCH 10/24] Added Color Temperature action, Enhanced Hue attribute (#22870) Co-authored-by: Nikita Solianik --- .../lighting-common/include/ColorFormat.h | 6 +++ .../lighting-common/src/ColorFormat.cpp | 53 ++++++++++++++++++ .../qpg/include/LightingManager.h | 3 ++ .../lighting-app/qpg/src/LightingManager.cpp | 16 ++++++ .../lighting-app/qpg/src/ZclCallbacks.cpp | 54 ++++++++++++------- 5 files changed, 114 insertions(+), 18 deletions(-) diff --git a/examples/lighting-app/lighting-common/include/ColorFormat.h b/examples/lighting-app/lighting-common/include/ColorFormat.h index 541155e6bf2f3c..1ad0cb0e75f4f4 100755 --- a/examples/lighting-app/lighting-common/include/ColorFormat.h +++ b/examples/lighting-app/lighting-common/include/ColorFormat.h @@ -40,5 +40,11 @@ struct XyColor_t uint16_t y; }; +struct CtColor_t +{ + uint16_t ctMireds; +}; + RgbColor_t XYToRgb(uint8_t Level, uint16_t currentX, uint16_t currentY); RgbColor_t HsvToRgb(HsvColor_t hsv); +RgbColor_t CTToRgb(CtColor_t ct); diff --git a/examples/lighting-app/lighting-common/src/ColorFormat.cpp b/examples/lighting-app/lighting-common/src/ColorFormat.cpp index dd76eebb782768..0b71b35d4a1ccb 100644 --- a/examples/lighting-app/lighting-common/src/ColorFormat.cpp +++ b/examples/lighting-app/lighting-common/src/ColorFormat.cpp @@ -130,3 +130,56 @@ RgbColor_t XYToRgb(uint8_t Level, uint16_t currentX, uint16_t currentY) return rgb; } + +RgbColor_t CTToRgb(CtColor_t ct) +{ + RgbColor_t rgb; + float r, g, b; + + // Algorithm credits to Tanner Helland: https://tannerhelland.com/2012/09/18/convert-temperature-rgb-algorithm-code.html + + // Convert Mireds to centiKelvins. k = 1,000,000/mired + float ctCentiKelvin = 10000 / ct.ctMireds; + + // Red + if (ctCentiKelvin <= 66) + { + r = 255; + } + else + { + r = 329.698727446f * pow(ctCentiKelvin - 60, -0.1332047592f); + } + + // Green + if (ctCentiKelvin <= 66) + { + g = 99.4708025861f * log(ctCentiKelvin) - 161.1195681661f; + } + else + { + g = 288.1221695283f * pow(ctCentiKelvin - 60, -0.0755148492f); + } + + // Blue + if (ctCentiKelvin >= 66) + { + b = 255; + } + else + { + if (ctCentiKelvin <= 19) + { + b = 0; + } + else + { + b = 138.5177312231 * log(ctCentiKelvin - 10) - 305.0447927307; + } + } + rgb.r = (uint8_t) clamp(r, 0, 255); + rgb.g = (uint8_t) clamp(g, 0, 255); + rgb.b = (uint8_t) clamp(b, 0, 255); + + return rgb; +} diff --git a/examples/lighting-app/qpg/include/LightingManager.h b/examples/lighting-app/qpg/include/LightingManager.h index 309a2f5766c3f7..b1cb0ab9ad1a18 100644 --- a/examples/lighting-app/qpg/include/LightingManager.h +++ b/examples/lighting-app/qpg/include/LightingManager.h @@ -41,6 +41,7 @@ class LightingManager LEVEL_ACTION, COLOR_ACTION_XY, COLOR_ACTION_HSV, + COLOR_ACTION_CT, INVALID_ACTION } Action; @@ -66,6 +67,7 @@ class LightingManager XyColor_t mXY; HsvColor_t mHSV; RgbColor_t mRGB; + CtColor_t mCT; LightingCallback_fn mActionInitiated_CB; LightingCallback_fn mActionCompleted_CB; @@ -74,6 +76,7 @@ class LightingManager void SetLevel(uint8_t aLevel); void SetColor(uint16_t x, uint16_t y); void SetColor(uint8_t hue, uint8_t saturation); + void SetColorTemperature(CtColor_t ct); void UpdateLight(); diff --git a/examples/lighting-app/qpg/src/LightingManager.cpp b/examples/lighting-app/qpg/src/LightingManager.cpp index 3f53f9a02f2644..9f00b25db45927 100644 --- a/examples/lighting-app/qpg/src/LightingManager.cpp +++ b/examples/lighting-app/qpg/src/LightingManager.cpp @@ -66,6 +66,7 @@ bool LightingManager::InitiateAction(Action_t aAction, int32_t aActor, uint16_t State_t new_state; XyColor_t xy; HsvColor_t hsv; + CtColor_t ct; switch (aAction) { @@ -86,6 +87,10 @@ bool LightingManager::InitiateAction(Action_t aAction, int32_t aActor, uint16_t hsv = *reinterpret_cast(value); ChipLogProgress(NotSpecified, "LightMgr:COLOR: hsv:%u|%u->%u|%u", mHSV.h, mHSV.s, hsv.h, hsv.s); break; + case COLOR_ACTION_CT: + ct.ctMireds = *reinterpret_cast(value); + ChipLogProgress(NotSpecified, "LightMgr:COLOR: ct:%u->%u", mCT.ctMireds, ct.ctMireds); + break; default: ChipLogProgress(NotSpecified, "LightMgr:Unknown"); break; @@ -157,6 +162,10 @@ bool LightingManager::InitiateAction(Action_t aAction, int32_t aActor, uint16_t { SetColor(hsv.h, hsv.s); } + else if (aAction == COLOR_ACTION_CT) + { + SetColorTemperature(ct); + } else { Set(new_state == kState_On); @@ -195,6 +204,13 @@ void LightingManager::SetColor(uint8_t hue, uint8_t saturation) UpdateLight(); } +void LightingManager::SetColorTemperature(CtColor_t ct) +{ + mCT = ct; + mRGB = CTToRgb(ct); + UpdateLight(); +} + void LightingManager::Set(bool aOn) { if (aOn) diff --git a/examples/lighting-app/qpg/src/ZclCallbacks.cpp b/examples/lighting-app/qpg/src/ZclCallbacks.cpp index 0d365320c7cf12..9faedea78dcec3 100644 --- a/examples/lighting-app/qpg/src/ZclCallbacks.cpp +++ b/examples/lighting-app/qpg/src/ZclCallbacks.cpp @@ -65,16 +65,14 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & return; } - if ((attributeId != ColorControl::Attributes::CurrentX::Id) && (attributeId != ColorControl::Attributes::CurrentY::Id) && - (attributeId != ColorControl::Attributes::CurrentHue::Id) && - (attributeId != ColorControl::Attributes::CurrentSaturation::Id)) - { - ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); - return; - } - - if (size == sizeof(uint16_t)) + /* XY color space */ + if (attributeId == ColorControl::Attributes::CurrentX::Id || attributeId == ColorControl::Attributes::CurrentY::Id) { + if (size != sizeof(uint16_t)) + { + ChipLogError(Zcl, "Wrong length for ColorControl value: %d", size); + return; + } XyColor_t xy; if (attributeId == ColorControl::Attributes::CurrentX::Id) { @@ -90,20 +88,37 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & EmberAfStatus status = ColorControl::Attributes::CurrentX::Get(endpoint, &xy.x); assert(status == EMBER_ZCL_STATUS_SUCCESS); } + ChipLogProgress(Zcl, "New XY color: %u|%u", xy.x, xy.y); LightingMgr().InitiateAction(LightingManager::COLOR_ACTION_XY, 0, sizeof(xy), (uint8_t *) &xy); } - else if (size == sizeof(uint8_t)) + /* HSV color space */ + else if (attributeId == ColorControl::Attributes::CurrentHue::Id || + attributeId == ColorControl::Attributes::CurrentSaturation::Id || + attributeId == ColorControl::Attributes::EnhancedCurrentHue::Id) { + if (size != sizeof(uint8_t)) + { + ChipLogError(Zcl, "Wrong length for ColorControl value: %d", size); + return; + } HsvColor_t hsv; - if (attributeId == ColorControl::Attributes::CurrentHue::Id) + if (attributeId == ColorControl::Attributes::EnhancedCurrentHue::Id) + { + // We only support 8-bit hue. Assuming hue is linear, normalize 16-bit to 8-bit. + hsv.h = (uint8_t)((*reinterpret_cast(value)) >> 8); + // get saturation from cluster value storage + EmberAfStatus status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s); + assert(status == EMBER_ZCL_STATUS_SUCCESS); + } + else if (attributeId == ColorControl::Attributes::CurrentHue::Id) { hsv.h = *value; // get saturation from cluster value storage EmberAfStatus status = ColorControl::Attributes::CurrentSaturation::Get(endpoint, &hsv.s); assert(status == EMBER_ZCL_STATUS_SUCCESS); } - if (attributeId == ColorControl::Attributes::CurrentSaturation::Id) + else if (attributeId == ColorControl::Attributes::CurrentSaturation::Id) { hsv.s = *value; // get hue from cluster value storage @@ -113,16 +128,19 @@ void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & ChipLogProgress(Zcl, "New HSV color: %u|%u", hsv.h, hsv.s); LightingMgr().InitiateAction(LightingManager::COLOR_ACTION_HSV, 0, sizeof(hsv), (uint8_t *) &hsv); } + else if (attributeId == ColorControl::Attributes::ColorTemperatureMireds::Id) + { + CtColor_t ct; + ct.ctMireds = *reinterpret_cast(value); + ChipLogProgress(Zcl, "New CT color: %u", ct.ctMireds); + LightingMgr().InitiateAction(LightingManager::COLOR_ACTION_CT, 0, sizeof(ct), (uint8_t *) &ct.ctMireds); + } else { - ChipLogError(Zcl, "Wrong length for ColorControl value: %d", size); + ChipLogProgress(Zcl, "Unknown attribute ID: " ChipLogFormatMEI, ChipLogValueMEI(attributeId)); + return; } } - else - { - ChipLogProgress(Zcl, "Unknown cluster ID: " ChipLogFormatMEI, ChipLogValueMEI(clusterId)); - return; - } } /** @brief OnOff Cluster Init From 5d140df5e5f24736f1c329965a017c9fe540a90c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 27 Sep 2022 21:40:32 -0400 Subject: [PATCH 11/24] Address post-landing review comments from PR 22521. (#22843) The comments came in after that PR merged. * Store NSNumber as the NodeID in MTRDevice. * Have a helper in MTRDevice for creating MTRBaseDevice instances. --- src/darwin/Framework/CHIP/MTRDevice.mm | 17 +- .../Framework/CHIP/MTRDeviceController.mm | 6 +- .../Framework/CHIP/MTRDevice_Internal.h | 4 +- .../CHIP/templates/MTRClusters-src.zapt | 2 +- .../CHIP/zap-generated/MTRClusters.mm | 558 ++++++------------ 5 files changed, 203 insertions(+), 384 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRDevice.mm b/src/darwin/Framework/CHIP/MTRDevice.mm index 039df3c916dd02..1bd8fbf362faf0 100644 --- a/src/darwin/Framework/CHIP/MTRDevice.mm +++ b/src/darwin/Framework/CHIP/MTRDevice.mm @@ -146,7 +146,7 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle { if (self = [super init]) { _lock = OS_UNFAIR_LOCK_INIT; - _nodeID = [nodeID unsignedLongLongValue]; + _nodeID = [nodeID copy]; _deviceController = controller; _queue = dispatch_queue_create("com.apple.matter.framework.xpc.workqueue", DISPATCH_QUEUE_SERIAL); ; @@ -286,7 +286,7 @@ - (void)subscribeWithMinInterval:(uint16_t)minInterval maxInterval:(uint16_t)max _subscriptionActive = YES; - [_deviceController getSessionForNode:_nodeID + [_deviceController getSessionForNode:[_nodeID unsignedLongLongValue] completion:^(chip::Messaging::ExchangeManager * _Nullable exchangeManager, const chip::Optional & session, NSError * _Nullable error) { if (error != nil) { @@ -369,7 +369,7 @@ - (void)subscribeWithMinInterval:(uint16_t)minInterval maxInterval:(uint16_t)max // Create work item, set ready handler to perform task, then enqueue the work MTRAsyncCallbackQueueWorkItem * workItem = [[MTRAsyncCallbackQueueWorkItem alloc] initWithQueue:_queue]; MTRAsyncCallbackReadyHandler readyHandler = ^(MTRDevice * device, NSUInteger retryCount) { - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.nodeID) controller:self.deviceController]; + MTRBaseDevice * baseDevice = [self newBaseDevice]; [baseDevice readAttributePathWithEndpointID:endpointID clusterID:clusterID @@ -412,7 +412,7 @@ - (void)writeAttributeWithEndpointID:(NSNumber *)endpointID timedWriteTimeout:(NSNumber * _Nullable)timeout { // Start the asynchronous operation - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.nodeID) controller:self.deviceController]; + MTRBaseDevice * baseDevice = [self newBaseDevice]; [baseDevice writeAttributeWithEndpointID:endpointID clusterID:clusterID @@ -446,7 +446,7 @@ - (void)invokeCommandWithEndpointID:(NSNumber *)endpointID completion:(MTRDeviceResponseHandler)completion { // Perform this operation - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.nodeID) controller:self.deviceController]; + MTRBaseDevice * baseDevice = [self newBaseDevice]; [baseDevice invokeCommandWithEndpointID:endpointID clusterID:clusterID @@ -469,7 +469,7 @@ - (void)openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode queue:(dispatch_queue_t)queue completion:(MTRDeviceOpenCommissioningWindowHandler)completion { - auto * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.nodeID) controller:self.deviceController]; + auto * baseDevice = [self newBaseDevice]; [baseDevice openCommissioningWindowWithSetupPasscode:setupPasscode discriminator:discriminator duration:duration @@ -689,6 +689,11 @@ - (void)setExpectedValues:(NSArray *> *)values expe os_unfair_lock_unlock(&self->_lock); } +- (MTRBaseDevice *)newBaseDevice +{ + return [[MTRBaseDevice alloc] initWithNodeID:self.nodeID controller:self.deviceController]; +} + @end #pragma mark - SubscriptionCallback diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index 221b4731d2dffb..c99341f689ae3b 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -524,11 +524,11 @@ - (MTRDevice *)deviceForNodeID:(NSNumber *)nodeID - (void)removeDevice:(MTRDevice *)device { os_unfair_lock_lock(&_deviceMapLock); - MTRDevice * deviceToRemove = self.nodeIDToDeviceMap[@(device.nodeID)]; + MTRDevice * deviceToRemove = self.nodeIDToDeviceMap[device.nodeID]; if (deviceToRemove == device) { - self.nodeIDToDeviceMap[@(device.nodeID)] = nil; + self.nodeIDToDeviceMap[device.nodeID] = nil; } else { - MTR_LOG_ERROR("Error: Cannot remove device %p with nodeID %llu", device, device.nodeID); + MTR_LOG_ERROR("Error: Cannot remove device %p with nodeID %llu", device, [device.nodeID unsignedLongLongValue]); } os_unfair_lock_unlock(&_deviceMapLock); } diff --git a/src/darwin/Framework/CHIP/MTRDevice_Internal.h b/src/darwin/Framework/CHIP/MTRDevice_Internal.h index a7e0ba5a9e571f..04511bfd6ddc19 100644 --- a/src/darwin/Framework/CHIP/MTRDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDevice_Internal.h @@ -33,8 +33,8 @@ typedef void (^MTRDevicePerformAsyncBlock)(MTRBaseDevice * baseDevice); - (void)setExpectedValues:(NSArray *> *)values expectedValueInterval:(NSNumber *)expectedValueIntervalMs; -@property (nonatomic, readonly, strong, nonnull) MTRDeviceController * deviceController; -@property (nonatomic, readonly) uint64_t nodeID; +@property (nonatomic, readonly) MTRDeviceController * deviceController; +@property (nonatomic, readonly, copy) NSNumber * nodeID; @end diff --git a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt index 8042a6951c43af..18dba454865a31 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusters-src.zapt @@ -55,7 +55,7 @@ using chip::SessionHandle; { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice *baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) controller:self.device.deviceController]; + MTRBaseDevice *baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTR{{>callbackName}}CallbackBridge(self.callbackQueue, baseDevice, {{#if hasSpecificResponse}} diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm index 98f95c8899f820..0cb9da06b3129e 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusters.mm @@ -61,8 +61,7 @@ - (void)identifyWithParams:(MTRIdentifyClusterIdentifyParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -95,8 +94,7 @@ - (void)triggerEffectWithParams:(MTRIdentifyClusterTriggerEffectParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -224,8 +222,7 @@ - (void)addGroupWithParams:(MTRGroupsClusterAddGroupParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGroupsClusterAddGroupResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -256,8 +253,7 @@ - (void)viewGroupWithParams:(MTRGroupsClusterViewGroupParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGroupsClusterViewGroupResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -287,8 +283,7 @@ - (void)getGroupMembershipWithParams:(MTRGroupsClusterGetGroupMembershipParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGroupsClusterGetGroupMembershipResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -339,8 +334,7 @@ - (void)removeGroupWithParams:(MTRGroupsClusterRemoveGroupParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGroupsClusterRemoveGroupResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -378,8 +372,7 @@ - (void)removeAllGroupsWithParams:(MTRGroupsClusterRemoveAllGroupsParams * _Null { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -411,8 +404,7 @@ - (void)addGroupIfIdentifyingWithParams:(MTRGroupsClusterAddGroupIfIdentifyingPa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -511,8 +503,7 @@ - (void)addSceneWithParams:(MTRScenesClusterAddSceneParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterAddSceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -618,8 +609,7 @@ - (void)viewSceneWithParams:(MTRScenesClusterViewSceneParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterViewSceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -650,8 +640,7 @@ - (void)removeSceneWithParams:(MTRScenesClusterRemoveSceneParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterRemoveSceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -682,8 +671,7 @@ - (void)removeAllScenesWithParams:(MTRScenesClusterRemoveAllScenesParams *)param { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterRemoveAllScenesResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -713,8 +701,7 @@ - (void)storeSceneWithParams:(MTRScenesClusterStoreSceneParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterStoreSceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -744,8 +731,7 @@ - (void)recallSceneWithParams:(MTRScenesClusterRecallSceneParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -789,8 +775,7 @@ - (void)getSceneMembershipWithParams:(MTRScenesClusterGetSceneMembershipParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterGetSceneMembershipResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -820,8 +805,7 @@ - (void)enhancedAddSceneWithParams:(MTRScenesClusterEnhancedAddSceneParams *)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterEnhancedAddSceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -927,8 +911,7 @@ - (void)enhancedViewSceneWithParams:(MTRScenesClusterEnhancedViewSceneParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterEnhancedViewSceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -959,8 +942,7 @@ - (void)copySceneWithParams:(MTRScenesClusterCopySceneParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRScenesClusterCopySceneResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -1104,8 +1086,7 @@ - (void)offWithParams:(MTROnOffClusterOffParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1143,8 +1124,7 @@ - (void)onWithParams:(MTROnOffClusterOnParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1182,8 +1162,7 @@ - (void)toggleWithParams:(MTROnOffClusterToggleParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1215,8 +1194,7 @@ - (void)offWithEffectWithParams:(MTROnOffClusterOffWithEffectParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1260,8 +1238,7 @@ - (void)onWithRecallGlobalSceneWithParams:(MTROnOffClusterOnWithRecallGlobalScen { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1293,8 +1270,7 @@ - (void)onWithTimedOffWithParams:(MTROnOffClusterOnWithTimedOffParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1578,8 +1554,7 @@ - (void)moveToLevelWithParams:(MTRLevelControlClusterMoveToLevelParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1620,8 +1595,7 @@ - (void)moveWithParams:(MTRLevelControlClusterMoveParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1662,8 +1636,7 @@ - (void)stepWithParams:(MTRLevelControlClusterStepParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1705,8 +1678,7 @@ - (void)stopWithParams:(MTRLevelControlClusterStopParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1740,8 +1712,7 @@ - (void)moveToLevelWithOnOffWithParams:(MTRLevelControlClusterMoveToLevelWithOnO { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1782,8 +1753,7 @@ - (void)moveWithOnOffWithParams:(MTRLevelControlClusterMoveWithOnOffParams *)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1824,8 +1794,7 @@ - (void)stepWithOnOffWithParams:(MTRLevelControlClusterStepWithOnOffParams *)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1867,8 +1836,7 @@ - (void)stopWithOnOffWithParams:(MTRLevelControlClusterStopWithOnOffParams *)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -1902,8 +1870,7 @@ - (void)moveToClosestFrequencyWithParams:(MTRLevelControlClusterMoveToClosestFre { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -2791,8 +2758,7 @@ - (void)instantActionWithParams:(MTRActionsClusterInstantActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -2829,8 +2795,7 @@ - (void)instantActionWithTransitionWithParams:(MTRActionsClusterInstantActionWit { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -2868,8 +2833,7 @@ - (void)startActionWithParams:(MTRActionsClusterStartActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -2906,8 +2870,7 @@ - (void)startActionWithDurationWithParams:(MTRActionsClusterStartActionWithDurat { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -2945,8 +2908,7 @@ - (void)stopActionWithParams:(MTRActionsClusterStopActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -2983,8 +2945,7 @@ - (void)pauseActionWithParams:(MTRActionsClusterPauseActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3021,8 +2982,7 @@ - (void)pauseActionWithDurationWithParams:(MTRActionsClusterPauseActionWithDurat { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3060,8 +3020,7 @@ - (void)resumeActionWithParams:(MTRActionsClusterResumeActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3098,8 +3057,7 @@ - (void)enableActionWithParams:(MTRActionsClusterEnableActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3136,8 +3094,7 @@ - (void)enableActionWithDurationWithParams:(MTRActionsClusterEnableActionWithDur { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3175,8 +3132,7 @@ - (void)disableActionWithParams:(MTRActionsClusterDisableActionParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3213,8 +3169,7 @@ - (void)disableActionWithDurationWithParams:(MTRActionsClusterDisableActionWithD { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3342,8 +3297,7 @@ - (void)mfgSpecificPingWithParams:(MTRBasicClusterMfgSpecificPingParams * _Nulla { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3650,8 +3604,7 @@ - (void)queryImageWithParams:(MTROTASoftwareUpdateProviderClusterQueryImageParam { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROTASoftwareUpdateProviderClusterQueryImageResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -3722,8 +3675,7 @@ - (void)applyUpdateRequestWithParams:(MTROTASoftwareUpdateProviderClusterApplyUp { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROTASoftwareUpdateProviderClusterApplyUpdateResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -3753,8 +3705,7 @@ - (void)notifyUpdateAppliedWithParams:(MTROTASoftwareUpdateProviderClusterNotify { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -3847,8 +3798,7 @@ - (void)announceOtaProviderWithParams:(MTROTASoftwareUpdateRequestorClusterAnnou { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -4673,8 +4623,7 @@ - (void)armFailSafeWithParams:(MTRGeneralCommissioningClusterArmFailSafeParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGeneralCommissioningClusterArmFailSafeResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -4705,8 +4654,7 @@ - (void)setRegulatoryConfigWithParams:(MTRGeneralCommissioningClusterSetRegulato { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGeneralCommissioningClusterSetRegulatoryConfigResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -4752,8 +4700,7 @@ - (void)commissioningCompleteWithParams:(MTRGeneralCommissioningClusterCommissio { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGeneralCommissioningClusterCommissioningCompleteResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -4901,8 +4848,7 @@ - (void)scanNetworksWithParams:(MTRNetworkCommissioningClusterScanNetworksParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRNetworkCommissioningClusterScanNetworksResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -4946,8 +4892,7 @@ - (void)addOrUpdateWiFiNetworkWithParams:(MTRNetworkCommissioningClusterAddOrUpd { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -4982,8 +4927,7 @@ - (void)addOrUpdateThreadNetworkWithParams:(MTRNetworkCommissioningClusterAddOrU { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -5017,8 +4961,7 @@ - (void)removeNetworkWithParams:(MTRNetworkCommissioningClusterRemoveNetworkPara { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -5052,8 +4995,7 @@ - (void)connectNetworkWithParams:(MTRNetworkCommissioningClusterConnectNetworkPa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRNetworkCommissioningClusterConnectNetworkResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -5087,8 +5029,7 @@ - (void)reorderNetworkWithParams:(MTRNetworkCommissioningClusterReorderNetworkPa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRNetworkCommissioningClusterNetworkConfigResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -5263,8 +5204,7 @@ - (void)retrieveLogsRequestWithParams:(MTRDiagnosticLogsClusterRetrieveLogsReque { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDiagnosticLogsClusterRetrieveLogsResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -5353,8 +5293,7 @@ - (void)testEventTriggerWithParams:(MTRGeneralDiagnosticsClusterTestEventTrigger { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -5527,8 +5466,7 @@ - (void)resetWatermarksWithParams:(MTRSoftwareDiagnosticsClusterResetWatermarksP { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -5659,8 +5597,7 @@ - (void)resetCountsWithParams:(MTRThreadNetworkDiagnosticsClusterResetCountsPara { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -6280,8 +6217,7 @@ - (void)resetCountsWithParams:(MTRWiFiNetworkDiagnosticsClusterResetCountsParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -6488,8 +6424,7 @@ - (void)resetCountsWithParams:(MTREthernetNetworkDiagnosticsClusterResetCountsPa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -6929,8 +6864,7 @@ - (void)openCommissioningWindowWithParams:(MTRAdministratorCommissioningClusterO { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -6970,8 +6904,7 @@ - (void)openBasicCommissioningWindowWithParams:(MTRAdministratorCommissioningClu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -7016,8 +6949,7 @@ - (void)revokeCommissioningWithParams:(MTRAdministratorCommissioningClusterRevok { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -7137,8 +7069,7 @@ - (void)attestationRequestWithParams:(MTROperationalCredentialsClusterAttestatio { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterAttestationResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7168,8 +7099,7 @@ - (void)certificateChainRequestWithParams:(MTROperationalCredentialsClusterCerti { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterCertificateChainResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7199,8 +7129,7 @@ - (void)CSRRequestWithParams:(MTROperationalCredentialsClusterCSRRequestParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterCSRResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7234,8 +7163,7 @@ - (void)addNOCWithParams:(MTROperationalCredentialsClusterAddNOCParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterNOCResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7273,8 +7201,7 @@ - (void)updateNOCWithParams:(MTROperationalCredentialsClusterUpdateNOCParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterNOCResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7308,8 +7235,7 @@ - (void)updateFabricLabelWithParams:(MTROperationalCredentialsClusterUpdateFabri { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterNOCResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7339,8 +7265,7 @@ - (void)removeFabricWithParams:(MTROperationalCredentialsClusterRemoveFabricPara { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTROperationalCredentialsClusterNOCResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7369,8 +7294,7 @@ - (void)addTrustedRootCertificateWithParams:(MTROperationalCredentialsClusterAdd { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -7510,8 +7434,7 @@ - (void)keySetWriteWithParams:(MTRGroupKeyManagementClusterKeySetWriteParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -7584,8 +7507,7 @@ - (void)keySetReadWithParams:(MTRGroupKeyManagementClusterKeySetReadParams *)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGroupKeyManagementClusterKeySetReadResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -7614,8 +7536,7 @@ - (void)keySetRemoveWithParams:(MTRGroupKeyManagementClusterKeySetRemoveParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -7649,8 +7570,7 @@ - (void)keySetReadAllIndicesWithParams:(MTRGroupKeyManagementClusterKeySetReadAl { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRGroupKeyManagementClusterKeySetReadAllIndicesResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8022,8 +7942,7 @@ - (void)changeToModeWithParams:(MTRModeSelectClusterChangeToModeParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8199,8 +8118,7 @@ - (void)lockDoorWithParams:(MTRDoorLockClusterLockDoorParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8241,8 +8159,7 @@ - (void)unlockDoorWithParams:(MTRDoorLockClusterUnlockDoorParams * _Nullable)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8283,8 +8200,7 @@ - (void)unlockWithTimeoutWithParams:(MTRDoorLockClusterUnlockWithTimeoutParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8324,8 +8240,7 @@ - (void)setWeekDayScheduleWithParams:(MTRDoorLockClusterSetWeekDayScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8365,8 +8280,7 @@ - (void)getWeekDayScheduleWithParams:(MTRDoorLockClusterGetWeekDayScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDoorLockClusterGetWeekDayScheduleResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8396,8 +8310,7 @@ - (void)clearWeekDayScheduleWithParams:(MTRDoorLockClusterClearWeekDaySchedulePa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8431,8 +8344,7 @@ - (void)setYearDayScheduleWithParams:(MTRDoorLockClusterSetYearDayScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8469,8 +8381,7 @@ - (void)getYearDayScheduleWithParams:(MTRDoorLockClusterGetYearDayScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDoorLockClusterGetYearDayScheduleResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8500,8 +8411,7 @@ - (void)clearYearDayScheduleWithParams:(MTRDoorLockClusterClearYearDaySchedulePa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8535,8 +8445,7 @@ - (void)setHolidayScheduleWithParams:(MTRDoorLockClusterSetHolidayScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8574,8 +8483,7 @@ - (void)getHolidayScheduleWithParams:(MTRDoorLockClusterGetHolidayScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDoorLockClusterGetHolidayScheduleResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8604,8 +8512,7 @@ - (void)clearHolidayScheduleWithParams:(MTRDoorLockClusterClearHolidaySchedulePa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8638,8 +8545,7 @@ - (void)setUserWithParams:(MTRDoorLockClusterSetUserParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8709,8 +8615,7 @@ - (void)getUserWithParams:(MTRDoorLockClusterGetUserParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDoorLockClusterGetUserResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8739,8 +8644,7 @@ - (void)clearUserWithParams:(MTRDoorLockClusterClearUserParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -8777,8 +8681,7 @@ - (void)setCredentialWithParams:(MTRDoorLockClusterSetCredentialParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDoorLockClusterSetCredentialResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8835,8 +8738,7 @@ - (void)getCredentialStatusWithParams:(MTRDoorLockClusterGetCredentialStatusPara { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRDoorLockClusterGetCredentialStatusResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -8867,8 +8769,7 @@ - (void)clearCredentialWithParams:(MTRDoorLockClusterClearCredentialParams *)par { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9621,8 +9522,7 @@ - (void)upOrOpenWithParams:(MTRWindowCoveringClusterUpOrOpenParams * _Nullable)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9663,8 +9563,7 @@ - (void)downOrCloseWithParams:(MTRWindowCoveringClusterDownOrCloseParams * _Null { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9705,8 +9604,7 @@ - (void)stopMotionWithParams:(MTRWindowCoveringClusterStopMotionParams * _Nullab { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9738,8 +9636,7 @@ - (void)goToLiftValueWithParams:(MTRWindowCoveringClusterGoToLiftValueParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9772,8 +9669,7 @@ - (void)goToLiftPercentageWithParams:(MTRWindowCoveringClusterGoToLiftPercentage { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9806,8 +9702,7 @@ - (void)goToTiltValueWithParams:(MTRWindowCoveringClusterGoToTiltValueParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -9840,8 +9735,7 @@ - (void)goToTiltPercentageWithParams:(MTRWindowCoveringClusterGoToTiltPercentage { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -10132,8 +10026,7 @@ - (void)barrierControlGoToPercentWithParams:(MTRBarrierControlClusterBarrierCont { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -10175,8 +10068,7 @@ - (void)barrierControlStopWithParams:(MTRBarrierControlClusterBarrierControlStop { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -10794,8 +10686,7 @@ - (void)setpointRaiseLowerWithParams:(MTRThermostatClusterSetpointRaiseLowerPara { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -10829,8 +10720,7 @@ - (void)setWeeklyScheduleWithParams:(MTRThermostatClusterSetWeeklyScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -10902,8 +10792,7 @@ - (void)getWeeklyScheduleWithParams:(MTRThermostatClusterGetWeeklyScheduleParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRThermostatClusterGetWeeklyScheduleResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -10944,8 +10833,7 @@ - (void)clearWeeklyScheduleWithParams:(MTRThermostatClusterClearWeeklySchedulePa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12376,8 +12264,7 @@ - (void)moveToHueWithParams:(MTRColorControlClusterMoveToHueParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12415,8 +12302,7 @@ - (void)moveHueWithParams:(MTRColorControlClusterMoveHueParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12452,8 +12338,7 @@ - (void)stepHueWithParams:(MTRColorControlClusterStepHueParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12490,8 +12375,7 @@ - (void)moveToSaturationWithParams:(MTRColorControlClusterMoveToSaturationParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12527,8 +12411,7 @@ - (void)moveSaturationWithParams:(MTRColorControlClusterMoveSaturationParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12564,8 +12447,7 @@ - (void)stepSaturationWithParams:(MTRColorControlClusterStepSaturationParams *)p { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12602,8 +12484,7 @@ - (void)moveToHueAndSaturationWithParams:(MTRColorControlClusterMoveToHueAndSatu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12640,8 +12521,7 @@ - (void)moveToColorWithParams:(MTRColorControlClusterMoveToColorParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12678,8 +12558,7 @@ - (void)moveColorWithParams:(MTRColorControlClusterMoveColorParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12715,8 +12594,7 @@ - (void)stepColorWithParams:(MTRColorControlClusterStepColorParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12753,8 +12631,7 @@ - (void)moveToColorTemperatureWithParams:(MTRColorControlClusterMoveToColorTempe { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12790,8 +12667,7 @@ - (void)enhancedMoveToHueWithParams:(MTRColorControlClusterEnhancedMoveToHuePara { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12829,8 +12705,7 @@ - (void)enhancedMoveHueWithParams:(MTRColorControlClusterEnhancedMoveHueParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12866,8 +12741,7 @@ - (void)enhancedStepHueWithParams:(MTRColorControlClusterEnhancedStepHueParams * { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12904,8 +12778,7 @@ - (void)enhancedMoveToHueAndSaturationWithParams:(MTRColorControlClusterEnhanced { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12942,8 +12815,7 @@ - (void)colorLoopSetWithParams:(MTRColorControlClusterColorLoopSetParams *)param { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -12984,8 +12856,7 @@ - (void)stopMoveStepWithParams:(MTRColorControlClusterStopMoveStepParams *)param { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -13019,8 +12890,7 @@ - (void)moveColorTemperatureWithParams:(MTRColorControlClusterMoveColorTemperatu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -13058,8 +12928,7 @@ - (void)stepColorTemperatureWithParams:(MTRColorControlClusterStepColorTemperatu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -15116,8 +14985,7 @@ - (void)changeChannelWithParams:(MTRChannelClusterChangeChannelParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRChannelClusterChangeChannelResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15146,8 +15014,7 @@ - (void)changeChannelByNumberWithParams:(MTRChannelClusterChangeChannelByNumberP { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -15181,8 +15048,7 @@ - (void)skipChannelWithParams:(MTRChannelClusterSkipChannelParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -15297,8 +15163,7 @@ - (void)navigateTargetWithParams:(MTRTargetNavigatorClusterNavigateTargetParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTargetNavigatorClusterNavigateTargetResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15412,8 +15277,7 @@ - (void)playWithParams:(MTRMediaPlaybackClusterPlayParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15449,8 +15313,7 @@ - (void)pauseWithParams:(MTRMediaPlaybackClusterPauseParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15489,8 +15352,7 @@ - (void)stopPlaybackWithParams:(MTRMediaPlaybackClusterStopPlaybackParams * _Nul { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15529,8 +15391,7 @@ - (void)startOverWithParams:(MTRMediaPlaybackClusterStartOverParams * _Nullable) { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15566,8 +15427,7 @@ - (void)previousWithParams:(MTRMediaPlaybackClusterPreviousParams * _Nullable)pa { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15603,8 +15463,7 @@ - (void)nextWithParams:(MTRMediaPlaybackClusterNextParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15640,8 +15499,7 @@ - (void)rewindWithParams:(MTRMediaPlaybackClusterRewindParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15680,8 +15538,7 @@ - (void)fastForwardWithParams:(MTRMediaPlaybackClusterFastForwardParams * _Nulla { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15710,8 +15567,7 @@ - (void)skipForwardWithParams:(MTRMediaPlaybackClusterSkipForwardParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15741,8 +15597,7 @@ - (void)skipBackwardWithParams:(MTRMediaPlaybackClusterSkipBackwardParams *)para { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15772,8 +15627,7 @@ - (void)seekWithParams:(MTRMediaPlaybackClusterSeekParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRMediaPlaybackClusterPlaybackResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -15915,8 +15769,7 @@ - (void)selectInputWithParams:(MTRMediaInputClusterSelectInputParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -15958,8 +15811,7 @@ - (void)showInputStatusWithParams:(MTRMediaInputClusterShowInputStatusParams * _ { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -16000,8 +15852,7 @@ - (void)hideInputStatusWithParams:(MTRMediaInputClusterHideInputStatusParams * _ { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -16033,8 +15884,7 @@ - (void)renameInputWithParams:(MTRMediaInputClusterRenameInputParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -16147,8 +15997,7 @@ - (void)sleepWithParams:(MTRLowPowerClusterSleepParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -16238,8 +16087,7 @@ - (void)sendKeyWithParams:(MTRKeypadInputClusterSendKeyParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRKeypadInputClusterSendKeyResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -16326,8 +16174,7 @@ - (void)launchContentWithParams:(MTRContentLauncherClusterLaunchContentParams *) { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRContentLauncherClusterLaunchResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -16413,8 +16260,7 @@ - (void)launchURLWithParams:(MTRContentLauncherClusterLaunchURLParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRContentLauncherClusterLaunchResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -16636,8 +16482,7 @@ - (void)selectOutputWithParams:(MTRAudioOutputClusterSelectOutputParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -16670,8 +16515,7 @@ - (void)renameOutputWithParams:(MTRAudioOutputClusterRenameOutputParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -16779,8 +16623,7 @@ - (void)launchAppWithParams:(MTRApplicationLauncherClusterLaunchAppParams *)para { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRApplicationLauncherClusterLauncherResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -16815,8 +16658,7 @@ - (void)stopAppWithParams:(MTRApplicationLauncherClusterStopAppParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRApplicationLauncherClusterLauncherResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -16847,8 +16689,7 @@ - (void)hideAppWithParams:(MTRApplicationLauncherClusterHideAppParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRApplicationLauncherClusterLauncherResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -17092,8 +16933,7 @@ - (void)getSetupPINWithParams:(MTRAccountLoginClusterGetSetupPINParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRAccountLoginClusterGetSetupPINResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -17125,8 +16965,7 @@ - (void)loginWithParams:(MTRAccountLoginClusterLoginParams *)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -17169,8 +17008,7 @@ - (void)logoutWithParams:(MTRAccountLoginClusterLogoutParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -17271,8 +17109,7 @@ - (void)getProfileInfoCommandWithParams:(MTRElectricalMeasurementClusterGetProfi { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -17304,8 +17141,7 @@ - (void)getMeasurementProfileCommandWithParams:(MTRElectricalMeasurementClusterG { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -18640,8 +18476,7 @@ - (void)testWithParams:(MTRTestClusterClusterTestParams * _Nullable)params { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -18682,8 +18517,7 @@ - (void)testNotHandledWithParams:(MTRTestClusterClusterTestNotHandledParams * _N { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -18726,8 +18560,7 @@ - (void)testSpecificWithParams:(MTRTestClusterClusterTestSpecificParams * _Nulla { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestSpecificResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -18764,8 +18597,7 @@ - (void)testUnknownCommandWithParams:(MTRTestClusterClusterTestUnknownCommandPar { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -18798,8 +18630,7 @@ - (void)testAddArgumentsWithParams:(MTRTestClusterClusterTestAddArgumentsParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestAddArgumentsResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -18830,8 +18661,7 @@ - (void)testSimpleArgumentRequestWithParams:(MTRTestClusterClusterTestSimpleArgu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestSimpleArgumentResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -18862,8 +18692,7 @@ - (void)testStructArrayArgumentRequestWithParams:(MTRTestClusterClusterTestStruc { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestStructArrayArgumentResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19102,8 +18931,7 @@ - (void)testStructArgumentRequestWithParams:(MTRTestClusterClusterTestStructArgu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterBooleanResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19140,8 +18968,7 @@ - (void)testNestedStructArgumentRequestWithParams:(MTRTestClusterClusterTestNest { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterBooleanResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19180,8 +19007,7 @@ - (void)testListStructArgumentRequestWithParams:(MTRTestClusterClusterTestListSt { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterBooleanResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19241,8 +19067,7 @@ - (void)testListInt8UArgumentRequestWithParams:(MTRTestClusterClusterTestListInt { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterBooleanResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19293,8 +19118,7 @@ - (void)testNestedStructListArgumentRequestWithParams:(MTRTestClusterClusterTest { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterBooleanResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19431,8 +19255,7 @@ - (void)testListNestedStructListArgumentRequestWithParams: { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterBooleanResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19593,8 +19416,7 @@ - (void)testListInt8UReverseRequestWithParams:(MTRTestClusterClusterTestListInt8 { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestListInt8UReverseResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19645,8 +19467,7 @@ - (void)testEnumsRequestWithParams:(MTRTestClusterClusterTestEnumsRequestParams { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestEnumsResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19677,8 +19498,7 @@ - (void)testNullableOptionalRequestWithParams:(MTRTestClusterClusterTestNullable { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestNullableOptionalResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19720,8 +19540,7 @@ - (void)testComplexNullableOptionalRequestWithParams:(MTRTestClusterClusterTestC { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestComplexNullableOptionalResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19919,8 +19738,7 @@ - (void)simpleStructEchoRequestWithParams:(MTRTestClusterClusterSimpleStructEcho { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterSimpleStructResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -19965,8 +19783,7 @@ - (void)timedInvokeRequestWithParams:(MTRTestClusterClusterTimedInvokeRequestPar { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -20001,8 +19818,7 @@ - (void)testSimpleOptionalArgumentRequestWithParams:(MTRTestClusterClusterTestSi { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRCommandSuccessCallbackBridge( self.callbackQueue, baseDevice, ^(id _Nullable value, NSError * _Nullable error) { @@ -20041,8 +19857,7 @@ - (void)testEmitTestEventRequestWithParams:(MTRTestClusterClusterTestEmitTestEve { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestEmitTestEventResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; @@ -20077,8 +19892,7 @@ new MTRTestClusterClusterTestEmitTestEventResponseCallbackBridge(self.callbackQu { // Make a copy of params before we go async. params = [params copy]; - MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:@(self.device.nodeID) - controller:self.device.deviceController]; + MTRBaseDevice * baseDevice = [[MTRBaseDevice alloc] initWithNodeID:self.device.nodeID controller:self.device.deviceController]; new MTRTestClusterClusterTestEmitTestFabricScopedEventResponseCallbackBridge(self.callbackQueue, baseDevice, completion, ^(ExchangeManager & exchangeManager, const SessionHandle & session, Cancelable * success, Cancelable * failure) { chip::Optional timedInvokeTimeoutMs; From f72807b6f4008bff3e1a7a60fb3969d39851bb46 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 27 Sep 2022 21:43:33 -0400 Subject: [PATCH 12/24] Stop holding on to a PASE DeviceProxy pointer in MTRBaseDevice. (#22848) Fixes https://github.com/project-chip/connectedhomeip/issues/22846 --- src/darwin/Framework/CHIP/MTRBaseDevice.mm | 53 +++---------------- .../Framework/CHIP/MTRBaseDevice_Internal.h | 24 ++++----- .../CHIP/MTRCallbackBridgeBase_internal.h | 31 ++++++----- .../Framework/CHIP/MTRDeviceController.mm | 39 ++++++++++++-- .../CHIP/MTRDeviceController_Internal.h | 14 +++++ 5 files changed, 86 insertions(+), 75 deletions(-) diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index cece722a25de5d..a2d6a22a475126 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -74,15 +74,6 @@ class MTRDataValueDictionaryCallbackBridge; -@interface MTRBaseDevice () - -@property (nonatomic, readonly, assign, nullable) chip::DeviceProxy * cppPASEDevice; -@property (nonatomic, readwrite) NSMutableDictionary * reportHandlerBridges; - -- (chip::NodeId)deviceID; -- (BOOL)isPASEDevice; -@end - @interface MTRReadClientContainer : NSObject @property (nonatomic, readwrite) app::ReadClient * readClientPtr; @property (nonatomic, readwrite) app::AttributePathParams * pathParams; @@ -223,19 +214,8 @@ @implementation MTRBaseDevice - (instancetype)initWithPASEDevice:(chip::DeviceProxy *)device controller:(MTRDeviceController *)controller { if (self = [super init]) { - chip::Optional session = device->GetSecureSession(); - if (!session.HasValue()) { - MTR_LOG_ERROR("Failing to initialize MTRBaseDevice: no secure session"); - return nil; - } - - if (!session.Value()->AsSecureSession()->IsPASESession()) { - MTR_LOG_ERROR("Failing to initialize MTRBaseDevice: not a PASE session"); - return nil; - } - - _cppPASEDevice = device; - _nodeID = kUndefinedNodeId; + _isPASEDevice = YES; + _nodeID = device->GetDeviceId(); _deviceController = controller; } return self; @@ -244,7 +224,7 @@ - (instancetype)initWithPASEDevice:(chip::DeviceProxy *)device controller:(MTRDe - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller { if (self = [super init]) { - _cppPASEDevice = nil; + _isPASEDevice = NO; _nodeID = [nodeID unsignedLongLongValue]; _deviceController = controller; } @@ -258,32 +238,13 @@ + (instancetype)deviceWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControl return [controller baseDeviceForNodeID:nodeID]; } -- (chip::DeviceProxy * _Nullable)paseDevice -{ - return _cppPASEDevice; -} - -- (chip::NodeId)deviceID -{ - if (_cppPASEDevice != nullptr) { - return _cppPASEDevice->GetDeviceId(); - } - - return self.nodeID; -} - -- (BOOL)isPASEDevice -{ - return _cppPASEDevice != nullptr; -} - - (void)invalidateCASESession { if (self.isPASEDevice) { return; } - [self.deviceController invalidateCASESessionForNode:self.deviceID]; + [self.deviceController invalidateCASESessionForNode:self.nodeID]; } namespace { @@ -1195,7 +1156,7 @@ - (void)subscribeAttributePathWithEndpointID:(NSNumber * _Nullable)endpointID }; MTRReadClientContainer * container = [[MTRReadClientContainer alloc] init]; - container.deviceID = [self deviceID]; + container.deviceID = self.nodeID; container.pathParams = Platform::New(); if (endpointID) { container.pathParams->mEndpointId = static_cast([endpointID unsignedShortValue]); @@ -1261,7 +1222,7 @@ - (void)deregisterReportHandlersWithQueue:(dispatch_queue_t)queue completion:(di { // This method must only be used for MTRDeviceOverXPC. However, for unit testing purpose, the method purges all read clients. MTR_LOG_DEBUG("Unexpected call to deregister report handlers"); - PurgeReadClientContainers([self deviceID], queue, completion); + PurgeReadClientContainers(self.nodeID, queue, completion); } namespace { @@ -1407,7 +1368,7 @@ - (void)openCommissioningWindowWithSetupPasscode:(NSNumber *)setupPasscode - (void)failSubscribers:(dispatch_queue_t)queue completion:(void (^)(void))completion { MTR_LOG_DEBUG("Causing failure in subscribers on purpose"); - CauseReadClientFailure([self deviceID], queue, completion); + CauseReadClientFailure(self.nodeID, queue, completion); } #endif diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h index 3dc8cb9bf875bf..c6fb24742f648b 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h @@ -29,12 +29,6 @@ NS_ASSUME_NONNULL_BEGIN - (instancetype)initWithPASEDevice:(chip::DeviceProxy *)device controller:(MTRDeviceController *)controller; -/** - * Only returns non-nil if the device is using a PASE session. Otherwise, the - * deviceController + nodeId should be used to get a CASE session. - */ -- (chip::DeviceProxy * _Nullable)paseDevice; - /** * Invalidate the CASE session, so an attempt to getConnectedDevice for this * device id will have to create a new CASE session. Ideally this API will go @@ -42,14 +36,20 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)invalidateCASESession; +/** + * Whether this device represents a PASE session or not. + */ +@property (nonatomic, assign, readonly) BOOL isPASEDevice; + /** * Controller that that this MTRDevice was gotten from. */ @property (nonatomic, strong, readonly) MTRDeviceController * deviceController; /** - * Node id for this MTRDevice. Only set to a usable value if this device - * represents a CASE session. + * Node id for this MTRDevice. If this device represents a CASE session, this + * is set to the node ID of the target node. If this device represents a PASE + * session, this is set to the device id of the PASE device. */ @property (nonatomic, assign, readonly) chip::NodeId nodeID; @@ -60,10 +60,10 @@ NS_ASSUME_NONNULL_BEGIN + (instancetype)new NS_UNAVAILABLE; /** - * Initialize the device object with the given node id and controller. This - * will always succeed, even if there is no such node id on the controller's - * fabric, but attempts to actually use the MTRBaseDevice will fail - * (asynchronously) in that case. + * Initialize the device object as a CASE device with the given node id and + * controller. This will always succeed, even if there is no such node id on + * the controller's fabric, but attempts to actually use the MTRBaseDevice will + * fail (asynchronously) in that case. */ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceController *)controller; diff --git a/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h b/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h index e0e53e3c9b21d9..3ea7d4c0fb8260 100644 --- a/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h +++ b/src/darwin/Framework/CHIP/MTRCallbackBridgeBase_internal.h @@ -96,11 +96,10 @@ template class MTRCallbackBridge { } /** - * Run the given MTRActionBlock on the Matter thread (possibly - * synchronously, if the MTRBaseDevice represents a PASE connection), after - * getting a secure session corresponding to the given MTRBaseDevice. On - * success, convert the success value to whatever type it needs to be to - * call the callback type we're templated over. + * Run the given MTRActionBlock on the Matter thread after getting a secure + * session corresponding to the given MTRBaseDevice. On success, convert + * the success value to whatever type it needs to be to call the callback + * type we're templated over. */ MTRCallbackBridge(dispatch_queue_t queue, MTRBaseDevice * device, ResponseHandler handler, MTRActionBlock action, T OnSuccessFn, bool keepAlive) @@ -111,23 +110,27 @@ template class MTRCallbackBridge { , mSuccess(OnSuccessFn, this) , mFailure(OnFailureFn, this) { - auto * paseDevice = [device paseDevice]; - if (paseDevice != nullptr) { - ActionWithDevice(paseDevice); + if (device.isPASEDevice) { + ActionWithPASEDevice(device); } else { ActionWithNodeID(device.nodeID, device.deviceController); } }; - void ActionWithDevice(chip::DeviceProxy * device) + void ActionWithPASEDevice(MTRBaseDevice * device) { LogRequestStart(); - // Keep doing dispatch_sync here for now, because we don't want device - // to become stale. - dispatch_sync(chip::DeviceLayer::PlatformMgrImpl().GetWorkQueue(), ^{ - MaybeDoAction(device->GetExchangeManager(), device->GetSecureSession(), nil); - }); + BOOL ok = [device.deviceController + getSessionForCommissioneeDevice:device.nodeID + completion:^(chip::Messaging::ExchangeManager * exchangeManager, + const chip::Optional & session, NSError * error) { + MaybeDoAction(exchangeManager, session, error); + }]; + + if (ok == NO) { + OnFailureFn(this, CHIP_ERROR_INCORRECT_STATE); + } } void ActionWithNodeID(chip::NodeId nodeID, MTRDeviceController * controller) diff --git a/src/darwin/Framework/CHIP/MTRDeviceController.mm b/src/darwin/Framework/CHIP/MTRDeviceController.mm index c99341f689ae3b..85b37f3aae9310 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController.mm +++ b/src/darwin/Framework/CHIP/MTRDeviceController.mm @@ -489,18 +489,19 @@ - (MTRBaseDevice *)deviceBeingCommissionedWithNodeID:(NSNumber *)nodeID error:(N { VerifyOrReturnValue([self checkIsRunning:error], nil); - __block chip::CommissioneeDeviceProxy * deviceProxy; - + __block MTRBaseDevice * device; __block BOOL success = NO; dispatch_sync(_chipWorkQueue, ^{ VerifyOrReturn([self checkIsRunning:error]); + chip::CommissioneeDeviceProxy * deviceProxy; auto errorCode = self->_cppCommissioner->GetDeviceBeingCommissioned([nodeID unsignedLongLongValue], &deviceProxy); success = ![MTRDeviceController checkForError:errorCode logMsg:kErrorStopPairing error:error]; + device = [[MTRBaseDevice alloc] initWithPASEDevice:deviceProxy controller:self]; }); VerifyOrReturnValue(success, nil); - return [[MTRBaseDevice alloc] initWithPASEDevice:deviceProxy controller:self]; + return device; } - (MTRBaseDevice *)baseDeviceForNodeID:(NSNumber *)nodeID @@ -708,6 +709,38 @@ - (BOOL)getSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConn return YES; } +- (BOOL)getSessionForCommissioneeDevice:(chip::NodeId)deviceID completion:(MTRInternalDeviceConnectionCallback)completion +{ + if (![self checkIsRunning]) { + return NO; + } + + dispatch_async(_chipWorkQueue, ^{ + NSError * error; + if (![self checkIsRunning:&error]) { + completion(nullptr, chip::NullOptional, error); + return; + } + + chip::CommissioneeDeviceProxy * deviceProxy; + CHIP_ERROR err = self->_cppCommissioner->GetDeviceBeingCommissioned(deviceID, &deviceProxy); + if (err != CHIP_NO_ERROR) { + completion(nullptr, chip::NullOptional, [MTRError errorForCHIPErrorCode:err]); + return; + } + + chip::Optional session = deviceProxy->GetSecureSession(); + if (!session.HasValue() || !session.Value()->AsSecureSession()->IsPASESession()) { + completion(nullptr, chip::NullOptional, [MTRError errorForCHIPErrorCode:CHIP_ERROR_INCORRECT_STATE]); + return; + } + + completion(deviceProxy->GetExchangeManager(), session, nil); + }); + + return YES; +} + - (void)asyncDispatchToMatterQueue:(void (^)(chip::Controller::DeviceCommissioner *))block errorHandler:(void (^)(NSError *))errorHandler { diff --git a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h index 6b69b4a579077e..602713793bd70f 100644 --- a/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h +++ b/src/darwin/Framework/CHIP/MTRDeviceController_Internal.h @@ -120,6 +120,20 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)getSessionForNode:(chip::NodeId)nodeID completion:(MTRInternalDeviceConnectionCallback)completion; +/** + * Get a session for the commissionee device with the given device id. This may + * be called on any queue (including the Matter event queue) and will always + * call the provided connection callback on the Matter queue, asynchronously. + * Consumers must be prepared to run on the Matter queue (an in particular must + * not use any APIs that will try to do sync dispatch to the Matter queue). + * + * If the controller is not running when this function is called, will return NO + * and never invoke the completion. If the controller is not running when the + * async dispatch on the Matter queue would happen, an error will be dispatched + * to the completion handler. + */ +- (BOOL)getSessionForCommissioneeDevice:(chip::NodeId)deviceID completion:(MTRInternalDeviceConnectionCallback)completion; + /** * Invalidate the CASE session for the given node ID. This is a temporary thing * just to support MTRBaseDevice's invalidateCASESession. Must not be called on From 7e759232f9b8447806686815a721fd265f12151a Mon Sep 17 00:00:00 2001 From: Sen Date: Wed, 28 Sep 2022 20:09:22 +0800 Subject: [PATCH 13/24] fix bug: fail to register NsdService (#22914) * fix bug: fail to register NsdService * import package * Restyled by google-java-format Co-authored-by: Restyled.io --- .../chip/platform/NsdManagerServiceResolver.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java b/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java index 4fb5bcbe31d664..a3a4ecfa4822d2 100644 --- a/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java +++ b/src/platform/android/java/chip/platform/NsdManagerServiceResolver.java @@ -27,6 +27,7 @@ import android.util.Log; import java.util.ArrayList; import java.util.List; +import java.util.concurrent.CopyOnWriteArrayList; public class NsdManagerServiceResolver implements ServiceResolver { private static final String TAG = NsdManagerServiceResolver.class.getSimpleName(); @@ -35,6 +36,7 @@ public class NsdManagerServiceResolver implements ServiceResolver { private MulticastLock multicastLock; private Handler mainThreadHandler; private List registrationListeners = new ArrayList<>(); + private final CopyOnWriteArrayList mMFServiceName = new CopyOnWriteArrayList<>(); public NsdManagerServiceResolver(Context context) { this.nsdManager = (NsdManager) context.getSystemService(Context.NSD_SERVICE); @@ -134,6 +136,15 @@ public void publish( String[] textEntriesKeys, byte[][] textEntriesDatas, String[] subTypes) { + /** + * Note, MF's NSDService will be repeatedly registered until it exceeds the OS's + * maximum(http://androidxref.com/9.0.0_r3/xref/frameworks/base/services/core/java/com/android/server/NsdService.java#MAX_LIMIT) + * limit at which time the registration will fail. + */ + if (serviceName.contains("-") && mMFServiceName.contains(serviceName)) { + Log.w(TAG, "publish: duplicate MF nsdService"); + return; + } NsdServiceInfo serviceInfo = new NsdServiceInfo(); serviceInfo.setServiceName(serviceName); @@ -193,6 +204,7 @@ public void onServiceUnregistered(NsdServiceInfo serviceInfo) { multicastLock.acquire(); } registrationListeners.add(registrationListener); + mMFServiceName.add(serviceName); nsdManager.registerService(serviceInfo, NsdManager.PROTOCOL_DNS_SD, registrationListener); Log.d(TAG, "publish " + registrationListener + " count = " + registrationListeners.size()); @@ -209,5 +221,6 @@ public void removeServices() { nsdManager.unregisterService(l); } registrationListeners.clear(); + mMFServiceName.clear(); } } From 3b48c2c15eac0c7b8f8cb5b1dc4f94cbb56dad5b Mon Sep 17 00:00:00 2001 From: yunhanw-google Date: Wed, 28 Sep 2022 05:11:01 -0700 Subject: [PATCH 14/24] event should be stored in array for java/android (#22909) --- .../clusterclient/WildcardFragment.kt | 17 ++++++----- .../devicecontroller/model/ClusterState.java | 30 +++++++++++-------- .../devicecontroller/model/NodeState.java | 7 +++-- 3 files changed, 33 insertions(+), 21 deletions(-) diff --git a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt index 9a29d0d598d549..dd2f366e28f469 100644 --- a/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt +++ b/src/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/WildcardFragment.kt @@ -95,13 +95,16 @@ class WildcardFragment : Fragment() { val attributeName = ChipIdLookup.attributeIdToName(clusterId, attributeId) stringBuilder.append("\t\t$attributeName: ${attributeState.value}\n") } - clusterState.eventStates.forEach { (eventId, eventState) -> - stringBuilder.append("\t\teventNumber: ${eventState.eventNumber}\n") - stringBuilder.append("\t\tpriorityLevel: ${eventState.priorityLevel}\n") - stringBuilder.append("\t\tsystemTimeStamp: ${eventState.systemTimeStamp}\n") - - val eventName = ChipIdLookup.eventIdToName(clusterId, eventId) - stringBuilder.append("\t\t$eventName: ${eventState.value}\n") + clusterState.eventStates.forEach { (eventId, events) -> + for (event in events) + { + stringBuilder.append("\t\teventNumber: ${event.eventNumber}\n") + stringBuilder.append("\t\tpriorityLevel: ${event.priorityLevel}\n") + stringBuilder.append("\t\tsystemTimeStamp: ${event.systemTimeStamp}\n") + + val eventName = ChipIdLookup.eventIdToName(clusterId, eventId) + stringBuilder.append("\t\t$eventName: ${event.value}\n") + } } stringBuilder.append("\t}\n") } diff --git a/src/controller/java/src/chip/devicecontroller/model/ClusterState.java b/src/controller/java/src/chip/devicecontroller/model/ClusterState.java index e90d0e76acec54..4ce1c1e62e1824 100644 --- a/src/controller/java/src/chip/devicecontroller/model/ClusterState.java +++ b/src/controller/java/src/chip/devicecontroller/model/ClusterState.java @@ -18,16 +18,18 @@ package chip.devicecontroller.model; import androidx.annotation.Nullable; +import java.util.ArrayList; import java.util.Map; import java.util.Optional; /** Class for tracking CHIP cluster state in a hierarchical manner. */ public final class ClusterState { private Map attributes; - private Map events; + private Map> events; private Optional dataVersion; - public ClusterState(Map attributes, Map events) { + public ClusterState( + Map attributes, Map> events) { this.attributes = attributes; this.events = events; this.dataVersion = Optional.empty(); @@ -37,7 +39,7 @@ public Map getAttributeStates() { return attributes; } - public Map getEventStates() { + public Map> getEventStates() { return events; } @@ -60,12 +62,12 @@ public AttributeState getAttributeState(long attributeId) { } /** - * Convenience utility for getting an {@code EventState}. + * Convenience utility for getting an {@code ArrayList }. * - * @return the {@code EventState} for the specified id, or null if not found. + * @return the {@code ArrayList} for the specified id, or null if not found. */ @Nullable - public EventState getEventState(long eventId) { + public ArrayList getEventState(long eventId) { return events.get(eventId); } @@ -82,12 +84,16 @@ public String toString() { builder.append("\n"); }); events.forEach( - (eventId, eventState) -> { - builder.append("Event "); - builder.append(eventId); - builder.append(": "); - builder.append(eventState.getValue() == null ? "null" : eventState.getValue().toString()); - builder.append("\n"); + (eventId, eventStates) -> { + eventStates.forEach( + (eventState) -> { + builder.append("Event "); + builder.append(eventId); + builder.append(": "); + builder.append( + eventState.getValue() == null ? "null" : eventState.getValue().toString()); + builder.append("\n"); + }); }); return builder.toString(); } diff --git a/src/controller/java/src/chip/devicecontroller/model/NodeState.java b/src/controller/java/src/chip/devicecontroller/model/NodeState.java index 652dc3265ffab1..1dab3ebc0ea3b6 100644 --- a/src/controller/java/src/chip/devicecontroller/model/NodeState.java +++ b/src/controller/java/src/chip/devicecontroller/model/NodeState.java @@ -18,6 +18,7 @@ package chip.devicecontroller.model; import androidx.annotation.Nullable; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map; @@ -75,8 +76,10 @@ private void addEvent(int endpointId, long clusterId, long eventId, EventState e endpointState.getClusterStates().put(clusterId, clusterState); } - // This will overwrite previous events. - clusterState.getEventStates().put(eventId, eventStateToAdd); + if (!clusterState.getEventStates().containsKey(eventId)) { + clusterState.getEventStates().put(eventId, new ArrayList()); + } + clusterState.getEventStates().get(eventId).add(eventStateToAdd); } @Override From 83ffda859f9f65d91d2ac4fc919bc452cbc4eeb6 Mon Sep 17 00:00:00 2001 From: Thomas Langewouters <82949801+q-thla@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:11:33 +0200 Subject: [PATCH 15/24] Build Qorvo libraries, use QMatter v0.9.0.0-libs (#22864) Build Qorvo libraries instead of using binary artifacts Reduce mbedtls sources list Use ld path without '_mrom' in the name use compiler executables from $PATH --- .gitmodules | 4 +- third_party/openthread/platforms/qpg/BUILD.gn | 4 - third_party/qpg_sdk/BUILD.gn | 131 ++++++++++++++++++ third_party/qpg_sdk/make.py | 23 +++ third_party/qpg_sdk/qpg_sdk.gni | 129 +++++------------ third_party/qpg_sdk/repo | 2 +- 6 files changed, 190 insertions(+), 103 deletions(-) create mode 100755 third_party/qpg_sdk/make.py diff --git a/.gitmodules b/.gitmodules index f5b4f75ec7b6ac..5a60849e011130 100644 --- a/.gitmodules +++ b/.gitmodules @@ -51,8 +51,8 @@ branch = master [submodule "qpg_sdk"] path = third_party/qpg_sdk/repo - url = https://github.com/Qorvo/qpg-connectedhomeip - branch = master + url = https://github.com/Qorvo/QMatter + branch = v0.9.0.0-libs platforms = qpg [submodule "zap"] path = third_party/zap/repo diff --git a/third_party/openthread/platforms/qpg/BUILD.gn b/third_party/openthread/platforms/qpg/BUILD.gn index 4a3c7634b2f7d9..d7e0b9590386b1 100644 --- a/third_party/openthread/platforms/qpg/BUILD.gn +++ b/third_party/openthread/platforms/qpg/BUILD.gn @@ -64,10 +64,6 @@ source_set("libopenthread-qpg") { ] include_dirs += [ "${openthread_root}/examples/apps" ] - if (qpg_sdk_include_platform_libs) { - libs = [ "${qpg_sdk_root}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_${qpg_target_ic}_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ] - } - public_deps = [ ":openthread_core_config_qpg", "${openthread_root}/src/core:libopenthread_core_headers", diff --git a/third_party/qpg_sdk/BUILD.gn b/third_party/qpg_sdk/BUILD.gn index c7cf2b29d0b7bc..88263ed5a4ebfe 100755 --- a/third_party/qpg_sdk/BUILD.gn +++ b/third_party/qpg_sdk/BUILD.gn @@ -47,3 +47,134 @@ freertos_target("freertos") { public_configs = [ ":qpg_freertos_config" ] } + +template("qpg_make_build") { + forward_variables_from(invoker, + [ + "make_sources", + "make_args", + "make_output", + ]) + action(target_name) { + script = "make.py" + sources = make_sources + outputs = make_output + args = [ + "-s", + + #use PATH variable lookup for compiler + "TOOLCHAIN=", + ] + args += make_args + } +} + +qpg_make_build("qpg_mbedtls_alt") { + make_sources = [ "${qpg_sdk_root}/Components/ThirdParty/Silex" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}/libmbedtls_alt_${qpg_target_ic}.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + + "/Libraries/Qorvo/mbedtls_alt/Makefile.mbedtls_alt_${qpg_target_ic}", + "MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/mbedtls/repo", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}", + ] +} + +static_library("qpg_mbedtls_alt_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_mbedtls_alt" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}/libmbedtls_alt_${qpg_target_ic}.a" ] +} + +qpg_make_build("qpg_stack") { + make_sources = [ "${qpg_sdk_root}/Components/Qorvo" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/QorvoStack/libQorvoStack_${qpg_target_ic}.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + + "/Libraries/Qorvo/QorvoStack/Makefile.QorvoStack_${qpg_target_ic}", + "FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/freertos/repo", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/QorvoStack", + ] +} + +static_library("qpg_stack_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_stack" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/QorvoStack/libQorvoStack_${qpg_target_ic}.a" ] +} + +qpg_make_build("qpg_glue") { + make_sources = [ "${qpg_sdk_root}/Components/Qorvo/Matter" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/MatterQorvoGlue/libMatterQorvoGlue_${qpg_target_ic}_libbuild.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/MatterQorvoGlue/Makefile.MatterQorvoGlue_${qpg_target_ic}_libbuild", + "FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/freertos/repo", + "MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/mbedtls/repo", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/MatterQorvoGlue", + ] +} +static_library("qpg_glue_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_glue" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/MatterQorvoGlue/libMatterQorvoGlue_${qpg_target_ic}_libbuild.a" ] +} + +# openthread toevoegen +# bootloader build +# +qpg_make_build("qpg_bootloader") { + make_sources = [ "${qpg_sdk_root}/Libraries/Qorvo/Bootloader" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure/libBootloader_${qpg_target_ic}_compr_secure.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/Bootloader/Makefile.Bootloader_${qpg_target_ic}_compr_secure", + "FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/freertos/repo", + "MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/mbedtls/repo", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure", + "UMB_WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/UMB_QPG6105DK_B01_nrt_flash_compr_secure", + ] +} +config("qpg_retain_bootloader") { + ldflags = [ + "-Wl,-u_binary_bl_userlicense_bin_start", + "-Wl,-u_binary_bootloader_bin_start", + ] +} + +static_library("qpg_bootloader_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_bootloader" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure/libBootloader_${qpg_target_ic}_compr_secure.a" ] + public_configs = [ ":qpg_retain_bootloader" ] +} + +qpg_make_build("qpg_openthread_glue") { + make_sources = [ "${qpg_sdk_root}/Components/Qorvo/Matter" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + "/Libraries/Qorvo/OpenThreadQorvoGlue/Makefile.OpenThreadQorvoGlue_${qpg_target_ic}_mtd", + "FREERTOS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/freertos/repo", + "MBEDTLS_REPO_DIR=" + rebase_path(chip_root, root_build_dir) + + "/third_party/mbedtls/repo", + "OPENTHREAD_REPO_DIR =" + rebase_path(chip_root, root_build_dir) + + "/third_party/openthread/repo", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_${qpg_target_ic}_mtd", + ] +} +static_library("qpg_openthread_glue_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_openthread_glue" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/OpenThreadQorvoGlue_qpg6105_mtd/libOpenThreadQorvoGlue_${qpg_target_ic}_mtd.a" ] +} diff --git a/third_party/qpg_sdk/make.py b/third_party/qpg_sdk/make.py new file mode 100755 index 00000000000000..d6a1b3ee0ebc84 --- /dev/null +++ b/third_party/qpg_sdk/make.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +# +# 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. +# + +'''Python wrapper to call make based builds within the SDK +''' +import subprocess +import sys + +subprocess.run(['make', '-j'] + sys.argv[1:], check=True) diff --git a/third_party/qpg_sdk/qpg_sdk.gni b/third_party/qpg_sdk/qpg_sdk.gni index 708a29c15b6b74..c1415af3743f93 100644 --- a/third_party/qpg_sdk/qpg_sdk.gni +++ b/third_party/qpg_sdk/qpg_sdk.gni @@ -23,9 +23,7 @@ declare_args() { qpg_sdk_root = "${chip_root}/third_party/qpg_sdk/repo" # subdirectory in qpg_sdk_root where the binary library builds (.a) are to be found - # for connectedhomeip-qpg: Binaries (default) - # for matter endnodes sdk: Work - qpg_sdk_lib_dir = "Binaries" + qpg_sdk_lib_dir = "Work" # Target IC for QPG SDK qpg_target_ic = "qpg6105" @@ -69,28 +67,12 @@ template("qpg_sdk") { "${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc", "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc", "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt", - "${qpg_sdk_root}/Components/ThirdParty/Lwip", - "${qpg_sdk_root}/Components/ThirdParty/Lwip/arch", "${mbedtls_root}/repo/include", "${openthread_root}/include", ] lib_dirs = [] - if (qpg_sdk_include_platform_libs) { - libs += [ - "${qpg_sdk_root}/${qpg_sdk_lib_dir}/MatterQorvoGlue_${qpg_target_ic}_libbuild/libMatterQorvoGlue_${qpg_target_ic}_libbuild.a", - "${qpg_sdk_root}/${qpg_sdk_lib_dir}/QorvoStack_${qpg_target_ic}/libQorvoStack_${qpg_target_ic}.a", - "${qpg_sdk_root}/${qpg_sdk_lib_dir}/mbedtls_alt_${qpg_target_ic}/libmbedtls_alt_${qpg_target_ic}.a", - "${qpg_sdk_root}/${qpg_sdk_lib_dir}/Bootloader_${qpg_target_ic}_compr_secure/libBootloader_${qpg_target_ic}_compr_secure.a", - ] - } - - ldflags = [ - "-Wl,-u_binary_bl_userlicense_bin_start", - "-Wl,-u_binary_bootloader_bin_start", - ] - #MBed TLS built from third_party/mbedtls tree - OT config not used defines = [ "QORVO_CRYPTO_ENGINE", @@ -111,108 +93,54 @@ template("qpg_sdk") { source_set(sdk_target_name) { sources = [ - "${chip_root}/third_party/mbedtls/repo/include/mbedtls/platform.h", - "${chip_root}/third_party/mbedtls/repo/library/aes.c", - "${chip_root}/third_party/mbedtls/repo/library/aesni.c", - "${chip_root}/third_party/mbedtls/repo/library/arc4.c", - "${chip_root}/third_party/mbedtls/repo/library/aria.c", + "${qpg_sdk_root}/Applications/Matter/shared/config/inc/FreeRTOSConfig.h", + "${qpg_sdk_root}/Applications/Matter/shared/config/src/hooks.c", + ] + + chip_glue_sources = [ + # + "${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc/qvIO.h", + "${qpg_sdk_root}/Components/Qorvo/Matter/qvCHIP/inc/qvCHIP.h", + ] + sources += chip_glue_sources + + mbedtls_alt_sources = [ + # Add alt src + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/aes_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ccm_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ecjpake_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ecp_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/sha256_alt.h", + "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc/${qpg_target_ic}-mbedtls-config.h", + "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/src/trng.c", + ] + mbedtls_sources = [ "${chip_root}/third_party/mbedtls/repo/library/asn1parse.c", "${chip_root}/third_party/mbedtls/repo/library/asn1write.c", - "${chip_root}/third_party/mbedtls/repo/library/base64.c", "${chip_root}/third_party/mbedtls/repo/library/bignum.c", - "${chip_root}/third_party/mbedtls/repo/library/blowfish.c", - "${chip_root}/third_party/mbedtls/repo/library/camellia.c", "${chip_root}/third_party/mbedtls/repo/library/ccm.c", - "${chip_root}/third_party/mbedtls/repo/library/certs.c", - "${chip_root}/third_party/mbedtls/repo/library/chacha20.c", - "${chip_root}/third_party/mbedtls/repo/library/chachapoly.c", "${chip_root}/third_party/mbedtls/repo/library/cipher.c", "${chip_root}/third_party/mbedtls/repo/library/cipher_wrap.c", - "${chip_root}/third_party/mbedtls/repo/library/cmac.c", - "${chip_root}/third_party/mbedtls/repo/library/constant_time.c", "${chip_root}/third_party/mbedtls/repo/library/ctr_drbg.c", - "${chip_root}/third_party/mbedtls/repo/library/debug.c", - "${chip_root}/third_party/mbedtls/repo/library/des.c", - "${chip_root}/third_party/mbedtls/repo/library/dhm.c", - "${chip_root}/third_party/mbedtls/repo/library/ecdh.c", "${chip_root}/third_party/mbedtls/repo/library/ecdsa.c", - "${chip_root}/third_party/mbedtls/repo/library/ecjpake.c", - "${chip_root}/third_party/mbedtls/repo/library/ecp.c", - "${chip_root}/third_party/mbedtls/repo/library/ecp_curves.c", "${chip_root}/third_party/mbedtls/repo/library/entropy.c", - "${chip_root}/third_party/mbedtls/repo/library/entropy_poll.c", - "${chip_root}/third_party/mbedtls/repo/library/error.c", - "${chip_root}/third_party/mbedtls/repo/library/gcm.c", - "${chip_root}/third_party/mbedtls/repo/library/havege.c", "${chip_root}/third_party/mbedtls/repo/library/hkdf.c", "${chip_root}/third_party/mbedtls/repo/library/hmac_drbg.c", "${chip_root}/third_party/mbedtls/repo/library/md.c", - "${chip_root}/third_party/mbedtls/repo/library/md2.c", - "${chip_root}/third_party/mbedtls/repo/library/md4.c", - "${chip_root}/third_party/mbedtls/repo/library/md5.c", - "${chip_root}/third_party/mbedtls/repo/library/memory_buffer_alloc.c", - "${chip_root}/third_party/mbedtls/repo/library/net_sockets.c", - "${chip_root}/third_party/mbedtls/repo/library/nist_kw.c", "${chip_root}/third_party/mbedtls/repo/library/oid.c", - "${chip_root}/third_party/mbedtls/repo/library/padlock.c", - "${chip_root}/third_party/mbedtls/repo/library/pem.c", "${chip_root}/third_party/mbedtls/repo/library/pk.c", "${chip_root}/third_party/mbedtls/repo/library/pk_wrap.c", - "${chip_root}/third_party/mbedtls/repo/library/pkcs11.c", - "${chip_root}/third_party/mbedtls/repo/library/pkcs12.c", "${chip_root}/third_party/mbedtls/repo/library/pkcs5.c", "${chip_root}/third_party/mbedtls/repo/library/pkparse.c", "${chip_root}/third_party/mbedtls/repo/library/pkwrite.c", "${chip_root}/third_party/mbedtls/repo/library/platform.c", "${chip_root}/third_party/mbedtls/repo/library/platform_util.c", - "${chip_root}/third_party/mbedtls/repo/library/poly1305.c", - "${chip_root}/third_party/mbedtls/repo/library/psa_crypto.c", - "${chip_root}/third_party/mbedtls/repo/library/psa_crypto_driver_wrappers.c", - "${chip_root}/third_party/mbedtls/repo/library/psa_crypto_se.c", - "${chip_root}/third_party/mbedtls/repo/library/psa_crypto_slot_management.c", - "${chip_root}/third_party/mbedtls/repo/library/psa_crypto_storage.c", - "${chip_root}/third_party/mbedtls/repo/library/psa_its_file.c", - "${chip_root}/third_party/mbedtls/repo/library/ripemd160.c", - "${chip_root}/third_party/mbedtls/repo/library/rsa.c", - "${chip_root}/third_party/mbedtls/repo/library/rsa_internal.c", "${chip_root}/third_party/mbedtls/repo/library/sha1.c", "${chip_root}/third_party/mbedtls/repo/library/sha256.c", - "${chip_root}/third_party/mbedtls/repo/library/sha512.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_cache.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_ciphersuites.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_cli.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_cookie.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_msg.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_srv.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_ticket.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_tls.c", - "${chip_root}/third_party/mbedtls/repo/library/ssl_tls13_keys.c", - "${chip_root}/third_party/mbedtls/repo/library/threading.c", - "${chip_root}/third_party/mbedtls/repo/library/timing.c", - "${chip_root}/third_party/mbedtls/repo/library/version.c", - "${chip_root}/third_party/mbedtls/repo/library/version_features.c", - "${chip_root}/third_party/mbedtls/repo/library/x509.c", "${chip_root}/third_party/mbedtls/repo/library/x509_create.c", - "${chip_root}/third_party/mbedtls/repo/library/x509_crl.c", - "${chip_root}/third_party/mbedtls/repo/library/x509_crt.c", - "${chip_root}/third_party/mbedtls/repo/library/x509_csr.c", - "${chip_root}/third_party/mbedtls/repo/library/x509write_crt.c", "${chip_root}/third_party/mbedtls/repo/library/x509write_csr.c", - "${chip_root}/third_party/mbedtls/repo/library/xtea.c", - "${qpg_sdk_root}/Applications/Matter/shared/config/inc/FreeRTOSConfig.h", - "${qpg_sdk_root}/Applications/Matter/shared/config/src/hooks.c", - "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/aes_alt.h", - "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ccm_alt.h", - "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ecjpake_alt.h", - "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/ecp_alt.h", - "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt/sha256_alt.h", - "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc/${qpg_target_ic}-mbedtls-config.h", - "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/src/trng.c", - - # mbedtls_hardware_poll - "${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc/qvIO.h", - "${qpg_sdk_root}/Components/Qorvo/Matter/qvCHIP/inc/qvCHIP.h", ] + sources += mbedtls_sources + mbedtls_alt_sources if (defined(invoker.sources)) { sources += invoker.sources @@ -220,5 +148,14 @@ template("qpg_sdk") { public_configs = [ ":${sdk_target_name}_config" ] public_deps = [ "${chip_root}/third_party/qpg_sdk:freertos" ] + if (qpg_sdk_include_platform_libs) { + public_deps += [ + "${chip_root}/third_party/qpg_sdk:qpg_bootloader_lib", + "${chip_root}/third_party/qpg_sdk:qpg_glue_lib", + "${chip_root}/third_party/qpg_sdk:qpg_mbedtls_alt_lib", + "${chip_root}/third_party/qpg_sdk:qpg_openthread_glue_lib", + "${chip_root}/third_party/qpg_sdk:qpg_stack_lib", + ] + } } } diff --git a/third_party/qpg_sdk/repo b/third_party/qpg_sdk/repo index 35ccb383fb401a..e92a7eb78f7f8a 160000 --- a/third_party/qpg_sdk/repo +++ b/third_party/qpg_sdk/repo @@ -1 +1 @@ -Subproject commit 35ccb383fb401ad8ed02162a33915b1dff2af9d0 +Subproject commit e92a7eb78f7f8aa4de774cdd973272767eab2e8a From 99c2e48a142cd072bd7c739c1d2b4140014a0414 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 28 Sep 2022 08:11:54 -0400 Subject: [PATCH 16/24] Fix file naming for genio (#22918) --- scripts/build/builders/genio.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build/builders/genio.py b/scripts/build/builders/genio.py index 2262cfad26f19c..ce099a2504919e 100755 --- a/scripts/build/builders/genio.py +++ b/scripts/build/builders/genio.py @@ -19,9 +19,9 @@ def ExampleName(self): def AppNamePrefix(self): if self == GenioApp.LIGHT: - return 'chip-genio-lighting-app-example' + return 'chip-mt793x-lighting-app-example' elif self == GenioApp.SHELL: - return 'chip-genio-shell-example' + return 'chip-mt793x-shell-example' else: raise Exception('Unknown app type: %r' % self) From a8bd3897a5ea57277cded688c00a6a75309a7ae1 Mon Sep 17 00:00:00 2001 From: jinran-google Date: Wed, 28 Sep 2022 22:06:25 +0800 Subject: [PATCH 17/24] [Thread] fix assertions in operational dataset (#22858) The assertions in `SetExtendedPanId` and `SetMasterKey` would fail if the dataset is exactly 254 bytes after sets it. --- src/lib/support/ThreadOperationalDataset.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/support/ThreadOperationalDataset.cpp b/src/lib/support/ThreadOperationalDataset.cpp index bb3837df3555bb..cbce0de667ac2a 100644 --- a/src/lib/support/ThreadOperationalDataset.cpp +++ b/src/lib/support/ThreadOperationalDataset.cpp @@ -318,7 +318,7 @@ CHIP_ERROR OperationalDataset::SetExtendedPanId(const uint8_t (&aExtendedPanId)[ tlv->SetValue(aExtendedPanId, sizeof(aExtendedPanId)); - assert(mLength + tlv->GetSize() < sizeof(mData)); + assert(mLength + tlv->GetSize() <= sizeof(mData)); mLength = static_cast(mLength + tlv->GetSize()); @@ -349,7 +349,7 @@ CHIP_ERROR OperationalDataset::SetMasterKey(const uint8_t (&aMasterKey)[kSizeMas tlv->SetValue(aMasterKey, sizeof(aMasterKey)); - assert(mLength + tlv->GetSize() < sizeof(mData)); + assert(mLength + tlv->GetSize() <= sizeof(mData)); mLength = static_cast(mLength + tlv->GetSize()); From d5d61fc6b4b09d2b6fffb6ebddc69b6c104936b9 Mon Sep 17 00:00:00 2001 From: Yufeng Wang Date: Wed, 28 Sep 2022 08:13:36 -0700 Subject: [PATCH 18/24] Run yaml and unit test for unified coverage (#22892) * Include yaml test into test coverage result * Address review comments --- BUILD.gn | 13 +++++++++++++ scripts/build_coverage.sh | 24 +++++++++++++++++++++++- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index e5b64a2f62e4d5..e21616f90f9a87 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -43,6 +43,9 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { (current_os == "mac" || current_os == "linux") && (host_cpu == "x64" || host_cpu == "arm64" || host_cpu == "arm") enable_pylib = false + + # Build the Linux all clusters app example with default group + chip_build_all_clusters_app = false } if (enable_fuzz_test_targets) { @@ -218,6 +221,16 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (build_tv_casting_common_a) { deps += [ "${chip_root}/examples/tv-casting-app/tv-casting-common:tvCastingCommon" ] } + + if (chip_build_all_clusters_app) { + if (is_libfuzzer) { + deps += [ "${chip_root}/examples/all-clusters-app/linux:chip-all-clusters-app-fuzzing" ] + } else { + deps += [ + "${chip_root}/examples/all-clusters-app/linux:chip-all-clusters-app", + ] + } + } } if (chip_build_tools) { diff --git a/scripts/build_coverage.sh b/scripts/build_coverage.sh index 91f5e7f4f0e2a0..d89967f701913a 100755 --- a/scripts/build_coverage.sh +++ b/scripts/build_coverage.sh @@ -46,6 +46,7 @@ CHIP_ROOT=$(_normpath "$(dirname "$0")/..") OUTPUT_ROOT="$CHIP_ROOT/out/coverage" COVERAGE_ROOT="$OUTPUT_ROOT/coverage" skip_gn=false +run_yaml=false help() { @@ -53,6 +54,7 @@ help() { echo "General Options: -h, --help Display this information. + -f, --full Run both yaml and unit tests for unified coverage. Input Options: -o, --output_root Set the build output directory. When set manually, performs only lcov stage on provided build output. Assumes output_root has been built with 'use_coverage=true' @@ -68,6 +70,9 @@ while (($#)); do help exit 1 ;; + --full | -f) + run_yaml=true + ;; --output_root | -o) OUTPUT_ROOT=$2 COVERAGE_ROOT="$OUTPUT_ROOT/coverage" @@ -88,10 +93,27 @@ source "$CHIP_ROOT/scripts/activate.sh" # Generates ninja files if [ "$skip_gn" == false ]; then - gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args='use_coverage=true' + gn --root="$CHIP_ROOT" gen "$OUTPUT_ROOT" --args='use_coverage=true chip_build_all_clusters_app=true' + ninja -C "$OUTPUT_ROOT" +fi + +# Run unit tests +if [ "$skip_gn" == false ]; then ninja -C "$OUTPUT_ROOT" check fi +# Run yaml tests +if [ "$run_yaml" == true ]; then + scripts/run_in_build_env.sh \ + "./scripts/tests/run_test_suite.py \ + --chip-tool ""$OUTPUT_ROOT/chip-tool \ + run \ + --iterations 1 \ + --test-timeout-seconds 120 \ + --all-clusters-app ""$OUTPUT_ROOT/chip-all-clusters-app + " +fi + # Remove unit test itself from coverage statistics find "$OUTPUT_ROOT/obj/src/" -depth -name 'tests' -exec rm -rf {} \; From 6dfab6fb446b0ff86d5e35a5d87c1f8df74534ef Mon Sep 17 00:00:00 2001 From: andrei-menzopol <96489227+andrei-menzopol@users.noreply.github.com> Date: Wed, 28 Sep 2022 19:17:08 +0300 Subject: [PATCH 19/24] [K32W0] Update Docker image to accomodate SDK 2.6.7 (#22921) Signed-off-by: Andrei Menzopol Signed-off-by: Andrei Menzopol --- integrations/docker/images/chip-build-k32w/Dockerfile | 6 +++--- integrations/docker/images/chip-build/version | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/docker/images/chip-build-k32w/Dockerfile b/integrations/docker/images/chip-build-k32w/Dockerfile index ba925821566384..d07d868e59c19a 100644 --- a/integrations/docker/images/chip-build-k32w/Dockerfile +++ b/integrations/docker/images/chip-build-k32w/Dockerfile @@ -12,9 +12,9 @@ RUN set -x \ WORKDIR /opt/sdk # Setup the K32W SDK RUN set -x \ - && wget https://cache.nxp.com/lgfiles/bsps/SDK_2_6_6_K32W061DK6.zip \ - && unzip SDK_2_6_6_K32W061DK6.zip \ - && rm -rf SDK_2_6_6_K32W061DK6.zip \ + && wget https://cache.nxp.com/lgfiles/bsps/SDK_2_6_7_K32W061DK6.zip \ + && unzip SDK_2_6_7_K32W061DK6.zip \ + && rm -rf SDK_2_6_7_K32W061DK6.zip \ && : # last line FROM connectedhomeip/chip-build:${VERSION} diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 2c7460f1cae50b..98ee5e6302783c 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.5.99 Version bump reason: fix IMX SDK root in vscode dockerfile +0.6.00 Version bump reason: K32W0-SDK 2.6.7 update From 46fd14aaf361d85f1204075a18a20f6b39a89074 Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Wed, 28 Sep 2022 13:24:49 -0400 Subject: [PATCH 20/24] Remove 'issue required' check from CI (#22934) * Remove requirement for a issue in PRs * Update the pull request template to not directly require a issue number anymore --- .github/PULL_REQUEST_TEMPLATE.md | 15 +++++++++---- .github/workflows/require-issue.yaml | 32 ---------------------------- 2 files changed, 11 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/require-issue.yaml diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f610e3bfecf7e1..16f3afcae54feb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,12 @@ -#### Issue Being Resolved -* Fixes #12345 (exactly like this, so this PR is associated with an issue) +> !!!!!!!!!! Please delete the instructions below and replace with PR desription +> +> If you have an issue number, please use a syntax of +> `Fixes #12345` and a brief change description +> +> If you do not have an issue number, please have a good description of +> the problem and the fix. Help the reviewer understand what to expect. +> +> Make sure you delete these instructions (to prove you have read them). +> +> !!!!!!!!!! Instructions end -#### Change overview -What's in this PR diff --git a/.github/workflows/require-issue.yaml b/.github/workflows/require-issue.yaml deleted file mode 100644 index 3915821ae618b7..00000000000000 --- a/.github/workflows/require-issue.yaml +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (c) 2020 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Require Issues for PRs - -on: - pull_request: - types: [edited, synchronize, opened, reopened] - -jobs: - verify_issue_exists: - name: Verify Linked Issue - runs-on: ubuntu-latest - - steps: - - name: Verify Linked Issue - uses: hattan/verify-linked-issue-action@v1.1.5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - message: "All PRs require an issue to be accepted, please link an issue or mention it in the body using #" From 3bd7c373366e4a0e38615b8b02bbebaf799332a3 Mon Sep 17 00:00:00 2001 From: Wootak Jung Date: Thu, 29 Sep 2022 04:49:11 +0900 Subject: [PATCH 21/24] [Tizen] Fix ipv6 link local interface issue (#22888) * [Tizen] Fix ipv6 link local interface issue Signed-off-by: kibak.yoon Signed-off-by: Wootak Jung * Add error handling logic Signed-off-by: kibak.yoon Signed-off-by: Wootak Jung --- src/platform/Tizen/DnssdImpl.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/platform/Tizen/DnssdImpl.cpp b/src/platform/Tizen/DnssdImpl.cpp index ed4276e0866033..40a3e23e4f9b49 100644 --- a/src/platform/Tizen/DnssdImpl.cpp +++ b/src/platform/Tizen/DnssdImpl.cpp @@ -299,11 +299,13 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * data) char * ipv4 = nullptr; char * ipv6 = nullptr; int port = 0; + char * interface = nullptr; unsigned short txtLen = 0; uint8_t * txtRecord = nullptr; std::vector textEntries; DnssdService dnssdService = {}; chip::Inet::IPAddress ipAddr; + CHIP_ERROR err = CHIP_NO_ERROR; // In fact, if cancel resolve fails, we can not do anything about it int ret = dnssd_cancel_resolve_service(service); @@ -352,6 +354,14 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * data) dnssdService.mPort = static_cast(port); + ret = dnssd_service_get_interface(service, &interface); + VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_interface() failed. ret: %d", ret)); + + err = chip::Inet::InterfaceId::InterfaceNameToId(interface, dnssdService.mInterface); + VerifyOrExit( + err == CHIP_NO_ERROR, + ChipLogError(DeviceLayer, "chip::Inet::InterfaceId::InterfaceNameToId() failed. ret: %" CHIP_ERROR_FORMAT, err.Format())); + ret = dnssd_service_get_all_txt_record(service, &txtLen, reinterpret_cast(&txtRecord)); VerifyOrExit(ret == DNSSD_ERROR_NONE, ChipLogError(DeviceLayer, "dnssd_service_get_all_txt_record() failed. ret: %d", ret)); @@ -371,7 +381,14 @@ void OnResolve(dnssd_error_e result, dnssd_service_h service, void * data) return; exit: - rCtx->mCallback(rCtx->mCbContext, nullptr, chip::Span(), GetChipError(ret)); + if (err == CHIP_NO_ERROR) + { + rCtx->mCallback(rCtx->mCbContext, nullptr, chip::Span(), GetChipError(ret)); + } + else + { + rCtx->mCallback(rCtx->mCbContext, nullptr, chip::Span(), err); + } rCtx->mInstance->RemoveContext(rCtx); } From 5701b1758d5a6057b0739fd8ee6d082d9e1a5f10 Mon Sep 17 00:00:00 2001 From: Sharad Binjola <31142146+sharadb-amazon@users.noreply.github.com> Date: Wed, 28 Sep 2022 14:21:07 -0700 Subject: [PATCH 22/24] Extending Media attribute subscriptions to Android tv-casting-app and lib (#22859) --- .../casting/app/CommissioningFragment.java | 7 +- .../casting/app/ContentLauncherFragment.java | 7 +- .../com/chip/casting/app/MainActivity.java | 14 +- .../casting/app/MediaPlaybackFragment.java | 133 +++ .../casting/app/SelectClusterFragment.java | 78 ++ .../chip/casting/ContentLauncherTypes.java | 96 ++ .../jni/com/chip/casting/FailureCallback.java | 26 + .../chip/casting/MatterCallbackHandler.java | 52 +- .../jni/com/chip/casting/MatterError.java | 66 ++ .../com/chip/casting/MediaPlaybackTypes.java | 56 ++ .../SubscriptionEstablishedCallback.java | 22 + .../jni/com/chip/casting/SuccessCallback.java | 22 + .../chip/casting/TargetNavigatorTypes.java | 44 + .../jni/com/chip/casting/TvCastingApp.java | 132 +++ .../App/app/src/main/jni/cpp/Constants.h | 26 + .../jni/cpp/MatterCallbackHandler-JNI.cpp | 331 ++++++- .../main/jni/cpp/MatterCallbackHandler-JNI.h | 221 ++++- .../app/src/main/jni/cpp/TvCastingApp-JNI.cpp | 871 ++++++++++++++++++ .../app/src/main/jni/cpp/TvCastingApp-JNI.h | 59 ++ .../res/layout/fragment_media_playback.xml | 106 +++ .../res/layout/fragment_select_cluster.xml | 36 + .../App/app/src/main/res/values/strings.xml | 11 + examples/tv-casting-app/android/BUILD.gn | 7 + .../tv-casting-app/tv-casting-common/BUILD.gn | 1 + .../include/ApplicationBasic.h | 73 ++ .../tv-casting-common/include/CastingServer.h | 93 ++ .../include/ContentLauncher.h | 17 + .../tv-casting-common/src/CastingServer.cpp | 137 +++ 28 files changed, 2672 insertions(+), 72 deletions(-) create mode 100644 examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java create mode 100644 examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_media_playback.xml create mode 100644 examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_select_cluster.xml create mode 100644 examples/tv-casting-app/tv-casting-common/include/ApplicationBasic.h diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissioningFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissioningFragment.java index a46714224e8e2a..71b2d62b38b18d 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissioningFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/CommissioningFragment.java @@ -9,6 +9,7 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.chip.casting.MatterCallbackHandler; +import com.chip.casting.MatterError; import com.chip.casting.TvCastingApp; import com.chip.casting.dnssd.DiscoveredNodeData; import com.chip.casting.util.GlobalCastingConstants; @@ -53,9 +54,9 @@ public View onCreateView( GlobalCastingConstants.CommissioningWindowDurationSecs, new MatterCallbackHandler() { @Override - public void handle(Status status) { - Log.d(TAG, "handle() called on CommissioningComplete event with " + status); - if (status.isSuccess()) { + public void handle(MatterError error) { + Log.d(TAG, "handle() called on CommissioningComplete event with " + error); + if (error.isNoError()) { callback.handleCommissioningComplete(); } } diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java index 0e1ff58fbdeb59..d939ad944265c6 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/ContentLauncherFragment.java @@ -10,6 +10,7 @@ import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import com.chip.casting.MatterCallbackHandler; +import com.chip.casting.MatterError; import com.chip.casting.TvCastingApp; /** A {@link Fragment} to send Content Launcher commands from the TV Casting App. */ @@ -55,10 +56,10 @@ public void onClick(View v) { contentDisplayString.getText().toString(), new MatterCallbackHandler() { @Override - public void handle(Status status) { - Log.d(TAG, "handle() called on LaunchURLResponse with success " + status); + public void handle(MatterError error) { + Log.d(TAG, "handle() called on LaunchURLResponse with " + error); TextView launchUrlStatus = getView().findViewById(R.id.launchUrlStatus); - launchUrlStatus.setText(status.isSuccess() ? "Success!" : "Failure!"); + launchUrlStatus.setText(error.isNoError() ? "Success!" : "Failure!"); } }); } diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java index afd768a1a20679..c9d493d214b7cd 100644 --- a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MainActivity.java @@ -21,7 +21,9 @@ import com.chip.casting.util.GlobalCastingConstants; public class MainActivity extends AppCompatActivity - implements CommissionerDiscoveryFragment.Callback, CommissioningFragment.Callback { + implements CommissionerDiscoveryFragment.Callback, + CommissioningFragment.Callback, + SelectClusterFragment.Callback { private static final String TAG = MainActivity.class.getSimpleName(); @@ -49,9 +51,19 @@ public void handleCommissioningButtonClicked(DiscoveredNodeData commissioner) { @Override public void handleCommissioningComplete() { + showFragment(SelectClusterFragment.newInstance()); + } + + @Override + public void handleContentLauncherSelected() { showFragment(ContentLauncherFragment.newInstance(tvCastingApp)); } + @Override + public void handleMediaPlaybackSelected() { + showFragment(MediaPlaybackFragment.newInstance(tvCastingApp)); + } + /** * The order is important, must first new TvCastingApp to load dynamic library, then * AndroidChipPlatform to prepare platform, then start ChipAppServer, then call init on diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java new file mode 100644 index 00000000000000..6745b94904e192 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/MediaPlaybackFragment.java @@ -0,0 +1,133 @@ +package com.chip.casting.app; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.TextView; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; +import com.chip.casting.FailureCallback; +import com.chip.casting.MatterError; +import com.chip.casting.MediaPlaybackTypes; +import com.chip.casting.SubscriptionEstablishedCallback; +import com.chip.casting.SuccessCallback; +import com.chip.casting.TvCastingApp; + +/** A {@link Fragment} for the Media Playback cluster */ +public class MediaPlaybackFragment extends Fragment { + private static final String TAG = MediaPlaybackFragment.class.getSimpleName(); + + private final TvCastingApp tvCastingApp; + + private View.OnClickListener subscribeToCurrentStateButtonClickListener; + + public MediaPlaybackFragment(TvCastingApp tvCastingApp) { + this.tvCastingApp = tvCastingApp; + } + + /** + * Use this factory method to create a new instance of this fragment using the provided + * parameters. + * + * @param tvCastingApp TV Casting App (JNI) + * @return A new instance of fragment MediaPlaybackFragment. + */ + public static MediaPlaybackFragment newInstance(TvCastingApp tvCastingApp) { + return new MediaPlaybackFragment(tvCastingApp); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView( + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + this.subscribeToCurrentStateButtonClickListener = + new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d(TAG, "SubscribeToCurrentStateButtonClickListener called"); + TextView minInterval = getView().findViewById(R.id.minIntervalEditText); + TextView maxInterval = getView().findViewById(R.id.maxIntervalEditText); + TextView subscriptionStatus = + getView().findViewById(R.id.currentStateSubscriptionEstablishedStatus); + TextView currentStateValue = getView().findViewById(R.id.currentStateValue); + + SuccessCallback successCallback = + playbackStateEnum -> { + Log.d( + TAG, + "handle() called on SuccessCallback with " + + playbackStateEnum); + getActivity() + .runOnUiThread( + new Runnable() { + @Override + public void run() { + if (playbackStateEnum != null) { + currentStateValue.setText(playbackStateEnum.toString()); + } + } + }); + }; + + FailureCallback failureCallback = + new FailureCallback() { + @Override + public void handle(MatterError matterError) { + Log.d(TAG, "handle() called on FailureCallback with " + matterError); + getActivity() + .runOnUiThread( + new Runnable() { + @Override + public void run() { + currentStateValue.setText("Error!"); + } + }); + } + }; + + SubscriptionEstablishedCallback subscriptionEstablishedCallback = + (SubscriptionEstablishedCallback) + () -> { + Log.d(TAG, "handle() called on SubscriptionEstablishedCallback"); + getActivity() + .runOnUiThread( + new Runnable() { + @Override + public void run() { + subscriptionStatus.setText("Subscription established!"); + } + }); + }; + + boolean retVal = + tvCastingApp.mediaPlayback_subscribeToCurrentState( + successCallback, + failureCallback, + Integer.parseInt(minInterval.getText().toString()), + Integer.parseInt(maxInterval.getText().toString()), + subscriptionEstablishedCallback); + Log.d(TAG, "tvCastingApp.mediaPlayback_subscribeToCurrentState returned " + retVal); + if (retVal == false) { + subscriptionStatus.setText("Subscribe call failed!"); + } + } + }; + + return inflater.inflate(R.layout.fragment_media_playback, container, false); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + Log.d(TAG, "MediaPlaybackFragment.onViewCreated called"); + getView() + .findViewById(R.id.subscribeToCurrentStateButton) + .setOnClickListener(subscribeToCurrentStateButtonClickListener); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java new file mode 100644 index 00000000000000..67de30838b296d --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/java/com/chip/casting/app/SelectClusterFragment.java @@ -0,0 +1,78 @@ +package com.chip.casting.app; + +import android.os.Bundle; +import android.util.Log; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import androidx.annotation.Nullable; +import androidx.fragment.app.Fragment; + +/** An interstitial {@link Fragment} to select one of the supported media actions to perform */ +public class SelectClusterFragment extends Fragment { + private static final String TAG = SelectClusterFragment.class.getSimpleName(); + + private View.OnClickListener selectContentLauncherButtonClickListener; + private View.OnClickListener selectMediaPlaybackButtonClickListener; + + /** + * Use this factory method to create a new instance of this fragment using the provided + * parameters. + * + * @return A new instance of fragment SelectActionFragment. + */ + public static SelectClusterFragment newInstance() { + return new SelectClusterFragment(); + } + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + } + + @Override + public View onCreateView( + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + SelectClusterFragment.Callback callback = (SelectClusterFragment.Callback) this.getActivity(); + this.selectContentLauncherButtonClickListener = + new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d(TAG, "handle() called on selectContentLauncherButtonClickListener"); + callback.handleContentLauncherSelected(); + } + }; + + this.selectMediaPlaybackButtonClickListener = + new View.OnClickListener() { + @Override + public void onClick(View v) { + Log.d(TAG, "handle() called on selectMediaPlaybackButtonClickListener"); + callback.handleMediaPlaybackSelected(); + } + }; + + return inflater.inflate(R.layout.fragment_select_cluster, container, false); + } + + @Override + public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + Log.d(TAG, "SelectActionFragment.onViewCreated called"); + getView() + .findViewById(R.id.selectContentLauncherButton) + .setOnClickListener(selectContentLauncherButtonClickListener); + getView() + .findViewById(R.id.selectMediaPlaybackButton) + .setOnClickListener(selectMediaPlaybackButtonClickListener); + } + + /** Interface for notifying the host. */ + public interface Callback { + /** Notifies listener to trigger transition on selection of Content Launcher cluster */ + void handleContentLauncherSelected(); + + /** Notifies listener to trigger transition on selection of Media Playback cluster */ + void handleMediaPlaybackSelected(); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java new file mode 100644 index 00000000000000..bc4ee6a6a24bdf --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/ContentLauncherTypes.java @@ -0,0 +1,96 @@ +/* + * 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. + * + */ +package com.chip.casting; + +import java.util.ArrayList; +import java.util.Optional; + +public class ContentLauncherTypes { + public static class AdditionalInfo { + public String name; + public String value; + + public AdditionalInfo(String name, String value) { + this.name = name; + this.value = value; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("AdditionalInfo {\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class Parameter { + public Integer type; + public String value; + public Optional> externalIDList; + + public Parameter( + Integer type, String value, Optional> externalIDList) { + this.type = type; + this.value = value; + this.externalIDList = externalIDList; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("Parameter {\n"); + output.append("\ttype: "); + output.append(type); + output.append("\n"); + output.append("\tvalue: "); + output.append(value); + output.append("\n"); + output.append("\texternalIDList: "); + output.append(externalIDList); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } + + public static class ContentSearch { + public ArrayList parameterList; + + public ContentSearch(ArrayList parameterList) { + this.parameterList = parameterList; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("ContentSearch {\n"); + output.append("\tparameterList: "); + output.append(parameterList); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java new file mode 100644 index 00000000000000..1d6b4097e77cbc --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/FailureCallback.java @@ -0,0 +1,26 @@ +/* + * 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. + * + */ +package com.chip.casting; + +public abstract class FailureCallback { + public abstract void handle(MatterError err); + + public final void handle(int errorCode, String errorMessage) { + handle(new MatterError(errorCode, errorMessage)); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java index 44eb3472d8f496..a06f12248883db 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterCallbackHandler.java @@ -17,58 +17,10 @@ */ package com.chip.casting; -import java.util.Objects; - public abstract class MatterCallbackHandler { - public abstract void handle(Status status); + public abstract void handle(MatterError err); public final void handle(int errorCode, String errorMessage) { - handle(new Status(errorCode, errorMessage)); - } - - public static class Status { - private int errorCode; - private String errorMessage; - - public static final Status SUCCESS = new Status(0, null); - - public Status(int errorCode, String errorMessage) { - this.errorCode = errorCode; - this.errorMessage = errorMessage; - } - - public boolean isSuccess() { - return this.equals(SUCCESS); - } - - public int getErrorCode() { - return errorCode; - } - - public String getErrorMessage() { - return errorMessage; - } - - @Override - public String toString() { - return "Status{" - + (isSuccess() - ? "Success" - : "errorCode=" + errorCode + ", errorMessage='" + errorMessage + '\'') - + '}'; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - Status status = (Status) o; - return errorCode == status.errorCode; - } - - @Override - public int hashCode() { - return Objects.hash(errorCode); - } + handle(new MatterError(errorCode, errorMessage)); } } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java new file mode 100644 index 00000000000000..aaaf95911f18da --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MatterError.java @@ -0,0 +1,66 @@ +/* + * 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. + * + */ +package com.chip.casting; + +import java.util.Objects; + +public class MatterError { + private int errorCode; + private String errorMessage; + + public static final MatterError NO_ERROR = new MatterError(0, null); + + public MatterError(int errorCode, String errorMessage) { + this.errorCode = errorCode; + this.errorMessage = errorMessage; + } + + public boolean isNoError() { + return this.equals(NO_ERROR); + } + + public int getErrorCode() { + return errorCode; + } + + public String getErrorMessage() { + return errorMessage; + } + + @Override + public String toString() { + return "MatterError{" + + (isNoError() + ? "No error" + : "errorCode=" + errorCode + ", errorMessage='" + errorMessage + '\'') + + '}'; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + MatterError matterError = (MatterError) o; + return errorCode == matterError.errorCode; + } + + @Override + public int hashCode() { + return Objects.hash(errorCode); + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java new file mode 100644 index 00000000000000..7bf37b5d1cd8e4 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/MediaPlaybackTypes.java @@ -0,0 +1,56 @@ +/* + * 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. + * + */ +package com.chip.casting; + +public class MediaPlaybackTypes { + public enum PlaybackStateEnum { + Playing, + Paused, + NotPlaying, + Buffering, + Unknown + } + + public static class PlaybackPosition { + public Long updatedAt; + public Long position; + + public PlaybackPosition(Long updatedAt) { + this.updatedAt = updatedAt; + } + + public PlaybackPosition(Long updatedAt, Long position) { + this.updatedAt = updatedAt; + this.position = position; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("PlaybackPosition {\n"); + output.append("\tupdatedAt: "); + output.append(updatedAt); + output.append("\n"); + output.append("\tposition: "); + output.append(position); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java new file mode 100644 index 00000000000000..e182c80e7ccdef --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SubscriptionEstablishedCallback.java @@ -0,0 +1,22 @@ +/* + * 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. + * + */ +package com.chip.casting; + +public interface SubscriptionEstablishedCallback { + void handle(); +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java new file mode 100644 index 00000000000000..125ce4daabfc90 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/SuccessCallback.java @@ -0,0 +1,22 @@ +/* + * 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. + * + */ +package com.chip.casting; + +public interface SuccessCallback { + void handle(R response); +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java new file mode 100644 index 00000000000000..88f71bb796ceaf --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TargetNavigatorTypes.java @@ -0,0 +1,44 @@ +/* + * 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. + * + */ +package com.chip.casting; + +public class TargetNavigatorTypes { + public static class TargetInfo { + public Integer identifier; + public String name; + + public TargetInfo(Integer identifier, String name) { + this.identifier = identifier; + this.name = name; + } + + @Override + public String toString() { + StringBuilder output = new StringBuilder(); + output.append("TargetInfo {\n"); + output.append("\tidentifier: "); + output.append(identifier); + output.append("\n"); + output.append("\tname: "); + output.append(name); + output.append("\n"); + output.append("}\n"); + return output.toString(); + } + } +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java index e8804387149b47..eb3a184b1ab3f8 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java +++ b/examples/tv-casting-app/android/App/app/src/main/jni/com/chip/casting/TvCastingApp.java @@ -33,10 +33,25 @@ public native boolean openBasicCommissioningWindow( /* * CONTENT LAUNCHER CLUSTER + * + * TODO: Add API to subscribe to AcceptHeader */ public native boolean contentLauncherLaunchURL( String contentUrl, String contentDisplayStr, Object launchURLHandler); + public native boolean contentLauncher_launchContent( + ContentLauncherTypes.ContentSearch search, + boolean autoPlay, + String data, + Object responseHandler); + + public native boolean contentLauncher_subscribeToSupportedStreamingProtocols( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + /* * LEVEL CONTROL CLUSTER */ @@ -55,6 +70,27 @@ public native boolean levelControl_moveToLevel( byte optionOverridem, Object responseHandler); + public native boolean levelControl_subscribeToCurrentLevel( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean levelControl_subscribeToMinLevel( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean levelControl_subscribeToMaxLevel( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + /* * MEDIA PLAYBACK CLUSTER */ @@ -74,6 +110,48 @@ public native boolean mediaPlayback_skipForward( public native boolean mediaPlayback_skipBackward( long deltaPositionMilliseconds, Object responseHandler); + public native boolean mediaPlayback_subscribeToCurrentState( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean mediaPlayback_subscribeToDuration( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean mediaPlayback_subscribeToSampledPosition( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean mediaPlayback_subscribeToPlaybackSpeed( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean mediaPlayback_subscribeToSeekRangeEnd( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean mediaPlayback_subscribeToSeekRangeStart( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + /* * APPLICATION LAUNCHER CLUSTER */ @@ -92,11 +170,65 @@ public native boolean applicationLauncher_hideApp( public native boolean targetNavigator_navigateTarget( byte target, String data, Object responseHandler); + public native boolean targetNavigator_subscribeToCurrentTarget( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean targetNavigator_subscribeToTargetList( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + /* * KEYPAD INPUT CLUSTER */ public native boolean keypadInput_sendKey(byte keyCode, Object responseHandler); + /** + * APPLICATION BASIC + * + *

TODO: Add APIs to subscribe to Application, Status and AllowedVendorList + */ + public native boolean applicationBasic_subscribeToVendorName( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean applicationBasic_subscribeToVendorID( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean applicationBasic_subscribeToApplicationName( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean applicationBasic_subscribeToProductID( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + + public native boolean applicationBasic_subscribeToApplicationVersion( + SuccessCallback readSuccessHandler, + FailureCallback readFailureHandler, + int minInterval, + int maxInterval, + SubscriptionEstablishedCallback subscriptionEstablishedHandler); + static { System.loadLibrary("TvCastingApp"); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h index ddf0ef028e9eb7..334e1180e13f72 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/Constants.h @@ -38,3 +38,29 @@ enum MediaCommandName MEDIA_COMMAND_COUNT }; + +enum MediaAttributeName +{ + ContentLauncher_SupportedStreamingProtocols, + ContentLauncher_AcceptHeader, + LevelControl_CurrentLevel, + LevelControl_MinLevel, + LevelControl_MaxLevel, + MediaPlayback_CurrentState, + MediaPlayback_StartTime, + MediaPlayback_Duration, + MediaPlayback_SampledPosition, + MediaPlayback_PlaybackSpeed, + MediaPlayback_SeekRangeEnd, + MediaPlayback_SeekRangeStart, + ApplicationLauncher_CurrentApp, + TargetNavigator_TargetList, + TargetNavigator_CurrentTarget, + ApplicationBasic_VendorName, + ApplicationBasic_VendorID, + ApplicationBasic_ApplicationName, + ApplicationBasic_ProductID, + ApplicationBasic_ApplicationVersion, + + MEDIA_ATTRIBUTE_COUNT +}; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp index 3f28b5ac5f84d7..ef682b67da3d78 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.cpp @@ -18,14 +18,11 @@ #include "MatterCallbackHandler-JNI.h" -#include -#include - using namespace chip; -CHIP_ERROR MatterCallbackHandlerJNI::SetUp(JNIEnv * env, jobject inHandler) +CHIP_ERROR CallbackBaseJNI::SetUp(JNIEnv * env, jobject inHandler) { - ChipLogProgress(AppServer, "MatterCallbackHandlerJNI::SetUp called"); + ChipLogProgress(AppServer, "CallbackBaseJNI::SetUp called"); CHIP_ERROR err = CHIP_NO_ERROR; mObject = env->NewGlobalRef(inHandler); @@ -34,7 +31,7 @@ CHIP_ERROR MatterCallbackHandlerJNI::SetUp(JNIEnv * env, jobject inHandler) mClazz = env->GetObjectClass(mObject); VerifyOrExit(mClazz != nullptr, ChipLogError(AppServer, "Failed to get handler Java class")); - mMethod = env->GetMethodID(mClazz, "handle", "(ILjava/lang/String;)V"); + mMethod = env->GetMethodID(mClazz, "handle", mMethodSignature); if (mMethod == nullptr) { ChipLogError(AppServer, "Failed to access 'handle' method"); @@ -44,16 +41,16 @@ CHIP_ERROR MatterCallbackHandlerJNI::SetUp(JNIEnv * env, jobject inHandler) exit: if (err != CHIP_NO_ERROR) { - ChipLogError(AppServer, "MatterCallbackHandlerJNI::SetUp error: %s", err.AsString()); + ChipLogError(AppServer, "CallbackBaseJNI::SetUp error: %s", err.AsString()); return err; } return err; } -void MatterCallbackHandlerJNI::Handle(CHIP_ERROR callbackErr) +void FailureHandlerJNI::Handle(CHIP_ERROR callbackErr) { - ChipLogProgress(AppServer, "MatterCallbackHandlerJNI::Handle called"); + ChipLogProgress(AppServer, "FailureHandlerJNI::Handle called"); JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); UtfString jniCallbackErrString(env, callbackErr.AsString()); @@ -65,6 +62,320 @@ void MatterCallbackHandlerJNI::Handle(CHIP_ERROR callbackErr) exit: if (err != CHIP_NO_ERROR) { - ChipLogError(AppServer, "MatterCallbackHandlerJNI::Handle status error: %s", err.AsString()); + ChipLogError(AppServer, "FailureHandlerJNI::Handle status error: %s", err.AsString()); + } +} + +void SubscriptionEstablishedHandlerJNI::Handle() +{ + ChipLogProgress(AppServer, "SubscriptionEstablishedHandlerJNI::Handle called"); + + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrExit(mObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + + env->CallVoidMethod(mObject, mMethod); +exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SubscriptionEstablishedHandlerJNI::Handle status error: %s", err.AsString()); + } +} + +jobject ConvertToLongJObject(uint64_t responseData) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jclass responseTypeClass = env->FindClass("java/lang/Long"); + if (responseTypeClass == nullptr) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(J)V"); + return env->NewObject(responseTypeClass, constructor, responseData); +} + +jobject ConvertToFloatJObject(float responseData) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jclass responseTypeClass = env->FindClass("java/lang/Float"); + if (responseTypeClass == nullptr) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(F)V"); + return env->NewObject(responseTypeClass, constructor, responseData); +} + +jobject ConvertToShortJObject(uint16_t responseData) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jclass responseTypeClass = env->FindClass("java/lang/Short"); + if (responseTypeClass == nullptr) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(S)V"); + return env->NewObject(responseTypeClass, constructor, responseData); +} + +jobject ConvertToByteJObject(uint8_t responseData) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jclass responseTypeClass = env->FindClass("java/lang/Byte"); + if (responseTypeClass == nullptr) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(B)V"); + return env->NewObject(responseTypeClass, constructor, responseData); +} + +jstring ConvertToJString(chip::CharSpan responseData) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + return env->NewStringUTF(std::string(responseData.data(), responseData.size()).c_str()); +} + +jobject ConvertToIntegerJObject(uint32_t responseData) +{ + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jclass responseTypeClass = env->FindClass("java/lang/Integer"); + if (responseTypeClass == nullptr) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(I)V"); + return env->NewObject(responseTypeClass, constructor, responseData); +} + +// MEDIA PLAYBACK + +jobject CurrentStateSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "CurrentStateSuccessHandlerJNI::ConvertToJObject called"); + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jclass enumClass = nullptr; + CHIP_ERROR err = + JniReferences::GetInstance().GetClassRef(env, "com/chip/casting/MediaPlaybackTypes$PlaybackStateEnum", enumClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; } + + jfieldID enumType = nullptr; + switch (responseData) + { + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kPlaying: + enumType = env->GetStaticFieldID(enumClass, "Playing", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); + break; + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kPaused: + enumType = env->GetStaticFieldID(enumClass, "Paused", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); + break; + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kNotPlaying: + enumType = env->GetStaticFieldID(enumClass, "NotPlaying", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); + break; + case chip::app::Clusters::MediaPlayback::PlaybackStateEnum::kBuffering: + enumType = env->GetStaticFieldID(enumClass, "Buffering", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); + break; + default: + enumType = env->GetStaticFieldID(enumClass, "Unknown", "Lcom/chip/casting/MediaPlaybackTypes$PlaybackStateEnum;"); + break; + } + + if (enumType != nullptr) + { + return env->GetStaticObjectField(enumClass, enumType); + } + return nullptr; +} + +jobject DurationSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "DurationSuccessHandlerJNI::ConvertToJObject called"); + return responseData.IsNull() ? nullptr : ConvertToLongJObject(responseData.Value()); +} + +jobject SampledPositionSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "SampledPositionSuccessHandlerJNI::ConvertToJObject called"); + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jobject jSampledPosition = nullptr; + if (!responseData.IsNull()) + { + const chip::app::Clusters::MediaPlayback::Structs::PlaybackPosition::DecodableType & playbackPosition = + responseData.Value(); + + jclass responseTypeClass = nullptr; + CHIP_ERROR err = JniReferences::GetInstance().GetClassRef(env, "com/chip/casting/MediaPlaybackTypes$PlaybackPosition", + responseTypeClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + if (playbackPosition.position.IsNull()) + { + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(Ljava/lang/Long;)V"); + jSampledPosition = env->NewObject(responseTypeClass, constructor, playbackPosition.updatedAt); + } + else + { + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(Ljava/lang/Long;java/lang/Long;)V"); + jSampledPosition = + env->NewObject(responseTypeClass, constructor, playbackPosition.updatedAt, playbackPosition.position.Value()); + } + } + + return jSampledPosition; +} + +jobject PlaybackSpeedSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "PlaybackSpeedSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToFloatJObject(responseData); +} + +jobject SeekRangeEndSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "SeekRangeEndSuccessHandlerJNI::ConvertToJObject called"); + return responseData.IsNull() ? nullptr : ConvertToLongJObject(responseData.Value()); +} + +jobject SeekRangeStartSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "SeekRangeStartSuccessHandlerJNI::ConvertToJObject called"); + return responseData.IsNull() ? nullptr : ConvertToLongJObject(responseData.Value()); +} + +// TARGET NAVIGATOR +jobject CurrentTargetSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "CurrentTargetSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToByteJObject(responseData); +} + +jobject TargetListSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "TargetListSuccessHandlerJNI::ConvertToJObject called"); + + JNIEnv * env = JniReferences::GetInstance().GetEnvForCurrentThread(); + + jobject jArrayList; + chip::JniReferences::GetInstance().CreateArrayList(jArrayList); + auto iter = responseData.begin(); + while (iter.Next()) + { + const chip::app::Clusters::TargetNavigator::Structs::TargetInfo::DecodableType & targetInfo = iter.GetValue(); + + jclass responseTypeClass = nullptr; + CHIP_ERROR err = + JniReferences::GetInstance().GetClassRef(env, "com/chip/casting/TargetNavigatorTypes$TargetInfo", responseTypeClass); + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "ConvertToJObject: Class for Response Type not found!"); + return nullptr; + } + + jmethodID constructor = env->GetMethodID(responseTypeClass, "", "(Ljava/lang/Integer;java/lang/String;)V"); + jobject jTargetInfo = env->NewObject(responseTypeClass, constructor, targetInfo.identifier, targetInfo.name); + + chip::JniReferences::GetInstance().AddToList(jArrayList, jTargetInfo); + } + return jArrayList; +} + +// LEVEL CONTROL +jobject CurrentLevelSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "CurrentLevelSuccessHandlerJNI::ConvertToJObject called"); + return responseData.IsNull() ? nullptr : ConvertToByteJObject(responseData.Value()); +} + +jobject MinLevelSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "MinLevelSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToByteJObject(responseData); +} + +jobject MaxLevelSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "MaxLevelSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToByteJObject(responseData); +} + +// CONTENT LAUNCHER +jobject SupportedStreamingProtocolsSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "SupportedStreamingProtocolsSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToIntegerJObject(responseData); +} + +// APPLICATION BASIC +jobject VendorNameSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "VendorNameSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToJString(responseData); +} + +jobject VendorIDSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "VendorIDSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToShortJObject(responseData); +} + +jobject ApplicationNameSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "ApplicationNameSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToJString(responseData); +} + +jobject ProductIDSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "ProductIDSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToShortJObject(responseData); +} + +jobject ApplicationVersionSuccessHandlerJNI::ConvertToJObject( + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData) +{ + ChipLogProgress(AppServer, "ApplicationVersionSuccessHandlerJNI::ConvertToJObject called"); + return ConvertToJString(responseData); } diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h index 51f1f0edf45593..91babd44a4fb7b 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/MatterCallbackHandler-JNI.h @@ -18,18 +18,229 @@ #pragma once +#include #include #include +#include +#include -class MatterCallbackHandlerJNI +class CallbackBaseJNI { public: + CallbackBaseJNI(const char * methodSignature) { mMethodSignature = methodSignature; } CHIP_ERROR SetUp(JNIEnv * env, jobject inHandler); +protected: + jobject mObject = nullptr; + jclass mClazz = nullptr; + jmethodID mMethod = nullptr; + const char * mMethodSignature = nullptr; +}; + +class FailureHandlerJNI : public CallbackBaseJNI +{ +public: + FailureHandlerJNI() : CallbackBaseJNI("(ILjava/lang/String;)V") {} void Handle(CHIP_ERROR err); +}; + +class MatterCallbackHandlerJNI : public FailureHandlerJNI +{ +}; + +class SubscriptionEstablishedHandlerJNI : public CallbackBaseJNI +{ +public: + SubscriptionEstablishedHandlerJNI() : CallbackBaseJNI("()V") {} + void Handle(); +}; + +// helper functions for conversions +jobject ConvertToLongJObject(uint64_t responseData); +jobject ConvertToFloatJObject(float responseData); +jobject ConvertToShortJObject(uint8_t responseData); +jobject ConvertToByteJObject(uint8_t responseData); +jobject ConvertToIntegerJObject(uint32_t responseData); +jstring ConvertToJString(chip::CharSpan responseData); + +template +class SuccessHandlerJNI : public CallbackBaseJNI +{ +public: + SuccessHandlerJNI(const char * methodSignature) : CallbackBaseJNI(methodSignature) {} + + virtual ~SuccessHandlerJNI() = 0; + + virtual jobject ConvertToJObject(T responseData) = 0; + + void Handle(T responseData) + { + ChipLogProgress(AppServer, "SuccessHandlerJNI::Handle called"); + + JNIEnv * env = chip::JniReferences::GetInstance().GetEnvForCurrentThread(); + jobject jResponseData = ConvertToJObject(responseData); + + CHIP_ERROR err = CHIP_NO_ERROR; + VerifyOrExit(mObject != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + VerifyOrExit(mMethod != nullptr, err = CHIP_ERROR_INCORRECT_STATE); + env->CallVoidMethod(mObject, mMethod, jResponseData); + exit: + if (err != CHIP_NO_ERROR) + { + ChipLogError(AppServer, "SuccessHandlerJNI::Handle status error: %s", err.AsString()); + } + } +}; + +template +SuccessHandlerJNI::~SuccessHandlerJNI(){}; -private: - jobject mObject = nullptr; - jclass mClazz = nullptr; - jmethodID mMethod = nullptr; +// MEDIA PLAYBACK +class CurrentStateSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + CurrentStateSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} + jobject ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType responseData); +}; + +class DurationSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + DurationSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Long;)V") {} + jobject ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableArgType responseData); +}; + +class SampledPositionSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + SampledPositionSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Object;)V") {} + jobject + ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType responseData); +}; + +class PlaybackSpeedSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + PlaybackSpeedSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Float;)V") {} + jobject + ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType responseData); +}; + +class SeekRangeEndSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + SeekRangeEndSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Long;)V") {} + jobject ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType responseData); +}; + +class SeekRangeStartSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + SeekRangeStartSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Long;)V") {} + jobject + ConvertToJObject(chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType responseData); +}; + +// TARGET NAVIGATOR +class CurrentTargetSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + CurrentTargetSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} + jobject + ConvertToJObject(chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType responseData); +}; + +class TargetListSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + TargetListSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/util/ArrayList;)V") {} + jobject ConvertToJObject(chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType responseData); +}; + +// LEVEL CONTROL +class CurrentLevelSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + CurrentLevelSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} + jobject ConvertToJObject(chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType responseData); +}; + +class MinLevelSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + MinLevelSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} + jobject ConvertToJObject(chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType responseData); +}; + +class MaxLevelSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + MaxLevelSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Byte;)V") {} + jobject ConvertToJObject(chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType responseData); +}; + +// CONTENT LAUNCHER +class SupportedStreamingProtocolsSuccessHandlerJNI + : public SuccessHandlerJNI< + chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType> +{ +public: + SupportedStreamingProtocolsSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Integer;)V") {} + jobject ConvertToJObject( + chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType responseData); +}; + +// APPLICATION BASIC +class VendorNameSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + VendorNameSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/String;)V") {} + jobject + ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData); +}; + +class VendorIDSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + VendorIDSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Short;)V") {} + jobject ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData); +}; + +class ApplicationNameSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + ApplicationNameSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/String;)V") {} + jobject + ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData); +}; + +class ProductIDSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + ProductIDSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/Short;)V") {} + jobject ConvertToJObject(chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData); +}; + +class ApplicationVersionSuccessHandlerJNI + : public SuccessHandlerJNI +{ +public: + ApplicationVersionSuccessHandlerJNI() : SuccessHandlerJNI("(Ljava/lang/String;)V") {} + jobject ConvertToJObject( + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData); }; diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp index ebc564bccff185..4edb41683f1962 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -153,6 +154,152 @@ JNI_METHOD(jboolean, contentLauncherLaunchURL) return true; } +CHIP_ERROR CreateParameter(JNIEnv * env, jobject jParameter, + chip::app::Clusters::ContentLauncher::Structs::Parameter::Type & parameter) +{ + jclass jParameterClass = env->GetObjectClass(jParameter); + + jfieldID jTypeField = env->GetFieldID(jParameterClass, "type", "Ljava/lang/Integer;"); + jobject jTypeObj = env->GetObjectField(jParameter, jTypeField); + jclass jIntegerClass = env->FindClass("java/lang/Integer"); + jmethodID jIntValueMid = env->GetMethodID(jIntegerClass, "intValue", "()I"); + parameter.type = static_cast(env->CallIntMethod(jTypeObj, jIntValueMid)); + + jfieldID jValueField = env->GetFieldID(jParameterClass, "value", "Ljava/lang/String;"); + jstring jValueObj = (jstring) env->GetObjectField(jParameter, jValueField); + const char * nativeValue = env->GetStringUTFChars(jValueObj, 0); + parameter.value = CharSpan::fromCharString(nativeValue); + return CHIP_NO_ERROR; +} + +CHIP_ERROR CreateContentSearch(JNIEnv * env, jobject jSearch, + chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type & search) +{ + jclass jContentSearchClass; + ReturnErrorOnFailure( + JniReferences::GetInstance().GetClassRef(env, "com/chip/casting/ContentLauncherTypes$ContentSearch", jContentSearchClass)); + + jfieldID jParameterListField = env->GetFieldID(jContentSearchClass, "parameterList", "Ljava/util/ArrayList;"); + jobject jParameterList = env->GetObjectField(jSearch, jParameterListField); + ReturnErrorOnFailure(jParameterList != nullptr ? CHIP_NO_ERROR : CHIP_ERROR_INVALID_ARGUMENT); + + jclass jArrayListClass = env->FindClass("java/util/ArrayList"); + jmethodID sizeMid = env->GetMethodID(jArrayListClass, "size", "()I"); + size_t parameterListSize = static_cast(env->CallIntMethod(jParameterList, sizeMid)); + + jobject jIterator = env->CallObjectMethod( + jParameterList, env->GetMethodID(env->GetObjectClass(jParameterList), "iterator", "()Ljava/util/Iterator;")); + jmethodID jNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "next", "()Ljava/lang/Object;"); + jmethodID jHasNextMid = env->GetMethodID(env->GetObjectClass(jIterator), "hasNext", "()Z"); + + chip::app::Clusters::ContentLauncher::Structs::Parameter::Type * parameterList = + new chip::app::Clusters::ContentLauncher::Structs::Parameter::Type[parameterListSize]; + int parameterIndex = 0; + while (env->CallBooleanMethod(jIterator, jHasNextMid)) + { + jobject jParameter = env->CallObjectMethod(jIterator, jNextMid); + chip::app::Clusters::ContentLauncher::Structs::Parameter::Type parameter; + ReturnErrorOnFailure(CreateParameter(env, jParameter, parameter)); + parameterList[parameterIndex++] = parameter; + } + search.parameterList = chip::app::DataModel::List( + parameterList, parameterListSize); + + return CHIP_NO_ERROR; +} + +JNI_METHOD(jboolean, contentLauncher_1launchContent) +(JNIEnv * env, jobject, jobject jSearch, jboolean jAutoplay, jstring jData, jobject jResponseHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD contentLauncher_1launchContent called"); + + // prepare arguments + bool autoplay = static_cast(jAutoplay); + + const char * nativeData = env->GetStringUTFChars(jData, 0); + chip::Optional data = MakeOptional(CharSpan::fromCharString(nativeData)); + + chip::app::Clusters::ContentLauncher::Structs::ContentSearch::Type search; + CHIP_ERROR err = CreateContentSearch(env, jSearch, search); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, + "contentLauncher_1launchContent::Could not create ContentSearch object %" CHIP_ERROR_FORMAT, + err.Format())); + + err = TvCastingAppJNIMgr().getMediaCommandResponseHandler(ContentLauncher_LaunchContent).SetUp(env, jResponseHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "MatterCallbackHandlerJNI::SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ContentLauncher_LaunchContent(search, autoplay, data, [](CHIP_ERROR err) { + TvCastingAppJNIMgr().getMediaCommandResponseHandler(ContentLauncher_LaunchContent).Handle(err); + }); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer::ContentLauncher_LaunchContent failed %" CHIP_ERROR_FORMAT, err.Format())); + + env->ReleaseStringUTFChars(jData, nativeData); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, contentLauncher_1subscribeToSupportedStreamingProtocols) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD ContentLauncher_subscribeToSupportedStreamingProtocols called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getSupportedStreamingProtocolsSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionReadFailureHandler(ContentLauncher_SupportedStreamingProtocols) + .SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(ContentLauncher_SupportedStreamingProtocols) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ContentLauncher_SubscribeToSupportedStreamingProtocols( + nullptr, + [](void * context, + chip::app::Clusters::ContentLauncher::Attributes::SupportedStreamingProtocols::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getSupportedStreamingProtocolsSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ContentLauncher_SupportedStreamingProtocols).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { + TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ContentLauncher_SupportedStreamingProtocols).Handle(); + }); + + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, + "CastingServer.ContentLauncher_SubscribeToSupportedStreamingProtocols failed %" CHIP_ERROR_FORMAT, + err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + JNI_METHOD(jboolean, levelControl_1step) (JNIEnv * env, jobject, jbyte stepMode, jbyte stepSize, jshort transitionTime, jbyte optionMask, jbyte optionOverride, jobject jResponseHandler) @@ -208,6 +355,137 @@ JNI_METHOD(jboolean, levelControl_1moveToLevel) return true; } +JNI_METHOD(jboolean, levelControl_1subscribeToCurrentLevel) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD levelControl_subscribeToCurrentLevel called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getCurrentLevelSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_CurrentLevel).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(LevelControl_CurrentLevel) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->LevelControl_SubscribeToCurrentLevel( + nullptr, + [](void * context, chip::app::Clusters::LevelControl::Attributes::CurrentLevel::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getCurrentLevelSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_CurrentLevel).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_CurrentLevel).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.LevelControl_SubscribeToCurrentLevel failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, levelControl_1subscribeToMinLevel) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD levelControl_subscribeToMinLevel called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getMinLevelSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MinLevel).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MinLevel).SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->LevelControl_SubscribeToMinLevel( + nullptr, + [](void * context, chip::app::Clusters::LevelControl::Attributes::MinLevel::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getMinLevelSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MinLevel).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MinLevel).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.LevelControl_SubscribeToMinLevel failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, levelControl_1subscribeToMaxLevel) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD levelControl_subscribeToMaxLevel called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getMaxLevelSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MaxLevel).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MaxLevel).SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->LevelControl_SubscribeToMaxLevel( + nullptr, + [](void * context, chip::app::Clusters::LevelControl::Attributes::MaxLevel::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getMaxLevelSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(LevelControl_MaxLevel).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(LevelControl_MaxLevel).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.LevelControl_SubscribeToMaxLevel failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + JNI_METHOD(jboolean, mediaPlayback_1play) (JNIEnv * env, jobject, jobject jResponseHandler) { @@ -386,6 +664,277 @@ JNI_METHOD(jboolean, mediaPlayback_1skipBackward) return true; } +JNI_METHOD(jboolean, mediaPlayback_1subscribeToCurrentState) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_subscribeToCurrentState called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getCurrentStateSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_CurrentState).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(MediaPlayback_CurrentState) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->MediaPlayback_SubscribeToCurrentState( + nullptr, + [](void * context, chip::app::Clusters::MediaPlayback::Attributes::CurrentState::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getCurrentStateSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_CurrentState).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_CurrentState).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.MediaPlayback_SubscribeToCurrentState failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, mediaPlayback_1subscribeToDuration) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToDuration called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getDurationSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_Duration).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = + TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_Duration).SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->MediaPlayback_SubscribeToDuration( + nullptr, + [](void * context, chip::app::Clusters::MediaPlayback::Attributes::Duration::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getDurationSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_Duration).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_Duration).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToDuration failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, mediaPlayback_1subscribeToSampledPosition) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToSampledPosition called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getSampledPositionSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SampledPosition).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(MediaPlayback_SampledPosition) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->MediaPlayback_SubscribeToSampledPosition( + nullptr, + [](void * context, + chip::app::Clusters::MediaPlayback::Attributes::SampledPosition::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getSampledPositionSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SampledPosition).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_SampledPosition).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToSampledPosition failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, mediaPlayback_1subscribeToPlaybackSpeed) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToPlaybackSpeed called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getPlaybackSpeedSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_PlaybackSpeed).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(MediaPlayback_PlaybackSpeed) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->MediaPlayback_SubscribeToPlaybackSpeed( + nullptr, + [](void * context, chip::app::Clusters::MediaPlayback::Attributes::PlaybackSpeed::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getPlaybackSpeedSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_PlaybackSpeed).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_PlaybackSpeed).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToPlaybackSpeed failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, mediaPlayback_1subscribeToSeekRangeEnd) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToSeekRangeEnd called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getSeekRangeEndSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeEnd).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeEnd) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->MediaPlayback_SubscribeToSeekRangeEnd( + nullptr, + [](void * context, chip::app::Clusters::MediaPlayback::Attributes::SeekRangeEnd::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getSeekRangeEndSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeEnd).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeEnd).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToSeekRangeEnd failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, mediaPlayback_1subscribeToSeekRangeStart) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD mediaPlayback_1subscribeToSeekRangeStart called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getSeekRangeStartSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeStart).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeStart) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->MediaPlayback_SubscribeToSeekRangeStart( + nullptr, + [](void * context, + chip::app::Clusters::MediaPlayback::Attributes::SeekRangeStart::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getSeekRangeStartSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(MediaPlayback_SeekRangeStart).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(MediaPlayback_SeekRangeStart).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.mediaPlayback_subscribeToSeekRangeStart failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + JNI_METHOD(jboolean, applicationLauncher_1launchApp) (JNIEnv * env, jobject, jshort catalogVendorId, jstring applicationId, jbyteArray data, jobject jResponseHandler) { @@ -514,6 +1063,97 @@ JNI_METHOD(jboolean, targetNavigator_1navigateTarget) return true; } +JNI_METHOD(jboolean, targetNavigator_1subscribeToCurrentTarget) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD targetNavigator_1subscribeToCurrentTarget called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getCurrentTargetSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_CurrentTarget).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(TargetNavigator_CurrentTarget) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->TargetNavigator_SubscribeToCurrentTarget( + nullptr, + [](void * context, + chip::app::Clusters::TargetNavigator::Attributes::CurrentTarget::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getCurrentTargetSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_CurrentTarget).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(TargetNavigator_CurrentTarget).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.targetNavigator_subscribeToCurrentTarget failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, targetNavigator_1subscribeToTargetList) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD targetNavigator_1subscribeToTargetList called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getTargetListSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_TargetList).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(TargetNavigator_TargetList) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->TargetNavigator_SubscribeToTargetList( + nullptr, + [](void * context, chip::app::Clusters::TargetNavigator::Attributes::TargetList::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getTargetListSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(TargetNavigator_TargetList).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(TargetNavigator_TargetList).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.targetNavigator_subscribeToTargetList failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + JNI_METHOD(jboolean, keypadInput_1sendKey) (JNIEnv * env, jobject, jbyte keyCode, jobject jResponseHandler) { @@ -539,3 +1179,234 @@ JNI_METHOD(jboolean, keypadInput_1sendKey) return true; } + +// APPLICATION BASIC +JNI_METHOD(jboolean, applicationBasic_1subscribeToVendorName) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToVendorName called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getVendorNameSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorName).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(ApplicationBasic_VendorName) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToVendorName( + nullptr, + [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::VendorName::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getVendorNameSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorName).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_VendorName).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToVendorName failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, applicationBasic_1subscribeToVendorID) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToVendorID called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getVendorIDSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorID).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(ApplicationBasic_VendorID) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToVendorID( + nullptr, + [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::VendorID::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getVendorIDSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_VendorID).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_VendorID).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToVendorID failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, applicationBasic_1subscribeToApplicationName) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToApplicationName called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getApplicationNameSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationName).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationName) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToApplicationName( + nullptr, + [](void * context, + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationName::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getApplicationNameSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationName).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationName).Handle(); }); + + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToApplicationName failed %" CHIP_ERROR_FORMAT, + err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, applicationBasic_1subscribeToProductID) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToProductID called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getProductIDSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ProductID).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(ApplicationBasic_ProductID) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToProductID( + nullptr, + [](void * context, chip::app::Clusters::ApplicationBasic::Attributes::ProductID::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getProductIDSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ProductID).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_ProductID).Handle(); }); + + VerifyOrExit( + CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToProductID failed %" CHIP_ERROR_FORMAT, err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} + +JNI_METHOD(jboolean, applicationBasic_1subscribeToApplicationVersion) +(JNIEnv * env, jobject, jobject jReadSuccessHandler, jobject jReadFailureHandler, jint minInterval, jint maxInterval, + jobject jSubscriptionEstablishedHandler) +{ + chip::DeviceLayer::StackLock lock; + + ChipLogProgress(AppServer, "JNI_METHOD applicationBasic_1subscribeToApplicationVersion called"); + + CHIP_ERROR err = TvCastingAppJNIMgr().getApplicationVersionSuccessHandler().SetUp(env, jReadSuccessHandler); + VerifyOrExit(CHIP_NO_ERROR == err, ChipLogError(AppServer, "SuccessHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationVersion).SetUp(env, jReadFailureHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionReadFailureHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = TvCastingAppJNIMgr() + .getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationVersion) + .SetUp(env, jSubscriptionEstablishedHandler); + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "SubscriptionEstablishedHandler.SetUp failed %" CHIP_ERROR_FORMAT, err.Format())); + + err = CastingServer::GetInstance()->ApplicationBasic_SubscribeToApplicationVersion( + nullptr, + [](void * context, + chip::app::Clusters::ApplicationBasic::Attributes::ApplicationVersion::TypeInfo::DecodableArgType responseData) { + TvCastingAppJNIMgr().getApplicationVersionSuccessHandler().Handle(responseData); + }, + [](void * context, CHIP_ERROR err) { + TvCastingAppJNIMgr().getSubscriptionReadFailureHandler(ApplicationBasic_ApplicationVersion).Handle(err); + }, + static_cast(minInterval), static_cast(maxInterval), + [](void * context) { + TvCastingAppJNIMgr().getSubscriptionEstablishedHandler(ApplicationBasic_ApplicationVersion).Handle(); + }); + + VerifyOrExit(CHIP_NO_ERROR == err, + ChipLogError(AppServer, "CastingServer.applicationBasic_subscribeToApplicationVersion failed %" CHIP_ERROR_FORMAT, + err.Format())); + +exit: + if (err != CHIP_NO_ERROR) + { + return false; + } + + return true; +} diff --git a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h index fdab6936710069..1336eb076d8ecd 100644 --- a/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h +++ b/examples/tv-casting-app/android/App/app/src/main/jni/cpp/TvCastingApp-JNI.h @@ -32,6 +32,41 @@ class TvCastingAppJNI return mMediaCommandResponseHandler[name]; } + FailureHandlerJNI & getSubscriptionReadFailureHandler(enum MediaAttributeName name) + { + return mSubscriptionReadFailureHandler[name]; + } + + SubscriptionEstablishedHandlerJNI & getSubscriptionEstablishedHandler(enum MediaAttributeName name) + { + return mSubscriptionEstablishedHandler[name]; + } + + CurrentStateSuccessHandlerJNI & getCurrentStateSuccessHandler() { return mCurrentStateSuccessHandlerJNI; } + DurationSuccessHandlerJNI & getDurationSuccessHandler() { return mDurationSuccessHandlerJNI; } + SampledPositionSuccessHandlerJNI & getSampledPositionSuccessHandler() { return mSampledPositionSuccessHandlerJNI; } + PlaybackSpeedSuccessHandlerJNI & getPlaybackSpeedSuccessHandler() { return mPlaybackSpeedSuccessHandlerJNI; } + SeekRangeEndSuccessHandlerJNI & getSeekRangeEndSuccessHandler() { return mSeekRangeEndSuccessHandlerJNI; } + SeekRangeStartSuccessHandlerJNI & getSeekRangeStartSuccessHandler() { return mSeekRangeStartSuccessHandlerJNI; } + + CurrentTargetSuccessHandlerJNI & getCurrentTargetSuccessHandler() { return mCurrentTargetSuccessHandlerJNI; } + TargetListSuccessHandlerJNI & getTargetListSuccessHandler() { return mTargetListSuccessHandlerJNI; } + + CurrentLevelSuccessHandlerJNI & getCurrentLevelSuccessHandler() { return mCurrentLevelSuccessHandlerJNI; } + MinLevelSuccessHandlerJNI & getMinLevelSuccessHandler() { return mMinLevelSuccessHandlerJNI; } + MaxLevelSuccessHandlerJNI & getMaxLevelSuccessHandler() { return mMaxLevelSuccessHandlerJNI; } + + SupportedStreamingProtocolsSuccessHandlerJNI & getSupportedStreamingProtocolsSuccessHandler() + { + return mSupportedStreamingProtocolsSuccessHandlerJNI; + } + + VendorNameSuccessHandlerJNI & getVendorNameSuccessHandler() { return mVendorNameSuccessHandlerJNI; } + VendorIDSuccessHandlerJNI & getVendorIDSuccessHandler() { return mVendorIDSuccessHandlerJNI; } + ApplicationNameSuccessHandlerJNI & getApplicationNameSuccessHandler() { return mApplicationNameSuccessHandlerJNI; } + ProductIDSuccessHandlerJNI & getProductIDSuccessHandler() { return mProductIDSuccessHandlerJNI; } + ApplicationVersionSuccessHandlerJNI & getApplicationVersionSuccessHandler() { return mApplicationVersionSuccessHandlerJNI; } + private: friend TvCastingAppJNI & TvCastingAppJNIMgr(); @@ -39,6 +74,30 @@ class TvCastingAppJNI MatterCallbackHandlerJNI mCommissioningCompleteHandler; MatterCallbackHandlerJNI mMediaCommandResponseHandler[MEDIA_COMMAND_COUNT]; + FailureHandlerJNI mSubscriptionReadFailureHandler[MEDIA_ATTRIBUTE_COUNT]; + SubscriptionEstablishedHandlerJNI mSubscriptionEstablishedHandler[MEDIA_ATTRIBUTE_COUNT]; + + CurrentStateSuccessHandlerJNI mCurrentStateSuccessHandlerJNI; + DurationSuccessHandlerJNI mDurationSuccessHandlerJNI; + SampledPositionSuccessHandlerJNI mSampledPositionSuccessHandlerJNI; + PlaybackSpeedSuccessHandlerJNI mPlaybackSpeedSuccessHandlerJNI; + SeekRangeEndSuccessHandlerJNI mSeekRangeEndSuccessHandlerJNI; + SeekRangeStartSuccessHandlerJNI mSeekRangeStartSuccessHandlerJNI; + + CurrentTargetSuccessHandlerJNI mCurrentTargetSuccessHandlerJNI; + TargetListSuccessHandlerJNI mTargetListSuccessHandlerJNI; + + CurrentLevelSuccessHandlerJNI mCurrentLevelSuccessHandlerJNI; + MinLevelSuccessHandlerJNI mMinLevelSuccessHandlerJNI; + MaxLevelSuccessHandlerJNI mMaxLevelSuccessHandlerJNI; + + SupportedStreamingProtocolsSuccessHandlerJNI mSupportedStreamingProtocolsSuccessHandlerJNI; + + VendorNameSuccessHandlerJNI mVendorNameSuccessHandlerJNI; + VendorIDSuccessHandlerJNI mVendorIDSuccessHandlerJNI; + ApplicationNameSuccessHandlerJNI mApplicationNameSuccessHandlerJNI; + ProductIDSuccessHandlerJNI mProductIDSuccessHandlerJNI; + ApplicationVersionSuccessHandlerJNI mApplicationVersionSuccessHandlerJNI; }; inline class TvCastingAppJNI & TvCastingAppJNIMgr() diff --git a/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_media_playback.xml b/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_media_playback.xml new file mode 100644 index 00000000000000..fac656c8c447a5 --- /dev/null +++ b/examples/tv-casting-app/android/App/app/src/main/res/layout/fragment_media_playback.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + +