diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 7ab674139d3c77..c2659148b81655 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -17,7 +17,7 @@ "build": { "dockerfile": "Dockerfile", "args": { - "BUILD_VERSION": "0.7.2" + "BUILD_VERSION": "0.7.3" } }, "remoteUser": "vscode", diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index 2e809977c1dc1a..d77e05b4f26c58 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -606,6 +606,7 @@ GroupKeyManagement groupKeySecurityPolicy groupKeySetID groupsettings +gsdk gtk GUA Gv diff --git a/.github/workflows/bloat_check.yaml b/.github/workflows/bloat_check.yaml index 24c6b0420dfe9c..99d279c20970c6 100644 --- a/.github/workflows/bloat_check.yaml +++ b/.github/workflows/bloat_check.yaml @@ -33,7 +33,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 steps: - uses: Wandalen/wretry.action@v1.0.36 diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f189d5045c3da0..f659f10b5a76e8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 @@ -148,7 +148,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 @@ -320,7 +320,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" options: --sysctl "net.ipv6.conf.all.disable_ipv6=0 @@ -487,7 +487,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 diff --git a/.github/workflows/chef.yaml b/.github/workflows/chef.yaml index 7d8ea2f394b9d0..f6f8c4c6076986 100644 --- a/.github/workflows/chef.yaml +++ b/.github/workflows/chef.yaml @@ -30,7 +30,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 options: --user root steps: @@ -66,7 +66,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.7.2 + image: connectedhomeip/chip-build-esp32:0.7.3 options: --user root steps: @@ -102,7 +102,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-nrf-platform:0.7.2 + image: connectedhomeip/chip-build-nrf-platform:0.7.3 options: --user root steps: diff --git a/.github/workflows/cirque.yaml b/.github/workflows/cirque.yaml index 945a73300713aa..6b2dfa7372ed6b 100644 --- a/.github/workflows/cirque.yaml +++ b/.github/workflows/cirque.yaml @@ -30,7 +30,7 @@ jobs: timeout-minutes: 90 env: - DOCKER_RUN_VERSION: 0.7.2 + DOCKER_RUN_VERSION: 0.7.3 GITHUB_CACHE_PATH: /tmp/cirque-cache runs-on: ubuntu-latest @@ -39,7 +39,7 @@ jobs: # need to run with privilege, which isn't supported by job.XXX.contaner # https://github.com/actions/container-action/issues/2 # container: - # image: connectedhomeip/chip-build-cirque:0.7.2 + # image: connectedhomeip/chip-build-cirque:0.7.3 # volumes: # - "/tmp:/tmp" # - "/dev/pts:/dev/pts" diff --git a/.github/workflows/darwin.yaml b/.github/workflows/darwin.yaml index 169606644a9e19..00c669eb81a4ce 100644 --- a/.github/workflows/darwin.yaml +++ b/.github/workflows/darwin.yaml @@ -145,7 +145,9 @@ jobs: # And a different port from the test harness too; the test harness uses port 5541. ../../../out/debug/chip-ota-requestor-app --interface-id -1 --secured-device-port 5542 --discriminator 1111 --KVS /tmp/chip-ota-requestor-kvs1 --otaDownloadPath /tmp/chip-ota-requestor-downloaded-image1 --autoApplyImage > >(tee /tmp/darwin/framework-tests/ota-requestor-app-1.log) 2> >(tee /tmp/darwin/framework-tests/ota-requestor-app-err-1.log >&2) & ../../../out/debug/chip-ota-requestor-app --interface-id -1 --secured-device-port 5543 --discriminator 1112 --KVS /tmp/chip-ota-requestor-kvs2 --otaDownloadPath /tmp/chip-ota-requestor-downloaded-image2 --autoApplyImage > >(tee /tmp/darwin/framework-tests/ota-requestor-app-2.log) 2> >(tee /tmp/darwin/framework-tests/ota-requestor-app-err-2.log >&2) & - xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-incomplete-umbrella -Wno-unguarded-availability-new' > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2) + # UndefinedBehaviorSanitizer is enabled in the Xcode scheme, so the code in Matter.framework gets instrumented, + # but to instrument the code in the underlying libCHIP we need to pass CHIP_IS_UBSAN=YES + xcodebuild test -target "Matter" -scheme "Matter Framework Tests" -sdk macosx OTHER_CFLAGS='${inherited} -Werror -Wconversion -Wno-incomplete-umbrella -Wno-unguarded-availability-new' CHIP_IS_UBSAN=YES > >(tee /tmp/darwin/framework-tests/darwin-tests.log) 2> >(tee /tmp/darwin/framework-tests/darwin-tests-err.log >&2) working-directory: src/darwin/Framework - name: Uploading log files uses: actions/upload-artifact@v3 diff --git a/.github/workflows/doxygen.yaml b/.github/workflows/doxygen.yaml index 0e6ac209210838..3a0dc4a9d9f8b1 100644 --- a/.github/workflows/doxygen.yaml +++ b/.github/workflows/doxygen.yaml @@ -82,7 +82,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-doxygen:0.7.2 + image: connectedhomeip/chip-build-doxygen:0.7.3 if: github.actor != 'restyled-io[bot]' diff --git a/.github/workflows/examples-ameba.yaml b/.github/workflows/examples-ameba.yaml index 329d2c47dd29bb..438df5c863a991 100644 --- a/.github/workflows/examples-ameba.yaml +++ b/.github/workflows/examples-ameba.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-ameba:0.7.2 + image: connectedhomeip/chip-build-ameba:0.7.3 options: --user root steps: diff --git a/.github/workflows/examples-bouffalolab.yaml b/.github/workflows/examples-bouffalolab.yaml index d3a47d11cfb1c6..b0216522bde2c0 100644 --- a/.github/workflows/examples-bouffalolab.yaml +++ b/.github/workflows/examples-bouffalolab.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-bouffalolab:0.7.2 + image: connectedhomeip/chip-build-bouffalolab:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc13x2x7_26x2x7.yaml b/.github/workflows/examples-cc13x2x7_26x2x7.yaml index e0a14620e850f6..ee76323463763b 100644 --- a/.github/workflows/examples-cc13x2x7_26x2x7.yaml +++ b/.github/workflows/examples-cc13x2x7_26x2x7.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-ti:0.7.2 + image: connectedhomeip/chip-build-ti:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-cc32xx.yaml b/.github/workflows/examples-cc32xx.yaml index a0581ba63a90f4..c2b86972a294ae 100644 --- a/.github/workflows/examples-cc32xx.yaml +++ b/.github/workflows/examples-cc32xx.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-ti:0.7.2 + image: connectedhomeip/chip-build-ti:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-efr32.yaml b/.github/workflows/examples-efr32.yaml index cde592dee78c8e..4954d9c9af8930 100644 --- a/.github/workflows/examples-efr32.yaml +++ b/.github/workflows/examples-efr32.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-efr32:0.7.2 + image: connectedhomeip/chip-build-efr32:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-esp32.yaml b/.github/workflows/examples-esp32.yaml index e91b33c8dfbd05..67872b2f186a79 100644 --- a/.github/workflows/examples-esp32.yaml +++ b/.github/workflows/examples-esp32.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.7.2 + image: connectedhomeip/chip-build-esp32:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" @@ -160,7 +160,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32:0.7.2 + image: connectedhomeip/chip-build-esp32:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-infineon.yaml b/.github/workflows/examples-infineon.yaml index 9cb27d40fbf5f9..f270017b796cdf 100644 --- a/.github/workflows/examples-infineon.yaml +++ b/.github/workflows/examples-infineon.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-infineon:0.7.2 + image: connectedhomeip/chip-build-infineon:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-k32w.yaml b/.github/workflows/examples-k32w.yaml index 130f37bc2d5529..cea556dbb51dc2 100644 --- a/.github/workflows/examples-k32w.yaml +++ b/.github/workflows/examples-k32w.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-k32w:0.7.2 + image: connectedhomeip/chip-build-k32w:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-linux-arm.yaml b/.github/workflows/examples-linux-arm.yaml index fb72d2db3a1129..17e9562baecb31 100644 --- a/.github/workflows/examples-linux-arm.yaml +++ b/.github/workflows/examples-linux-arm.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-crosscompile:0.7.2 + image: connectedhomeip/chip-build-crosscompile:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-linux-imx.yaml b/.github/workflows/examples-linux-imx.yaml index 6bb97f378cfac0..2f9d0a26a297aa 100644 --- a/.github/workflows/examples-linux-imx.yaml +++ b/.github/workflows/examples-linux-imx.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-imx:0.7.2 + image: connectedhomeip/chip-build-imx:0.7.3 steps: - uses: Wandalen/wretry.action@v1.0.36 diff --git a/.github/workflows/examples-linux-standalone.yaml b/.github/workflows/examples-linux-standalone.yaml index 2d76468d96e3fa..6a18a1ab872ff2 100644 --- a/.github/workflows/examples-linux-standalone.yaml +++ b/.github/workflows/examples-linux-standalone.yaml @@ -35,7 +35,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mbed.yaml b/.github/workflows/examples-mbed.yaml index a0ee16f9396385..a00d7d3a463f97 100644 --- a/.github/workflows/examples-mbed.yaml +++ b/.github/workflows/examples-mbed.yaml @@ -41,7 +41,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-mbed-os:0.7.2 + image: connectedhomeip/chip-build-mbed-os:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-mw320.yaml b/.github/workflows/examples-mw320.yaml index 4ce562711fbbed..8d7c59bbdc0408 100755 --- a/.github/workflows/examples-mw320.yaml +++ b/.github/workflows/examples-mw320.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-nrfconnect.yaml b/.github/workflows/examples-nrfconnect.yaml index 4ca9d323f7e941..df8204cb89903e 100644 --- a/.github/workflows/examples-nrfconnect.yaml +++ b/.github/workflows/examples-nrfconnect.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-nrf-platform:0.7.2 + image: connectedhomeip/chip-build-nrf-platform:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-openiotsdk.yaml b/.github/workflows/examples-openiotsdk.yaml index d137c949c984fa..91503e37be7e41 100644 --- a/.github/workflows/examples-openiotsdk.yaml +++ b/.github/workflows/examples-openiotsdk.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-openiotsdk:0.7.2 + image: connectedhomeip/chip-build-openiotsdk:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" options: --privileged diff --git a/.github/workflows/examples-qpg.yaml b/.github/workflows/examples-qpg.yaml index d37dc2ac4e8cc2..b61da7a91ce0e7 100644 --- a/.github/workflows/examples-qpg.yaml +++ b/.github/workflows/examples-qpg.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" steps: diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index b28d0b38e65a5e..f5f1b58a5fbe5b 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -36,7 +36,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-telink:0.7.2 + image: connectedhomeip/chip-build-telink:0.7.3 volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index b66a47963b0413..5f254879850215 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-tizen:0.7.2 + image: connectedhomeip/chip-build-tizen:0.7.3 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/.github/workflows/full-android.yaml b/.github/workflows/full-android.yaml index 71e558a070b7f2..6b79e4fa1917a9 100644 --- a/.github/workflows/full-android.yaml +++ b/.github/workflows/full-android.yaml @@ -37,7 +37,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.7.2 + image: connectedhomeip/chip-build-android:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/fuzzing-build.yaml b/.github/workflows/fuzzing-build.yaml index 1884e3809489d2..9e7b4a4ba76a45 100644 --- a/.github/workflows/fuzzing-build.yaml +++ b/.github/workflows/fuzzing-build.yaml @@ -34,7 +34,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/minimal-build.yaml b/.github/workflows/minimal-build.yaml index e6215890be1dda..67d9bbfdd642f8 100644 --- a/.github/workflows/minimal-build.yaml +++ b/.github/workflows/minimal-build.yaml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-minimal:0.7.2 + image: connectedhomeip/chip-build-minimal:0.7.3 steps: - name: Checkout diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index 5a795f295fd038..2be27598801d6a 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -39,7 +39,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-esp32-qemu:0.7.2 + image: connectedhomeip/chip-build-esp32-qemu:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" @@ -103,7 +103,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-tizen-qemu:0.7.2 + image: connectedhomeip/chip-build-tizen-qemu:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/release_artifacts.yaml b/.github/workflows/release_artifacts.yaml index cd8d67e42302fa..c19ccaca595ff5 100644 --- a/.github/workflows/release_artifacts.yaml +++ b/.github/workflows/release_artifacts.yaml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-esp32:0.7.2 + image: connectedhomeip/chip-build-esp32:0.7.3 steps: - uses: Wandalen/wretry.action@v1.0.36 @@ -85,7 +85,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-efr32:0.7.2 + image: connectedhomeip/chip-build-efr32:0.7.3 steps: - uses: Wandalen/wretry.action@v1.0.36 name: Checkout diff --git a/.github/workflows/smoketest-android.yaml b/.github/workflows/smoketest-android.yaml index 54b9e4b00bf5c0..c962d705f29627 100644 --- a/.github/workflows/smoketest-android.yaml +++ b/.github/workflows/smoketest-android.yaml @@ -38,7 +38,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-android:0.7.2 + image: connectedhomeip/chip-build-android:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" diff --git a/.github/workflows/smoketest-darwin.yaml b/.github/workflows/smoketest-darwin.yaml index 7cefedeca044b0..55271cdef05c53 100644 --- a/.github/workflows/smoketest-darwin.yaml +++ b/.github/workflows/smoketest-darwin.yaml @@ -66,7 +66,7 @@ jobs: .environment/gn_out/.ninja_log .environment/pigweed-venv/*.log - name: Build Matter TV Casting Bridge - timeout-minutes: 20 + timeout-minutes: 45 run: | xcodebuild -target "MatterTvCastingBridge" -sdk iphoneos working-directory: examples/tv-casting-app/darwin/MatterTvCastingBridge diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6b21bc56a32961..b882cce8330dff 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -48,7 +48,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" @@ -442,7 +442,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" @@ -500,6 +500,7 @@ jobs: scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_ACE_1_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --int-arg PIXIT.ACE.APPENDPOINT:1 PIXIT.ACE.APPDEVTYPEID:0x0100 --string-arg PIXIT.ACE.APPCLUSTER:OnOff PIXIT.ACE.APPATTRIBUTE:OnOff"' scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_ACE_1_3.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --app out/linux-x64-all-clusters-ipv6only-no-ble-no-wifi-tsan-clang-test/chip-all-clusters-app --factoryreset --app-args "--discriminator 1234 --KVS kvs1 --trace_decode 1" --script "src/python_testing/TC_CGEN_2_4.py" --script-args "--storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021"' + scripts/run_in_build_env.sh './scripts/tests/run_python_test.py --script "src/python_testing/TestMatterTestingSupport.py"' - name: Uploading core files uses: actions/upload-artifact@v3 if: ${{ failure() && !env.ACT }} @@ -529,7 +530,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build-java:0.7.2 + image: connectedhomeip/chip-build-java:0.7.3 options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=0 net.ipv6.conf.all.forwarding=0" diff --git a/.github/workflows/unit_integration_test.yaml b/.github/workflows/unit_integration_test.yaml index af90a200a59cc5..c42595e1c98129 100644 --- a/.github/workflows/unit_integration_test.yaml +++ b/.github/workflows/unit_integration_test.yaml @@ -38,7 +38,7 @@ jobs: runs-on: ubuntu-latest container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 volumes: - "/tmp/log_output:/tmp/test_logs" options: --privileged --sysctl "net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1" diff --git a/.github/workflows/zap_regeneration.yaml b/.github/workflows/zap_regeneration.yaml index add42097b68648..4be57110756b43 100644 --- a/.github/workflows/zap_regeneration.yaml +++ b/.github/workflows/zap_regeneration.yaml @@ -28,7 +28,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 defaults: run: shell: sh diff --git a/.github/workflows/zap_templates.yaml b/.github/workflows/zap_templates.yaml index 67eb4483f4e33f..9eb38e03a8a7e0 100644 --- a/.github/workflows/zap_templates.yaml +++ b/.github/workflows/zap_templates.yaml @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-20.04 container: - image: connectedhomeip/chip-build:0.7.2 + image: connectedhomeip/chip-build:0.7.3 defaults: run: shell: sh diff --git a/.vscode/launch.json b/.vscode/launch.json index 5a8cfbce9c8682..e68b78cbd4e57a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -432,7 +432,7 @@ "request": "launch", "cwd": "${workspaceRoot}/examples/${input:openiotsdkApp}/openiotsdk", "executable": "./build/chip-openiotsdk-${input:openiotsdkApp}-example.elf", - "armToolchainPath": "${env:ARM_GCC_TOOLCHAIN_PATH}/bin", + "armToolchainPath": "${env:PW_ENVIRONMENT_ROOT}/cipd/packages/arm/bin/", "servertype": "external", "gdbTarget": "${input:openiotsdkRemoteHost}:31627", //GDBserver port on FVP "overrideLaunchCommands": [ @@ -452,7 +452,7 @@ "request": "launch", "cwd": "${workspaceRoot}/src/test_driver/openiotsdk/unit-tests", "executable": "./build/${input:openiotsdkUnittest}.elf", - "armToolchainPath": "${env:ARM_GCC_TOOLCHAIN_PATH}/bin", + "armToolchainPath": "${env:PW_ENVIRONMENT_ROOT}/cipd/packages/arm/bin/", "servertype": "external", "gdbTarget": ":31627", //GDBserver port on FVP "overrideLaunchCommands": ["-enable-pretty-printing"], diff --git a/BUILD.gn b/BUILD.gn index d9c68de527c0aa..dfe6cbbf4850f3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -677,10 +677,14 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") { if (enable_tizen_builds) { group("check:tizen") { testonly = true - deps = [ "${chip_root}/src/test_driver/tizen/integration-tests:check" ] + deps = [ "${chip_root}/src/test_driver/tizen:check(${chip_root}/build/toolchain/tizen:tizen_arm)" ] } - extra_check_deps += [ ":check:tizen" ] + # Include Tizen check target only if BLE is not enabled, since + # currently, QEMU-based Tizen does not support Bluetooth. + if (!chip_config_network_layer_ble) { + extra_check_deps += [ ":check:tizen" ] + } } if (enable_mw320_shell_build) { diff --git a/docs/guides/android_building.md b/docs/guides/android_building.md index 6f693e38efa5e3..8bc480568e2230 100644 --- a/docs/guides/android_building.md +++ b/docs/guides/android_building.md @@ -42,7 +42,7 @@ directory. ## Requirements for building -You need Android SDK 21 & NDK 21.4.7075529 downloaded to your machine. Set the +You need Android SDK 26 & NDK 23.2.8568313 downloaded to your machine. Set the `$ANDROID_HOME` environment variable to where the SDK is downloaded and the `$ANDROID_NDK_HOME` environment variable to point to where the NDK package is downloaded. The build also requires `kotlinc` to be in your `$PATH`. @@ -51,15 +51,15 @@ downloaded. The build also requires `kotlinc` to be in your `$PATH`. 2. Install NDK: 1. Tools -> SDK Manager -> SDK Tools Tab 2. Click [x] Show Package Details - 3. Select NDK (Side by Side) -> 21.4.7075529 + 3. Select NDK (Side by Side) -> 23.2.8568313 4. Apply 3. Install Command Line Tools: 1. Tools -> SDK Manager -> SDK Tools Tab -> Android SDK Command Line Tools (latest) 2. Apply -4. Install SDK 21: - 1. Tools -> SDK Manager -> SDK Platforms Tab -> Android 5.0 (Lollipop) SDK - Level 21 +4. Install SDK 26: + 1. Tools -> SDK Manager -> SDK Platforms Tab -> Android 8.0 (Oreo) SDK Level + 26 2. Apply 5. Install Emulator: 1. Tools -> Device Manager -> Create device -> Pixel 5 -> Android S API 31 @@ -69,14 +69,14 @@ downloaded. The build also requires `kotlinc` to be in your `$PATH`. ``` export ANDROID_HOME=~/Android/Sdk -export ANDROID_NDK_HOME=~/Android/Sdk/ndk/21.4.7075529 +export ANDROID_NDK_HOME=~/Android/Sdk/ndk/23.2.8568313 ``` ### MacOS ``` export ANDROID_HOME=~/Library/Android/sdk -export ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/21.4.7075529 +export ANDROID_NDK_HOME=~/Library/Android/sdk/ndk/23.2.8568313 ``` @@ -108,6 +108,7 @@ Android Studio Dolphin and below: ```shell export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/Contents/Home/ ``` + Android Studio Electric Eel 2022.1.1 and above: ```shell diff --git a/docs/guides/esp32/ota.md b/docs/guides/esp32/ota.md index 0217514523efd0..ab079250250b40 100644 --- a/docs/guides/esp32/ota.md +++ b/docs/guides/esp32/ota.md @@ -35,11 +35,24 @@ control list. ### Using Console -After commissioning is successful, press Enter in requestor device console and -type below query. +After commissioning is successful, read the default-ota-providers list of +requestor using the command below. ``` ->matter ota query 1 0 +./out/debug/chip-tool otasoftwareupdaterequestor read default-otaproviders 0 +``` + +If the list does not have your provider, write into default-ota-providers list +of requestor using the command below. + +``` +./out/debug/chip-tool otasoftwareupdaterequestor write default-otaproviders '[{"fabricIndex": 1, "providerNodeID": , "endpoint": 0}, {"fabricIndex": 1, "providerNodeID": , "endpoint": 0}]' 0 +``` + +Press Enter in requestor device console and type below query. + +``` +>matter ota query ``` Once the transfer is complete, OTA requestor sends ApplyUpdateRequest command to diff --git a/examples/android/CHIPTool/app/src/main/AndroidManifest.xml b/examples/android/CHIPTool/app/src/main/AndroidManifest.xml index 0d7401fea46066..0526dc5a78160d 100644 --- a/examples/android/CHIPTool/app/src/main/AndroidManifest.xml +++ b/examples/android/CHIPTool/app/src/main/AndroidManifest.xml @@ -3,6 +3,8 @@ xmlns:tools="http://schemas.android.com/tools" package="com.google.chip.chiptool"> + + diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt index 3d130f835de459..add408b7af9693 100644 --- a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt +++ b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/ChipClient.kt @@ -33,7 +33,7 @@ import chip.platform.PreferencesKeyValueStoreManager import com.google.chip.chiptool.attestation.ExampleAttestationTrustStoreDelegate import kotlin.coroutines.resume import kotlin.coroutines.resumeWithException -import kotlin.coroutines.suspendCoroutine +import kotlinx.coroutines.suspendCancellableCoroutine /** Lazily instantiates [ChipDeviceController] and holds a reference to it. */ object ChipClient { @@ -75,7 +75,7 @@ object ChipClient { // once we are done with the returned device pointer. Memory leak was introduced since the refactor // that introduced it was very large in order to fix a use after free, which was considered to be // worse than the memory leak that was introduced. - return suspendCoroutine { continuation -> + return suspendCancellableCoroutine { continuation -> getDeviceController(context).getConnectedDevicePointer( nodeId, object : GetConnectedDeviceCallback { diff --git a/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/endpointItem.kt b/examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/EndpointItem.kt similarity index 100% rename from examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/endpointItem.kt rename to examples/android/CHIPTool/app/src/main/java/com/google/chip/chiptool/clusterclient/clusterinteraction/EndpointItem.kt diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter index 6a4d8ddd2f6e67..71b16a0f2d6fef 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.matter @@ -455,7 +455,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1571,7 +1570,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap index bb927e9cdc822d..3b9dacec8cd93b 100644 --- a/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/noip_rootnode_dimmablelight_bCwGYSDpoe.zap @@ -1,5 +1,5 @@ { - "featureLevel": 95, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter index d3e2e4f1d767a7..7f83d419ed05bb 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.matter @@ -454,7 +454,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1552,7 +1551,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap index 1b151c0c6d7910..add54ac827902b 100644 --- a/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap +++ b/examples/chef/devices/rootnode_colortemperaturelight_hbUnzYVeyn.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -8169,5 +8169,6 @@ "endpointVersion": 1, "deviceIdentifier": 268 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter index b22e383af2ad27..ded5178c5ee201 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.matter @@ -306,7 +306,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1262,7 +1261,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap index 1d9fd78706cee2..c89f444b22f4e1 100644 --- a/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap +++ b/examples/chef/devices/rootnode_contactsensor_lFAGG1bfRO.zap @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter index b02fd871ece659..8f64d3a3c765dc 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.matter @@ -455,7 +455,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1437,7 +1436,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap index 67b075fe349bf9..427d91f778d64d 100644 --- a/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap +++ b/examples/chef/devices/rootnode_dimmablelight_bCwGYSDpoe.zap @@ -1,5 +1,5 @@ { - "featureLevel": 95, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1121,7 +1121,7 @@ "side": "server", "type": "array", "included": 0, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1508,7 +1508,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1541,7 +1541,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -2319,7 +2319,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter index 140935ef9ee206..7b8f60cf3d3c8d 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.matter @@ -306,7 +306,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1730,7 +1729,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap index d3a89febeb0b44..070614d2552400 100644 --- a/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap +++ b/examples/chef/devices/rootnode_doorlock_aNKYAreMXE.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -9312,5 +9312,6 @@ "endpointVersion": 1, "deviceIdentifier": 10 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter index 05c3478971017c..0d59a951762910 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.matter @@ -455,7 +455,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1664,7 +1663,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap index 1dad6a1f0af97d..23a361e271368b 100644 --- a/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap +++ b/examples/chef/devices/rootnode_extendedcolorlight_8lcaaYJVAa.zap @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter index 0184f55ea7dc1d..806546549a9f6f 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.matter @@ -293,7 +293,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1297,7 +1296,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap index 56a127c5012700..41ab37e804b286 100644 --- a/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap +++ b/examples/chef/devices/rootnode_fan_7N2TobIlOX.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -6387,5 +6387,6 @@ "endpointVersion": 1, "deviceIdentifier": 43 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter index 7cfc2fabca5579..86996b5ed6e777 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.matter @@ -377,7 +377,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1332,7 +1331,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap index a875091a1cb1c5..5e2eb092ff701d 100644 --- a/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap +++ b/examples/chef/devices/rootnode_flowsensor_1zVxHedlaV.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6367,5 +6367,6 @@ "endpointVersion": 1, "deviceIdentifier": 774 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter index 790801e6d0dc21..1d6715ca7bf6f9 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.matter @@ -449,7 +449,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1605,7 +1604,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap index abc314d2429fdf..b34ca684831211 100644 --- a/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap +++ b/examples/chef/devices/rootnode_heatingcoolingunit_ncdGai1E5a.zap @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter index 061546fcd14fe4..8dc61f017adcea 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.matter @@ -377,7 +377,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1332,7 +1331,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap index 28a3bda1f0cbed..269c850874557d 100644 --- a/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap +++ b/examples/chef/devices/rootnode_humiditysensor_Xyj4gda6Hb.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6367,5 +6367,6 @@ "endpointVersion": 1, "deviceIdentifier": 775 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter index ab408221539d94..1eabc4a86d3d96 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.matter @@ -377,7 +377,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1337,7 +1336,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap index fce7f9bc5ad74e..68b146d451d158 100644 --- a/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap +++ b/examples/chef/devices/rootnode_lightsensor_lZQycTFcJK.zap @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter index ed687a8a792a4a..bb44cd84394001 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.matter @@ -377,7 +377,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1348,7 +1347,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap index fa7b7e97eb5004..d35ed962806f8a 100644 --- a/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap +++ b/examples/chef/devices/rootnode_occupancysensor_iHyVgifZuo.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6495,5 +6495,6 @@ "endpointVersion": 1, "deviceIdentifier": 263 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter index 61151ed87e3264..549e69d48576e0 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.matter @@ -455,7 +455,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1396,7 +1395,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap index 6cda946228e3c2..982dacd48f8766 100644 --- a/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap +++ b/examples/chef/devices/rootnode_onofflight_bbs1b7IaOV.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7491,5 +7491,6 @@ "endpointVersion": 1, "deviceIdentifier": 256 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter index d610effe96b829..4a0f3b6496df09 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.matter @@ -418,7 +418,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1359,7 +1358,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap index d7f5c1531329cc..0b7369a8c68c0e 100644 --- a/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap +++ b/examples/chef/devices/rootnode_onofflightswitch_FsPlMr090Q.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7491,5 +7491,6 @@ "endpointVersion": 1, "deviceIdentifier": 259 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter index cb20eb0010bef2..abed57a9256e33 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.matter @@ -354,7 +354,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1295,7 +1294,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap index fae71f853ca6a0..f3d05fcf91c01e 100644 --- a/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap +++ b/examples/chef/devices/rootnode_onoffpluginunit_Wtf8ss5EBY.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7167,5 +7167,6 @@ "endpointVersion": 1, "deviceIdentifier": 266 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter index e6a48ec1d33c99..dba7298c1a33d8 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.matter @@ -377,7 +377,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1351,7 +1350,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap index e1542aea915884..76a26d5b0c3404 100644 --- a/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap +++ b/examples/chef/devices/rootnode_pressuresensor_s0qC9wLH4k.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6447,5 +6447,6 @@ "endpointVersion": 1, "deviceIdentifier": 773 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter index 570a451d306239..b4842483068952 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.matter @@ -449,7 +449,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1390,7 +1389,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap index 3536614448a94d..a8142c637b0d93 100644 --- a/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap +++ b/examples/chef/devices/rootnode_speaker_RpzeXdimqA.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6599,5 +6599,6 @@ "endpointVersion": 1, "deviceIdentifier": 34 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter index bcf4f5fe127047..5a608865b67404 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.matter @@ -377,7 +377,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1331,7 +1330,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap index 7c76328fad7416..b336f9aa8c81b5 100644 --- a/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap +++ b/examples/chef/devices/rootnode_temperaturesensor_Qy1zkNW7c3.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -6367,5 +6367,6 @@ "endpointVersion": 1, "deviceIdentifier": 770 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter index c7f90bd36eee7b..661c82ffcda78f 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.matter @@ -306,7 +306,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1497,7 +1496,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap index b77fce2b8d2475..41db456660bdf0 100644 --- a/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap +++ b/examples/chef/devices/rootnode_thermostat_bm3fb8dhYi.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4670,16 +4670,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4702,16 +4702,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7847,5 +7847,6 @@ "endpointVersion": 1, "deviceIdentifier": 769 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter index ab5184084acaf1..753344467092fb 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.matter @@ -306,7 +306,6 @@ server cluster BasicInformation = 40 { readonly attribute char_string<64> productLabel = 14; readonly attribute char_string<32> serialNumber = 15; attribute access(write: manage) boolean localConfigDisabled = 16; - readonly attribute boolean reachable = 17; readonly attribute char_string<32> uniqueID = 18; readonly attribute CapabilityMinimaStruct capabilityMinima = 19; readonly attribute command_id generatedCommandList[] = 65528; @@ -1391,7 +1390,6 @@ endpoint 0 { callback attribute productLabel; callback attribute serialNumber; persist attribute localConfigDisabled default = 0; - ram attribute reachable default = 1; callback attribute uniqueID; callback attribute capabilityMinima; ram attribute featureMap default = 0; diff --git a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap index b78cd6315182a1..8a900bc80d1b16 100644 --- a/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap +++ b/examples/chef/devices/rootnode_windowcovering_RLCxaGi9Yx.zap @@ -1,5 +1,5 @@ { - "featureLevel": 92, + "featureLevel": 96, "creator": "zap", "keyValuePairs": [ { @@ -1041,7 +1041,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1057,7 +1057,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1073,7 +1073,7 @@ "side": "server", "type": "int16u", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1460,7 +1460,7 @@ "mfgCode": null, "side": "server", "type": "boolean", - "included": 1, + "included": 0, "storageOption": "RAM", "singleton": 1, "bounded": 0, @@ -1493,7 +1493,7 @@ "side": "server", "type": "CapabilityMinimaStruct", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 1, "bounded": 0, "defaultValue": "", @@ -1885,13 +1885,13 @@ "enabled": 1, "attributes": [ { - "name": "SupportedLocales", - "code": 1, + "name": "ActiveLocale", + "code": 0, "mfgCode": null, "side": "server", - "type": "array", + "type": "char_string", "included": 1, - "storageOption": "External", + "storageOption": "RAM", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -1901,13 +1901,13 @@ "reportableChange": 0 }, { - "name": "ActiveLocale", - "code": 0, + "name": "SupportedLocales", + "code": 1, "mfgCode": null, "side": "server", - "type": "char_string", + "type": "array", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "", @@ -2271,7 +2271,7 @@ "side": "server", "type": "boolean", "included": 1, - "storageOption": "RAM", + "storageOption": "External", "singleton": 0, "bounded": 0, "defaultValue": "1", @@ -4622,16 +4622,16 @@ "enabled": 1, "attributes": [ { - "name": "FeatureMap", - "code": 65532, + "name": "NumberOfPositions", + "code": 0, "mfgCode": null, "side": "server", - "type": "bitmap32", + "type": "int8u", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "0", + "defaultValue": "2", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -4654,16 +4654,16 @@ "reportableChange": 0 }, { - "name": "NumberOfPositions", - "code": 0, + "name": "FeatureMap", + "code": 65532, "mfgCode": null, "side": "server", - "type": "int8u", + "type": "bitmap32", "included": 1, "storageOption": "RAM", "singleton": 0, "bounded": 0, - "defaultValue": "2", + "defaultValue": "0", "reportable": 1, "minInterval": 1, "maxInterval": 65534, @@ -7049,5 +7049,6 @@ "endpointVersion": 1, "deviceIdentifier": 514 } - ] + ], + "log": [] } \ No newline at end of file diff --git a/examples/chip-tool/BUILD.gn b/examples/chip-tool/BUILD.gn index 85f1c56e2d8266..e1e92d94b62ec3 100644 --- a/examples/chip-tool/BUILD.gn +++ b/examples/chip-tool/BUILD.gn @@ -70,8 +70,6 @@ static_library("chip-tool-utils") { "commands/discover/DiscoverCommand.cpp", "commands/discover/DiscoverCommissionablesCommand.cpp", "commands/discover/DiscoverCommissionersCommand.cpp", - "commands/pairing/CloseSessionCommand.cpp", - "commands/pairing/CloseSessionCommand.h", "commands/pairing/OpenCommissioningWindowCommand.cpp", "commands/pairing/OpenCommissioningWindowCommand.h", "commands/pairing/PairingCommand.cpp", @@ -80,6 +78,8 @@ static_library("chip-tool-utils") { "commands/payload/SetupPayloadGenerateCommand.cpp", "commands/payload/SetupPayloadParseCommand.cpp", "commands/payload/SetupPayloadVerhoeff.cpp", + "commands/session-management/CloseSessionCommand.cpp", + "commands/session-management/CloseSessionCommand.h", "commands/storage/StorageManagementCommand.cpp", ] diff --git a/examples/chip-tool/commands/common/CHIPCommand.cpp b/examples/chip-tool/commands/common/CHIPCommand.cpp index d64db23eb072b2..ecf97505c331fe 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.cpp +++ b/examples/chip-tool/commands/common/CHIPCommand.cpp @@ -93,7 +93,7 @@ CHIP_ERROR CHIPCommand::MaybeSetUpStack() ReturnLogErrorOnFailure(chip::DeviceLayer::Internal::BLEMgrImpl().ConfigureBle(mBleAdapterId.ValueOr(0), true)); #endif - ReturnLogErrorOnFailure(mDefaultStorage.Init()); + ReturnLogErrorOnFailure(mDefaultStorage.Init(nullptr, GetStorageDirectory().ValueOr(nullptr))); ReturnLogErrorOnFailure(mOperationalKeystore.Init(&mDefaultStorage)); ReturnLogErrorOnFailure(mOpCertStore.Init(&mDefaultStorage)); @@ -326,7 +326,7 @@ CHIP_ERROR CHIPCommand::GetIdentityNodeId(std::string identity, chip::NodeId * n return CHIP_NO_ERROR; } - ReturnLogErrorOnFailure(mCommissionerStorage.Init(identity.c_str())); + ReturnLogErrorOnFailure(mCommissionerStorage.Init(identity.c_str(), GetStorageDirectory().ValueOr(nullptr))); *nodeId = mCommissionerStorage.GetLocalNodeId(); @@ -419,7 +419,7 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(CommissionerIdentity & identity, // TODO - OpCreds should only be generated for pairing command // store the credentials in persistent storage, and // generate when not available in the storage. - ReturnLogErrorOnFailure(mCommissionerStorage.Init(identity.mName.c_str())); + ReturnLogErrorOnFailure(mCommissionerStorage.Init(identity.mName.c_str(), GetStorageDirectory().ValueOr(nullptr))); if (mUseMaxSizedCerts.HasValue()) { auto option = CredentialIssuerCommands::CredentialIssuerOptions::kMaximizeCertificateSizes; diff --git a/examples/chip-tool/commands/common/CHIPCommand.h b/examples/chip-tool/commands/common/CHIPCommand.h index 3f16ff95c4cd36..da0183aed04d89 100644 --- a/examples/chip-tool/commands/common/CHIPCommand.h +++ b/examples/chip-tool/commands/common/CHIPCommand.h @@ -86,6 +86,8 @@ class CHIPCommand : public Command AddArgument("trace_decode", 0, 1, &mTraceDecode); #endif // CHIP_CONFIG_TRANSPORT_TRACE_ENABLED AddArgument("ble-adapter", 0, UINT16_MAX, &mBleAdapterId); + AddArgument("storage-directory", &mStorageDirectory, + "Directory to place chip-tool's storage files in. Defaults to $TMPDIR, with fallback to /tmp"); } /////////// Command Interface ///////// diff --git a/examples/chip-tool/commands/common/Command.h b/examples/chip-tool/commands/common/Command.h index 39d59dfb1d6a44..c3c59f41f99477 100644 --- a/examples/chip-tool/commands/common/Command.h +++ b/examples/chip-tool/commands/common/Command.h @@ -260,12 +260,19 @@ class Command bool IsInteractive() { return mIsInteractive; } - CHIP_ERROR RunAsInteractive() + CHIP_ERROR RunAsInteractive(const chip::Optional & interactiveStorageDirectory) { - mIsInteractive = true; + mStorageDirectory = interactiveStorageDirectory; + mIsInteractive = true; return Run(); } + const chip::Optional & GetStorageDirectory() const { return mStorageDirectory; } + +protected: + // mStorageDirectory lives here so we can just set it in RunAsInteractive. + chip::Optional mStorageDirectory; + private: bool InitArgument(size_t argIndex, char * argValue); size_t AddArgument(const char * name, int64_t min, uint64_t max, void * out, ArgumentType type, const char * desc, diff --git a/examples/chip-tool/commands/common/Commands.cpp b/examples/chip-tool/commands/common/Commands.cpp index b59aaf0ff47d59..eef7d8ccb39174 100644 --- a/examples/chip-tool/commands/common/Commands.cpp +++ b/examples/chip-tool/commands/common/Commands.cpp @@ -149,7 +149,7 @@ int Commands::Run(int argc, char ** argv) return (err == CHIP_NO_ERROR) ? EXIT_SUCCESS : EXIT_FAILURE; } -int Commands::RunInteractive(const char * command) +int Commands::RunInteractive(const char * command, const chip::Optional & storageDirectory) { std::vector arguments; VerifyOrReturnValue(DecodeArgumentsFromInteractiveMode(command, arguments), EXIT_FAILURE); @@ -174,7 +174,7 @@ int Commands::RunInteractive(const char * command) } ChipLogProgress(chipTool, "Command: %s", commandStr.c_str()); - auto err = RunCommand(argc, argv, true); + auto err = RunCommand(argc, argv, true, storageDirectory); // Do not delete arg[0] for (auto i = 1; i < argc; i++) @@ -185,7 +185,8 @@ int Commands::RunInteractive(const char * command) return (err == CHIP_NO_ERROR) ? EXIT_SUCCESS : EXIT_FAILURE; } -CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive) +CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive, + const chip::Optional & interactiveStorageDirectory) { Command * command = nullptr; @@ -271,7 +272,25 @@ CHIP_ERROR Commands::RunCommand(int argc, char ** argv, bool interactive) return CHIP_ERROR_INVALID_ARGUMENT; } - return interactive ? command->RunAsInteractive() : command->Run(); + if (interactive) + { + return command->RunAsInteractive(interactiveStorageDirectory); + } + + // Now that the command is initialized, get our storage from it as needed + // and set up our loging level. +#ifdef CONFIG_USE_LOCAL_STORAGE + CHIP_ERROR err = mStorage.Init(nullptr, command->GetStorageDirectory().ValueOr(nullptr)); + if (err != CHIP_NO_ERROR) + { + ChipLogError(Controller, "Init Storage failure: %s", chip::ErrorStr(err)); + return err; + } + + chip::Logging::SetLogFilter(mStorage.GetLoggingLevel()); +#endif // CONFIG_USE_LOCAL_STORAGE + + return command->Run(); } Commands::ClusterMap::iterator Commands::GetCluster(std::string clusterName) diff --git a/examples/chip-tool/commands/common/Commands.h b/examples/chip-tool/commands/common/Commands.h index eae7946e84c5ef..f9ba9f739ae140 100644 --- a/examples/chip-tool/commands/common/Commands.h +++ b/examples/chip-tool/commands/common/Commands.h @@ -32,12 +32,13 @@ class Commands void Register(const char * clusterName, commands_list commandsList, const char * helpText = nullptr); int Run(int argc, char ** argv); - int RunInteractive(const char * command); + int RunInteractive(const char * command, const chip::Optional & storageDirectory = chip::NullOptional); private: using ClusterMap = std::map>; - CHIP_ERROR RunCommand(int argc, char ** argv, bool interactive = false); + CHIP_ERROR RunCommand(int argc, char ** argv, bool interactive = false, + const chip::Optional & interactiveStorageDirectory = chip::NullOptional); ClusterMap::iterator GetCluster(std::string clusterName); Command * GetCommand(CommandsVector & commands, std::string commandName); diff --git a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp index fc895d4eb69eb1..84e543afada9ba 100644 --- a/examples/chip-tool/commands/interactive/InteractiveCommands.cpp +++ b/examples/chip-tool/commands/interactive/InteractiveCommands.cpp @@ -319,7 +319,7 @@ bool InteractiveCommand::ParseCommand(char * command, int * status) ClearLine(); - *status = mHandler->RunInteractive(command); + *status = mHandler->RunInteractive(command, GetStorageDirectory()); return true; } diff --git a/examples/chip-tool/commands/pairing/Commands.h b/examples/chip-tool/commands/pairing/Commands.h index 4f4f445d929a8c..213c9e3ceb58f5 100644 --- a/examples/chip-tool/commands/pairing/Commands.h +++ b/examples/chip-tool/commands/pairing/Commands.h @@ -19,7 +19,6 @@ #pragma once #include "commands/common/Commands.h" -#include "commands/pairing/CloseSessionCommand.h" #include "commands/pairing/GetCommissionerNodeIdCommand.h" #include "commands/pairing/GetCommissionerRootCertificateCommand.h" #include "commands/pairing/IssueNOCChainCommand.h" @@ -241,7 +240,6 @@ void registerCommandsPairing(Commands & commands, CredentialIssuerCommands * cre // make_unique(), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), - make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/examples/chip-tool/commands/pairing/CloseSessionCommand.cpp b/examples/chip-tool/commands/session-management/CloseSessionCommand.cpp similarity index 72% rename from examples/chip-tool/commands/pairing/CloseSessionCommand.cpp rename to examples/chip-tool/commands/session-management/CloseSessionCommand.cpp index 7f0a8bfef4d34a..ba38bca90d5dbb 100644 --- a/examples/chip-tool/commands/pairing/CloseSessionCommand.cpp +++ b/examples/chip-tool/commands/session-management/CloseSessionCommand.cpp @@ -23,20 +23,20 @@ using namespace chip; using namespace chip::Protocols; -CHIP_ERROR CloseSessionCommand::RunCommand() +CHIP_ERROR SendCloseSessionCommand::RunCommand() { CommissioneeDeviceProxy * commissioneeDeviceProxy = nullptr; - if (CHIP_NO_ERROR == CurrentCommissioner().GetDeviceBeingCommissioned(mDestinationId, &commissioneeDeviceProxy)) + if (CHIP_NO_ERROR == CurrentCommissioner().GetDeviceBeingCommissioned(mDestinationNodeId, &commissioneeDeviceProxy)) { VerifyOrReturnError(commissioneeDeviceProxy->GetSecureSession().HasValue(), CHIP_ERROR_INCORRECT_STATE); return CloseSession(*commissioneeDeviceProxy->GetExchangeManager(), commissioneeDeviceProxy->GetSecureSession().Value()); } - return CurrentCommissioner().GetConnectedDevice(mDestinationId, &mOnDeviceConnectedCallback, + return CurrentCommissioner().GetConnectedDevice(mDestinationNodeId, &mOnDeviceConnectedCallback, &mOnDeviceConnectionFailureCallback); } -CHIP_ERROR CloseSessionCommand::CloseSession(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) +CHIP_ERROR SendCloseSessionCommand::CloseSession(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle) { // TODO perhaps factor out this code into something on StatusReport that // takes an exchange and maybe a SendMessageFlags? @@ -60,6 +60,10 @@ CHIP_ERROR CloseSessionCommand::CloseSession(Messaging::ExchangeManager & exchan exchange->SendMessage(SecureChannel::MsgType::StatusReport, std::move(msg), Messaging::SendMessageFlags::kNoAutoRequestAck); if (err == CHIP_NO_ERROR) { + if (mEvictLocalSession.ValueOr(true)) + { + sessionHandle->AsSecureSession()->MarkForEviction(); + } SetCommandExitStatus(CHIP_NO_ERROR); } else @@ -70,21 +74,32 @@ CHIP_ERROR CloseSessionCommand::CloseSession(Messaging::ExchangeManager & exchan return err; } -void CloseSessionCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, - const SessionHandle & sessionHandle) +void SendCloseSessionCommand::OnDeviceConnectedFn(void * context, Messaging::ExchangeManager & exchangeMgr, + const SessionHandle & sessionHandle) { - auto * command = reinterpret_cast(context); + auto * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectedFn: context is null")); CHIP_ERROR err = command->CloseSession(exchangeMgr, sessionHandle); VerifyOrReturn(CHIP_NO_ERROR == err, command->SetCommandExitStatus(err)); } -void CloseSessionCommand::OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err) +void SendCloseSessionCommand::OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR err) { LogErrorOnFailure(err); - auto * command = reinterpret_cast(context); + auto * command = reinterpret_cast(context); VerifyOrReturn(command != nullptr, ChipLogError(chipTool, "OnDeviceConnectionFailureFn: context is null")); command->SetCommandExitStatus(err); } + +CHIP_ERROR EvictLocalCASESessionsCommand::RunCommand() +{ + auto & controller = CurrentCommissioner(); + auto sessionManager = controller.SessionMgr(); + + sessionManager->ExpireAllSessions(ScopedNodeId(mDestinationNodeId, controller.GetFabricIndex())); + + SetCommandExitStatus(CHIP_NO_ERROR); + return CHIP_NO_ERROR; +} diff --git a/examples/chip-tool/commands/pairing/CloseSessionCommand.h b/examples/chip-tool/commands/session-management/CloseSessionCommand.h similarity index 53% rename from examples/chip-tool/commands/pairing/CloseSessionCommand.h rename to examples/chip-tool/commands/session-management/CloseSessionCommand.h index edbcb82b094d5d..b51934a9390a92 100644 --- a/examples/chip-tool/commands/pairing/CloseSessionCommand.h +++ b/examples/chip-tool/commands/session-management/CloseSessionCommand.h @@ -23,16 +23,35 @@ #include #include -class CloseSessionCommand : public CHIPCommand +namespace detail { + +class SessionManagementCommand : public CHIPCommand +{ +public: + SessionManagementCommand(const char * commandName, CredentialIssuerCommands * credIssuerCommands, const char * helpText) : + CHIPCommand(commandName, credIssuerCommands, helpText) + { + AddArgument("node-id", 0, UINT64_MAX, &mDestinationNodeId); + } + +protected: + chip::NodeId mDestinationNodeId; +}; + +} // namespace detail + +class SendCloseSessionCommand : public detail::SessionManagementCommand { public: - CloseSessionCommand(CredentialIssuerCommands * credIssuerCommands) : - CHIPCommand("close-session", credIssuerCommands, "Sends a CloseSession message to the given destination node id."), + SendCloseSessionCommand(CredentialIssuerCommands * credIssuerCommands) : + detail::SessionManagementCommand("send-close-session", credIssuerCommands, + "Sends a CloseSession message to the given node id."), mOnDeviceConnectedCallback(OnDeviceConnectedFn, this), mOnDeviceConnectionFailureCallback(OnDeviceConnectionFailureFn, this) { - AddArgument("destination-id", 0, UINT64_MAX, &mDestinationId); AddArgument("timeout", 0, UINT64_MAX, &mTimeoutSecs, "Time, in seconds, before this command is considered to have timed out."); + AddArgument("evict-local-session", 0, 1, &mEvictLocalSession, + "If true, evicts the local session after sending the message. If false, leaves it around. Defaults to true."); } /////////// CHIPCommand Interface ///////// @@ -43,16 +62,33 @@ class CloseSessionCommand : public CHIPCommand } private: - chip::NodeId mDestinationId; chip::Optional mTimeoutSecs; + chip::Optional mEvictLocalSession; static void OnDeviceConnectedFn(void * context, chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle); static void OnDeviceConnectionFailureFn(void * context, const chip::ScopedNodeId & peerId, CHIP_ERROR error); - // Try to send the action CloseSession status report. + // Try to send the CloseSession status report. CHIP_ERROR CloseSession(chip::Messaging::ExchangeManager & exchangeMgr, const chip::SessionHandle & sessionHandle); chip::Callback::Callback mOnDeviceConnectedCallback; chip::Callback::Callback mOnDeviceConnectionFailureCallback; }; + +class EvictLocalCASESessionsCommand : public detail::SessionManagementCommand +{ +public: + EvictLocalCASESessionsCommand(CredentialIssuerCommands * credIssuerCommands) : + detail::SessionManagementCommand("expire-case-sessions", credIssuerCommands, + "Expires (evicts) all local CASE sessions to the given node id.") + {} + + /////////// CHIPCommand Interface ///////// + CHIP_ERROR RunCommand() override; + chip::System::Clock::Timeout GetWaitDuration() const override + { + // This command does all its work synchronously, so it really does not matter too much. + return chip::System::Clock::Seconds16(5); + } +}; diff --git a/examples/chip-tool/commands/session-management/Commands.h b/examples/chip-tool/commands/session-management/Commands.h new file mode 100644 index 00000000000000..7c75be2065f13d --- /dev/null +++ b/examples/chip-tool/commands/session-management/Commands.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2022 Project CHIP Authors + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#pragma once + +#include "commands/common/Commands.h" +#include "commands/session-management/CloseSessionCommand.h" + +void registerCommandsSessionManagement(Commands & commands, CredentialIssuerCommands * credsIssuerConfig) +{ + const char * clusterName = "SessionManagement"; + + commands_list clusterCommands = { + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + }; + + commands.Register(clusterName, clusterCommands, "Commands for managing CASE and PASE session state"); +} diff --git a/examples/chip-tool/main.cpp b/examples/chip-tool/main.cpp index c45998a8c8e337..17bb7f13a57e80 100644 --- a/examples/chip-tool/main.cpp +++ b/examples/chip-tool/main.cpp @@ -26,6 +26,7 @@ #include "commands/interactive/Commands.h" #include "commands/pairing/Commands.h" #include "commands/payload/Commands.h" +#include "commands/session-management/Commands.h" #include "commands/storage/Commands.h" #include @@ -48,6 +49,7 @@ int main(int argc, char * argv[]) registerClusters(commands, &credIssuerCommands); registerCommandsSubscriptions(commands, &credIssuerCommands); registerCommandsStorage(commands); + registerCommandsSessionManagement(commands, &credIssuerCommands); return commands.Run(argc, argv); } diff --git a/examples/light-switch-app/silabs/efr32/README.md b/examples/light-switch-app/silabs/efr32/README.md index bf18af9f03c0b2..6b7239ff263550 100644 --- a/examples/light-switch-app/silabs/efr32/README.md +++ b/examples/light-switch-app/silabs/efr32/README.md @@ -169,7 +169,12 @@ arguments All EFR32 boards require a bootloader, see Silicon Labs documentation for more info. Pre-built bootloader binaries are available in the Assets section of the Releases page on -[Silabs Matter Github](https://github.com/SiliconLabs/matter/releases) . +[Silabs Matter Github](https://github.com/SiliconLabs/matter/releases). + +- On the command line: + + + $ commander flash bootloader_binaries/bootloader-storage-internal-single-512k-BRD4187C-gsdk4.1.s37 ## Viewing Logging Output @@ -211,10 +216,16 @@ combination with JLinkRTTClient as follows: $ JLinkExe -device EFR32MG12PXXXF1024 -if JTAG -speed 4000 -autoconnect 1 + For MG21 use: $ JLinkExe -device EFR32MG21AXXXF1024 -if SWD -speed 4000 -autoconnect 1 + + For MG24 use: + + $ JLinkExe -device EFR32MG24AXXXF1536 -if SWD -speed 4000 -autoconnect 1 + - In a second terminal, run the JLinkRTTClient to view logs: $ JLinkRTTClient diff --git a/examples/lighting-app/qpg/BUILD.gn b/examples/lighting-app/qpg/BUILD.gn index 57d8d449f8ff46..b165b116a84473 100644 --- a/examples/lighting-app/qpg/BUILD.gn +++ b/examples/lighting-app/qpg/BUILD.gn @@ -64,7 +64,6 @@ qpg_executable("lighting_app") { ] deps = [ - ":factorydata_lib", ":sdk", "${chip_root}/examples/lighting-app/lighting-common:color-format", "${chip_root}/examples/lighting-app/qpg/zap/", @@ -73,6 +72,7 @@ qpg_executable("lighting_app") { "${chip_root}/src/setup_payload", "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", + "${chip_root}/third_party/qpg_sdk:qpg_light_factorydata_lib", ] if (chip_openthread_ftd) { @@ -156,15 +156,3 @@ group("qpg") { group("default") { deps = [ ":qpg" ] } - -static_library("factorydata_lib") { - libs = [ "${qpg_sdk_root}/Binaries/FactoryData/FactoryData_example/FactoryData_example.a" ] - public_configs = [ ":qpg_retain_factorydata" ] -} - -config("qpg_retain_factorydata") { - ldflags = [ - "-Wl,-u_binary_factory_data_bin_start", - "-Wl,-u_binary_factory_data_start", - ] -} diff --git a/examples/lock-app/qpg/BUILD.gn b/examples/lock-app/qpg/BUILD.gn index aaaea081a65b56..03d657ac5a0023 100644 --- a/examples/lock-app/qpg/BUILD.gn +++ b/examples/lock-app/qpg/BUILD.gn @@ -62,7 +62,6 @@ qpg_executable("lock_app") { ] deps = [ - ":factorydata_lib", ":sdk", "${chip_root}/examples/lock-app/qpg/zap/", "${chip_root}/examples/providers:device_info_provider", @@ -70,6 +69,7 @@ qpg_executable("lock_app") { "${chip_root}/src/setup_payload", "${chip_root}/third_party/openthread/platforms:libopenthread-platform", "${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils", + "${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata_lib", ] if (chip_openthread_ftd) { @@ -153,15 +153,3 @@ group("qpg") { group("default") { deps = [ ":qpg" ] } - -static_library("factorydata_lib") { - libs = [ "${qpg_sdk_root}/Binaries/FactoryData/FactoryData_example/FactoryData_example.a" ] - public_configs = [ ":qpg_retain_factorydata" ] -} - -config("qpg_retain_factorydata") { - ldflags = [ - "-Wl,-u_binary_factory_data_bin_start", - "-Wl,-u_binary_factory_data_start", - ] -} diff --git a/examples/platform/ameba/shell/launch_shell.cpp b/examples/platform/ameba/shell/launch_shell.cpp index d6feddb7dadf59..435966b27e89fa 100644 --- a/examples/platform/ameba/shell/launch_shell.cpp +++ b/examples/platform/ameba/shell/launch_shell.cpp @@ -21,6 +21,7 @@ #include "task.h" #include +#include namespace { @@ -35,7 +36,11 @@ namespace chip { void LaunchShell() { - chip::Shell::Engine::Root().Init(); + if (chip::Shell::Engine::Root().Init() < 0) + { + ChipLogError(DeviceLayer, "Failed to initialize shell engine!"); + return; + } xTaskCreate(MatterShellTask, "matter_shell", 2048, NULL, tskIDLE_PRIORITY + 1, NULL); } diff --git a/examples/platform/nxp/se05x/linux/AppMain.cpp b/examples/platform/nxp/se05x/linux/AppMain.cpp index 2f38e784dd395c..1ecf8052100a54 100644 --- a/examples/platform/nxp/se05x/linux/AppMain.cpp +++ b/examples/platform/nxp/se05x/linux/AppMain.cpp @@ -299,7 +299,7 @@ struct CommonCaseDeviceServerInitParams_Se05x : public CommonCaseDeviceServerIni static chip::PersistentStorageOperationalKeystoreHSM sPersistentStorageOperationalKeystore; static chip::Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; static chip::Credentials::GroupDataProviderImpl sGroupDataProvider; - static IgnoreCertificateValidityPolicy sDefaultCertValidityPolicy; + static Credentials::IgnoreCertificateValidityPeriodPolicy sDefaultCertValidityPolicy; static chip::Crypto::DefaultSessionKeystore sSessionKeystore; #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION diff --git a/integrations/cloudbuild/build-all.yaml b/integrations/cloudbuild/build-all.yaml index 5bafe90943b898..55162c7260f86d 100644 --- a/integrations/cloudbuild/build-all.yaml +++ b/integrations/cloudbuild/build-all.yaml @@ -6,7 +6,7 @@ steps: - "--init" - "--recursive" id: Submodules - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -21,7 +21,7 @@ steps: path: /pwenv timeout: 900s - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -76,7 +76,7 @@ steps: --target k32w-shell build --create-archives /workspace/artifacts/ - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/chef.yaml b/integrations/cloudbuild/chef.yaml index c0e166c9d26b1a..4db1c7afb05b2e 100644 --- a/integrations/cloudbuild/chef.yaml +++ b/integrations/cloudbuild/chef.yaml @@ -1,5 +1,5 @@ steps: - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -12,7 +12,7 @@ steps: path: /pwenv timeout: 2700s - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -26,7 +26,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: diff --git a/integrations/cloudbuild/smoke-test.yaml b/integrations/cloudbuild/smoke-test.yaml index 7b760749482f4d..411ae1825f67a5 100644 --- a/integrations/cloudbuild/smoke-test.yaml +++ b/integrations/cloudbuild/smoke-test.yaml @@ -1,5 +1,5 @@ steps: - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" entrypoint: "bash" args: - "-c" @@ -7,7 +7,7 @@ steps: git config --global --add safe.directory "*" git submodule update --init --recursive id: Submodules - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" env: - PW_ENVIRONMENT_ROOT=/pwenv args: @@ -22,7 +22,7 @@ steps: path: /pwenv timeout: 900s - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" id: ESP32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -41,7 +41,7 @@ steps: volumes: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" id: NRFConnect env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -62,7 +62,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" id: EFR32 env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -84,7 +84,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" id: Linux env: - PW_ENVIRONMENT_ROOT=/pwenv @@ -144,7 +144,7 @@ steps: - name: pwenv path: /pwenv - - name: "connectedhomeip/chip-build-vscode:0.7.2" + - name: "connectedhomeip/chip-build-vscode:0.7.3" id: Android env: - PW_ENVIRONMENT_ROOT=/pwenv diff --git a/integrations/docker/images/chip-build-k32w/Dockerfile b/integrations/docker/images/chip-build-k32w/Dockerfile index 8d0e7ea9cce4ab..41e779c8fdd613 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_10_K32W061DK6.zip \ - && unzip SDK_2_6_10_K32W061DK6.zip \ - && rm -rf SDK_2_6_10_K32W061DK6.zip \ + && wget https://cache.nxp.com/lgfiles/bsps/SDK_2_6_11_K32W061DK6.zip \ + && unzip SDK_2_6_11_K32W061DK6.zip \ + && rm -rf SDK_2_6_11_K32W061DK6.zip \ && : # last line FROM connectedhomeip/chip-build:${VERSION} diff --git a/integrations/docker/images/chip-build-openiotsdk/Dockerfile b/integrations/docker/images/chip-build-openiotsdk/Dockerfile index d3daf90439b5d3..2759f7e34c20e2 100644 --- a/integrations/docker/images/chip-build-openiotsdk/Dockerfile +++ b/integrations/docker/images/chip-build-openiotsdk/Dockerfile @@ -11,14 +11,6 @@ RUN set -x \ SHELL ["/bin/bash", "-o", "pipefail", "-c"] -# ------------------------------------------------------------------------------ -# Download ARM GCC toolchain 10.3-2021.10 -RUN set -x \ - && wget -q https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \ - && tar -xjf gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 -C /opt \ - && rm -r gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2 \ - && : # last line - # ------------------------------------------------------------------------------ # Install FVP Corstone 300 RUN set -x \ @@ -30,7 +22,6 @@ RUN set -x \ FROM connectedhomeip/chip-build:${VERSION} -COPY --from=build /opt/gcc-arm-none-eabi-10.3-2021.10/ /opt/gcc-arm-none-eabi-10.3-2021.10/ COPY --from=build /opt/FVP_Corstone_SSE-300/ /opt/FVP_Corstone_SSE-300/ # Required packages for building, running and testing @@ -47,6 +38,5 @@ RUN set -x \ # ------------------------------------------------------------------------------ # Configure environment variables ENV FVP_CORSTONE_300_PATH=/opt/FVP_Corstone_SSE-300 -ENV ARM_GCC_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-10.3-2021.10 -ENV PATH="${PATH}:${FVP_CORSTONE_300_PATH}/models/Linux64_GCC-6.4:${ARM_GCC_TOOLCHAIN_PATH}/bin" +ENV PATH="${PATH}:${FVP_CORSTONE_300_PATH}/models/Linux64_GCC-6.4" diff --git a/integrations/docker/images/chip-build-vscode/Dockerfile b/integrations/docker/images/chip-build-vscode/Dockerfile index 7e4186dd7d3254..d0e45d41b41b75 100644 --- a/integrations/docker/images/chip-build-vscode/Dockerfile +++ b/integrations/docker/images/chip-build-vscode/Dockerfile @@ -115,5 +115,4 @@ ENV TIZEN_SDK_TOOLCHAIN $TIZEN_SDK_ROOT/tools/arm-linux-gnueabi-gcc-9.2 ENV TIZEN_SDK_SYSROOT $TIZEN_SDK_ROOT/platforms/tizen-$TIZEN_VERSION/mobile/rootstraps/mobile-$TIZEN_VERSION-device.core ENV FVP_CORSTONE_300_PATH=/opt/FVP_Corstone_SSE-300 -ENV ARM_GCC_TOOLCHAIN_PATH=/opt/gcc-arm-none-eabi-10.3-2021.10 ENV BOUFFALOLAB_SDK_ROOT=/opt/bouffalolab_sdk diff --git a/integrations/docker/images/chip-build/version b/integrations/docker/images/chip-build/version index 87721f4184776e..4930e0379db757 100644 --- a/integrations/docker/images/chip-build/version +++ b/integrations/docker/images/chip-build/version @@ -1 +1 @@ -0.7.3 Version bump reason: [Ameba] Matter shell Update +0.7.5 Version bump reason: [OIS] Remove GCC toolchain diff --git a/scripts/configure b/scripts/configure index 84203e71043b3e..da5b1852086dbd 100755 --- a/scripts/configure +++ b/scripts/configure @@ -33,23 +33,31 @@ # the build directory, but an external directory can be specified using the # --build-env-dir option. The build environment directory can be shared by any # number of build directories, independently of target / tool chain. -# -# Project options can be passed in the usual GNU configure style (--enable-foo, -# --foo-bar=value) and are translated into GN build arguments. By default, -# configure will override the toolchain for the GN build using a 'custom' -# toolchain assembled from the usual environment variables (CC, CXX, AR, CFLAGS, -# CXXFLAGS, ...). -function usage() { +set -o pipefail +shopt -s extglob + +function usage() { # status info "Usage: $0 [OPTIONS] [--project=... [PROJECT OPTIONS]]" info "Options:" - info " --build-env-dir=DIR Directory to create (host) build environment in" - info " --project=DIR Sub-directory to build, e.g. examples/lighting-app/linux" - exit 0 + info " --build-env-dir=DIR Directory to create (host) build environment in" + info " --project=DIR Sub-directory to build, eg examples/lighting-app/linux" + info "" + info "Project options (mapped to GN build args):" + info " --enable-[=no] Enables (or disables with '=no') a bool build arg" + info " --= Sets a (non-bool) build arg to the given value" + info " GN argument names can be specified with '-' instead of '_' and prefixes" + info " like 'chip_' can be ommitted from names. For the full list of available" + info " build arguments, see the generated args.configured file." + info "" + info " By default, the toolchain for the GN build will be configured from the usual" + info " environment variables (CC, CXX, AR, CFLAGS, CXXFLAGS, ...), falling back to" + info " default tool names (CC=cc, ...). When using this script within an external" + info " build system, toolchain environment variables should be populated." + exit "$1" } function main() { # ... - set -o pipefail CHIP_ROOT=$(cd "$(dirname "$0")/.." && pwd) BUILD_ENV_DEPS=( "${CHIP_ROOT}/scripts/setup/requirements.build.txt" @@ -57,29 +65,27 @@ function main() { # ... "${CHIP_ROOT}/scripts/setup/zap.version" ) - if [[ "$PWD" == "$CHIP_ROOT" ]]; then - BUILD_DIR="out/configured" - BUILD_ROOT="${CHIP_ROOT}/${BUILD_DIR}" - BUILD_ENV_DIR=".venv" - info "Configuring in-tree, will build in $BUILD_DIR using environment $BUILD_ENV_DIR" - else - BUILD_DIR="." - BUILD_ROOT="$PWD" - BUILD_ENV_DIR="build-env" - fi + # Parse global options, process VAR=VALUE style arguments, and collect project options + BUILD_ENV_DIR= PROJECT= - - # Parse main options but leave project options in $@ - while [[ $# -gt 0 && -z "$PROJECT" ]]; do + PROJECT_ARGS=() + while [[ $# -gt 0 ]]; do case "$1" in - --help) usage ;; + --help) usage 0 ;; --build-env-dir=*) BUILD_ENV_DIR="${1#*=}" ;; --project=*) PROJECT="${1#*=}" ;; - *) fail "Invalid argument: '$1'" ;; + +([A-Z_])=*) export "$1" ;; + *) + [[ -n "$PROJECT" ]] || fail "Invalid argument: '$1'" + PROJECT_ARGS+=("$1") + ;; esac shift done + # Ensure we have something to do + [[ -n "$PROJECT" || -n "$BUILD_ENV_DIR" ]] || usage 1 + if [[ -n "$PROJECT" ]]; then local subdir="$(cd "${CHIP_ROOT}/${PROJECT}" 2>/dev/null && pwd)" [[ -n "$subdir" && -r "${subdir}/.gn" ]] || fail "Invalid project '${PROJECT}'" @@ -89,7 +95,28 @@ function main() { # ... check_binary gn GN check_binary ninja NINJA - if ! activate_build_env; then + + # Work out build and environment directories + if [[ "$PWD" == "$CHIP_ROOT" ]]; then + BUILD_DIR="out/configured" + NINJA_HINT="ninja -C ${BUILD_DIR}" + else + BUILD_DIR="." + NINJA_HINT="ninja" + fi + + if [[ -n "$BUILD_ENV_DIR" ]]; then + mkdir -p "$BUILD_ENV_DIR" + BUILD_ENV_PATH="$(cd "$BUILD_ENV_DIR" && pwd)" + [[ -n "$BUILD_ENV_PATH" ]] || fail "Invalid build-env-dir '${BUILD_ENV_DIR}'" + BUILD_ENV_DIR="$BUILD_ENV_PATH" # absolute + else + BUILD_ENV_DIR="build-env" # relative to BUILD_DIR + BUILD_ENV_PATH="${BUILD_DIR}/${BUILD_ENV_DIR}" + fi + + # Create the build environment if necessary + if ! check_build_env; then check_python configure_python_env if ! check_binary zap-cli; then @@ -98,15 +125,19 @@ function main() { # ... finalize_build_env fi + # Configure the project (if requested) if [[ -z "$PROJECT" ]]; then info "Build environment created. (Specify --project=DIR to configure a build.)" return fi + [[ "$BUILD_DIR" != "." ]] && info "Configuring in-tree, will build in ${BUILD_DIR}" + create_empty_pw_env - gn_generate "$@" + guess_toolchain + gn_generate "${PROJECT_ARGS[@]}" create_ninja_wrapper - info "You can now run ./ninja-build" + info "You can now run ./ninja-build (or $NINJA_HINT)" } function create_empty_pw_env() { @@ -123,61 +154,90 @@ function create_empty_pw_env() { fi } +function guess_toolchain() { + # There is no widely used standard command for the C++ compiler (analogous to + # `cc` for the C compiler), so if neither CC nor CXX are defined try to guess. + if [[ -z "$CC" && -z "$CXX" ]] && have_binary cc; then + local probe="$(cc -E - <<<'gnu=__GNUC__ clang=__clang__' 2>/dev/null)" + # Check for clang first because it also defines __GNUC__ + if [[ "$probe" =~ clang=[1-9] ]] && have_binary clang && have_binary clang++; then + info "Guessing CC=clang CXX=clang++ because cc appears to be clang" + export CC=clang CXX=clang++ + elif [[ "$probe" =~ gnu=[1-9] ]] && have_binary gcc && have_binary g++; then + info "Guessing CC=gcc CXX=g++ because cc appears to be gcc" + export CC=gcc CXX=g++ + else + info "Unable to guess c++ compiler: $probe" + fi + fi +} + function gn_generate() { # [project options] - mkdir -p "${BUILD_ROOT}" - ensure_no_clobber "${BUILD_ROOT}/args.gn" - ( - cd "${CHIP_ROOT}/${PROJECT}" # --root= doesn't work for gn args! - - # Run gn gen with an empty args.gn first so we can list all arguments - info "Configuring gn build arguments (see $BUILD_DIR/args.configured for full list)" - echo "# ${CONFIGURE_MARKER}" >"${BUILD_ROOT}/args.gn" - gn -q gen "$BUILD_ROOT" - - # Use the argument list to drive the mapping of our command line options to GN args - call_impl process_project_args <(gn args "$BUILD_ROOT" --list --json) "$@" >>"${BUILD_ROOT}/args.gn" - gn args "$BUILD_ROOT" --list >"${BUILD_ROOT}/args.configured" - - # Now gn gen with the arguments we have configured. - info "Running gn gen to generate ninja files" - gn -q gen "$BUILD_ROOT" - ) + mkdir -p "${BUILD_DIR}" + ensure_no_clobber "${BUILD_DIR}/args.gn" + + # Pass --script-executable to all `gn` calls so scripts run in our venv + local gn=(gn --script-executable="${BUILD_ENV_DIR}/bin/python" --root="${CHIP_ROOT}/${PROJECT}") + + # Run gn gen with an empty args.gn first so we can list all arguments + info "Configuring gn build arguments (see $BUILD_DIR/args.configured for full list)" + { + echo "# ${CONFIGURE_MARKER}" + echo "# project root: ${PROJECT}" + } >"${BUILD_DIR}/args.gn" + "${gn[@]}" -q gen "$BUILD_DIR" + + # Use the argument list to drive the mapping of our command line options to GN args + call_impl process_project_args <("${gn[@]}" args "$BUILD_DIR" --list --json) "$@" >>"${BUILD_DIR}/args.gn" + "${gn[@]}" args "$BUILD_DIR" --list >"${BUILD_DIR}/args.configured" + + # Now gn gen with the arguments we have configured. + info "Running gn gen to generate ninja files" + "${gn[@]}" -q gen "$BUILD_DIR" } function create_ninja_wrapper() { - # Note: "." != $BUILD_DIR for in-tree builds local wrapper="ninja-build" ensure_no_clobber "$wrapper" - cat >"$wrapper" <"$wrapper" chmod a+x "$wrapper" } -function activate_build_env() { +function check_build_env() { generate_build_env_cksum # re-used by finalize_build_env - [[ -r "${BUILD_ENV_DIR}/.cksum" ]] || return 1 - read -r <"${BUILD_ENV_DIR}/.cksum" || true + [[ -r "${BUILD_ENV_PATH}/.cksum" ]] || return 1 + read -r <"${BUILD_ENV_PATH}/.cksum" || true [[ "$REPLY" == "$CURRENT_ENV_CKSUM" ]] || return 1 - [[ -r "${BUILD_ENV_DIR}/bin/activate" ]] || return 1 - info "Using existing build environment: ${BUILD_ENV_DIR}" - source "${BUILD_ENV_DIR}/bin/activate" - PYTHON="python" + [[ -r "${BUILD_ENV_PATH}/bin/activate" ]] || return 1 + info "Using existing build environment: ${BUILD_ENV_PATH}" + PYTHON="${BUILD_ENV_PATH}/bin/python" } function configure_python_env() { progress "Setting up Python venv" - "$PYTHON" -m venv "$BUILD_ENV_DIR" - info "ok" + "$PYTHON" -m venv --clear "$BUILD_ENV_PATH" + info "$BUILD_ENV_PATH" + + # Install our auto-loading venvactivate module so that running scripts via + # the venv python has the side-effect of fully activating the environment. + local sitepkgs=("${BUILD_ENV_PATH}/lib/python"*"/site-packages") + [[ -d "$sitepkgs" ]] || fail "Failed to locate venv site-packages" + cp "${CHIP_ROOT}/scripts/configure.venv/venvactivate".{pth,py} "${sitepkgs}/" progress "Installing Python build dependencies" - "${BUILD_ENV_DIR}/bin/pip" install --require-virtualenv --quiet --upgrade pip wheel - "${BUILD_ENV_DIR}/bin/pip" install --require-virtualenv --quiet \ + "${BUILD_ENV_PATH}/bin/pip" install --require-virtualenv --quiet --upgrade pip wheel + "${BUILD_ENV_PATH}/bin/pip" install --require-virtualenv --quiet \ -r "${CHIP_ROOT}/scripts/setup/requirements.build.txt" \ -c "${CHIP_ROOT}/scripts/setup/constraints.txt" info "ok" @@ -190,9 +250,7 @@ function generate_build_env_cksum() { } function finalize_build_env() { - echo "$CURRENT_ENV_CKSUM" >"${BUILD_ENV_DIR}/.cksum" - source "${BUILD_ENV_DIR}/bin/activate" - PYTHON="python" + echo "$CURRENT_ENV_CKSUM" >"${BUILD_ENV_PATH}/.cksum" } function download_zap() { @@ -206,8 +264,8 @@ function download_zap() { local url="https://github.com/project-chip/zap/releases/download/${version}/zap-${platform}.zip" progress "Installing zap-cli from $url" - call_impl download_and_extract_zip "$url" "${BUILD_ENV_DIR}/bin" zap-cli - chmod a+x "${BUILD_ENV_DIR}/bin/zap-cli" # ZipFile.extract() does not handle permissions + call_impl download_and_extract_zip "$url" "${BUILD_ENV_PATH}/bin" zap-cli + chmod a+x "${BUILD_ENV_PATH}/bin/zap-cli" # ZipFile.extract() does not handle permissions info "ok" } diff --git a/scripts/configure.venv/venvactivate.pth b/scripts/configure.venv/venvactivate.pth new file mode 100644 index 00000000000000..2f8f31d7042d68 --- /dev/null +++ b/scripts/configure.venv/venvactivate.pth @@ -0,0 +1 @@ +import venvactivate diff --git a/scripts/configure.venv/venvactivate.py b/scripts/configure.venv/venvactivate.py new file mode 100644 index 00000000000000..cfd0731fc95b3c --- /dev/null +++ b/scripts/configure.venv/venvactivate.py @@ -0,0 +1,11 @@ +# Activates the current venv as if the activate script had been sourced +import collections +import os +import sys + +# Prepend the venv bin to PATH (without introducing duplicate entries) +path = [os.path.join(sys.prefix, 'bin')] + os.environ['PATH'].split(':') +os.environ['PATH'] = ':'.join(collections.OrderedDict.fromkeys(path).keys()) + +# Set VIRTUAL_ENV to the venv directory +os.environ['VIRTUAL_ENV'] = sys.prefix diff --git a/scripts/py_matter_idl/matter_idl/test_xml_parser.py b/scripts/py_matter_idl/matter_idl/test_xml_parser.py index d3ff819b37d9c7..7828c4219694fd 100755 --- a/scripts/py_matter_idl/matter_idl/test_xml_parser.py +++ b/scripts/py_matter_idl/matter_idl/test_xml_parser.py @@ -18,9 +18,6 @@ from typing import List, Union try: - from matter_idl.matter_idl_types import (AccessPrivilege, Attribute, AttributeQuality, Bitmap, Cluster, ClusterSide, Command, - ConstantEntry, DataType, Event, EventPriority, EventQuality, Field, FieldQuality, Idl, - Struct, StructQuality, StructTag) from matter_idl.zapxml import ParseSource, ParseXmls except ImportError: import os @@ -28,12 +25,12 @@ sys.path.append(os.path.abspath( os.path.join(os.path.dirname(__file__), '..'))) - - from matter_idl.matter_idl_types import (AccessPrivilege, Attribute, AttributeQuality, Bitmap, Cluster, ClusterSide, Command, - ConstantEntry, DataType, Event, EventPriority, EventQuality, Field, FieldQuality, Idl, - Struct, StructQuality, StructTag) from matter_idl.zapxml import ParseSource, ParseXmls +from matter_idl.matter_idl_types import (AccessPrivilege, Attribute, AttributeQuality, Bitmap, Cluster, ClusterSide, Command, + ConstantEntry, DataType, Enum, Event, EventPriority, EventQuality, Field, FieldQuality, + Idl, Struct, StructQuality, StructTag) + def XmlToIdl(what: Union[str, List[str]]) -> Idl: if not isinstance(what, list): @@ -223,6 +220,62 @@ def testFabricScopedAndSensitive(self): qualities=StructQuality.FABRIC_SCOPED)], )])) + def testEnum(self): + idl = XmlToIdl(''' + + Test110 + Test220 + + + + + + + + + + + + + + + + + + + ''') + e1 = Enum( + name='GlobalEnum', + base_type="ENUM8", + entries=[ + ConstantEntry(name="First", code=0), + ConstantEntry(name="Second", code=1), + ] + ) + e2 = Enum( + name='OneCluster', + base_type="ENUM8", + entries=[ + ConstantEntry(name="Three", code=3), + ] + ) + e3 = Enum( + name='TwoClusters', + base_type="ENUM8", + entries=[ + ConstantEntry(name="Big", code=100), + ConstantEntry(name="Bigger", code=2000), + ] + ) + self.assertEqual(idl, + Idl(clusters=[ + Cluster(side=ClusterSide.CLIENT, + name='Test1', code=10, enums=[e2, e3]), + Cluster(side=ClusterSide.CLIENT, + name='Test2', code=20, enums=[e3])], + enums=[e1], + )) + def testStruct(self): idl = XmlToIdl(''' diff --git a/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py b/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py index b24406c1565991..966d875c3355ed 100644 --- a/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py +++ b/scripts/py_matter_idl/matter_idl/zapxml/handlers/handlers.py @@ -248,7 +248,10 @@ class EnumHandler(BaseHandler, IdlPostProcessor): def __init__(self, context: Context, attrs): super().__init__(context) - self._cluster_code = None # if set, enum belongs to a specific cluster + + # no cluster codes means global. Note that at the time + # of writing this, no global enums were defined in XMLs + self._cluster_codes = set() self._enum = Enum(name=attrs['name'], base_type=attrs['type'], entries=[]) @@ -260,10 +263,7 @@ def GetNextProcessor(self, name, attrs): )) return BaseHandler(self.context, handled=HandledDepth.SINGLE_TAG) elif name.lower() == 'cluster': - if self._cluster_code is not None: - raise Exception( - 'Multiple cluster codes for enum %s' % self._enum.name) - self._cluster_code = ParseInt(attrs['code']) + self._cluster_codes.add(ParseInt(attrs['code'])) return BaseHandler(self.context, handled=HandledDepth.SINGLE_TAG) else: return BaseHandler(self.context) @@ -273,18 +273,18 @@ def FinalizeProcessing(self, idl: Idl): # - inside a cluster if a code exists # - inside top level if a code does not exist - if self._cluster_code is None: + if not self._cluster_codes: idl.enums.append(self._enum) else: - found = False + found = set() for c in idl.clusters: - if c.code == self._cluster_code: + if c.code in self._cluster_codes: c.enums.append(self._enum) - found = True + found.add(c.code) - if not found: - LOGGER.error('Enum %s could not find its cluster (code %d/0x%X)' % - (self._enum.name, self._cluster_code, self._cluster_code)) + if found != self._cluster_codes: + LOGGER.error('Enum %s could not find its clusters (codes: %r)' % + (self._enum.name, self._cluster_codes - found)) def EndProcessing(self): self.context.AddIdlPostProcessor(self) diff --git a/scripts/py_matter_yamltests/matter_yamltests/runner.py b/scripts/py_matter_yamltests/matter_yamltests/runner.py index 3229dace1301bf..fe4a091bc9676f 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/runner.py +++ b/scripts/py_matter_yamltests/matter_yamltests/runner.py @@ -16,7 +16,7 @@ import asyncio import time from abc import ABC, abstractmethod -from dataclasses import dataclass +from dataclasses import dataclass, field from .adapter import TestAdapter from .hooks import TestRunnerHooks @@ -72,7 +72,7 @@ class TestRunnerConfig: """ adapter: TestAdapter = None pseudo_clusters: PseudoClusters = PseudoClusters([]) - options: TestRunnerOptions = TestRunnerOptions() + options: TestRunnerOptions = field(default_factory=TestRunnerOptions) hooks: TestRunnerHooks = TestRunnerHooks() diff --git a/scripts/tests/chiptest/test_definition.py b/scripts/tests/chiptest/test_definition.py index 5b0f4a548f505c..5009ad90109dae 100644 --- a/scripts/tests/chiptest/test_definition.py +++ b/scripts/tests/chiptest/test_definition.py @@ -15,6 +15,8 @@ import logging import os +import shutil +import tempfile import threading import time import typing @@ -227,6 +229,7 @@ class TestRunTime(Enum): CHIP_TOOL_BUILTIN = auto() # run via chip-tool built-in test commands CHIP_TOOL_PYTHON = auto() # use the python yaml test parser with chip-tool CHIP_REPL_PYTHON = auto() # use the python yaml test runner + DARWIN_FRAMEWORK_TOOL_BUILTIN = auto() # run via darwin-framework-tool built-in test commands @dataclass @@ -259,6 +262,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, """ runner.capture_delegate = ExecutionCapture() + tool_storage_dir = None + try: if self.target == TestTarget.ALL_CLUSTERS: target_app = paths.all_clusters_app @@ -302,16 +307,8 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, tool_cmd = paths.chip_tool if test_runtime != TestRunTime.CHIP_TOOL_PYTHON else paths.chip_tool_with_python_cmd - files_to_unlink = [ - '/tmp/chip_tool_config.ini', - '/tmp/chip_tool_config.alpha.ini', - '/tmp/chip_tool_config.beta.ini', - '/tmp/chip_tool_config.gamma.ini', - ] - - for f in files_to_unlink: - if os.path.exists(f): - os.unlink(f) + tool_storage_dir = tempfile.mkdtemp() + tool_storage_args = ['--storage-directory', tool_storage_dir] # Only start and pair the default app app = apps_register.get('default') @@ -319,8 +316,13 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, pairing_cmd = tool_cmd + ['pairing', 'code', TEST_NODE_ID, app.setupCode] test_cmd = tool_cmd + ['tests', self.run_name] + ['--PICS', pics_file] if test_runtime == TestRunTime.CHIP_TOOL_PYTHON: - pairing_cmd += ['--server_path'] + [paths.chip_tool[-1]] - test_cmd += ['--server_path'] + [paths.chip_tool[-1]] + server_args = ['--server_path', paths.chip_tool[-1]] + \ + ['--server_arguments', 'interactive server ' + ' '.join(tool_storage_args)] + pairing_cmd += server_args + test_cmd += server_args + elif test_runtime == TestRunTime.CHIP_TOOL_BUILTIN: + pairing_cmd += tool_storage_args + test_cmd += tool_storage_args if dry_run: logging.info(" ".join(pairing_cmd)) @@ -348,3 +350,5 @@ def Run(self, runner, apps_register, paths: ApplicationPaths, pics_file: str, apps_register.killAll() apps_register.factoryResetAll() apps_register.removeAll() + if tool_storage_dir is not None: + shutil.rmtree(tool_storage_dir, ignore_errors=True) diff --git a/scripts/tests/run_test_suite.py b/scripts/tests/run_test_suite.py index 3b70bd81d7cffe..53ce7da5d07a01 100755 --- a/scripts/tests/run_test_suite.py +++ b/scripts/tests/run_test_suite.py @@ -143,6 +143,8 @@ def main(context, dry_run, log_level, target, target_glob, target_skip_glob, runtime = TestRunTime.CHIP_REPL_PYTHON elif runner == 'chip_tool_python': runtime = TestRunTime.CHIP_TOOL_PYTHON + elif chip_tool is not None and os.path.basename(chip_tool) == "darwin-framework-tool": + runtime = TestRunTime.DARWIN_FRAMEWORK_TOOL_BUILTIN if chip_tool is None and not runtime == TestRunTime.CHIP_REPL_PYTHON: # non yaml tests REQUIRE chip-tool. Yaml tests should not require chip-tool diff --git a/scripts/tools/memory/gh_report.py b/scripts/tools/memory/gh_report.py index 0e949134b1f5db..c35c3e53840be4 100755 --- a/scripts/tools/memory/gh_report.py +++ b/scripts/tools/memory/gh_report.py @@ -375,7 +375,8 @@ def merge(df: pd.DataFrame, comment) -> pd.DataFrame: cols, rows = memdf.util.markdown.read_hierified(body) break logging.debug('REC: read %d rows', len(rows)) - df = df.append(pd.DataFrame(data=rows, columns=cols).astype(df.dtypes)) + df = pd.concat([df, pd.DataFrame(data=rows, columns=cols).astype(df.dtypes)], + ignore_index=True) return df.sort_values( by=['platform', 'target', 'config', 'section']).drop_duplicates() diff --git a/scripts/tools/memory/memdf/util/markdown.py b/scripts/tools/memory/memdf/util/markdown.py index 52aea03e86db91..d738059decec8f 100644 --- a/scripts/tools/memory/memdf/util/markdown.py +++ b/scripts/tools/memory/memdf/util/markdown.py @@ -34,7 +34,7 @@ def read_hierified(f): for i in range(0, len(header)): column = columns[i + 1].strip() if not column: - column = rows[-1][i] + column = rows[-1][i] if rows else '(blank)' row.append(column) rows.append(tuple(row)) diff --git a/src/app/ReadClient.cpp b/src/app/ReadClient.cpp index e430c0ea5ddb48..6ccc913f38b8db 100644 --- a/src/app/ReadClient.cpp +++ b/src/app/ReadClient.cpp @@ -248,7 +248,6 @@ CHIP_ERROR ReadClient::SendRequest(ReadPrepareParams & aReadPrepareParams) CHIP_ERROR ReadClient::SendReadRequest(ReadPrepareParams & aReadPrepareParams) { - // TODO: SendRequest parameter is too long, need to have the structure to represent it CHIP_ERROR err = CHIP_NO_ERROR; ChipLogDetail(DataManagement, "%s ReadClient[%p]: Sending Read Request", __func__, this); diff --git a/src/app/server/Server.cpp b/src/app/server/Server.cpp index 344776c49ac93b..e741b9e34f0122 100644 --- a/src/app/server/Server.cpp +++ b/src/app/server/Server.cpp @@ -535,7 +535,7 @@ KvsPersistentStorageDelegate CommonCaseDeviceServerInitParams::sKvsPersistenStor PersistentStorageOperationalKeystore CommonCaseDeviceServerInitParams::sPersistentStorageOperationalKeystore; Credentials::PersistentStorageOpCertStore CommonCaseDeviceServerInitParams::sPersistentStorageOpCertStore; Credentials::GroupDataProviderImpl CommonCaseDeviceServerInitParams::sGroupDataProvider; -IgnoreCertificateValidityPolicy CommonCaseDeviceServerInitParams::sDefaultCertValidityPolicy; +Credentials::IgnoreCertificateValidityPeriodPolicy CommonCaseDeviceServerInitParams::sDefaultCertValidityPolicy; #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION SimpleSessionResumptionStorage CommonCaseDeviceServerInitParams::sSessionResumptionStorage; #endif diff --git a/src/app/server/Server.h b/src/app/server/Server.h index 380e8240abfed9..0a6bc5c54801f6 100644 --- a/src/app/server/Server.h +++ b/src/app/server/Server.h @@ -137,42 +137,6 @@ struct ServerInitParams Credentials::OperationalCertificateStore * opCertStore = nullptr; }; -class IgnoreCertificateValidityPolicy : public Credentials::CertificateValidityPolicy -{ -public: - IgnoreCertificateValidityPolicy() {} - - /** - * @brief - * - * This certificate validity policy does not validate NotBefore or - * NotAfter to accommodate platforms that may have wall clock time, but - * where it is unreliable. - * - * Last Known Good Time is also not considered in this policy. - * - * @param cert CHIP Certificate for which we are evaluating validity - * @param depth the depth of the certificate in the chain, where the leaf is at depth 0 - * @return CHIP_NO_ERROR if CHIPCert should accept the certificate; an appropriate CHIP_ERROR if it should be rejected - */ - CHIP_ERROR ApplyCertificateValidityPolicy(const Credentials::ChipCertificateData * cert, uint8_t depth, - Credentials::CertificateValidityResult result) override - { - switch (result) - { - case Credentials::CertificateValidityResult::kValid: - case Credentials::CertificateValidityResult::kNotYetValid: - case Credentials::CertificateValidityResult::kExpired: - case Credentials::CertificateValidityResult::kNotExpiredAtLastKnownGoodTime: - case Credentials::CertificateValidityResult::kExpiredAtLastKnownGoodTime: - case Credentials::CertificateValidityResult::kTimeUnknown: - return CHIP_NO_ERROR; - default: - return CHIP_ERROR_INVALID_ARGUMENT; - } - } -}; - /** * Transitional version of ServerInitParams to assist SDK integrators in * transitioning to injecting product/platform-owned resources. This version @@ -289,7 +253,7 @@ struct CommonCaseDeviceServerInitParams : public ServerInitParams static PersistentStorageOperationalKeystore sPersistentStorageOperationalKeystore; static Credentials::PersistentStorageOpCertStore sPersistentStorageOpCertStore; static Credentials::GroupDataProviderImpl sGroupDataProvider; - static IgnoreCertificateValidityPolicy sDefaultCertValidityPolicy; + static Credentials::IgnoreCertificateValidityPeriodPolicy sDefaultCertValidityPolicy; #if CHIP_CONFIG_ENABLE_SESSION_RESUMPTION static SimpleSessionResumptionStorage sSessionResumptionStorage; #endif diff --git a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml index 625d937f7adce9..2dca9c034950f2 100644 --- a/src/app/tests/suites/certification/Test_TC_S_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_S_1_1.yaml @@ -20,51 +20,103 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Scenes" + endpoint: 1 tests: - label: "Commission DUT to TH (can be skipped if done in a preceding test)" - verification: | - DUT and TH are on same fabric - disabled: true + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId - label: "Read ClusterRevision (global attribute 65533)" - verification: | - value SHALL be 4 - disabled: true + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 5 + constraints: + type: int16u - label: "Read FeatureMap (global attribute 65532)" - verification: | - value SHALL be 0 - disabled: true + PICS: (!S.S.F00) + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 0 + constraints: + type: bitmap32 - label: "Read FeatureMap (global attribute 65532)" - verification: | - value SHALL be 1 - disabled: true + PICS: S.S.F00 + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 1 + constraints: + type: bitmap32 - label: "Read AttributeList (global attribute 65531)" - verification: | - list SHALL be [0,1,2,3,4] - disabled: true + PICS: S.S.A0005 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: + [0, 1, 2, 3, 4, 5, 6, 7, 65528, 65529, 65531, 65532, 65533] - label: "Read AttributeList (global attribute 65531)" - verification: | - list SHALL be [0,1,2,3,4,5] - disabled: true + PICS: (!S.S.A0005) + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 4, 6, 7, 65528, 65529, 65531, 65532, 65533] - label: "Read EventList (global attribute 65530)" - verification: | - list SHALL be empty - disabled: true + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + contains: [] - label: "Read AcceptedCommandList (global attribute 65529)" - verification: | - list SHALL contain at least [0,1,2,3,4,5,6] if S.S.C40.Rsp(EnhancedAddScene) then list SHALL also contain [40] else it SHALL NOT contain [40] if S.S.C41.Rsp(EnhancedViewScene) then list SHALL also contain [41] else it SHALL NOT contain [41] if S.S.C42.Rsp(CopyScene) then list SHALL also contain [42] else it SHALL NOT contain [42] - disabled: true + PICS: S.S.C40.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 4, 5, 6, 40, 41, 42] + + - label: "Read AcceptedCommandList (global attribute 65529)" + PICS: (!S.S.C40.Rsp) + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 4, 5, 6] + + - label: "Read GeneratedCommandList (global attribute 65528)" + PICS: S.C.C40.Tx + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 4, 5, 6, 40, 41, 42] - label: "Read GeneratedCommandList (global attribute 65528)" - verification: | - list SHALL contain at least [0,1,2,3,4,5,6] if S.S.C40.Rsp(EnhancedAddScene) then list SHALL also contain [40] else it SHALL NOT contain [40] if S.S.C41.Rsp(EnhancedViewScene) then list SHALL also contain [41] else it SHALL NOT contain [41] if S.S.C42.Rsp(CopyScene) then list SHALL also contain [42] else it SHALL NOT contain [42] - disabled: true + PICS: (!S.C.C40.Tx) + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 4, 5, 6] diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 64bcf3908c2169..d8c37bd6f5e0e4 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -267,6 +267,7 @@ "Test_TC_G_1_1", "Test_TC_G_2_1" ], + "Scenes": ["Test_TC_S_1_1"], "collection": [ "AccessControl", "AccessControlEnforcement", diff --git a/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml b/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml index 3ee77549dae7dd..d93f1f47dadc0e 100644 --- a/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml +++ b/src/app/zap-templates/zcl/data-model/chip/time-synchronization-cluster.xml @@ -17,39 +17,74 @@ limitations under the License. + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -58,7 +93,7 @@ limitations under the License. - + @@ -68,42 +103,81 @@ limitations under the License. TIME_SYNCHRONIZATION_CLUSTER true true - Accurate time is required for a number of reasons, including scheduling, display and validating -security materials. + Accurate time is required for a number of reasons, including scheduling, display and validating security materials. UTCTime Granularity TimeSource - - TrustedTimeNodeId - - - - - DefaultNtp - - - - - TimeZone - - - - - DSTOffset - - - - LocalTime - TimeZoneDatabase - NtpServerPort - - - - Upon receipt of this command, the server MAY update its UTCTime Attribute to match the time specified in the command - - - - + TrustedTimeSource + DefaultNTP + TimeZone + DSTOffset + LocalTime + TimeZoneDatabase + NTPServerAvailable + TimeZoneListMaxSize + DSTOffsetListMaxSize + SupportsDNSResolve + + + This command MAY be issued by Administrator to set the time. + + + + + + + + This command SHALL set TrustedTimeSource. + + + + + + This command SHALL set TimeZone. + + + + + + Response to SetTimeZone. + + + + + This command SHALL set DSTOffset. + + + + + + This command is used to set DefaultNTP. + + + + + + This event SHALL be generated when the server stops applying the current DSTOffset and there are no entries in the list with a larger ValidStarting time. + + + + This event SHALL be generated when the server starts or stops applying a DST offset. + + + + + This event SHALL be generated when the server changes its time zone offset or name. + + + + + + This event SHALL be generated if the node has attempted to update its time, but was unable to find a good time from any source. + + + + This event SHALL be generated if the node attempts to update its time and finds that the TrustedTimeSource is null, or the specified peer cannot be reached. + + diff --git a/src/app/zap-templates/zcl/zcl-with-test-extensions.json b/src/app/zap-templates/zcl/zcl-with-test-extensions.json index 8399e4a3dfe139..04d2ded871b659 100644 --- a/src/app/zap-templates/zcl/zcl-with-test-extensions.json +++ b/src/app/zap-templates/zcl/zcl-with-test-extensions.json @@ -275,7 +275,15 @@ "Channel": ["Lineup", "CurrentChannel"], "Media Playback": ["SampledPosition"], "Application Launcher": ["CurrentApp"], - "Application Basic": ["Application"] + "Application Basic": ["Application"], + "Time Synchronization": [ + "TrustedTimeSource", + "DefaultNTP", + "TimeZone", + "DSTOffset", + "UTCTime", + "LocalTime" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/app/zap-templates/zcl/zcl.json b/src/app/zap-templates/zcl/zcl.json index f63ef856fce8ac..e59bac13b6f81a 100644 --- a/src/app/zap-templates/zcl/zcl.json +++ b/src/app/zap-templates/zcl/zcl.json @@ -273,7 +273,15 @@ "Channel": ["Lineup", "CurrentChannel"], "Media Playback": ["SampledPosition"], "Application Launcher": ["CurrentApp"], - "Application Basic": ["Application"] + "Application Basic": ["Application"], + "Time Synchronization": [ + "TrustedTimeSource", + "DefaultNTP", + "TimeZone", + "DSTOffset", + "UTCTime", + "LocalTime" + ] }, "defaultReportingPolicy": "mandatory", "ZCLDataTypes": ["ARRAY", "BITMAP", "ENUM", "NUMBER", "STRING", "STRUCT"], diff --git a/src/controller/CHIPDeviceController.cpp b/src/controller/CHIPDeviceController.cpp index 2ae83b320839db..e483a83b140d06 100644 --- a/src/controller/CHIPDeviceController.cpp +++ b/src/controller/CHIPDeviceController.cpp @@ -792,6 +792,13 @@ void DeviceCommissioner::OnDiscoveredDeviceOverBleError(void * appState, CHIP_ER { self->ReleaseCommissioneeDevice(device); self->mRendezvousParametersForDeviceDiscoveredOverBle = RendezvousParameters(); + + // Callback is required when BLE discovery fails, otherwise the caller will always be in a suspended state + // A better way to handle it should define a new error code + if (self->mPairingDelegate != nullptr) + { + self->mPairingDelegate->OnPairingComplete(err); + } } } #endif // CONFIG_NETWORK_LAYER_BLE diff --git a/src/controller/CHIPDeviceControllerFactory.cpp b/src/controller/CHIPDeviceControllerFactory.cpp index 100801c7db9566..6ae3b72464ddd1 100644 --- a/src/controller/CHIPDeviceControllerFactory.cpp +++ b/src/controller/CHIPDeviceControllerFactory.cpp @@ -249,12 +249,13 @@ CHIP_ERROR DeviceControllerFactory::InitSystemState(FactoryInitParams params) stateParams.caseClientPool = Platform::New(); CASEClientInitParams sessionInitParams = { - .sessionManager = stateParams.sessionMgr, - .sessionResumptionStorage = stateParams.sessionResumptionStorage.get(), - .exchangeMgr = stateParams.exchangeMgr, - .fabricTable = stateParams.fabricTable, - .groupDataProvider = stateParams.groupDataProvider, - .mrpLocalConfig = GetLocalMRPConfig(), + .sessionManager = stateParams.sessionMgr, + .sessionResumptionStorage = stateParams.sessionResumptionStorage.get(), + .certificateValidityPolicy = stateParams.certificateValidityPolicy, + .exchangeMgr = stateParams.exchangeMgr, + .fabricTable = stateParams.fabricTable, + .groupDataProvider = stateParams.groupDataProvider, + .mrpLocalConfig = GetLocalMRPConfig(), }; CASESessionManagerConfig sessionManagerConfig = { diff --git a/src/controller/ExamplePersistentStorage.cpp b/src/controller/ExamplePersistentStorage.cpp index e4b8188780b816..b98b682141b244 100644 --- a/src/controller/ExamplePersistentStorage.cpp +++ b/src/controller/ExamplePersistentStorage.cpp @@ -39,37 +39,43 @@ constexpr const char kLocalNodeIdKey[] = "LocalNodeId"; constexpr const char kCommissionerCATsKey[] = "CommissionerCATs"; constexpr LogCategory kDefaultLoggingLevel = kLogCategory_Automation; -std::string GetFilename(const char * name) +std::string GetFilename(const char * directory, const char * name) { - const char * tmpdir = getenv("TMPDIR"); + const char * dir = directory; - if (tmpdir == nullptr) + if (dir == nullptr) { - tmpdir = "/tmp"; + dir = getenv("TMPDIR"); + } + + if (dir == nullptr) + { + dir = "/tmp"; } if (name == nullptr) { - return std::string(tmpdir) + "/chip_tool_config.ini"; + return std::string(dir) + "/chip_tool_config.ini"; } - return std::string(tmpdir) + "/chip_tool_config." + std::string(name) + ".ini"; + return std::string(dir) + "/chip_tool_config." + std::string(name) + ".ini"; } -CHIP_ERROR PersistentStorage::Init(const char * name) +CHIP_ERROR PersistentStorage::Init(const char * name, const char * directory) { CHIP_ERROR err = CHIP_NO_ERROR; std::ifstream ifs; - ifs.open(GetFilename(name), std::ifstream::in); + ifs.open(GetFilename(directory, name), std::ifstream::in); if (!ifs.good()) { - CommitConfig(name); - ifs.open(GetFilename(name), std::ifstream::in); + CommitConfig(directory, name); + ifs.open(GetFilename(directory, name), std::ifstream::in); } VerifyOrExit(ifs.is_open(), err = CHIP_ERROR_OPEN_FAILED); - mName = name; + mName = name; + mDirectory = directory; mConfig.parse(ifs); ifs.close(); @@ -125,7 +131,7 @@ CHIP_ERROR PersistentStorage::SyncSetKeyValue(const char * key, const void * val } mConfig.sections[kDefaultSectionName] = section; - return CommitConfig(mName); + return CommitConfig(mDirectory, mName); } CHIP_ERROR PersistentStorage::SyncDeleteKeyValue(const char * key) @@ -138,7 +144,7 @@ CHIP_ERROR PersistentStorage::SyncDeleteKeyValue(const char * key) section.erase(escapedKey); mConfig.sections[kDefaultSectionName] = section; - return CommitConfig(mName); + return CommitConfig(mDirectory, mName); } bool PersistentStorage::SyncDoesKeyExist(const char * key) @@ -173,15 +179,15 @@ CHIP_ERROR PersistentStorage::SyncClearAll() auto section = mConfig.sections[kDefaultSectionName]; section.clear(); mConfig.sections[kDefaultSectionName] = section; - return CommitConfig(mName); + return CommitConfig(mDirectory, mName); } -CHIP_ERROR PersistentStorage::CommitConfig(const char * name) +CHIP_ERROR PersistentStorage::CommitConfig(const char * directory, const char * name) { CHIP_ERROR err = CHIP_NO_ERROR; std::ofstream ofs; - std::string tmpPath = GetFilename(name) + ".tmp"; + std::string tmpPath = GetFilename(directory, name) + ".tmp"; ofs.open(tmpPath, std::ofstream::out | std::ofstream::trunc); VerifyOrExit(ofs.good(), err = CHIP_ERROR_WRITE_FAILED); @@ -189,7 +195,7 @@ CHIP_ERROR PersistentStorage::CommitConfig(const char * name) ofs.close(); VerifyOrExit(ofs.good(), err = CHIP_ERROR_WRITE_FAILED); - VerifyOrExit(rename(tmpPath.c_str(), GetFilename(name).c_str()) == 0, err = CHIP_ERROR_WRITE_FAILED); + VerifyOrExit(rename(tmpPath.c_str(), GetFilename(directory, name).c_str()) == 0, err = CHIP_ERROR_WRITE_FAILED); exit: return err; diff --git a/src/controller/ExamplePersistentStorage.h b/src/controller/ExamplePersistentStorage.h index f2afde99355bf7..9323c1de501b04 100644 --- a/src/controller/ExamplePersistentStorage.h +++ b/src/controller/ExamplePersistentStorage.h @@ -26,7 +26,18 @@ class PersistentStorage : public chip::PersistentStorageDelegate { public: - CHIP_ERROR Init(const char * name = nullptr); + /** + * name is the name of the storage to use. If null, defaults to + * "chip_tool_config.ini". + * + * directory is the directory the storage file should be placed in. If + * null, falls back to getenv("TMPDIR") and if that is not set falls back + * to /tmp. + * + * If non-null values are provided, the memory they point to is expected to + * outlive this object. + */ + CHIP_ERROR Init(const char * name = nullptr, const char * directory = nullptr); /////////// PersistentStorageDelegate Interface ///////// CHIP_ERROR SyncGetKeyValue(const char * key, void * buffer, uint16_t & size) override; @@ -55,7 +66,8 @@ class PersistentStorage : public chip::PersistentStorageDelegate CHIP_ERROR SyncClearAll(); private: - CHIP_ERROR CommitConfig(const char * name); + CHIP_ERROR CommitConfig(const char * directory, const char * name); inipp::Ini mConfig; const char * mName; + const char * mDirectory; }; diff --git a/src/controller/python/chip/ble/LinuxImpl.cpp b/src/controller/python/chip/ble/LinuxImpl.cpp index 2aa869ed1a530f..41e589e3c62944 100644 --- a/src/controller/python/chip/ble/LinuxImpl.cpp +++ b/src/controller/python/chip/ble/LinuxImpl.cpp @@ -130,7 +130,11 @@ extern "C" void * pychip_ble_start_scanning(PyObject * context, void * adapter, return nullptr; } - if (scanner->StartScan(chip::System::Clock::Milliseconds32(timeoutMs)) != CHIP_NO_ERROR) + CHIP_ERROR err = CHIP_NO_ERROR; + chip::DeviceLayer::PlatformMgr().LockChipStack(); + err = scanner->StartScan(chip::System::Clock::Milliseconds32(timeoutMs)); + chip::DeviceLayer::PlatformMgr().UnlockChipStack(); + if (err != CHIP_NO_ERROR) { return nullptr; } diff --git a/src/controller/python/chip/clusters/Objects.py b/src/controller/python/chip/clusters/Objects.py index fba181de8c0289..d85ce20a52b52c 100644 --- a/src/controller/python/chip/clusters/Objects.py +++ b/src/controller/python/chip/clusters/Objects.py @@ -11035,13 +11035,16 @@ def descriptor(cls) -> ClusterObjectDescriptor: ClusterObjectFieldDescriptor(Label="UTCTime", Tag=0x00000000, Type=typing.Union[Nullable, uint]), ClusterObjectFieldDescriptor(Label="granularity", Tag=0x00000001, Type=TimeSynchronization.Enums.GranularityEnum), ClusterObjectFieldDescriptor(Label="timeSource", Tag=0x00000002, Type=typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]), - ClusterObjectFieldDescriptor(Label="trustedTimeNodeId", Tag=0x00000003, Type=typing.Union[Nullable, uint]), - ClusterObjectFieldDescriptor(Label="defaultNtp", Tag=0x00000004, Type=typing.Union[None, Nullable, str]), + ClusterObjectFieldDescriptor(Label="trustedTimeSource", Tag=0x00000003, Type=typing.Union[None, Nullable, TimeSynchronization.Structs.TrustedTimeSourceStruct]), + ClusterObjectFieldDescriptor(Label="defaultNTP", Tag=0x00000004, Type=typing.Union[None, Nullable, str]), ClusterObjectFieldDescriptor(Label="timeZone", Tag=0x00000005, Type=typing.Optional[typing.List[TimeSynchronization.Structs.TimeZoneStruct]]), ClusterObjectFieldDescriptor(Label="DSTOffset", Tag=0x00000006, Type=typing.Optional[typing.List[TimeSynchronization.Structs.DSTOffsetStruct]]), ClusterObjectFieldDescriptor(Label="localTime", Tag=0x00000007, Type=typing.Union[None, Nullable, uint]), - ClusterObjectFieldDescriptor(Label="timeZoneDatabase", Tag=0x00000008, Type=typing.Optional[bool]), - ClusterObjectFieldDescriptor(Label="ntpServerPort", Tag=0x00000009, Type=typing.Union[None, Nullable, uint]), + ClusterObjectFieldDescriptor(Label="timeZoneDatabase", Tag=0x00000008, Type=typing.Optional[TimeSynchronization.Enums.TimeZoneDatabaseEnum]), + ClusterObjectFieldDescriptor(Label="NTPServerAvailable", Tag=0x00000009, Type=typing.Optional[bool]), + ClusterObjectFieldDescriptor(Label="timeZoneListMaxSize", Tag=0x0000000A, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="DSTOffsetListMaxSize", Tag=0x0000000B, Type=typing.Optional[uint]), + ClusterObjectFieldDescriptor(Label="supportsDNSResolve", Tag=0x0000000C, Type=typing.Optional[bool]), ClusterObjectFieldDescriptor(Label="generatedCommandList", Tag=0x0000FFF8, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="acceptedCommandList", Tag=0x0000FFF9, Type=typing.List[uint]), ClusterObjectFieldDescriptor(Label="eventList", Tag=0x0000FFFA, Type=typing.List[uint]), @@ -11053,13 +11056,16 @@ def descriptor(cls) -> ClusterObjectDescriptor: UTCTime: 'typing.Union[Nullable, uint]' = None granularity: 'TimeSynchronization.Enums.GranularityEnum' = None timeSource: 'typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]' = None - trustedTimeNodeId: 'typing.Union[Nullable, uint]' = None - defaultNtp: 'typing.Union[None, Nullable, str]' = None + trustedTimeSource: 'typing.Union[None, Nullable, TimeSynchronization.Structs.TrustedTimeSourceStruct]' = None + defaultNTP: 'typing.Union[None, Nullable, str]' = None timeZone: 'typing.Optional[typing.List[TimeSynchronization.Structs.TimeZoneStruct]]' = None DSTOffset: 'typing.Optional[typing.List[TimeSynchronization.Structs.DSTOffsetStruct]]' = None localTime: 'typing.Union[None, Nullable, uint]' = None - timeZoneDatabase: 'typing.Optional[bool]' = None - ntpServerPort: 'typing.Union[None, Nullable, uint]' = None + timeZoneDatabase: 'typing.Optional[TimeSynchronization.Enums.TimeZoneDatabaseEnum]' = None + NTPServerAvailable: 'typing.Optional[bool]' = None + timeZoneListMaxSize: 'typing.Optional[uint]' = None + DSTOffsetListMaxSize: 'typing.Optional[uint]' = None + supportsDNSResolve: 'typing.Optional[bool]' = None generatedCommandList: 'typing.List[uint]' = None acceptedCommandList: 'typing.List[uint]' = None eventList: 'typing.List[uint]' = None @@ -11080,21 +11086,29 @@ class GranularityEnum(MatterIntEnum): # enum value. This specific should never be transmitted. kUnknownEnumValue = 5, + class StatusCode(MatterIntEnum): + kTimeNotAccepted = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 0, + class TimeSourceEnum(MatterIntEnum): kNone = 0x00 kUnknown = 0x01 kAdmin = 0x02 kNodeTimeCluster = 0x03 - kNonFabricSntp = 0x04 - kNonFabricNtp = 0x05 - kFabricSntp = 0x06 - kFabricNtp = 0x07 - kMixedNtp = 0x08 - kNonFabricSntpNts = 0x09 - kNonFabricNtpNts = 0x0A - kFabricSntpNts = 0x0B - kFabricNtpNts = 0x0C - kMixedNtpNts = 0x0D + kNonMatterSNTP = 0x04 + kNonMatterNTP = 0x05 + kMatterSNTP = 0x06 + kMatterNTP = 0x07 + kMixedNTP = 0x08 + kNonMatterSNTPNTS = 0x09 + kNonMatterNTPNTS = 0x0A + kMatterSNTPNTS = 0x0B + kMatterNTPNTS = 0x0C + kMixedNTPNTS = 0x0D kCloudSource = 0x0E kPtp = 0x0F kGnss = 0x10 @@ -11104,6 +11118,23 @@ class TimeSourceEnum(MatterIntEnum): # enum value. This specific should never be transmitted. kUnknownEnumValue = 17, + class TimeZoneDatabaseEnum(MatterIntEnum): + kFull = 0x00 + kPartial = 0x01 + kNone = 0x02 + # All received enum values that are not listed above will be mapped + # to kUnknownEnumValue. This is a helper enum value that should only + # be used by code to process how it handles receiving and unknown + # enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, + + class Bitmaps: + class TimeSynchronizationFeature(IntFlag): + kTimeZone = 0x1 + kNTPClient = 0x2 + kNTPServer = 0x4 + kTimeSyncClient = 0x8 + class Structs: @dataclass class DSTOffsetStruct(ClusterObject): @@ -11113,12 +11144,25 @@ def descriptor(cls) -> ClusterObjectDescriptor: Fields=[ ClusterObjectFieldDescriptor(Label="offset", Tag=0, Type=int), ClusterObjectFieldDescriptor(Label="validStarting", Tag=1, Type=uint), - ClusterObjectFieldDescriptor(Label="validUntil", Tag=2, Type=uint), + ClusterObjectFieldDescriptor(Label="validUntil", Tag=2, Type=typing.Union[Nullable, uint]), ]) offset: 'int' = 0 validStarting: 'uint' = 0 - validUntil: 'uint' = 0 + validUntil: 'typing.Union[Nullable, uint]' = NullValue + + @dataclass + class FabricScopedTrustedTimeSourceStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="nodeID", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="endpoint", Tag=1, Type=uint), + ]) + + nodeID: 'uint' = 0 + endpoint: 'uint' = 0 @dataclass class TimeZoneStruct(ClusterObject): @@ -11135,9 +11179,24 @@ def descriptor(cls) -> ClusterObjectDescriptor: validAt: 'uint' = 0 name: 'typing.Optional[str]' = None + @dataclass + class TrustedTimeSourceStruct(ClusterObject): + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="fabricIndex", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="nodeID", Tag=1, Type=uint), + ClusterObjectFieldDescriptor(Label="endpoint", Tag=2, Type=uint), + ]) + + fabricIndex: 'uint' = 0 + nodeID: 'uint' = 0 + endpoint: 'uint' = 0 + class Commands: @dataclass - class SetUtcTime(ClusterCommand): + class SetUTCTime(ClusterCommand): cluster_id: typing.ClassVar[int] = 0x0038 command_id: typing.ClassVar[int] = 0x00000000 is_client: typing.ClassVar[bool] = True @@ -11147,15 +11206,95 @@ class SetUtcTime(ClusterCommand): def descriptor(cls) -> ClusterObjectDescriptor: return ClusterObjectDescriptor( Fields=[ - ClusterObjectFieldDescriptor(Label="utcTime", Tag=0, Type=uint), + ClusterObjectFieldDescriptor(Label="UTCTime", Tag=0, Type=uint), ClusterObjectFieldDescriptor(Label="granularity", Tag=1, Type=TimeSynchronization.Enums.GranularityEnum), ClusterObjectFieldDescriptor(Label="timeSource", Tag=2, Type=typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]), ]) - utcTime: 'uint' = 0 + UTCTime: 'uint' = 0 granularity: 'TimeSynchronization.Enums.GranularityEnum' = 0 timeSource: 'typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]' = None + @dataclass + class SetTrustedTimeSource(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0038 + command_id: typing.ClassVar[int] = 0x00000001 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="trustedTimeSource", Tag=0, Type=typing.Union[Nullable, TimeSynchronization.Structs.FabricScopedTrustedTimeSourceStruct]), + ]) + + trustedTimeSource: 'typing.Union[Nullable, TimeSynchronization.Structs.FabricScopedTrustedTimeSourceStruct]' = NullValue + + @dataclass + class SetTimeZone(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0038 + command_id: typing.ClassVar[int] = 0x00000002 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = 'SetTimeZoneResponse' + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="timeZone", Tag=0, Type=typing.List[TimeSynchronization.Structs.TimeZoneStruct]), + ]) + + timeZone: 'typing.List[TimeSynchronization.Structs.TimeZoneStruct]' = field(default_factory=lambda: []) + + @dataclass + class SetTimeZoneResponse(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0038 + command_id: typing.ClassVar[int] = 0x00000003 + is_client: typing.ClassVar[bool] = False + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="DSTOffsetRequired", Tag=0, Type=bool), + ]) + + DSTOffsetRequired: 'bool' = False + + @dataclass + class SetDSTOffset(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0038 + command_id: typing.ClassVar[int] = 0x00000004 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="DSTOffset", Tag=0, Type=typing.List[TimeSynchronization.Structs.DSTOffsetStruct]), + ]) + + DSTOffset: 'typing.List[TimeSynchronization.Structs.DSTOffsetStruct]' = field(default_factory=lambda: []) + + @dataclass + class SetDefaultNTP(ClusterCommand): + cluster_id: typing.ClassVar[int] = 0x0038 + command_id: typing.ClassVar[int] = 0x00000005 + is_client: typing.ClassVar[bool] = True + response_type: typing.ClassVar[str] = None + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="defaultNTP", Tag=0, Type=typing.Union[Nullable, str]), + ]) + + defaultNTP: 'typing.Union[Nullable, str]' = NullValue + class Attributes: @dataclass class UTCTime(ClusterAttributeDescriptor): @@ -11206,7 +11345,7 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[TimeSynchronization.Enums.TimeSourceEnum]' = None @dataclass - class TrustedTimeNodeId(ClusterAttributeDescriptor): + class TrustedTimeSource(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0038 @@ -11217,12 +11356,12 @@ def attribute_id(cls) -> int: @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[Nullable, uint]) + return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, TimeSynchronization.Structs.TrustedTimeSourceStruct]) - value: 'typing.Union[Nullable, uint]' = NullValue + value: 'typing.Union[None, Nullable, TimeSynchronization.Structs.TrustedTimeSourceStruct]' = None @dataclass - class DefaultNtp(ClusterAttributeDescriptor): + class DefaultNTP(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0038 @@ -11295,6 +11434,22 @@ def cluster_id(cls) -> int: def attribute_id(cls) -> int: return 0x00000008 + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[TimeSynchronization.Enums.TimeZoneDatabaseEnum]) + + value: 'typing.Optional[TimeSynchronization.Enums.TimeZoneDatabaseEnum]' = None + + @dataclass + class NTPServerAvailable(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x00000009 + @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) @@ -11302,20 +11457,52 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'typing.Optional[bool]' = None @dataclass - class NtpServerPort(ClusterAttributeDescriptor): + class TimeZoneListMaxSize(ClusterAttributeDescriptor): @ChipUtility.classproperty def cluster_id(cls) -> int: return 0x0038 @ChipUtility.classproperty def attribute_id(cls) -> int: - return 0x00000009 + return 0x0000000A @ChipUtility.classproperty def attribute_type(cls) -> ClusterObjectFieldDescriptor: - return ClusterObjectFieldDescriptor(Type=typing.Union[None, Nullable, uint]) + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) - value: 'typing.Union[None, Nullable, uint]' = None + value: 'typing.Optional[uint]' = None + + @dataclass + class DSTOffsetListMaxSize(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000B + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[uint]) + + value: 'typing.Optional[uint]' = None + + @dataclass + class SupportsDNSResolve(ClusterAttributeDescriptor): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def attribute_id(cls) -> int: + return 0x0000000C + + @ChipUtility.classproperty + def attribute_type(cls) -> ClusterObjectFieldDescriptor: + return ClusterObjectFieldDescriptor(Type=typing.Optional[bool]) + + value: 'typing.Optional[bool]' = None @dataclass class GeneratedCommandList(ClusterAttributeDescriptor): @@ -11413,6 +11600,95 @@ def attribute_type(cls) -> ClusterObjectFieldDescriptor: value: 'uint' = 0 + class Events: + @dataclass + class DSTTableEmpty(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000000 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class DSTStatus(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000001 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="DSTOffsetActive", Tag=0, Type=bool), + ]) + + DSTOffsetActive: 'bool' = False + + @dataclass + class TimeZoneStatus(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000002 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ClusterObjectFieldDescriptor(Label="offset", Tag=0, Type=int), + ClusterObjectFieldDescriptor(Label="name", Tag=1, Type=typing.Optional[str]), + ]) + + offset: 'int' = 0 + name: 'typing.Optional[str]' = None + + @dataclass + class TimeFailure(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000003 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + + @dataclass + class MissingTrustedTimeSource(ClusterEvent): + @ChipUtility.classproperty + def cluster_id(cls) -> int: + return 0x0038 + + @ChipUtility.classproperty + def event_id(cls) -> int: + return 0x00000004 + + @ChipUtility.classproperty + def descriptor(cls) -> ClusterObjectDescriptor: + return ClusterObjectDescriptor( + Fields=[ + ]) + @dataclass class BridgedDeviceBasicInformation(Cluster): diff --git a/src/credentials/CHIPCert.cpp b/src/credentials/CHIPCert.cpp index 6c1c2012d32d6d..0c5b58d2ca1c84 100644 --- a/src/credentials/CHIPCert.cpp +++ b/src/credentials/CHIPCert.cpp @@ -1123,7 +1123,7 @@ DLL_EXPORT CHIP_ERROR ChipEpochToASN1Time(uint32_t epochTime, chip::ASN1::ASN1Un // times, which in consuming code can create a conversion from CHIP epoch 0 seconds to 99991231235959Z // for NotBefore, which is not conventional. // - // If an original X509 certificate encloses a NotBefore time that this the CHIP Epoch itself, 2000-01-01 + // If an original X509 certificate encloses a NotBefore time that is the CHIP Epoch itself, 2000-01-01 // 00:00:00, the resultant X509 certificate in a conversion back from CHIP TLV format using this time // conversion method will instead enclose the NotBefore time 99991231235959Z, which will invalidiate the // TBS signature. Thus, certificates with this specific attribute are not usable with this code. diff --git a/src/credentials/CertificateValidityPolicy.h b/src/credentials/CertificateValidityPolicy.h index 121647d1b94226..58552af728a047 100644 --- a/src/credentials/CertificateValidityPolicy.h +++ b/src/credentials/CertificateValidityPolicy.h @@ -60,5 +60,39 @@ class CertificateValidityPolicy static CHIP_ERROR ApplyDefaultPolicy(const ChipCertificateData * cert, uint8_t depth, CertificateValidityResult result); }; +class IgnoreCertificateValidityPeriodPolicy : public CertificateValidityPolicy +{ +public: + IgnoreCertificateValidityPeriodPolicy() {} + + /** + * This certificate validity policy does not validate NotBefore or + * NotAfter to accommodate platforms that may have wall clock time, but + * where it is unreliable. + * + * Last Known Good Time is also not considered in this policy. + * + * @param cert CHIP Certificate for which we are evaluating validity + * @param depth the depth of the certificate in the chain, where the leaf is at depth 0 + * @return CHIP_NO_ERROR if CHIPCert should accept the certificate; an appropriate CHIP_ERROR if it should be rejected + */ + CHIP_ERROR ApplyCertificateValidityPolicy(const Credentials::ChipCertificateData * cert, uint8_t depth, + Credentials::CertificateValidityResult result) override + { + switch (result) + { + case Credentials::CertificateValidityResult::kValid: + case Credentials::CertificateValidityResult::kNotYetValid: + case Credentials::CertificateValidityResult::kExpired: + case Credentials::CertificateValidityResult::kNotExpiredAtLastKnownGoodTime: + case Credentials::CertificateValidityResult::kExpiredAtLastKnownGoodTime: + case Credentials::CertificateValidityResult::kTimeUnknown: + return CHIP_NO_ERROR; + default: + return CHIP_ERROR_INVALID_ARGUMENT; + } + } +}; + } // namespace Credentials } // namespace chip diff --git a/src/credentials/GenerateChipX509Cert.cpp b/src/credentials/GenerateChipX509Cert.cpp index b51c49e0174f22..12aacab9bf87fb 100644 --- a/src/credentials/GenerateChipX509Cert.cpp +++ b/src/credentials/GenerateChipX509Cert.cpp @@ -330,7 +330,8 @@ CHIP_ERROR EncodeTBSCert(const X509CertRequestParams & requestParams, const Cryp bool isCA; VerifyOrReturnError(requestParams.SerialNumber >= 0, CHIP_ERROR_INVALID_ARGUMENT); - VerifyOrReturnError(requestParams.ValidityEnd >= requestParams.ValidityStart, CHIP_ERROR_INVALID_ARGUMENT); + VerifyOrReturnError(requestParams.ValidityEnd == kNullCertTime || requestParams.ValidityEnd >= requestParams.ValidityStart, + CHIP_ERROR_INVALID_ARGUMENT); ReturnErrorOnFailure(requestParams.SubjectDN.GetCertType(certType)); isCA = (certType == kCertType_ICA || certType == kCertType_Root); diff --git a/src/credentials/tests/CHIPCert_test_vectors.cpp b/src/credentials/tests/CHIPCert_test_vectors.cpp index 565e1cfdaf51ce..314c13e6f8063e 100644 --- a/src/credentials/tests/CHIPCert_test_vectors.cpp +++ b/src/credentials/tests/CHIPCert_test_vectors.cpp @@ -35,6 +35,7 @@ namespace TestCerts { extern const uint8_t gTestCerts[] = { TestCert::kRoot01, TestCert::kRoot02, + TestCert::kRoot03, TestCert::kICA01, TestCert::kICA02, TestCert::kICA01_1, @@ -78,6 +79,7 @@ CHIP_ERROR GetTestCert(uint8_t certType, BitFlags certLoadFla SELECT_CERT(Root01); SELECT_CERT(Root02); + SELECT_CERT(Root03); SELECT_CERT(ICA01); SELECT_CERT(ICA02); SELECT_CERT(ICA01_1); @@ -114,6 +116,7 @@ const char * GetTestCertName(uint8_t certType) NAME_CERT(Root01); NAME_CERT(Root02); + NAME_CERT(Root03); NAME_CERT(ICA01); NAME_CERT(ICA02); NAME_CERT(ICA01_1); @@ -150,6 +153,7 @@ CHIP_ERROR GetTestCertPubkey(uint8_t certType, ByteSpan & pubkey) SELECT_PUBKEY(Root01); SELECT_PUBKEY(Root02); + SELECT_PUBKEY(Root03); SELECT_PUBKEY(ICA01); SELECT_PUBKEY(ICA02); SELECT_PUBKEY(ICA01_1); @@ -189,6 +193,7 @@ CHIP_ERROR GetTestCertSKID(uint8_t certType, ByteSpan & skid) SELECT_SKID(Root01); SELECT_SKID(Root02); + SELECT_SKID(Root03); SELECT_SKID(ICA01); SELECT_SKID(ICA02); SELECT_SKID(ICA01_1); @@ -228,6 +233,7 @@ CHIP_ERROR GetTestCertAKID(uint8_t certType, ByteSpan & akid) SELECT_AKID(Root01); SELECT_AKID(Root02); + SELECT_AKID(Root03); SELECT_AKID(ICA01); SELECT_AKID(ICA02); SELECT_AKID(ICA01_1); @@ -557,6 +563,140 @@ extern const uint8_t sTestCert_Root02_AuthorityKeyId[] = { extern const size_t sTestCert_Root02_AuthorityKeyId_Len = sizeof(sTestCert_Root02_AuthorityKeyId); +/************** Test Root03 Certificate ************** +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 7744074172075392897 (0x6b787a6dfcd4bf81) + Signature Algorithm: ecdsa-with-SHA256 + Issuer: 1.3.6.1.4.1.37244.1.4 = CACACACA00000002, 1.3.6.1.4.1.37244.1.5 = FAB000000000001D + Validity + Not Before: Oct 15 14:23:43 2020 GMT + Not After : Dec 31 23:59:59 9999 GMT + Subject: 1.3.6.1.4.1.37244.1.4 = CACACACA00000002, 1.3.6.1.4.1.37244.1.5 = FAB000000000001D + Subject Public Key Info: + Public Key Algorithm: id-ecPublicKey + Public-Key: (256 bit) + pub: + 04:71:05:40:8a:85:a9:d9:a0:8a:f8:b7:70:77:db: + 38:8b:7e:a4:38:97:dc:df:d3:16:f2:4f:0a:7e:71: + de:69:a5:0c:44:55:0c:0c:9d:a2:36:1c:d8:29:e5: + 5f:dd:63:cc:f5:79:ed:44:e0:22:08:b4:f8:25:fc: + d6:f0:68:2c:02 + ASN1 OID: prime256v1 + NIST CURVE: P-256 + X509v3 extensions: + X509v3 Basic Constraints: critical + CA:TRUE, pathlen:1 + X509v3 Key Usage: critical + Certificate Sign, CRL Sign + X509v3 Subject Key Identifier: + FF:87:F3:CD:D2:06:9A:EF:8D:5D:32:EB:A3:16:3B:9E:B0:0A:00:29 + X509v3 Authority Key Identifier: + keyid:FF:87:F3:CD:D2:06:9A:EF:8D:5D:32:EB:A3:16:3B:9E:B0:0A:00:29 + + Signature Algorithm: ecdsa-with-SHA256 + 30:44:02:20:75:f6:70:eb:35:45:b9:97:86:46:67:99:eb:ea: + 40:51:a3:41:af:2a:9b:67:7f:d7:1b:4c:3d:4e:68:09:3b:66: + 02:20:5f:28:42:cb:7e:d3:19:9c:9a:d7:c9:62:79:47:a1:8a: + 92:16:8a:fc:d6:5f:3e:9c:af:6e:ed:fa:9e:60:c5:2f + +-----BEGIN CERTIFICATE----- +MIIB5TCCAYygAwIBAgIIa3h6bfzUv4EwCgYIKoZIzj0EAwIwRDEgMB4GCisGAQQB +gqJ8AQQMEENBQ0FDQUNBMDAwMDAwMDIxIDAeBgorBgEEAYKifAEFDBBGQUIwMDAw +MDAwMDAwMDFEMCAXDTIwMTAxNTE0MjM0M1oYDzk5OTkxMjMxMjM1OTU5WjBEMSAw +HgYKKwYBBAGConwBBAwQQ0FDQUNBQ0EwMDAwMDAwMjEgMB4GCisGAQQBgqJ8AQUM +EEZBQjAwMDAwMDAwMDAwMUQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARxBUCK +hanZoIr4t3B32ziLfqQ4l9zf0xbyTwp+cd5ppQxEVQwMnaI2HNgp5V/dY8z1ee1E +4CIItPgl/NbwaCwCo2YwZDASBgNVHRMBAf8ECDAGAQH/AgEBMA4GA1UdDwEB/wQE +AwIBBjAdBgNVHQ4EFgQU/4fzzdIGmu+NXTLroxY7nrAKACkwHwYDVR0jBBgwFoAU +/4fzzdIGmu+NXTLroxY7nrAKACkwCgYIKoZIzj0EAwIDRwAwRAIgdfZw6zVFuZeG +RmeZ6+pAUaNBryqbZ3/XG0w9TmgJO2YCIF8oQst+0xmcmtfJYnlHoYqSFor81l8+ +nK9u7fqeYMUv +-----END CERTIFICATE----- + +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEIHDnbQApKIHktaW8tOzQL/XkdbwUid5uw+jWPFo/LlqHoAoGCCqGSM49 +AwEHoUQDQgAEcQVAioWp2aCK+Ldwd9s4i36kOJfc39MW8k8KfnHeaaUMRFUMDJ2i +NhzYKeVf3WPM9XntROAiCLT4JfzW8GgsAg== +-----END EC PRIVATE KEY----- +*/ + +extern const uint8_t sTestCert_Root03_Chip[] = { + 0x15, 0x30, 0x01, 0x08, 0x6b, 0x78, 0x7a, 0x6d, 0xfc, 0xd4, 0xbf, 0x81, 0x24, 0x02, 0x01, 0x37, 0x03, 0x27, 0x14, 0x02, 0x00, + 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x26, 0x04, 0xef, 0x17, + 0x1b, 0x27, 0x24, 0x05, 0x00, 0x37, 0x06, 0x27, 0x14, 0x02, 0x00, 0x00, 0x00, 0xca, 0xca, 0xca, 0xca, 0x27, 0x15, 0x1d, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xb0, 0xfa, 0x18, 0x24, 0x07, 0x01, 0x24, 0x08, 0x01, 0x30, 0x09, 0x41, 0x04, 0x71, 0x05, 0x40, 0x8a, + 0x85, 0xa9, 0xd9, 0xa0, 0x8a, 0xf8, 0xb7, 0x70, 0x77, 0xdb, 0x38, 0x8b, 0x7e, 0xa4, 0x38, 0x97, 0xdc, 0xdf, 0xd3, 0x16, 0xf2, + 0x4f, 0x0a, 0x7e, 0x71, 0xde, 0x69, 0xa5, 0x0c, 0x44, 0x55, 0x0c, 0x0c, 0x9d, 0xa2, 0x36, 0x1c, 0xd8, 0x29, 0xe5, 0x5f, 0xdd, + 0x63, 0xcc, 0xf5, 0x79, 0xed, 0x44, 0xe0, 0x22, 0x08, 0xb4, 0xf8, 0x25, 0xfc, 0xd6, 0xf0, 0x68, 0x2c, 0x02, 0x37, 0x0a, 0x35, + 0x01, 0x29, 0x01, 0x24, 0x02, 0x01, 0x18, 0x24, 0x02, 0x60, 0x30, 0x04, 0x14, 0xff, 0x87, 0xf3, 0xcd, 0xd2, 0x06, 0x9a, 0xef, + 0x8d, 0x5d, 0x32, 0xeb, 0xa3, 0x16, 0x3b, 0x9e, 0xb0, 0x0a, 0x00, 0x29, 0x30, 0x05, 0x14, 0xff, 0x87, 0xf3, 0xcd, 0xd2, 0x06, + 0x9a, 0xef, 0x8d, 0x5d, 0x32, 0xeb, 0xa3, 0x16, 0x3b, 0x9e, 0xb0, 0x0a, 0x00, 0x29, 0x18, 0x30, 0x0b, 0x40, 0x75, 0xf6, 0x70, + 0xeb, 0x35, 0x45, 0xb9, 0x97, 0x86, 0x46, 0x67, 0x99, 0xeb, 0xea, 0x40, 0x51, 0xa3, 0x41, 0xaf, 0x2a, 0x9b, 0x67, 0x7f, 0xd7, + 0x1b, 0x4c, 0x3d, 0x4e, 0x68, 0x09, 0x3b, 0x66, 0x5f, 0x28, 0x42, 0xcb, 0x7e, 0xd3, 0x19, 0x9c, 0x9a, 0xd7, 0xc9, 0x62, 0x79, + 0x47, 0xa1, 0x8a, 0x92, 0x16, 0x8a, 0xfc, 0xd6, 0x5f, 0x3e, 0x9c, 0xaf, 0x6e, 0xed, 0xfa, 0x9e, 0x60, 0xc5, 0x2f, 0x18, +}; + +extern const size_t sTestCert_Root03_Chip_Len = sizeof(sTestCert_Root03_Chip); + +extern const uint8_t sTestCert_Root03_DER[] = { + 0x30, 0x82, 0x01, 0xe5, 0x30, 0x82, 0x01, 0x8c, 0xa0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x08, 0x6b, 0x78, 0x7a, 0x6d, 0xfc, 0xd4, + 0xbf, 0x81, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, + 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, + 0x7c, 0x01, 0x05, 0x0c, 0x10, 0x46, 0x41, 0x42, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x44, + 0x30, 0x20, 0x17, 0x0d, 0x32, 0x30, 0x31, 0x30, 0x31, 0x35, 0x31, 0x34, 0x32, 0x33, 0x34, 0x33, 0x5a, 0x18, 0x0f, 0x39, 0x39, + 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5a, 0x30, 0x44, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, + 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, 0x01, 0x04, 0x0c, 0x10, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x43, 0x41, 0x30, + 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x32, 0x31, 0x20, 0x30, 0x1e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0xa2, 0x7c, + 0x01, 0x05, 0x0c, 0x10, 0x46, 0x41, 0x42, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x31, 0x44, 0x30, + 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, + 0x07, 0x03, 0x42, 0x00, 0x04, 0x71, 0x05, 0x40, 0x8a, 0x85, 0xa9, 0xd9, 0xa0, 0x8a, 0xf8, 0xb7, 0x70, 0x77, 0xdb, 0x38, 0x8b, + 0x7e, 0xa4, 0x38, 0x97, 0xdc, 0xdf, 0xd3, 0x16, 0xf2, 0x4f, 0x0a, 0x7e, 0x71, 0xde, 0x69, 0xa5, 0x0c, 0x44, 0x55, 0x0c, 0x0c, + 0x9d, 0xa2, 0x36, 0x1c, 0xd8, 0x29, 0xe5, 0x5f, 0xdd, 0x63, 0xcc, 0xf5, 0x79, 0xed, 0x44, 0xe0, 0x22, 0x08, 0xb4, 0xf8, 0x25, + 0xfc, 0xd6, 0xf0, 0x68, 0x2c, 0x02, 0xa3, 0x66, 0x30, 0x64, 0x30, 0x12, 0x06, 0x03, 0x55, 0x1d, 0x13, 0x01, 0x01, 0xff, 0x04, + 0x08, 0x30, 0x06, 0x01, 0x01, 0xff, 0x02, 0x01, 0x01, 0x30, 0x0e, 0x06, 0x03, 0x55, 0x1d, 0x0f, 0x01, 0x01, 0xff, 0x04, 0x04, + 0x03, 0x02, 0x01, 0x06, 0x30, 0x1d, 0x06, 0x03, 0x55, 0x1d, 0x0e, 0x04, 0x16, 0x04, 0x14, 0xff, 0x87, 0xf3, 0xcd, 0xd2, 0x06, + 0x9a, 0xef, 0x8d, 0x5d, 0x32, 0xeb, 0xa3, 0x16, 0x3b, 0x9e, 0xb0, 0x0a, 0x00, 0x29, 0x30, 0x1f, 0x06, 0x03, 0x55, 0x1d, 0x23, + 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0xff, 0x87, 0xf3, 0xcd, 0xd2, 0x06, 0x9a, 0xef, 0x8d, 0x5d, 0x32, 0xeb, 0xa3, 0x16, 0x3b, + 0x9e, 0xb0, 0x0a, 0x00, 0x29, 0x30, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x04, 0x03, 0x02, 0x03, 0x47, 0x00, 0x30, + 0x44, 0x02, 0x20, 0x75, 0xf6, 0x70, 0xeb, 0x35, 0x45, 0xb9, 0x97, 0x86, 0x46, 0x67, 0x99, 0xeb, 0xea, 0x40, 0x51, 0xa3, 0x41, + 0xaf, 0x2a, 0x9b, 0x67, 0x7f, 0xd7, 0x1b, 0x4c, 0x3d, 0x4e, 0x68, 0x09, 0x3b, 0x66, 0x02, 0x20, 0x5f, 0x28, 0x42, 0xcb, 0x7e, + 0xd3, 0x19, 0x9c, 0x9a, 0xd7, 0xc9, 0x62, 0x79, 0x47, 0xa1, 0x8a, 0x92, 0x16, 0x8a, 0xfc, 0xd6, 0x5f, 0x3e, 0x9c, 0xaf, 0x6e, + 0xed, 0xfa, 0x9e, 0x60, 0xc5, 0x2f, +}; + +extern const size_t sTestCert_Root03_DER_Len = sizeof(sTestCert_Root03_DER); + +extern const uint8_t sTestCert_Root03_PublicKey[] = { + 0x04, 0x71, 0x05, 0x40, 0x8a, 0x85, 0xa9, 0xd9, 0xa0, 0x8a, 0xf8, 0xb7, 0x70, 0x77, 0xdb, 0x38, 0x8b, + 0x7e, 0xa4, 0x38, 0x97, 0xdc, 0xdf, 0xd3, 0x16, 0xf2, 0x4f, 0x0a, 0x7e, 0x71, 0xde, 0x69, 0xa5, 0x0c, + 0x44, 0x55, 0x0c, 0x0c, 0x9d, 0xa2, 0x36, 0x1c, 0xd8, 0x29, 0xe5, 0x5f, 0xdd, 0x63, 0xcc, 0xf5, 0x79, + 0xed, 0x44, 0xe0, 0x22, 0x08, 0xb4, 0xf8, 0x25, 0xfc, 0xd6, 0xf0, 0x68, 0x2c, 0x02, +}; + +extern const size_t sTestCert_Root03_PublicKey_Len = sizeof(sTestCert_Root03_PublicKey); + +extern const uint8_t sTestCert_Root03_PrivateKey[] = { + 0x70, 0xe7, 0x6d, 0x00, 0x29, 0x28, 0x81, 0xe4, 0xb5, 0xa5, 0xbc, 0xb4, 0xec, 0xd0, 0x2f, 0xf5, + 0xe4, 0x75, 0xbc, 0x14, 0x89, 0xde, 0x6e, 0xc3, 0xe8, 0xd6, 0x3c, 0x5a, 0x3f, 0x2e, 0x5a, 0x87, +}; + +extern const size_t sTestCert_Root03_PrivateKey_Len = sizeof(sTestCert_Root03_PrivateKey); + +extern const uint8_t sTestCert_Root03_SubjectKeyId[] = { + 0xFF, 0x87, 0xF3, 0xCD, 0xD2, 0x06, 0x9A, 0xEF, 0x8D, 0x5D, 0x32, 0xEB, 0xA3, 0x16, 0x3B, 0x9E, 0xB0, 0x0A, 0x00, 0x29, +}; + +extern const size_t sTestCert_Root03_SubjectKeyId_Len = sizeof(sTestCert_Root03_SubjectKeyId); + +extern const uint8_t sTestCert_Root03_AuthorityKeyId[] = { + 0xFF, 0x87, 0xF3, 0xCD, 0xD2, 0x06, 0x9A, 0xEF, 0x8D, 0x5D, 0x32, 0xEB, 0xA3, 0x16, 0x3B, 0x9E, 0xB0, 0x0A, 0x00, 0x29, +}; + +extern const size_t sTestCert_Root03_AuthorityKeyId_Len = sizeof(sTestCert_Root03_AuthorityKeyId); + /************** Test ICA01 Certificate ************** Certificate: Data: diff --git a/src/credentials/tests/CHIPCert_test_vectors.h b/src/credentials/tests/CHIPCert_test_vectors.h index 30f36c8cd46455..2793fd8d5ef867 100644 --- a/src/credentials/tests/CHIPCert_test_vectors.h +++ b/src/credentials/tests/CHIPCert_test_vectors.h @@ -54,6 +54,7 @@ enum TestCert kNode02_06 = 14, kNode02_07 = 15, kNode02_08 = 16, + kRoot03 = 17, }; // Special flags to alter how certificates are fetched/loaded. @@ -106,6 +107,19 @@ extern const size_t sTestCert_Root02_SubjectKeyId_Len; extern const uint8_t sTestCert_Root02_AuthorityKeyId[]; extern const size_t sTestCert_Root02_AuthorityKeyId_Len; +extern const uint8_t sTestCert_Root03_Chip[]; +extern const size_t sTestCert_Root03_Chip_Len; +extern const uint8_t sTestCert_Root03_DER[]; +extern const size_t sTestCert_Root03_DER_Len; +extern const uint8_t sTestCert_Root03_PublicKey[]; +extern const size_t sTestCert_Root03_PublicKey_Len; +extern const uint8_t sTestCert_Root03_PrivateKey[]; +extern const size_t sTestCert_Root03_PrivateKey_Len; +extern const uint8_t sTestCert_Root03_SubjectKeyId[]; +extern const size_t sTestCert_Root03_SubjectKeyId_Len; +extern const uint8_t sTestCert_Root03_AuthorityKeyId[]; +extern const size_t sTestCert_Root03_AuthorityKeyId_Len; + extern const uint8_t sTestCert_ICA01_Chip[]; extern const size_t sTestCert_ICA01_Chip_Len; extern const uint8_t sTestCert_ICA01_DER[]; diff --git a/src/credentials/tests/TestChipCert.cpp b/src/credentials/tests/TestChipCert.cpp index 39c16f1de3260b..a29f357d274c77 100644 --- a/src/credentials/tests/TestChipCert.cpp +++ b/src/credentials/tests/TestChipCert.cpp @@ -1345,6 +1345,23 @@ static void TestChipCert_GenerateRootCert(nlTestSuite * inSuite, void * inContex NL_TEST_ASSERT(inSuite, ConvertX509CertToChipCert(signed_cert_span2, outCert) == CHIP_NO_ERROR); NL_TEST_ASSERT(inSuite, DecodeChipCert(outCert, certData) == CHIP_NO_ERROR); + // Test with no defined notAfter time. + { + X509CertRequestParams root_params3 = { .SerialNumber = 1234, + .ValidityStart = 631161876, + .ValidityEnd = kNullCertTime, + .SubjectDN = root_dn, + .IssuerDN = root_dn }; + MutableByteSpan signed_cert_span_no_expiry(signed_cert); + + NL_TEST_ASSERT(inSuite, NewRootX509Cert(root_params3, keypair, signed_cert_span_no_expiry) == CHIP_NO_ERROR); + outCert = MutableByteSpan(outCertBuf); + + NL_TEST_ASSERT(inSuite, ConvertX509CertToChipCert(signed_cert_span_no_expiry, outCert) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, DecodeChipCert(outCert, certData) == CHIP_NO_ERROR); + NL_TEST_ASSERT(inSuite, certData.mNotAfterTime == kNullCertTime); + } + // Test error case: root cert subject provided ICA OID Attribute. root_params.SubjectDN.Clear(); NL_TEST_ASSERT(inSuite, root_params.SubjectDN.AddAttribute_MatterICACId(0xabcdabcd) == CHIP_NO_ERROR); diff --git a/src/darwin/Framework/CHIP/MTRAttributeTLVValueDecoder_Internal.h b/src/darwin/Framework/CHIP/MTRAttributeTLVValueDecoder_Internal.h index 7338767d15979a..a9adc87bb76f2b 100644 --- a/src/darwin/Framework/CHIP/MTRAttributeTLVValueDecoder_Internal.h +++ b/src/darwin/Framework/CHIP/MTRAttributeTLVValueDecoder_Internal.h @@ -26,6 +26,7 @@ NS_ASSUME_NONNULL_BEGIN -id MTRDecodeAttributeValue(const chip::app::ConcreteAttributePath & aPath, chip::TLV::TLVReader & aReader, CHIP_ERROR * aError); +id _Nullable MTRDecodeAttributeValue(const chip::app::ConcreteAttributePath & aPath, chip::TLV::TLVReader & aReader, + CHIP_ERROR * aError); NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.h b/src/darwin/Framework/CHIP/MTRBaseDevice.h index 0d4fbdd1f498f2..56edeff07f2af3 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.h @@ -584,12 +584,57 @@ API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) @interface MTRAttributeReport : NSObject @property (nonatomic, readonly, copy) MTRAttributePath * path; -// value is nullable because nullable attributes can have nil as value. + +/** + * value will be nil in the following cases: + * + * * There was an error. In this case, "error" will not be nil. + * * The attribute is nullable and the value of the attribute is null. + * + * If value is not nil, the actual type of value will depend on the + * schema-defined (typically defiend in the Matter specification) type of the + * attribute as follows: + * + * * list: NSArray of whatever type the list entries are. + * * struct: The corresponding structure interface defined by Matter.framework + * * octet string: NSData + * * string: NSString + * * discrete/analog types: NSNumber + * + * Derived types (in the Matter specification sense) are represented the same as + * the base type, except for "string" (which is a derived type of "octet string" + * in the specification). + */ @property (nonatomic, readonly, copy, nullable) id value; -// If this specific path resulted in an error, the error (in the -// MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this -// path. + +/** + * If this specific path resulted in an error, the error (in the + * MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this + * path. + */ @property (nonatomic, readonly, copy, nullable) NSError * error; + +/** + * Initialize an MTRAttributeReport with a response-value dictionary of the sort + * that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * an attribute response. + * + * Will set the value property to nil and the error property to non-nil, even if + * the schema for the value is not known, if the response-value is an error, not + * data. + * + * Will return nil and hand out an error if the response-value is data in the + * following cases: + * + * * The response is for a cluster/attribute combination for which the schema is + * unknown and hence the type of the data is not known. + * * The data does not match the known schema. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_NEWLY_AVAILABLE; + @end typedef NS_ENUM(NSUInteger, MTREventTimeType) { @@ -605,22 +650,62 @@ typedef NS_ENUM(NSUInteger, MTREventPriority) { @interface MTREventReport : NSObject @property (nonatomic, readonly, copy) MTREventPath * path; + +/** + * eventNumber will only have a useful value if "error" is nil. + */ @property (nonatomic, readonly, copy) NSNumber * eventNumber; // EventNumber type (uint64_t) + +/** + * priority will only have a useful value if "error" is nil. + */ @property (nonatomic, readonly, copy) NSNumber * priority; // PriorityLevel type (MTREventPriority) -// Either systemUpTime or timestampDate will be valid depending on eventTimeType +/** + * Either systemUpTime or timestampDate will be valid depending on + * eventTimeType, if "error" is nil. If "error" is not nil, none of + * eventTimeType, systemUpTime, timestampDate should be expected to have useful + * values. + */ @property (nonatomic, readonly) MTREventTimeType eventTimeType API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); @property (nonatomic, readonly) NSTimeInterval systemUpTime API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); @property (nonatomic, readonly, copy, nullable) NSDate * timestampDate API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); -// An instance of one of the event payload interfaces. -@property (nonatomic, readonly, copy) id value; +/** + * An instance of one of the event payload interfaces, or nil if error is not + * nil (in which case there is no payload available). + */ +@property (nonatomic, readonly, copy, nullable) id value; -// If this specific path resulted in an error, the error (in the -// MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this -// path. +/** + * If this specific path resulted in an error, the error (in the + * MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this + * path. + */ @property (nonatomic, readonly, copy, nullable) NSError * error; + +/** + * Initialize an MTREventReport with a response-value dictionary of the sort + * that MTRDeviceResponseHandler would receive. + * + * Will return nil and hand out an error if the response-value dictionary is not + * an event response. + * + * Will set the value property to nil and the error property to non-nil, even if + * the schema for the value is not known, if the response-value is an error, not + * data. + * + * Will return nil and hand out an error if the response-value is data in the + * following cases: + * + * * The response is for a cluster/event combination for which the schema is + * unknown and hence the type of the data is not known. + * * The data does not match the known schema. + */ +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error MTR_NEWLY_AVAILABLE; + @end @interface MTRBaseDevice (Deprecated) diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice.mm b/src/darwin/Framework/CHIP/MTRBaseDevice.mm index f3251dbbc4db8f..d39dd74c2d2819 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice.mm +++ b/src/darwin/Framework/CHIP/MTRBaseDevice.mm @@ -25,12 +25,14 @@ #import "MTRDevice_Internal.h" #import "MTRError_Internal.h" #import "MTREventTLVValueDecoder_Internal.h" +#import "MTRFramework.h" #import "MTRLogging_Internal.h" #import "MTRSetupPayload_Internal.h" #include "app/ConcreteAttributePath.h" #include "app/ConcreteCommandPath.h" #include "app/ConcreteEventPath.h" +#include "app/StatusResponse.h" #include "lib/core/CHIPError.h" #include "lib/core/DataModelTypes.h" @@ -2161,6 +2163,12 @@ - (id)copyWithZone:(NSZone *)zone { return [MTRAttributePath attributePathWithEndpointID:self.endpoint clusterID:self.cluster attributeID:_attribute]; } + +- (ConcreteAttributePath)_asConcretePath +{ + return ConcreteAttributePath([self.endpoint unsignedShortValue], static_cast([self.cluster unsignedLongValue]), + static_cast([self.attribute unsignedLongValue])); +} @end @implementation MTRAttributePath (Deprecated) @@ -2200,6 +2208,12 @@ - (id)copyWithZone:(NSZone *)zone { return [MTREventPath eventPathWithEndpointID:self.endpoint clusterID:self.cluster eventID:_event]; } + +- (ConcreteEventPath)_asConcretePath +{ + return ConcreteEventPath([self.endpoint unsignedShortValue], static_cast([self.cluster unsignedLongValue]), + static_cast([self.event unsignedLongValue])); +} @end @implementation MTREventPath (Deprecated) @@ -2239,7 +2253,124 @@ + (instancetype)commandPathWithEndpointId:(NSNumber *)endpointId clusterId:(NSNu } @end +static void LogStringAndReturnError(NSString * errorStr, MTRErrorCode errorCode, NSError * __autoreleasing * error) +{ + MTR_LOG_ERROR("%s", errorStr.UTF8String); + if (!error) { + return; + } + + NSDictionary * userInfo = @ { NSLocalizedFailureReasonErrorKey : NSLocalizedString(errorStr, nil) }; + *error = [NSError errorWithDomain:MTRErrorDomain code:errorCode userInfo:userInfo]; +} + +static void LogStringAndReturnError(NSString * errorStr, CHIP_ERROR errorCode, NSError * __autoreleasing * error) +{ + MTR_LOG_ERROR("%s: %s", errorStr.UTF8String, errorCode.AsString()); + if (!error) { + return; + } + + *error = [MTRError errorForCHIPErrorCode:errorCode]; +} + +static bool CheckMemberOfType(NSDictionary * responseValue, NSString * memberName, Class expectedClass, + NSString * errorMessage, NSError * __autoreleasing * error) +{ + id _Nullable value = responseValue[memberName]; + if (value == nil) { + LogStringAndReturnError([NSString stringWithFormat:@"%s is null when not expected to be", memberName.UTF8String], + MTRErrorCodeInvalidArgument, error); + return false; + } + + if (![value isKindOfClass:expectedClass]) { + LogStringAndReturnError(errorMessage, MTRErrorCodeInvalidArgument, error); + return false; + } + + return true; +} + +// Allocates a buffer, encodes the data-value as TLV, and points the TLV::Reader +// to the data. Returns false if any of that fails, in which case error gets +// set. +// +// Data model decoding requires a contiguous buffer (because lists walk all the +// data multiple times and TLVPacketBufferBackingStore doesn't have a way to +// checkpoint and restore its state), but we can encode into chained packet +// buffers and then decide whether we need a contiguous realloc. +static bool EncodeDataValueToTLV(System::PacketBufferHandle & buffer, Platform::ScopedMemoryBuffer & flatBuffer, + NSDictionary * data, TLV::TLVReader & reader, NSError * __autoreleasing * error) +{ + buffer = System::PacketBufferHandle::New(System::PacketBuffer::kMaxSizeWithoutReserve, 0); + if (buffer.IsNull()) { + LogStringAndReturnError(@"Unable to allocate encoding buffer", CHIP_ERROR_NO_MEMORY, error); + return false; + } + + System::PacketBufferTLVWriter writer; + writer.Init(std::move(buffer), /* useChainedBuffers = */ true); + + CHIP_ERROR errorCode = MTREncodeTLVFromDataValueDictionary(data, writer, TLV::AnonymousTag()); + if (errorCode != CHIP_NO_ERROR) { + LogStringAndReturnError(@"Unable to encode data-value to TLV", errorCode, error); + return false; + } + + errorCode = writer.Finalize(&buffer); + if (errorCode != CHIP_NO_ERROR) { + LogStringAndReturnError(@"Unable to encode data-value to TLV", errorCode, error); + return false; + } + + if (buffer->HasChainedBuffer()) { + // We need to reallocate into a single contiguous buffer. + size_t remainingData = buffer->TotalLength(); + if (!flatBuffer.Calloc(remainingData)) { + LogStringAndReturnError(@"Unable to allocate decoding buffer", CHIP_ERROR_NO_MEMORY, error); + return false; + } + size_t copiedData = 0; + while (!buffer.IsNull()) { + if (buffer->DataLength() > remainingData) { + // Should never happen, but let's be extra careful about buffer + // overruns. + LogStringAndReturnError(@"Encoding buffer size is bigger than it claimed", CHIP_ERROR_INCORRECT_STATE, error); + return false; + } + + memcpy(flatBuffer.Get() + copiedData, buffer->Start(), buffer->DataLength()); + copiedData += buffer->DataLength(); + remainingData -= buffer->DataLength(); + buffer.Advance(); + } + if (remainingData != 0) { + LogStringAndReturnError( + @"Did not copy all data from Encoding buffer for some reason", CHIP_ERROR_INCORRECT_STATE, error); + return false; + } + reader.Init(flatBuffer.Get(), copiedData); + } else { + reader.Init(buffer->Start(), buffer->DataLength()); + } + + errorCode = reader.Next(TLV::AnonymousTag()); + if (errorCode != CHIP_NO_ERROR) { + LogStringAndReturnError(@"data-value TLV encoding did not create a TLV element", errorCode, error); + return false; + } + + return true; +} + @implementation MTRAttributeReport ++ (void)initialize +{ + // One of our init methods ends up doing Platform::MemoryAlloc. + MTRFrameworkInit(); +} + - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(id _Nullable)value error:(NSError * _Nullable)error { if (self = [super init]) { @@ -2249,6 +2380,75 @@ - (instancetype)initWithPath:(const ConcreteDataAttributePath &)path value:(id _ } return self; } + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + // In theory, the types of all the things in the dictionary will be correct + // if our consumer passes in an actual response-value dictionary, but + // double-check just to be sure + if (!CheckMemberOfType(responseValue, MTRAttributePathKey, [MTRAttributePath class], + @"response-value attribute path is not an MTRAttributePath.", error)) { + return nil; + } + MTRAttributePath * path = responseValue[MTRAttributePathKey]; + + id _Nullable value = responseValue[MTRErrorKey]; + if (value != nil) { + if (!CheckMemberOfType(responseValue, MTRErrorKey, [NSError class], @"response-value error is not an NSError.", error)) { + return nil; + } + + _path = path; + _value = nil; + _error = value; + return self; + } + + if (!CheckMemberOfType( + responseValue, MTRDataKey, [NSDictionary class], @"response-value data is not a data-value dictionary.", error)) { + return nil; + } + NSDictionary * data = responseValue[MTRDataKey]; + + // Encode the data to TLV and then decode from that, to reuse existing code. + System::PacketBufferHandle buffer; + Platform::ScopedMemoryBuffer flatBuffer; + TLV::TLVReader reader; + if (!EncodeDataValueToTLV(buffer, flatBuffer, data, reader, error)) { + return nil; + } + + auto attributePath = [path _asConcretePath]; + + CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; + id decodedValue = MTRDecodeAttributeValue(attributePath, reader, &errorCode); + if (errorCode == CHIP_NO_ERROR) { + _path = path; + _value = decodedValue; + _error = nil; + return self; + } + + if (errorCode == CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB) { + LogStringAndReturnError(@"No known schema for decoding attribute value.", MTRErrorCodeUnknownSchema, error); + return nil; + } + + // Treat all other errors as schema errors. + LogStringAndReturnError(@"Attribute decoding failed schema check.", MTRErrorCodeSchemaMismatch, error); + return nil; +} + +- (id)copyWithZone:(NSZone *)zone +{ + return [[MTRAttributeReport alloc] initWithPath:[self.path _asConcretePath] value:self.value error:self.error]; +} + @end @interface MTREventReport () { @@ -2257,12 +2457,17 @@ @interface MTREventReport () { @end @implementation MTREventReport ++ (void)initialize +{ + // One of our init methods ends up doing Platform::MemoryAlloc. + MTRFrameworkInit(); +} + - (instancetype)initWithPath:(const chip::app::ConcreteEventPath &)path eventNumber:(NSNumber *)eventNumber priority:(PriorityLevel)priority timestamp:(const Timestamp &)timestamp - value:(id _Nullable)value - error:(NSError * _Nullable)error + value:(id)value { if (self = [super init]) { _path = [[MTREventPath alloc] initWithPath:path]; @@ -2282,10 +2487,124 @@ - (instancetype)initWithPath:(const chip::app::ConcreteEventPath &)path return nil; } _value = value; + _error = nil; + } + return self; +} + +- (instancetype)initWithPath:(const chip::app::ConcreteEventPath &)path error:(NSError *)error +{ + if (self = [super init]) { + _path = [[MTREventPath alloc] initWithPath:path]; + // Use some sort of initialized values for our members, even though + // those values are meaningless in this case. + _eventNumber = @(0); + _priority = @(MTREventPriorityDebug); + _eventTimeType = MTREventTimeTypeSystemUpTime; + _systemUpTime = 0; + _timestampDate = nil; + _value = nil; _error = error; } return self; } + +- (nullable instancetype)initWithResponseValue:(NSDictionary *)responseValue + error:(NSError * __autoreleasing *)error +{ + if (!(self = [super init])) { + return nil; + } + + // In theory, the types of all the things in the dictionary will be correct + // if our consumer passes in an actual response-value dictionary, but + // double-check just to be sure + if (!CheckMemberOfType( + responseValue, MTREventPathKey, [MTREventPath class], @"response-value event path is not an MTREventPath.", error)) { + return nil; + } + MTREventPath * path = responseValue[MTREventPathKey]; + + id _Nullable value = responseValue[MTRErrorKey]; + if (value != nil) { + if (!CheckMemberOfType(responseValue, MTRErrorKey, [NSError class], @"response-value error is not an NSError.", error)) { + return nil; + } + + return [self initWithPath:[path _asConcretePath] error:value]; + } + + if (!CheckMemberOfType( + responseValue, MTRDataKey, [NSDictionary class], @"response-value data is not a data-value dictionary.", error)) { + return nil; + } + NSDictionary * data = responseValue[MTRDataKey]; + + // Encode the data to TLV and then decode from that, to reuse existing code. + System::PacketBufferHandle buffer; + Platform::ScopedMemoryBuffer flatBuffer; + TLV::TLVReader reader; + if (!EncodeDataValueToTLV(buffer, flatBuffer, data, reader, error)) { + return nil; + } + auto eventPath = [path _asConcretePath]; + + CHIP_ERROR errorCode = CHIP_ERROR_INTERNAL; + id decodedValue = MTRDecodeEventPayload(eventPath, reader, &errorCode); + if (errorCode == CHIP_NO_ERROR) { + // Validate our other members. + if (!CheckMemberOfType( + responseValue, MTREventNumberKey, [NSNumber class], @"response-value event number is not an NSNumber", error)) { + return nil; + } + _eventNumber = responseValue[MTREventNumberKey]; + + if (!CheckMemberOfType( + responseValue, MTREventPriorityKey, [NSNumber class], @"response-value event priority is not an NSNumber", error)) { + return nil; + } + _priority = responseValue[MTREventPriorityKey]; + + if (!CheckMemberOfType(responseValue, MTREventTimeTypeKey, [NSNumber class], + @"response-value event time type is not an NSNumber", error)) { + return nil; + } + NSNumber * wrappedTimeType = responseValue[MTREventTimeTypeKey]; + if (wrappedTimeType.unsignedIntegerValue == MTREventTimeTypeSystemUpTime) { + if (!CheckMemberOfType(responseValue, MTREventSystemUpTimeKey, [NSNumber class], + @"response-value event system uptime time is not an NSNumber", error)) { + return nil; + } + NSNumber * wrappedSystemTime = responseValue[MTREventSystemUpTimeKey]; + _systemUpTime = wrappedSystemTime.doubleValue; + } else if (wrappedTimeType.unsignedIntegerValue == MTREventTimeTypeTimestampDate) { + if (!CheckMemberOfType(responseValue, MTREventTimestampDateKey, [NSDate class], + @"response-value event timestampe is not an NSDate", error)) { + return nil; + } + _timestampDate = responseValue[MTREventTimestampDateKey]; + } else { + LogStringAndReturnError([NSString stringWithFormat:@"Invalid event time type: %lu", wrappedTimeType.unsignedLongValue], + MTRErrorCodeInvalidArgument, error); + return nil; + } + _eventTimeType = static_cast(wrappedTimeType.unsignedIntegerValue); + + _path = path; + _value = decodedValue; + _error = nil; + return self; + } + + if (errorCode == CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB) { + LogStringAndReturnError(@"No known schema for decoding event payload.", MTRErrorCodeUnknownSchema, error); + return nil; + } + + // Treat all other errors as schema errors. + LogStringAndReturnError(@"Event payload decoding failed schema check.", MTRErrorCodeSchemaMismatch, error); + return nil; +} @end @implementation MTREventReport (Deprecated) @@ -2324,12 +2643,15 @@ - (NSNumber *)timestamp return; } - [mEventReports addObject:[[MTREventReport alloc] initWithPath:aEventHeader.mPath - eventNumber:@(aEventHeader.mEventNumber) - priority:aEventHeader.mPriorityLevel - timestamp:aEventHeader.mTimestamp - value:value - error:error]]; + if (error != nil) { + [mEventReports addObject:[[MTREventReport alloc] initWithPath:aEventHeader.mPath error:error]]; + } else { + [mEventReports addObject:[[MTREventReport alloc] initWithPath:aEventHeader.mPath + eventNumber:@(aEventHeader.mEventNumber) + priority:aEventHeader.mPriorityLevel + timestamp:aEventHeader.mTimestamp + value:value]]; + } } void SubscriptionCallback::OnAttributeData( diff --git a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h index d6be73f96375c2..c0c709fce7e7dc 100644 --- a/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h +++ b/src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h @@ -108,12 +108,12 @@ static inline MTRTransportType MTRMakeTransportType(chip::Transport::Type type) @end @interface MTREventReport () +- (instancetype)initWithPath:(const chip::app::ConcreteEventPath &)path error:(NSError *)error; - (instancetype)initWithPath:(const chip::app::ConcreteEventPath &)path eventNumber:(NSNumber *)eventNumber priority:(chip::app::PriorityLevel)priority timestamp:(const chip::app::Timestamp &)timestamp - value:(id _Nullable)value - error:(NSError * _Nullable)error; + value:(id)value; @end @interface MTRAttributeRequestPath () diff --git a/src/darwin/Framework/CHIP/MTRCertificates.h b/src/darwin/Framework/CHIP/MTRCertificates.h index 268ee3e223ac30..e74d3de729ce4b 100644 --- a/src/darwin/Framework/CHIP/MTRCertificates.h +++ b/src/darwin/Framework/CHIP/MTRCertificates.h @@ -44,9 +44,25 @@ NS_ASSUME_NONNULL_BEGIN * If fabricID is not nil, it will be included in the subject DN of the * certificate. In this case it must be a valid Matter fabric id. * + * validityPeriod specifies when the certificate will be valid. Note that + * there is currently no mechanism available in Matter to update or rotate + * the root certificate of a fabric installed on a device. A certificate with + * no expiration time can be created by specifying [NSDate distantFuture] for + * the end of the period. + * * On failure returns nil and if "error" is not null sets *error to the relevant * error. */ ++ (MTRCertificateDERBytes _Nullable)createRootCertificate:(id)keypair + issuerID:(NSNumber * _Nullable)issuerID + fabricID:(NSNumber * _Nullable)fabricID + validityPeriod:(NSDateInterval *)validityPeriod + error:(NSError * __autoreleasing _Nullable * _Nullable)error + MTR_NEWLY_AVAILABLE; + +/** + * As above, but defaults to no expiration time. + */ + (MTRCertificateDERBytes _Nullable)createRootCertificate:(id)keypair issuerID:(NSNumber * _Nullable)issuerID fabricID:(NSNumber * _Nullable)fabricID @@ -66,9 +82,25 @@ NS_ASSUME_NONNULL_BEGIN * If fabricID is not nil, it will be included in the subject DN of the * certificate. In this case it must be a valid Matter fabric id. * + * validityPeriod specifies when the certificate will be valid. A certificate + * with no expiration time can be created by specifying [NSDate distantFuture] + * for the end of the period. + * * On failure returns nil and if "error" is not null sets *error to the relevant * error. */ ++ (MTRCertificateDERBytes _Nullable)createIntermediateCertificate:(id)rootKeypair + rootCertificate:(MTRCertificateDERBytes)rootCertificate + intermediatePublicKey:(SecKeyRef)intermediatePublicKey + issuerID:(NSNumber * _Nullable)issuerID + fabricID:(NSNumber * _Nullable)fabricID + validityPeriod:(NSDateInterval *)validityPeriod + error:(NSError * __autoreleasing _Nullable * _Nullable)error + MTR_NEWLY_AVAILABLE; + +/** + * As above, but defaults to no expiration time. + */ + (MTRCertificateDERBytes _Nullable)createIntermediateCertificate:(id)rootKeypair rootCertificate:(MTRCertificateDERBytes)rootCertificate intermediatePublicKey:(SecKeyRef)intermediatePublicKey @@ -95,9 +127,26 @@ NS_ASSUME_NONNULL_BEGIN * 3 numbers, which are expected to be 32-bit unsigned Case Authenticated Tag * values. * + * validityPeriod specifies when the certificate will be valid. A certificate + * with no expiration time can be created by specifying [NSDate distantFuture] + * for the end of the period. + * * On failure returns nil and if "error" is not null sets *error to the relevant * error. */ ++ (MTRCertificateDERBytes _Nullable)createOperationalCertificate:(id)signingKeypair + signingCertificate:(MTRCertificateDERBytes)signingCertificate + operationalPublicKey:(SecKeyRef)operationalPublicKey + fabricID:(NSNumber *)fabricID + nodeID:(NSNumber *)nodeID + caseAuthenticatedTags:(NSSet * _Nullable)caseAuthenticatedTags + validityPeriod:(NSDateInterval *)validityPeriod + error:(NSError * __autoreleasing _Nullable * _Nullable)error + MTR_NEWLY_AVAILABLE; + +/** + * As above, but defaults to no expiration time. + */ + (MTRCertificateDERBytes _Nullable)createOperationalCertificate:(id)signingKeypair signingCertificate:(MTRCertificateDERBytes)signingCertificate operationalPublicKey:(SecKeyRef)operationalPublicKey diff --git a/src/darwin/Framework/CHIP/MTRCertificates.mm b/src/darwin/Framework/CHIP/MTRCertificates.mm index a8c28f32ea95ec..e2967faba8cac2 100644 --- a/src/darwin/Framework/CHIP/MTRCertificates.mm +++ b/src/darwin/Framework/CHIP/MTRCertificates.mm @@ -39,11 +39,13 @@ + (void)initialize + (MTRCertificateDERBytes _Nullable)createRootCertificate:(id)keypair issuerID:(NSNumber * _Nullable)issuerID fabricID:(NSNumber * _Nullable)fabricID + validityPeriod:(NSDateInterval *)validityPeriod error:(NSError * __autoreleasing *)error { MTR_LOG_DEFAULT("Generating root certificate"); NSData * rootCert = nil; - CHIP_ERROR err = MTROperationalCredentialsDelegate::GenerateRootCertificate(keypair, issuerID, fabricID, &rootCert); + CHIP_ERROR err + = MTROperationalCredentialsDelegate::GenerateRootCertificate(keypair, issuerID, fabricID, validityPeriod, &rootCert); if (error) { *error = [MTRError errorForCHIPErrorCode:err]; } @@ -55,17 +57,27 @@ + (MTRCertificateDERBytes _Nullable)createRootCertificate:(id)keypai return rootCert; } ++ (MTRCertificateDERBytes _Nullable)createRootCertificate:(id)keypair + issuerID:(NSNumber * _Nullable)issuerID + fabricID:(NSNumber * _Nullable)fabricID + error:(NSError * __autoreleasing *)error +{ + auto * validityPeriod = [[NSDateInterval alloc] initWithStartDate:[NSDate now] endDate:[NSDate distantFuture]]; + return [self createRootCertificate:keypair issuerID:issuerID fabricID:fabricID validityPeriod:validityPeriod error:error]; +} + + (MTRCertificateDERBytes _Nullable)createIntermediateCertificate:(id)rootKeypair rootCertificate:(MTRCertificateDERBytes)rootCertificate intermediatePublicKey:(SecKeyRef)intermediatePublicKey issuerID:(NSNumber * _Nullable)issuerID fabricID:(NSNumber * _Nullable)fabricID + validityPeriod:(NSDateInterval *)validityPeriod error:(NSError * __autoreleasing *)error { MTR_LOG_DEFAULT("Generating intermediate certificate"); NSData * intermediate = nil; CHIP_ERROR err = MTROperationalCredentialsDelegate::GenerateIntermediateCertificate( - rootKeypair, rootCertificate, intermediatePublicKey, issuerID, fabricID, &intermediate); + rootKeypair, rootCertificate, intermediatePublicKey, issuerID, fabricID, validityPeriod, &intermediate); if (error) { *error = [MTRError errorForCHIPErrorCode:err]; } @@ -77,18 +89,36 @@ + (MTRCertificateDERBytes _Nullable)createIntermediateCertificate:(id)rootKeypair + rootCertificate:(MTRCertificateDERBytes)rootCertificate + intermediatePublicKey:(SecKeyRef)intermediatePublicKey + issuerID:(NSNumber * _Nullable)issuerID + fabricID:(NSNumber * _Nullable)fabricID + error:(NSError * __autoreleasing *)error +{ + auto * validityPeriod = [[NSDateInterval alloc] initWithStartDate:[NSDate now] endDate:[NSDate distantFuture]]; + return [self createIntermediateCertificate:rootKeypair + rootCertificate:rootCertificate + intermediatePublicKey:intermediatePublicKey + issuerID:issuerID + fabricID:fabricID + validityPeriod:validityPeriod + error:error]; +} + + (MTRCertificateDERBytes _Nullable)createOperationalCertificate:(id)signingKeypair signingCertificate:(MTRCertificateDERBytes)signingCertificate operationalPublicKey:(SecKeyRef)operationalPublicKey fabricID:(NSNumber *)fabricID nodeID:(NSNumber *)nodeID caseAuthenticatedTags:(NSSet * _Nullable)caseAuthenticatedTags + validityPeriod:(NSDateInterval *)validityPeriod error:(NSError * __autoreleasing _Nullable * _Nullable)error { MTR_LOG_DEFAULT("Generating operational certificate"); NSData * opcert = nil; CHIP_ERROR err = MTROperationalCredentialsDelegate::GenerateOperationalCertificate( - signingKeypair, signingCertificate, operationalPublicKey, fabricID, nodeID, caseAuthenticatedTags, &opcert); + signingKeypair, signingCertificate, operationalPublicKey, fabricID, nodeID, caseAuthenticatedTags, validityPeriod, &opcert); if (error) { *error = [MTRError errorForCHIPErrorCode:err]; } @@ -100,6 +130,25 @@ + (MTRCertificateDERBytes _Nullable)createOperationalCertificate:(id return opcert; } ++ (MTRCertificateDERBytes _Nullable)createOperationalCertificate:(id)signingKeypair + signingCertificate:(MTRCertificateDERBytes)signingCertificate + operationalPublicKey:(SecKeyRef)operationalPublicKey + fabricID:(NSNumber *)fabricID + nodeID:(NSNumber *)nodeID + caseAuthenticatedTags:(NSSet * _Nullable)caseAuthenticatedTags + error:(NSError * __autoreleasing _Nullable * _Nullable)error +{ + auto * validityPeriod = [[NSDateInterval alloc] initWithStartDate:[NSDate now] endDate:[NSDate distantFuture]]; + return [self createOperationalCertificate:signingKeypair + signingCertificate:signingCertificate + operationalPublicKey:operationalPublicKey + fabricID:fabricID + nodeID:nodeID + caseAuthenticatedTags:caseAuthenticatedTags + validityPeriod:validityPeriod + error:error]; +} + + (BOOL)keypair:(id)keypair matchesCertificate:(NSData *)certificate { P256PublicKey keypairPubKey; diff --git a/src/darwin/Framework/CHIP/MTRError.h b/src/darwin/Framework/CHIP/MTRError.h index ffed8c8be3b9df..c7d367f78a8fa8 100644 --- a/src/darwin/Framework/CHIP/MTRError.h +++ b/src/darwin/Framework/CHIP/MTRError.h @@ -59,6 +59,16 @@ typedef NS_ERROR_ENUM(MTRErrorDomain, MTRErrorCode){ * into a fabric when it's already part of that fabric. */ MTRErrorCodeFabricExists = 11, + /** + * MTRErrorCodeUnknownSchema means the schema for the given cluster/attribute, + * cluster/event, or cluster/command combination is not known. + */ + MTRErrorCodeUnknownSchema MTR_NEWLY_AVAILABLE = 12, + /** + * MTRErrorCodeSchemaMismatch means that provided data did not match the + * expected schema. + */ + MTRErrorCodeSchemaMismatch MTR_NEWLY_AVAILABLE = 13, }; // clang-format on diff --git a/src/darwin/Framework/CHIP/MTRError_Internal.h b/src/darwin/Framework/CHIP/MTRError_Internal.h index 6eaba254b36398..d41046ecbf5bd7 100644 --- a/src/darwin/Framework/CHIP/MTRError_Internal.h +++ b/src/darwin/Framework/CHIP/MTRError_Internal.h @@ -16,6 +16,7 @@ */ #import +#import #include #include diff --git a/src/darwin/Framework/CHIP/MTREventTLVValueDecoder_Internal.h b/src/darwin/Framework/CHIP/MTREventTLVValueDecoder_Internal.h index bd5c412a8451a6..eeacb2ea06d41f 100644 --- a/src/darwin/Framework/CHIP/MTREventTLVValueDecoder_Internal.h +++ b/src/darwin/Framework/CHIP/MTREventTLVValueDecoder_Internal.h @@ -27,6 +27,6 @@ NS_ASSUME_NONNULL_BEGIN -id MTRDecodeEventPayload(const chip::app::ConcreteEventPath & aPath, chip::TLV::TLVReader & aReader, CHIP_ERROR * aError); +id _Nullable MTRDecodeEventPayload(const chip::app::ConcreteEventPath & aPath, chip::TLV::TLVReader & aReader, CHIP_ERROR * aError); NS_ASSUME_NONNULL_END diff --git a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h index a824971cb8abb3..b3dfd2419186f4 100644 --- a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h +++ b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.h @@ -92,7 +92,7 @@ class MTROperationalCredentialsDelegate : public chip::Controller::OperationalCr // // The outparam must not be null and is set to nil on errors. static CHIP_ERROR GenerateRootCertificate(id keypair, NSNumber * _Nullable issuerId, NSNumber * _Nullable fabricId, - NSData * _Nullable __autoreleasing * _Nonnull rootCert); + NSDateInterval * validityPeriod, NSData * _Nullable __autoreleasing * _Nonnull rootCert); // Generate an intermediate DER-encoded X.509 certificate for the given root // and intermediate public key. If issuerId is provided, it is used; @@ -102,21 +102,23 @@ class MTROperationalCredentialsDelegate : public chip::Controller::OperationalCr // The outparam must not be null and is set to nil on errors. static CHIP_ERROR GenerateIntermediateCertificate(id rootKeypair, NSData * rootCertificate, SecKeyRef intermediatePublicKey, NSNumber * _Nullable issuerId, NSNumber * _Nullable fabricId, - NSData * _Nullable __autoreleasing * _Nonnull intermediateCert); + NSDateInterval * validityPeriod, NSData * _Nullable __autoreleasing * _Nonnull intermediateCert); // Generate an operational DER-encoded X.509 certificate for the given // signing certificate and operational public key, using the given fabric // id, node id, and CATs. static CHIP_ERROR GenerateOperationalCertificate(id signingKeypair, NSData * signingCertificate, SecKeyRef operationalPublicKey, NSNumber * fabricId, NSNumber * nodeId, NSSet * _Nullable caseAuthenticatedTags, - NSData * _Nullable __autoreleasing * _Nonnull operationalCert); + NSDateInterval * validityPeriod, NSData * _Nullable __autoreleasing * _Nonnull operationalCert); private: - static bool ToChipEpochTime(uint32_t offset, uint32_t & epoch); + // notAfter times can represent "forever". + static bool ToChipNotAfterEpochTime(NSDate * date, uint32_t & epoch); + static bool ToChipEpochTime(NSDate * date, uint32_t & epoch); static CHIP_ERROR GenerateNOC(chip::Crypto::P256Keypair & signingKeypair, NSData * signingCertificate, chip::NodeId nodeId, chip::FabricId fabricId, const chip::CATValues & cats, const chip::Crypto::P256PublicKey & pubkey, - chip::MutableByteSpan & noc); + NSDateInterval * validityPeriod, chip::MutableByteSpan & noc); // Called asynchronously in response to the MTROperationalCertificateIssuer // calling the completion we passed it when asking it to generate a NOC @@ -135,8 +137,6 @@ class MTROperationalCredentialsDelegate : public chip::Controller::OperationalCr chip::Crypto::IdentityProtectionKey mIPK; - static const uint32_t kCertificateValiditySecs = 365 * 24 * 60 * 60; - MTRPersistentStorageDelegateBridge * mStorage; chip::NodeId mDeviceBeingPaired = chip::kUndefinedNodeId; diff --git a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm index b14ac062784105..887fd20dba9e1f 100644 --- a/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm +++ b/src/darwin/Framework/CHIP/MTROperationalCredentialsDelegate.mm @@ -89,21 +89,22 @@ return CHIP_ERROR_INCORRECT_STATE; } - return GenerateNOC( - *mIssuerKey, (mIntermediateCert != nil) ? mIntermediateCert : mRootCert, nodeId, fabricId, cats, pubkey, noc); + auto * validityPeriod = [[NSDateInterval alloc] initWithStartDate:[NSDate now] endDate:[NSDate distantFuture]]; + return GenerateNOC(*mIssuerKey, (mIntermediateCert != nil) ? mIntermediateCert : mRootCert, nodeId, fabricId, cats, pubkey, + validityPeriod, noc); } CHIP_ERROR MTROperationalCredentialsDelegate::GenerateNOC(P256Keypair & signingKeypair, NSData * signingCertificate, NodeId nodeId, - FabricId fabricId, const CATValues & cats, const P256PublicKey & pubkey, MutableByteSpan & noc) + FabricId fabricId, const CATValues & cats, const P256PublicKey & pubkey, NSDateInterval * validityPeriod, MutableByteSpan & noc) { uint32_t validityStart, validityEnd; - if (!ToChipEpochTime(0, validityStart)) { + if (!ToChipEpochTime(validityPeriod.startDate, validityStart)) { MTR_LOG_ERROR("Failed in computing certificate validity start date"); return CHIP_ERROR_INTERNAL; } - if (!ToChipEpochTime(kCertificateValiditySecs, validityEnd)) { + if (!ToChipNotAfterEpochTime(validityPeriod.endDate, validityEnd)) { MTR_LOG_ERROR("Failed in computing certificate validity end date"); return CHIP_ERROR_INTERNAL; } @@ -310,19 +311,37 @@ return AsByteSpan(mIntermediateCert); } -bool MTROperationalCredentialsDelegate::ToChipEpochTime(uint32_t offset, uint32_t & epoch) +bool MTROperationalCredentialsDelegate::ToChipNotAfterEpochTime(NSDate * date, uint32_t & epoch) +{ + if ([date isEqualToDate:[NSDate distantFuture]]) { + epoch = kNullCertTime; + return true; + } + + return ToChipEpochTime(date, epoch); +} + +bool MTROperationalCredentialsDelegate::ToChipEpochTime(NSDate * date, uint32_t & epoch) { - NSDate * date = [NSDate dateWithTimeIntervalSinceNow:offset]; NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDateComponents * components = [calendar componentsInTimeZone:[NSTimeZone timeZoneForSecondsFromGMT:0] fromDate:date]; - uint16_t year = static_cast([components year]); - uint8_t month = static_cast([components month]); - uint8_t day = static_cast([components day]); - uint8_t hour = static_cast([components hour]); - uint8_t minute = static_cast([components minute]); - uint8_t second = static_cast([components second]); - return chip::CalendarToChipEpochTime(year, month, day, hour, minute, second, epoch); + if (CanCastTo(components.year)) { + uint16_t year = static_cast([components year]); + uint8_t month = static_cast([components month]); + uint8_t day = static_cast([components day]); + uint8_t hour = static_cast([components hour]); + uint8_t minute = static_cast([components minute]); + uint8_t second = static_cast([components second]); + if (chip::CalendarToChipEpochTime(year, month, day, hour, minute, second, epoch)) { + return true; + } + } + + MTR_LOG_ERROR( + "Year %lu is out of range for Matter epoch time. Please use [NSDate distantFuture] to represent \"never expires\".", + static_cast(components.year)); + return false; } namespace { @@ -337,7 +356,7 @@ uint64_t GetIssuerId(NSNumber * _Nullable providedIssuerId) } // anonymous namespace CHIP_ERROR MTROperationalCredentialsDelegate::GenerateRootCertificate(id keypair, NSNumber * _Nullable issuerId, - NSNumber * _Nullable fabricId, NSData * _Nullable __autoreleasing * _Nonnull rootCert) + NSNumber * _Nullable fabricId, NSDateInterval * validityPeriod, NSData * _Nullable __autoreleasing * _Nonnull rootCert) { *rootCert = nil; MTRP256KeypairBridge keypairBridge; @@ -354,12 +373,12 @@ uint64_t GetIssuerId(NSNumber * _Nullable providedIssuerId) uint32_t validityStart, validityEnd; - if (!ToChipEpochTime(0, validityStart)) { + if (!ToChipEpochTime(validityPeriod.startDate, validityStart)) { MTR_LOG_ERROR("Failed in computing certificate validity start date"); return CHIP_ERROR_INTERNAL; } - if (!ToChipEpochTime(kCertificateValiditySecs, validityEnd)) { + if (!ToChipNotAfterEpochTime(validityPeriod.endDate, validityEnd)) { MTR_LOG_ERROR("Failed in computing certificate validity end date"); return CHIP_ERROR_INTERNAL; } @@ -373,7 +392,7 @@ uint64_t GetIssuerId(NSNumber * _Nullable providedIssuerId) } CHIP_ERROR MTROperationalCredentialsDelegate::GenerateIntermediateCertificate(id rootKeypair, NSData * rootCertificate, - SecKeyRef intermediatePublicKey, NSNumber * _Nullable issuerId, NSNumber * _Nullable fabricId, + SecKeyRef intermediatePublicKey, NSNumber * _Nullable issuerId, NSNumber * _Nullable fabricId, NSDateInterval * validityPeriod, NSData * _Nullable __autoreleasing * _Nonnull intermediateCert) { *intermediateCert = nil; @@ -404,12 +423,12 @@ uint64_t GetIssuerId(NSNumber * _Nullable providedIssuerId) uint32_t validityStart, validityEnd; - if (!ToChipEpochTime(0, validityStart)) { + if (!ToChipEpochTime(validityPeriod.startDate, validityStart)) { MTR_LOG_ERROR("Failed in computing certificate validity start date"); return CHIP_ERROR_INTERNAL; } - if (!ToChipEpochTime(kCertificateValiditySecs, validityEnd)) { + if (!ToChipNotAfterEpochTime(validityPeriod.endDate, validityEnd)) { MTR_LOG_ERROR("Failed in computing certificate validity end date"); return CHIP_ERROR_INTERNAL; } @@ -424,7 +443,8 @@ uint64_t GetIssuerId(NSNumber * _Nullable providedIssuerId) CHIP_ERROR MTROperationalCredentialsDelegate::GenerateOperationalCertificate(id signingKeypair, NSData * signingCertificate, SecKeyRef operationalPublicKey, NSNumber * fabricId, NSNumber * nodeId, - NSSet * _Nullable caseAuthenticatedTags, NSData * _Nullable __autoreleasing * _Nonnull operationalCert) + NSSet * _Nullable caseAuthenticatedTags, NSDateInterval * validityPeriod, + NSData * _Nullable __autoreleasing * _Nonnull operationalCert) { *operationalCert = nil; @@ -459,7 +479,7 @@ uint64_t GetIssuerId(NSNumber * _Nullable providedIssuerId) uint8_t nocBuffer[Controller::kMaxCHIPDERCertLength]; MutableByteSpan noc(nocBuffer); - ReturnErrorOnFailure(GenerateNOC(keypairBridge, signingCertificate, node, fabric, cats, pubKey, noc)); + ReturnErrorOnFailure(GenerateNOC(keypairBridge, signingCertificate, node, fabric, cats, pubKey, validityPeriod, noc)); *operationalCert = AsData(noc); return CHIP_NO_ERROR; diff --git a/src/darwin/Framework/CHIP/templates/MTRAttributeTLVValueDecoder-src.zapt b/src/darwin/Framework/CHIP/templates/MTRAttributeTLVValueDecoder-src.zapt index 8fd58f7cad306e..b24e063cdd06ce 100644 --- a/src/darwin/Framework/CHIP/templates/MTRAttributeTLVValueDecoder-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRAttributeTLVValueDecoder-src.zapt @@ -14,16 +14,12 @@ using namespace chip; using namespace chip::app; -id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{{#zcl_clusters}} +{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} +static id _Nullable DecodeAttributeValueFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { - switch (aPath.mClusterId) - { - {{#zcl_clusters}} - {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} - case Clusters::{{asUpperCamelCase name}}::Id: { - using namespace Clusters::{{asUpperCamelCase name}}; - switch (aPath.mAttributeId) - { + using namespace Clusters::{{asUpperCamelCase name}}; + switch (aAttributeId) { {{#zcl_attributes_server removeKeys='isOptional'}} {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) attribute=(asUpperCamelCase name preserveAcronyms=true))}} case Attributes::{{asUpperCamelCase name}}::Id: { @@ -40,18 +36,31 @@ id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & } {{/if}} {{/zcl_attributes_server}} - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + default: { + break; } - break; - } - {{/if}} - {{/zcl_clusters}} - default: { - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +{{/if}} +{{/zcl_clusters}} + +id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) { + {{#zcl_clusters}} + {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} + case Clusters::{{asUpperCamelCase name}}::Id: { + return DecodeAttributeValueFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(aPath.mAttributeId, aReader, aError); + } + {{/if}} + {{/zcl_clusters}} + default: { + break; + } } + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } diff --git a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt index 04111e11cfbf2c..4432bde2cf240d 100644 --- a/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt +++ b/src/darwin/Framework/CHIP/templates/MTRClusterConstants.zapt @@ -157,6 +157,15 @@ MTRCommandIDTypeCluster{{cluster}}Command{{command}}ID {{availability cluster co {{/inline}} {{> commandIdDecl cluster=(asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true)}} +{{! Anything which has an old name, and the new name was introduced in the "First after major API revamp" release or later + (or just after the "First major API revamp" release, but we don't have a good way to test for that), + we need to generate the new-form id for the old name too, as long as it was not removed. }} +{{#if (and (hasOldName (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true) + (not (wasIntroducedBeforeRelease "First after major API revamp" (asUpperCamelCase ../clusterName preserveAcronyms=true) command=(asUpperCamelCase name preserveAcronyms=true) isForIds=true)) + (isSupported (compatClusterNameRemapping ../clusterName) command=(compatCommandNameRemapping ../clusterName name) isForIds=true))}} +{{> commandIdDecl cluster=(compatClusterNameRemapping ../clusterName) + command=(compatCommandNameRemapping ../clusterName name)}} +{{/if}} {{#last}} {{/last}} diff --git a/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt b/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt index 7d476f8d5597dd..eca3f3fa328598 100644 --- a/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt +++ b/src/darwin/Framework/CHIP/templates/MTREventTLVValueDecoder-src.zapt @@ -17,19 +17,14 @@ using namespace chip; using namespace chip::app; -id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{{#zcl_clusters}} +{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} +static id _Nullable DecodeEventPayloadFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { - switch (aPath.mClusterId) - { - {{#zcl_clusters}} - {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} - case Clusters::{{asUpperCamelCase name}}::Id: { - using namespace Clusters::{{asUpperCamelCase name}}; - switch (aPath.mEventId) - { + using namespace Clusters::{{asUpperCamelCase name}}; + switch (aEventId) { {{#zcl_events}} {{#if (isSupported (asUpperCamelCase ../name preserveAcronyms=true) event=(asUpperCamelCase name preserveAcronyms=true))}} - case Events::{{asUpperCamelCase name}}::Id: { Events::{{asUpperCamelCase name}}::DecodableType cppValue; *aError = DataModel::Decode(aReader, cppValue); @@ -52,22 +47,33 @@ id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aRead return value; } - {{/if}} {{/zcl_events}} - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; + default: { + break; } - break; - } - {{/if}} - {{/zcl_clusters}} - default: { - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; } + + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +{{/if}} +{{/zcl_clusters}} + +id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) { + {{#zcl_clusters}} + {{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}} + case Clusters::{{asUpperCamelCase name}}::Id: { + return DecodeEventPayloadFor{{asUpperCamelCase name preserveAcronyms=true}}Cluster(aPath.mEventId, aReader, aError); + } + {{/if}} + {{/zcl_clusters}} + default: { + break; + } } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } diff --git a/src/darwin/Framework/CHIP/templates/availability.yaml b/src/darwin/Framework/CHIP/templates/availability.yaml index 33e51e15d8e722..5814f5a94460bd 100644 --- a/src/darwin/Framework/CHIP/templates/availability.yaml +++ b/src/darwin/Framework/CHIP/templates/availability.yaml @@ -7139,6 +7139,12 @@ Scenes: ScenesFeature: - SceneNames + ids: + attributes: + TimeSynchronization: + - TrustedTimeSource + - DefaultNTP + - NTPServerAvailable deprecated: bitmaps: Groups: @@ -7172,6 +7178,29 @@ - ProductFinishEnum - ColorEnum renames: + attributes: + TimeSynchronization: + TrustedTimeSource: TrustedTimeNodeId + DefaultNTP: DefaultNtp + NTPServerAvailable: NtpServerPort + commands: + TimeSynchronization: + SetUTCTime: SetUtcTime + enum values: + TimeSynchronization: + TimeSourceEnum: + NonMatterSNTP: NonFabricSntp + NonMatterNTP: NonFabricNtp + MatterSNTP: FabricSntp + MatterNTP: FabricNtp + MixedNTP: MixedNtp + NonMatterSNTPNTS: NonFabricSntpNts + NonMatterNTPNTS: NonFabricNtpNts + MatterSNTPNTS: FabricSntpNts + MatterNTPNTS: FabricNtpNts + MixedNTPNTS: MixedNtpNts + PTP: Ptp + GNSS: Gnss bitmaps: Groups: GroupsFeature: GroupClusterFeature @@ -7179,3 +7208,42 @@ PressureMeasurementFeature: PressureFeature PumpConfigurationAndControl: PumpConfigurationAndControlFeature: PumpFeature + provisional: + # Once we actually unmark TimeSynchronization as provisional, all these bits should go away too, and we should instead + # mark things as introduced/deprecated as needed. The "ids" entries should go away, in particular. + ids: + attributes: + TimeSynchronization: + - TimeZoneListMaxSize + - DSTOffsetListMaxSize + - SupportsDNSResolve + commands: + TimeSynchronization: + - SetUTCTime + - SetTrustedTimeSource + - SetTimeZone + - SetTimeZoneResponse + - SetDSTOffset + - SetDefaultNTP + events: + TimeSynchronization: + - DSTTableEmpty + - DSTStatus + - TimeZoneStatus + - TimeFailure + - MissingTrustedTimeSource + enum values: + TimeSynchronization: + TimeSourceEnum: + - NonMatterSNTP + - NonMatterNTP + - MatterSNTP + - MatterNTP + - MixedNTP + - NonMatterSNTPNTS + - NonMatterNTPNTS + - MatterSNTPNTS + - MatterNTPNTS + - MixedNTPNTS + - PTP + - GNSS diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm index c656e1f7c89e5d..4d86d21b482bcf 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRAttributeTLVValueDecoder.mm @@ -29,17581 +29,18020 @@ using namespace chip; using namespace chip::app; -id MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +static id _Nullable DecodeAttributeValueForIdentifyCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { - switch (aPath.mClusterId) { - case Clusters::Identify::Id: { - using namespace Clusters::Identify; - switch (aPath.mAttributeId) { - case Attributes::IdentifyTime::Id: { - using TypeInfo = Attributes::IdentifyTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::IdentifyType::Id: { - using TypeInfo = Attributes::IdentifyType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + using namespace Clusters::Identify; + switch (aAttributeId) { + case Attributes::IdentifyTime::Id: { + using TypeInfo = Attributes::IdentifyTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::IdentifyType::Id: { + using TypeInfo = Attributes::IdentifyType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForGroupsCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Groups; + switch (aAttributeId) { + case Attributes::NameSupport::Id: { + using TypeInfo = Attributes::NameSupport::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForScenesCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Scenes; + switch (aAttributeId) { + case Attributes::SceneCount::Id: { + using TypeInfo = Attributes::SceneCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CurrentScene::Id: { + using TypeInfo = Attributes::CurrentScene::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CurrentGroup::Id: { + using TypeInfo = Attributes::CurrentGroup::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::SceneValid::Id: { + using TypeInfo = Attributes::SceneValid::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::NameSupport::Id: { + using TypeInfo = Attributes::NameSupport::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::LastConfiguredBy::Id: { + using TypeInfo = Attributes::LastConfiguredBy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForOnOffCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OnOff; + switch (aAttributeId) { + case Attributes::OnOff::Id: { + using TypeInfo = Attributes::OnOff::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::GlobalSceneControl::Id: { + using TypeInfo = Attributes::GlobalSceneControl::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::OnTime::Id: { + using TypeInfo = Attributes::OnTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::OffWaitTime::Id: { + using TypeInfo = Attributes::OffWaitTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::StartUpOnOff::Id: { + using TypeInfo = Attributes::StartUpOnOff::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForOnOffSwitchConfigurationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OnOffSwitchConfiguration; + switch (aAttributeId) { + case Attributes::SwitchType::Id: { + using TypeInfo = Attributes::SwitchType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::SwitchActions::Id: { + using TypeInfo = Attributes::SwitchActions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForLevelControlCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::LevelControl; + switch (aAttributeId) { + case Attributes::CurrentLevel::Id: { + using TypeInfo = Attributes::CurrentLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::RemainingTime::Id: { + using TypeInfo = Attributes::RemainingTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::MinLevel::Id: { + using TypeInfo = Attributes::MinLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MaxLevel::Id: { + using TypeInfo = Attributes::MaxLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CurrentFrequency::Id: { + using TypeInfo = Attributes::CurrentFrequency::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::MinFrequency::Id: { + using TypeInfo = Attributes::MinFrequency::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::MaxFrequency::Id: { + using TypeInfo = Attributes::MaxFrequency::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Options::Id: { + using TypeInfo = Attributes::Options::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::OnOffTransitionTime::Id: { + using TypeInfo = Attributes::OnOffTransitionTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::OnLevel::Id: { + using TypeInfo = Attributes::OnLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::OnTransitionTime::Id: { + using TypeInfo = Attributes::OnTransitionTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::OffTransitionTime::Id: { + using TypeInfo = Attributes::OffTransitionTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::DefaultMoveRate::Id: { + using TypeInfo = Attributes::DefaultMoveRate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::StartUpCurrentLevel::Id: { + using TypeInfo = Attributes::StartUpCurrentLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBinaryInputBasicCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BinaryInputBasic; + switch (aAttributeId) { + case Attributes::ActiveText::Id: { + using TypeInfo = Attributes::ActiveText::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::Description::Id: { + using TypeInfo = Attributes::Description::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::InactiveText::Id: { + using TypeInfo = Attributes::InactiveText::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::OutOfService::Id: { + using TypeInfo = Attributes::OutOfService::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::Polarity::Id: { + using TypeInfo = Attributes::Polarity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::PresentValue::Id: { + using TypeInfo = Attributes::PresentValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::Reliability::Id: { + using TypeInfo = Attributes::Reliability::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::StatusFlags::Id: { + using TypeInfo = Attributes::StatusFlags::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ApplicationType::Id: { + using TypeInfo = Attributes::ApplicationType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForDescriptorCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Descriptor; + switch (aAttributeId) { + case Attributes::DeviceTypeList::Id: { + using TypeInfo = Attributes::DeviceTypeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRDescriptorClusterDeviceTypeStruct * newElement_0; + newElement_0 = [MTRDescriptorClusterDeviceTypeStruct new]; + newElement_0.deviceType = [NSNumber numberWithUnsignedInt:entry_0.deviceType]; + newElement_0.revision = [NSNumber numberWithUnsignedShort:entry_0.revision]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ServerList::Id: { + using TypeInfo = Attributes::ServerList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ClientList::Id: { + using TypeInfo = Attributes::ClientList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::PartsList::Id: { + using TypeInfo = Attributes::PartsList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBindingCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Binding; + switch (aAttributeId) { + case Attributes::Binding::Id: { + using TypeInfo = Attributes::Binding::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRBindingClusterTargetStruct * newElement_0; + newElement_0 = [MTRBindingClusterTargetStruct new]; + if (entry_0.node.HasValue()) { + newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; + } else { + newElement_0.node = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.group.HasValue()) { + newElement_0.group = [NSNumber numberWithUnsignedShort:entry_0.group.Value()]; + } else { + newElement_0.group = nil; } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + if (entry_0.endpoint.HasValue()) { + newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint.Value()]; + } else { + newElement_0.endpoint = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.cluster.HasValue()) { + newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster.Value()]; + } else { + newElement_0.cluster = nil; } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::Groups::Id: { - using namespace Clusters::Groups; - switch (aPath.mAttributeId) { - case Attributes::NameSupport::Id: { - using TypeInfo = Attributes::NameSupport::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForAccessControlCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AccessControl; + switch (aAttributeId) { + case Attributes::Acl::Id: { + using TypeInfo = Attributes::Acl::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRAccessControlClusterAccessControlEntryStruct * newElement_0; + newElement_0 = [MTRAccessControlClusterAccessControlEntryStruct new]; + newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; + newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; + if (entry_0.subjects.IsNull()) { + newElement_0.subjects = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_0.subjects.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + NSNumber * newElement_3; + newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.subjects = array_3; + } } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.targets.IsNull()) { + newElement_0.targets = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_0.targets.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + MTRAccessControlClusterTarget * newElement_3; + newElement_3 = [MTRAccessControlClusterTarget new]; + if (entry_3.cluster.IsNull()) { + newElement_3.cluster = nil; + } else { + newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; + } + if (entry_3.endpoint.IsNull()) { + newElement_3.endpoint = nil; + } else { + newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; + } + if (entry_3.deviceType.IsNull()) { + newElement_3.deviceType = nil; + } else { + newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; + } + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.targets = array_3; + } } - value = array_0; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; + value = array_0; } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + return value; + } + case Attributes::Extension::Id: { + using TypeInfo = Attributes::Extension::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRAccessControlClusterAccessControlExtensionStruct * newElement_0; + newElement_0 = [MTRAccessControlClusterAccessControlExtensionStruct new]; + newElement_0.data = [NSData dataWithBytes:entry_0.data.data() length:entry_0.data.size()]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::SubjectsPerAccessControlEntry::Id: { + using TypeInfo = Attributes::SubjectsPerAccessControlEntry::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::TargetsPerAccessControlEntry::Id: { + using TypeInfo = Attributes::TargetsPerAccessControlEntry::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AccessControlEntriesPerFabric::Id: { + using TypeInfo = Attributes::AccessControlEntriesPerFabric::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForActionsCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Actions; + switch (aAttributeId) { + case Attributes::ActionList::Id: { + using TypeInfo = Attributes::ActionList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRActionsClusterActionStruct * newElement_0; + newElement_0 = [MTRActionsClusterActionStruct new]; + newElement_0.actionID = [NSNumber numberWithUnsignedShort:entry_0.actionID]; + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() + length:entry_0.name.size() + encoding:NSUTF8StringEncoding]; + newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; + newElement_0.endpointListID = [NSNumber numberWithUnsignedShort:entry_0.endpointListID]; + newElement_0.supportedCommands = [NSNumber numberWithUnsignedShort:entry_0.supportedCommands.Raw()]; + newElement_0.state = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.state)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::EndpointLists::Id: { + using TypeInfo = Attributes::EndpointLists::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRActionsClusterEndpointListStruct * newElement_0; + newElement_0 = [MTRActionsClusterEndpointListStruct new]; + newElement_0.endpointListID = [NSNumber numberWithUnsignedShort:entry_0.endpointListID]; + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() + length:entry_0.name.size() + encoding:NSUTF8StringEncoding]; + newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.endpoints.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSNumber * newElement_2; + newElement_2 = [NSNumber numberWithUnsignedShort:entry_2]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.endpoints = array_2; } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + [array_0 addObject:newElement_0]; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::SetupURL::Id: { + using TypeInfo = Attributes::SetupURL::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::Scenes::Id: { - using namespace Clusters::Scenes; - switch (aPath.mAttributeId) { - case Attributes::SceneCount::Id: { - using TypeInfo = Attributes::SceneCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CurrentScene::Id: { - using TypeInfo = Attributes::CurrentScene::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CurrentGroup::Id: { - using TypeInfo = Attributes::CurrentGroup::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::SceneValid::Id: { - using TypeInfo = Attributes::SceneValid::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::NameSupport::Id: { - using TypeInfo = Attributes::NameSupport::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::LastConfiguredBy::Id: { - using TypeInfo = Attributes::LastConfiguredBy::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; } - case Clusters::OnOff::Id: { - using namespace Clusters::OnOff; - switch (aPath.mAttributeId) { - case Attributes::OnOff::Id: { - using TypeInfo = Attributes::OnOff::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::GlobalSceneControl::Id: { - using TypeInfo = Attributes::GlobalSceneControl::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::OnTime::Id: { - using TypeInfo = Attributes::OnTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::OffWaitTime::Id: { - using TypeInfo = Attributes::OffWaitTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::StartUpOnOff::Id: { - using TypeInfo = Attributes::StartUpOnOff::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBasicInformationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BasicInformation; + switch (aAttributeId) { + case Attributes::DataModelRevision::Id: { + using TypeInfo = Attributes::DataModelRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; } - case Clusters::OnOffSwitchConfiguration::Id: { - using namespace Clusters::OnOffSwitchConfiguration; - switch (aPath.mAttributeId) { - case Attributes::SwitchType::Id: { - using TypeInfo = Attributes::SwitchType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::SwitchActions::Id: { - using TypeInfo = Attributes::SwitchActions::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + case Attributes::VendorName::Id: { + using TypeInfo = Attributes::VendorName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::VendorID::Id: { + using TypeInfo = Attributes::VendorID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ProductName::Id: { + using TypeInfo = Attributes::ProductName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductID::Id: { + using TypeInfo = Attributes::ProductID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::NodeLabel::Id: { + using TypeInfo = Attributes::NodeLabel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::Location::Id: { + using TypeInfo = Attributes::Location::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::HardwareVersion::Id: { + using TypeInfo = Attributes::HardwareVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::HardwareVersionString::Id: { + using TypeInfo = Attributes::HardwareVersionString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::SoftwareVersion::Id: { + using TypeInfo = Attributes::SoftwareVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::SoftwareVersionString::Id: { + using TypeInfo = Attributes::SoftwareVersionString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ManufacturingDate::Id: { + using TypeInfo = Attributes::ManufacturingDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::PartNumber::Id: { + using TypeInfo = Attributes::PartNumber::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductURL::Id: { + using TypeInfo = Attributes::ProductURL::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductLabel::Id: { + using TypeInfo = Attributes::ProductLabel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::SerialNumber::Id: { + using TypeInfo = Attributes::SerialNumber::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::LocalConfigDisabled::Id: { + using TypeInfo = Attributes::LocalConfigDisabled::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::Reachable::Id: { + using TypeInfo = Attributes::Reachable::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::UniqueID::Id: { + using TypeInfo = Attributes::UniqueID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::CapabilityMinima::Id: { + using TypeInfo = Attributes::CapabilityMinima::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRBasicInformationClusterCapabilityMinimaStruct * _Nonnull value; + value = [MTRBasicInformationClusterCapabilityMinimaStruct new]; + value.caseSessionsPerFabric = [NSNumber numberWithUnsignedShort:cppValue.caseSessionsPerFabric]; + value.subscriptionsPerFabric = [NSNumber numberWithUnsignedShort:cppValue.subscriptionsPerFabric]; + return value; + } + case Attributes::ProductAppearance::Id: { + using TypeInfo = Attributes::ProductAppearance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRBasicInformationClusterProductAppearanceStruct * _Nonnull value; + value = [MTRBasicInformationClusterProductAppearanceStruct new]; + value.finish = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.finish)]; + if (cppValue.primaryColor.IsNull()) { + value.primaryColor = nil; + } else { + value.primaryColor = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.primaryColor.Value())]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::LevelControl::Id: { - using namespace Clusters::LevelControl; - switch (aPath.mAttributeId) { - case Attributes::CurrentLevel::Id: { - using TypeInfo = Attributes::CurrentLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::RemainingTime::Id: { - using TypeInfo = Attributes::RemainingTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::MinLevel::Id: { - using TypeInfo = Attributes::MinLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MaxLevel::Id: { - using TypeInfo = Attributes::MaxLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CurrentFrequency::Id: { - using TypeInfo = Attributes::CurrentFrequency::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::MinFrequency::Id: { - using TypeInfo = Attributes::MinFrequency::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::MaxFrequency::Id: { - using TypeInfo = Attributes::MaxFrequency::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Options::Id: { - using TypeInfo = Attributes::Options::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::OnOffTransitionTime::Id: { - using TypeInfo = Attributes::OnOffTransitionTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::OnLevel::Id: { - using TypeInfo = Attributes::OnLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::OnTransitionTime::Id: { - using TypeInfo = Attributes::OnTransitionTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::OffTransitionTime::Id: { - using TypeInfo = Attributes::OffTransitionTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::DefaultMoveRate::Id: { - using TypeInfo = Attributes::DefaultMoveRate::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::StartUpCurrentLevel::Id: { - using TypeInfo = Attributes::StartUpCurrentLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForOTASoftwareUpdateProviderCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OtaSoftwareUpdateProvider; + switch (aAttributeId) { + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::BinaryInputBasic::Id: { - using namespace Clusters::BinaryInputBasic; - switch (aPath.mAttributeId) { - case Attributes::ActiveText::Id: { - using TypeInfo = Attributes::ActiveText::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::Description::Id: { - using TypeInfo = Attributes::Description::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::InactiveText::Id: { - using TypeInfo = Attributes::InactiveText::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::OutOfService::Id: { - using TypeInfo = Attributes::OutOfService::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::Polarity::Id: { - using TypeInfo = Attributes::Polarity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::PresentValue::Id: { - using TypeInfo = Attributes::PresentValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::Reliability::Id: { - using TypeInfo = Attributes::Reliability::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::StatusFlags::Id: { - using TypeInfo = Attributes::StatusFlags::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ApplicationType::Id: { - using TypeInfo = Attributes::ApplicationType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForOTASoftwareUpdateRequestorCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OtaSoftwareUpdateRequestor; + switch (aAttributeId) { + case Attributes::DefaultOTAProviders::Id: { + using TypeInfo = Attributes::DefaultOTAProviders::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTROTASoftwareUpdateRequestorClusterProviderLocation * newElement_0; + newElement_0 = [MTROTASoftwareUpdateRequestorClusterProviderLocation new]; + newElement_0.providerNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.providerNodeID]; + newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::UpdatePossible::Id: { + using TypeInfo = Attributes::UpdatePossible::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::UpdateState::Id: { + using TypeInfo = Attributes::UpdateState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::UpdateStateProgress::Id: { + using TypeInfo = Attributes::UpdateStateProgress::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForLocalizationConfigurationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::LocalizationConfiguration; + switch (aAttributeId) { + case Attributes::ActiveLocale::Id: { + using TypeInfo = Attributes::ActiveLocale::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::SupportedLocales::Id: { + using TypeInfo = Attributes::SupportedLocales::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSString * newElement_0; + newElement_0 = [[NSString alloc] initWithBytes:entry_0.data() length:entry_0.size() encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForTimeFormatLocalizationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::TimeFormatLocalization; + switch (aAttributeId) { + case Attributes::HourFormat::Id: { + using TypeInfo = Attributes::HourFormat::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ActiveCalendarType::Id: { + using TypeInfo = Attributes::ActiveCalendarType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::SupportedCalendarTypes::Id: { + using TypeInfo = Attributes::SupportedCalendarTypes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForUnitLocalizationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::UnitLocalization; + switch (aAttributeId) { + case Attributes::TemperatureUnit::Id: { + using TypeInfo = Attributes::TemperatureUnit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForPowerSourceConfigurationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PowerSourceConfiguration; + switch (aAttributeId) { + case Attributes::Sources::Id: { + using TypeInfo = Attributes::Sources::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForPowerSourceCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PowerSource; + switch (aAttributeId) { + case Attributes::Status::Id: { + using TypeInfo = Attributes::Status::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::Order::Id: { + using TypeInfo = Attributes::Order::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Description::Id: { + using TypeInfo = Attributes::Description::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::WiredAssessedInputVoltage::Id: { + using TypeInfo = Attributes::WiredAssessedInputVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::WiredAssessedInputFrequency::Id: { + using TypeInfo = Attributes::WiredAssessedInputFrequency::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::WiredCurrentType::Id: { + using TypeInfo = Attributes::WiredCurrentType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::WiredAssessedCurrent::Id: { + using TypeInfo = Attributes::WiredAssessedCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::WiredNominalVoltage::Id: { + using TypeInfo = Attributes::WiredNominalVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::WiredMaximumCurrent::Id: { + using TypeInfo = Attributes::WiredMaximumCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::WiredPresent::Id: { + using TypeInfo = Attributes::WiredPresent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::ActiveWiredFaults::Id: { + using TypeInfo = Attributes::ActiveWiredFaults::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::BatVoltage::Id: { + using TypeInfo = Attributes::BatVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::BatPercentRemaining::Id: { + using TypeInfo = Attributes::BatPercentRemaining::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::BatTimeRemaining::Id: { + using TypeInfo = Attributes::BatTimeRemaining::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::BatChargeLevel::Id: { + using TypeInfo = Attributes::BatChargeLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::BatReplacementNeeded::Id: { + using TypeInfo = Attributes::BatReplacementNeeded::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::BatReplaceability::Id: { + using TypeInfo = Attributes::BatReplaceability::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::BatPresent::Id: { + using TypeInfo = Attributes::BatPresent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::ActiveBatFaults::Id: { + using TypeInfo = Attributes::ActiveBatFaults::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::BatReplacementDescription::Id: { + using TypeInfo = Attributes::BatReplacementDescription::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::BatCommonDesignation::Id: { + using TypeInfo = Attributes::BatCommonDesignation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::BatANSIDesignation::Id: { + using TypeInfo = Attributes::BatANSIDesignation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::BatIECDesignation::Id: { + using TypeInfo = Attributes::BatIECDesignation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::BatApprovedChemistry::Id: { + using TypeInfo = Attributes::BatApprovedChemistry::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::BatCapacity::Id: { + using TypeInfo = Attributes::BatCapacity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::BatQuantity::Id: { + using TypeInfo = Attributes::BatQuantity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::BatChargeState::Id: { + using TypeInfo = Attributes::BatChargeState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::BatTimeToFullCharge::Id: { + using TypeInfo = Attributes::BatTimeToFullCharge::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::BatFunctionalWhileCharging::Id: { + using TypeInfo = Attributes::BatFunctionalWhileCharging::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::BatChargingCurrent::Id: { + using TypeInfo = Attributes::BatChargingCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::ActiveBatChargeFaults::Id: { + using TypeInfo = Attributes::ActiveBatChargeFaults::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForGeneralCommissioningCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::GeneralCommissioning; + switch (aAttributeId) { + case Attributes::Breadcrumb::Id: { + using TypeInfo = Attributes::Breadcrumb::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::BasicCommissioningInfo::Id: { + using TypeInfo = Attributes::BasicCommissioningInfo::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nonnull value; + value = [MTRGeneralCommissioningClusterBasicCommissioningInfo new]; + value.failSafeExpiryLengthSeconds = [NSNumber numberWithUnsignedShort:cppValue.failSafeExpiryLengthSeconds]; + value.maxCumulativeFailsafeSeconds = [NSNumber numberWithUnsignedShort:cppValue.maxCumulativeFailsafeSeconds]; + return value; + } + case Attributes::RegulatoryConfig::Id: { + using TypeInfo = Attributes::RegulatoryConfig::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::LocationCapability::Id: { + using TypeInfo = Attributes::LocationCapability::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::SupportsConcurrentConnection::Id: { + using TypeInfo = Attributes::SupportsConcurrentConnection::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForNetworkCommissioningCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::NetworkCommissioning; + switch (aAttributeId) { + case Attributes::MaxNetworks::Id: { + using TypeInfo = Attributes::MaxNetworks::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Networks::Id: { + using TypeInfo = Attributes::Networks::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRNetworkCommissioningClusterNetworkInfo * newElement_0; + newElement_0 = [MTRNetworkCommissioningClusterNetworkInfo new]; + newElement_0.networkID = [NSData dataWithBytes:entry_0.networkID.data() length:entry_0.networkID.size()]; + newElement_0.connected = [NSNumber numberWithBool:entry_0.connected]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ScanMaxTimeSeconds::Id: { + using TypeInfo = Attributes::ScanMaxTimeSeconds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ConnectMaxTimeSeconds::Id: { + using TypeInfo = Attributes::ConnectMaxTimeSeconds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::InterfaceEnabled::Id: { + using TypeInfo = Attributes::InterfaceEnabled::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::LastNetworkingStatus::Id: { + using TypeInfo = Attributes::LastNetworkingStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::LastNetworkID::Id: { + using TypeInfo = Attributes::LastNetworkID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; + } + return value; + } + case Attributes::LastConnectErrorValue::Id: { + using TypeInfo = Attributes::LastConnectErrorValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithInt:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForDiagnosticLogsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::DiagnosticLogs; + switch (aAttributeId) { + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForGeneralDiagnosticsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::GeneralDiagnostics; + switch (aAttributeId) { + case Attributes::NetworkInterfaces::Id: { + using TypeInfo = Attributes::NetworkInterfaces::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRGeneralDiagnosticsClusterNetworkInterface * newElement_0; + newElement_0 = [MTRGeneralDiagnosticsClusterNetworkInterface new]; + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() + length:entry_0.name.size() + encoding:NSUTF8StringEncoding]; + newElement_0.isOperational = [NSNumber numberWithBool:entry_0.isOperational]; + if (entry_0.offPremiseServicesReachableIPv4.IsNull()) { + newElement_0.offPremiseServicesReachableIPv4 = nil; + } else { + newElement_0.offPremiseServicesReachableIPv4 = + [NSNumber numberWithBool:entry_0.offPremiseServicesReachableIPv4.Value()]; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.offPremiseServicesReachableIPv6.IsNull()) { + newElement_0.offPremiseServicesReachableIPv6 = nil; + } else { + newElement_0.offPremiseServicesReachableIPv6 = + [NSNumber numberWithBool:entry_0.offPremiseServicesReachableIPv6.Value()]; + } + newElement_0.hardwareAddress = [NSData dataWithBytes:entry_0.hardwareAddress.data() + length:entry_0.hardwareAddress.size()]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.IPv4Addresses.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSData * newElement_2; + newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.iPv4Addresses = array_2; + } + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.IPv6Addresses.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSData * newElement_2; + newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.iPv6Addresses = array_2; } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; + [array_0 addObject:newElement_0]; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::RebootCount::Id: { + using TypeInfo = Attributes::RebootCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::UpTime::Id: { + using TypeInfo = Attributes::UpTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::TotalOperationalHours::Id: { + using TypeInfo = Attributes::TotalOperationalHours::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::BootReason::Id: { + using TypeInfo = Attributes::BootReason::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ActiveHardwareFaults::Id: { + using TypeInfo = Attributes::ActiveHardwareFaults::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ActiveRadioFaults::Id: { + using TypeInfo = Attributes::ActiveRadioFaults::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ActiveNetworkFaults::Id: { + using TypeInfo = Attributes::ActiveNetworkFaults::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::TestEventTriggersEnabled::Id: { + using TypeInfo = Attributes::TestEventTriggersEnabled::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::Descriptor::Id: { - using namespace Clusters::Descriptor; - switch (aPath.mAttributeId) { - case Attributes::DeviceTypeList::Id: { - using TypeInfo = Attributes::DeviceTypeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRDescriptorClusterDeviceTypeStruct * newElement_0; - newElement_0 = [MTRDescriptorClusterDeviceTypeStruct new]; - newElement_0.deviceType = [NSNumber numberWithUnsignedInt:entry_0.deviceType]; - newElement_0.revision = [NSNumber numberWithUnsignedShort:entry_0.revision]; - [array_0 addObject:newElement_0]; + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForSoftwareDiagnosticsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::SoftwareDiagnostics; + switch (aAttributeId) { + case Attributes::ThreadMetrics::Id: { + using TypeInfo = Attributes::ThreadMetrics::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRSoftwareDiagnosticsClusterThreadMetricsStruct * newElement_0; + newElement_0 = [MTRSoftwareDiagnosticsClusterThreadMetricsStruct new]; + newElement_0.id = [NSNumber numberWithUnsignedLongLong:entry_0.id]; + if (entry_0.name.HasValue()) { + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().data() + length:entry_0.name.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.name = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.stackFreeCurrent.HasValue()) { + newElement_0.stackFreeCurrent = [NSNumber numberWithUnsignedInt:entry_0.stackFreeCurrent.Value()]; + } else { + newElement_0.stackFreeCurrent = nil; } - value = array_0; - } - return value; - } - case Attributes::ServerList::Id: { - using TypeInfo = Attributes::ServerList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + if (entry_0.stackFreeMinimum.HasValue()) { + newElement_0.stackFreeMinimum = [NSNumber numberWithUnsignedInt:entry_0.stackFreeMinimum.Value()]; + } else { + newElement_0.stackFreeMinimum = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.stackSize.HasValue()) { + newElement_0.stackSize = [NSNumber numberWithUnsignedInt:entry_0.stackSize.Value()]; + } else { + newElement_0.stackSize = nil; } - value = array_0; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::ClientList::Id: { - using TypeInfo = Attributes::ClientList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; + value = array_0; } - case Attributes::PartsList::Id: { - using TypeInfo = Attributes::PartsList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + return value; + } + case Attributes::CurrentHeapFree::Id: { + using TypeInfo = Attributes::CurrentHeapFree::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::CurrentHeapUsed::Id: { + using TypeInfo = Attributes::CurrentHeapUsed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::CurrentHeapHighWatermark::Id: { + using TypeInfo = Attributes::CurrentHeapHighWatermark::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForThreadNetworkDiagnosticsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ThreadNetworkDiagnostics; + switch (aAttributeId) { + case Attributes::Channel::Id: { + using TypeInfo = Attributes::Channel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::RoutingRole::Id: { + using TypeInfo = Attributes::RoutingRole::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::NetworkName::Id: { + using TypeInfo = Attributes::NetworkName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [[NSString alloc] initWithBytes:cppValue.Value().data() + length:cppValue.Value().size() + encoding:NSUTF8StringEncoding]; + } + return value; + } + case Attributes::PanId::Id: { + using TypeInfo = Attributes::PanId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::ExtendedPanId::Id: { + using TypeInfo = Attributes::ExtendedPanId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::MeshLocalPrefix::Id: { + using TypeInfo = Attributes::MeshLocalPrefix::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; + } + return value; + } + case Attributes::OverrunCount::Id: { + using TypeInfo = Attributes::OverrunCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::NeighborTable::Id: { + using TypeInfo = Attributes::NeighborTable::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRThreadNetworkDiagnosticsClusterNeighborTable * newElement_0; + newElement_0 = [MTRThreadNetworkDiagnosticsClusterNeighborTable new]; + newElement_0.extAddress = [NSNumber numberWithUnsignedLongLong:entry_0.extAddress]; + newElement_0.age = [NSNumber numberWithUnsignedInt:entry_0.age]; + newElement_0.rloc16 = [NSNumber numberWithUnsignedShort:entry_0.rloc16]; + newElement_0.linkFrameCounter = [NSNumber numberWithUnsignedInt:entry_0.linkFrameCounter]; + newElement_0.mleFrameCounter = [NSNumber numberWithUnsignedInt:entry_0.mleFrameCounter]; + newElement_0.lqi = [NSNumber numberWithUnsignedChar:entry_0.lqi]; + if (entry_0.averageRssi.IsNull()) { + newElement_0.averageRssi = nil; + } else { + newElement_0.averageRssi = [NSNumber numberWithChar:entry_0.averageRssi.Value()]; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.lastRssi.IsNull()) { + newElement_0.lastRssi = nil; + } else { + newElement_0.lastRssi = [NSNumber numberWithChar:entry_0.lastRssi.Value()]; } - value = array_0; + newElement_0.frameErrorRate = [NSNumber numberWithUnsignedChar:entry_0.frameErrorRate]; + newElement_0.messageErrorRate = [NSNumber numberWithUnsignedChar:entry_0.messageErrorRate]; + newElement_0.rxOnWhenIdle = [NSNumber numberWithBool:entry_0.rxOnWhenIdle]; + newElement_0.fullThreadDevice = [NSNumber numberWithBool:entry_0.fullThreadDevice]; + newElement_0.fullNetworkData = [NSNumber numberWithBool:entry_0.fullNetworkData]; + newElement_0.isChild = [NSNumber numberWithBool:entry_0.isChild]; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; + value = array_0; } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + return value; + } + case Attributes::RouteTable::Id: { + using TypeInfo = Attributes::RouteTable::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRThreadNetworkDiagnosticsClusterRouteTable * newElement_0; + newElement_0 = [MTRThreadNetworkDiagnosticsClusterRouteTable new]; + newElement_0.extAddress = [NSNumber numberWithUnsignedLongLong:entry_0.extAddress]; + newElement_0.rloc16 = [NSNumber numberWithUnsignedShort:entry_0.rloc16]; + newElement_0.routerId = [NSNumber numberWithUnsignedChar:entry_0.routerId]; + newElement_0.nextHop = [NSNumber numberWithUnsignedChar:entry_0.nextHop]; + newElement_0.pathCost = [NSNumber numberWithUnsignedChar:entry_0.pathCost]; + newElement_0.lqiIn = [NSNumber numberWithUnsignedChar:entry_0.LQIIn]; + newElement_0.lqiOut = [NSNumber numberWithUnsignedChar:entry_0.LQIOut]; + newElement_0.age = [NSNumber numberWithUnsignedChar:entry_0.age]; + newElement_0.allocated = [NSNumber numberWithBool:entry_0.allocated]; + newElement_0.linkEstablished = [NSNumber numberWithBool:entry_0.linkEstablished]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::PartitionId::Id: { + using TypeInfo = Attributes::PartitionId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::Weighting::Id: { + using TypeInfo = Attributes::Weighting::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::DataVersion::Id: { + using TypeInfo = Attributes::DataVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::StableDataVersion::Id: { + using TypeInfo = Attributes::StableDataVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::LeaderRouterId::Id: { + using TypeInfo = Attributes::LeaderRouterId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::DetachedRoleCount::Id: { + using TypeInfo = Attributes::DetachedRoleCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ChildRoleCount::Id: { + using TypeInfo = Attributes::ChildRoleCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RouterRoleCount::Id: { + using TypeInfo = Attributes::RouterRoleCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::LeaderRoleCount::Id: { + using TypeInfo = Attributes::LeaderRoleCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AttachAttemptCount::Id: { + using TypeInfo = Attributes::AttachAttemptCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PartitionIdChangeCount::Id: { + using TypeInfo = Attributes::PartitionIdChangeCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BetterPartitionAttachAttemptCount::Id: { + using TypeInfo = Attributes::BetterPartitionAttachAttemptCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ParentChangeCount::Id: { + using TypeInfo = Attributes::ParentChangeCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::TxTotalCount::Id: { + using TypeInfo = Attributes::TxTotalCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxUnicastCount::Id: { + using TypeInfo = Attributes::TxUnicastCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxBroadcastCount::Id: { + using TypeInfo = Attributes::TxBroadcastCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxAckRequestedCount::Id: { + using TypeInfo = Attributes::TxAckRequestedCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxAckedCount::Id: { + using TypeInfo = Attributes::TxAckedCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxNoAckRequestedCount::Id: { + using TypeInfo = Attributes::TxNoAckRequestedCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxDataCount::Id: { + using TypeInfo = Attributes::TxDataCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxDataPollCount::Id: { + using TypeInfo = Attributes::TxDataPollCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxBeaconCount::Id: { + using TypeInfo = Attributes::TxBeaconCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxBeaconRequestCount::Id: { + using TypeInfo = Attributes::TxBeaconRequestCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxOtherCount::Id: { + using TypeInfo = Attributes::TxOtherCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxRetryCount::Id: { + using TypeInfo = Attributes::TxRetryCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxDirectMaxRetryExpiryCount::Id: { + using TypeInfo = Attributes::TxDirectMaxRetryExpiryCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxIndirectMaxRetryExpiryCount::Id: { + using TypeInfo = Attributes::TxIndirectMaxRetryExpiryCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxErrCcaCount::Id: { + using TypeInfo = Attributes::TxErrCcaCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxErrAbortCount::Id: { + using TypeInfo = Attributes::TxErrAbortCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::TxErrBusyChannelCount::Id: { + using TypeInfo = Attributes::TxErrBusyChannelCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxTotalCount::Id: { + using TypeInfo = Attributes::RxTotalCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxUnicastCount::Id: { + using TypeInfo = Attributes::RxUnicastCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxBroadcastCount::Id: { + using TypeInfo = Attributes::RxBroadcastCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxDataCount::Id: { + using TypeInfo = Attributes::RxDataCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxDataPollCount::Id: { + using TypeInfo = Attributes::RxDataPollCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxBeaconCount::Id: { + using TypeInfo = Attributes::RxBeaconCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxBeaconRequestCount::Id: { + using TypeInfo = Attributes::RxBeaconRequestCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxOtherCount::Id: { + using TypeInfo = Attributes::RxOtherCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxAddressFilteredCount::Id: { + using TypeInfo = Attributes::RxAddressFilteredCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxDestAddrFilteredCount::Id: { + using TypeInfo = Attributes::RxDestAddrFilteredCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxDuplicatedCount::Id: { + using TypeInfo = Attributes::RxDuplicatedCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxErrNoFrameCount::Id: { + using TypeInfo = Attributes::RxErrNoFrameCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxErrUnknownNeighborCount::Id: { + using TypeInfo = Attributes::RxErrUnknownNeighborCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxErrInvalidSrcAddrCount::Id: { + using TypeInfo = Attributes::RxErrInvalidSrcAddrCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxErrSecCount::Id: { + using TypeInfo = Attributes::RxErrSecCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxErrFcsCount::Id: { + using TypeInfo = Attributes::RxErrFcsCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::RxErrOtherCount::Id: { + using TypeInfo = Attributes::RxErrOtherCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ActiveTimestamp::Id: { + using TypeInfo = Attributes::ActiveTimestamp::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::PendingTimestamp::Id: { + using TypeInfo = Attributes::PendingTimestamp::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::Delay::Id: { + using TypeInfo = Attributes::Delay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::SecurityPolicy::Id: { + using TypeInfo = Attributes::SecurityPolicy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRThreadNetworkDiagnosticsClusterSecurityPolicy * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRThreadNetworkDiagnosticsClusterSecurityPolicy new]; + value.rotationTime = [NSNumber numberWithUnsignedShort:cppValue.Value().rotationTime]; + value.flags = [NSNumber numberWithUnsignedShort:cppValue.Value().flags]; + } + return value; + } + case Attributes::ChannelPage0Mask::Id: { + using TypeInfo = Attributes::ChannelPage0Mask::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; + } + return value; + } + case Attributes::OperationalDatasetComponents::Id: { + using TypeInfo = Attributes::OperationalDatasetComponents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents new]; + value.activeTimestampPresent = [NSNumber numberWithBool:cppValue.Value().activeTimestampPresent]; + value.pendingTimestampPresent = [NSNumber numberWithBool:cppValue.Value().pendingTimestampPresent]; + value.masterKeyPresent = [NSNumber numberWithBool:cppValue.Value().masterKeyPresent]; + value.networkNamePresent = [NSNumber numberWithBool:cppValue.Value().networkNamePresent]; + value.extendedPanIdPresent = [NSNumber numberWithBool:cppValue.Value().extendedPanIdPresent]; + value.meshLocalPrefixPresent = [NSNumber numberWithBool:cppValue.Value().meshLocalPrefixPresent]; + value.delayPresent = [NSNumber numberWithBool:cppValue.Value().delayPresent]; + value.panIdPresent = [NSNumber numberWithBool:cppValue.Value().panIdPresent]; + value.channelPresent = [NSNumber numberWithBool:cppValue.Value().channelPresent]; + value.pskcPresent = [NSNumber numberWithBool:cppValue.Value().pskcPresent]; + value.securityPolicyPresent = [NSNumber numberWithBool:cppValue.Value().securityPolicyPresent]; + value.channelMaskPresent = [NSNumber numberWithBool:cppValue.Value().channelMaskPresent]; + } + return value; + } + case Attributes::ActiveNetworkFaultsList::Id: { + using TypeInfo = Attributes::ActiveNetworkFaultsList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForWiFiNetworkDiagnosticsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WiFiNetworkDiagnostics; + switch (aAttributeId) { + case Attributes::Bssid::Id: { + using TypeInfo = Attributes::Bssid::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; + } + return value; + } + case Attributes::SecurityType::Id: { + using TypeInfo = Attributes::SecurityType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::WiFiVersion::Id: { + using TypeInfo = Attributes::WiFiVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::ChannelNumber::Id: { + using TypeInfo = Attributes::ChannelNumber::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::Rssi::Id: { + using TypeInfo = Attributes::Rssi::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithChar:cppValue.Value()]; + } + return value; + } + case Attributes::BeaconLostCount::Id: { + using TypeInfo = Attributes::BeaconLostCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::BeaconRxCount::Id: { + using TypeInfo = Attributes::BeaconRxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::PacketMulticastRxCount::Id: { + using TypeInfo = Attributes::PacketMulticastRxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::PacketMulticastTxCount::Id: { + using TypeInfo = Attributes::PacketMulticastTxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::PacketUnicastRxCount::Id: { + using TypeInfo = Attributes::PacketUnicastRxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::PacketUnicastTxCount::Id: { + using TypeInfo = Attributes::PacketUnicastTxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::CurrentMaxRate::Id: { + using TypeInfo = Attributes::CurrentMaxRate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::OverrunCount::Id: { + using TypeInfo = Attributes::OverrunCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForEthernetNetworkDiagnosticsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::EthernetNetworkDiagnostics; + switch (aAttributeId) { + case Attributes::PHYRate::Id: { + using TypeInfo = Attributes::PHYRate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::FullDuplex::Id: { + using TypeInfo = Attributes::FullDuplex::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithBool:cppValue.Value()]; + } + return value; + } + case Attributes::PacketRxCount::Id: { + using TypeInfo = Attributes::PacketRxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::PacketTxCount::Id: { + using TypeInfo = Attributes::PacketTxCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::TxErrCount::Id: { + using TypeInfo = Attributes::TxErrCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::CollisionCount::Id: { + using TypeInfo = Attributes::CollisionCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::OverrunCount::Id: { + using TypeInfo = Attributes::OverrunCount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::CarrierDetect::Id: { + using TypeInfo = Attributes::CarrierDetect::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithBool:cppValue.Value()]; + } + return value; + } + case Attributes::TimeSinceReset::Id: { + using TypeInfo = Attributes::TimeSinceReset::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBridgedDeviceBasicInformationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BridgedDeviceBasicInformation; + switch (aAttributeId) { + case Attributes::VendorName::Id: { + using TypeInfo = Attributes::VendorName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::VendorID::Id: { + using TypeInfo = Attributes::VendorID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ProductName::Id: { + using TypeInfo = Attributes::ProductName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::NodeLabel::Id: { + using TypeInfo = Attributes::NodeLabel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::HardwareVersion::Id: { + using TypeInfo = Attributes::HardwareVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::HardwareVersionString::Id: { + using TypeInfo = Attributes::HardwareVersionString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::SoftwareVersion::Id: { + using TypeInfo = Attributes::SoftwareVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::SoftwareVersionString::Id: { + using TypeInfo = Attributes::SoftwareVersionString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ManufacturingDate::Id: { + using TypeInfo = Attributes::ManufacturingDate::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::PartNumber::Id: { + using TypeInfo = Attributes::PartNumber::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductURL::Id: { + using TypeInfo = Attributes::ProductURL::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductLabel::Id: { + using TypeInfo = Attributes::ProductLabel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::SerialNumber::Id: { + using TypeInfo = Attributes::SerialNumber::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::Reachable::Id: { + using TypeInfo = Attributes::Reachable::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::UniqueID::Id: { + using TypeInfo = Attributes::UniqueID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductAppearance::Id: { + using TypeInfo = Attributes::ProductAppearance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct * _Nonnull value; + value = [MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct new]; + value.finish = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.finish)]; + if (cppValue.primaryColor.IsNull()) { + value.primaryColor = nil; + } else { + value.primaryColor = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.primaryColor.Value())]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForSwitchCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Switch; + switch (aAttributeId) { + case Attributes::NumberOfPositions::Id: { + using TypeInfo = Attributes::NumberOfPositions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CurrentPosition::Id: { + using TypeInfo = Attributes::CurrentPosition::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MultiPressMax::Id: { + using TypeInfo = Attributes::MultiPressMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForAdministratorCommissioningCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AdministratorCommissioning; + switch (aAttributeId) { + case Attributes::WindowStatus::Id: { + using TypeInfo = Attributes::WindowStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::AdminFabricIndex::Id: { + using TypeInfo = Attributes::AdminFabricIndex::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::AdminVendorId::Id: { + using TypeInfo = Attributes::AdminVendorId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForOperationalCredentialsCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OperationalCredentials; + switch (aAttributeId) { + case Attributes::NOCs::Id: { + using TypeInfo = Attributes::NOCs::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTROperationalCredentialsClusterNOCStruct * newElement_0; + newElement_0 = [MTROperationalCredentialsClusterNOCStruct new]; + newElement_0.noc = [NSData dataWithBytes:entry_0.noc.data() length:entry_0.noc.size()]; + if (entry_0.icac.IsNull()) { + newElement_0.icac = nil; + } else { + newElement_0.icac = [NSData dataWithBytes:entry_0.icac.Value().data() length:entry_0.icac.Value().size()]; } - value = array_0; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; + value = array_0; } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + return value; + } + case Attributes::Fabrics::Id: { + using TypeInfo = Attributes::Fabrics::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTROperationalCredentialsClusterFabricDescriptorStruct * newElement_0; + newElement_0 = [MTROperationalCredentialsClusterFabricDescriptorStruct new]; + newElement_0.rootPublicKey = [NSData dataWithBytes:entry_0.rootPublicKey.data() + length:entry_0.rootPublicKey.size()]; + newElement_0.vendorID = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.vendorID)]; + newElement_0.fabricID = [NSNumber numberWithUnsignedLongLong:entry_0.fabricID]; + newElement_0.nodeID = [NSNumber numberWithUnsignedLongLong:entry_0.nodeID]; + newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() + length:entry_0.label.size() + encoding:NSUTF8StringEncoding]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::SupportedFabrics::Id: { + using TypeInfo = Attributes::SupportedFabrics::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CommissionedFabrics::Id: { + using TypeInfo = Attributes::CommissionedFabrics::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::TrustedRootCertificates::Id: { + using TypeInfo = Attributes::TrustedRootCertificates::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSData * newElement_0; + newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::CurrentFabricIndex::Id: { + using TypeInfo = Attributes::CurrentFabricIndex::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::Binding::Id: { - using namespace Clusters::Binding; - switch (aPath.mAttributeId) { - case Attributes::Binding::Id: { - using TypeInfo = Attributes::Binding::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRBindingClusterTargetStruct * newElement_0; - newElement_0 = [MTRBindingClusterTargetStruct new]; - if (entry_0.node.HasValue()) { - newElement_0.node = [NSNumber numberWithUnsignedLongLong:entry_0.node.Value()]; - } else { - newElement_0.node = nil; - } - if (entry_0.group.HasValue()) { - newElement_0.group = [NSNumber numberWithUnsignedShort:entry_0.group.Value()]; - } else { - newElement_0.group = nil; - } - if (entry_0.endpoint.HasValue()) { - newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint.Value()]; - } else { - newElement_0.endpoint = nil; + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForGroupKeyManagementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::GroupKeyManagement; + switch (aAttributeId) { + case Attributes::GroupKeyMap::Id: { + using TypeInfo = Attributes::GroupKeyMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; + newElement_0 = [MTRGroupKeyManagementClusterGroupKeyMapStruct new]; + newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; + newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GroupTable::Id: { + using TypeInfo = Attributes::GroupTable::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRGroupKeyManagementClusterGroupInfoMapStruct * newElement_0; + newElement_0 = [MTRGroupKeyManagementClusterGroupInfoMapStruct new]; + newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.endpoints.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSNumber * newElement_2; + newElement_2 = [NSNumber numberWithUnsignedShort:entry_2]; + [array_2 addObject:newElement_2]; } - if (entry_0.cluster.HasValue()) { - newElement_0.cluster = [NSNumber numberWithUnsignedInt:entry_0.cluster.Value()]; - } else { - newElement_0.cluster = nil; + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; + newElement_0.endpoints = array_2; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.groupName.HasValue()) { + newElement_0.groupName = [[NSString alloc] initWithBytes:entry_0.groupName.Value().data() + length:entry_0.groupName.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.groupName = nil; } - value = array_0; + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; + value = array_0; } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; + return value; + } + case Attributes::MaxGroupsPerFabric::Id: { + using TypeInfo = Attributes::MaxGroupsPerFabric::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::MaxGroupKeysPerFabric::Id: { + using TypeInfo = Attributes::MaxGroupKeysPerFabric::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForFixedLabelCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::FixedLabel; + switch (aAttributeId) { + case Attributes::LabelList::Id: { + using TypeInfo = Attributes::LabelList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRFixedLabelClusterLabelStruct * newElement_0; + newElement_0 = [MTRFixedLabelClusterLabelStruct new]; + newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() + length:entry_0.label.size() + encoding:NSUTF8StringEncoding]; + newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() + length:entry_0.value.size() + encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; + value = array_0; } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForUserLabelCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::UserLabel; + switch (aAttributeId) { + case Attributes::LabelList::Id: { + using TypeInfo = Attributes::LabelList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRUserLabelClusterLabelStruct * newElement_0; + newElement_0 = [MTRUserLabelClusterLabelStruct new]; + newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() + length:entry_0.label.size() + encoding:NSUTF8StringEncoding]; + newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() + length:entry_0.value.size() + encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::AccessControl::Id: { - using namespace Clusters::AccessControl; - switch (aPath.mAttributeId) { - case Attributes::Acl::Id: { - using TypeInfo = Attributes::Acl::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRAccessControlClusterAccessControlEntryStruct * newElement_0; - newElement_0 = [MTRAccessControlClusterAccessControlEntryStruct new]; - newElement_0.privilege = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.privilege)]; - newElement_0.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.authMode)]; - if (entry_0.subjects.IsNull()) { - newElement_0.subjects = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = entry_0.subjects.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; - [array_3 addObject:newElement_3]; - } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.subjects = array_3; - } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBooleanStateCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BooleanState; + switch (aAttributeId) { + case Attributes::StateValue::Id: { + using TypeInfo = Attributes::StateValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForModeSelectCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ModeSelect; + switch (aAttributeId) { + case Attributes::Description::Id: { + using TypeInfo = Attributes::Description::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::StandardNamespace::Id: { + using TypeInfo = Attributes::StandardNamespace::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::SupportedModes::Id: { + using TypeInfo = Attributes::SupportedModes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRModeSelectClusterModeOptionStruct * newElement_0; + newElement_0 = [MTRModeSelectClusterModeOptionStruct new]; + newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() + length:entry_0.label.size() + encoding:NSUTF8StringEncoding]; + newElement_0.mode = [NSNumber numberWithUnsignedChar:entry_0.mode]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.semanticTags.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRModeSelectClusterSemanticTagStruct * newElement_2; + newElement_2 = [MTRModeSelectClusterSemanticTagStruct new]; + newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode)]; + newElement_2.value = [NSNumber numberWithUnsignedShort:entry_2.value]; + [array_2 addObject:newElement_2]; } - if (entry_0.targets.IsNull()) { - newElement_0.targets = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = entry_0.targets.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - MTRAccessControlClusterTarget * newElement_3; - newElement_3 = [MTRAccessControlClusterTarget new]; - if (entry_3.cluster.IsNull()) { - newElement_3.cluster = nil; - } else { - newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; - } - if (entry_3.endpoint.IsNull()) { - newElement_3.endpoint = nil; - } else { - newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; - } - if (entry_3.deviceType.IsNull()) { - newElement_3.deviceType = nil; - } else { - newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; - } - [array_3 addObject:newElement_3]; - } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.targets = array_3; - } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::Extension::Id: { - using TypeInfo = Attributes::Extension::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRAccessControlClusterAccessControlExtensionStruct * newElement_0; - newElement_0 = [MTRAccessControlClusterAccessControlExtensionStruct new]; - newElement_0.data = [NSData dataWithBytes:entry_0.data.data() length:entry_0.data.size()]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + newElement_0.semanticTags = array_2; } - value = array_0; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::SubjectsPerAccessControlEntry::Id: { - using TypeInfo = Attributes::SubjectsPerAccessControlEntry::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::TargetsPerAccessControlEntry::Id: { - using TypeInfo = Attributes::TargetsPerAccessControlEntry::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AccessControlEntriesPerFabric::Id: { - using TypeInfo = Attributes::AccessControlEntriesPerFabric::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::CurrentMode::Id: { + using TypeInfo = Attributes::CurrentMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::StartUpMode::Id: { + using TypeInfo = Attributes::StartUpMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::OnMode::Id: { + using TypeInfo = Attributes::OnMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::Actions::Id: { - using namespace Clusters::Actions; - switch (aPath.mAttributeId) { - case Attributes::ActionList::Id: { - using TypeInfo = Attributes::ActionList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRActionsClusterActionStruct * newElement_0; - newElement_0 = [MTRActionsClusterActionStruct new]; - newElement_0.actionID = [NSNumber numberWithUnsignedShort:entry_0.actionID]; - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() - length:entry_0.name.size() - encoding:NSUTF8StringEncoding]; - newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; - newElement_0.endpointListID = [NSNumber numberWithUnsignedShort:entry_0.endpointListID]; - newElement_0.supportedCommands = [NSNumber numberWithUnsignedShort:entry_0.supportedCommands.Raw()]; - newElement_0.state = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.state)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::EndpointLists::Id: { - using TypeInfo = Attributes::EndpointLists::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRActionsClusterEndpointListStruct * newElement_0; - newElement_0 = [MTRActionsClusterEndpointListStruct new]; - newElement_0.endpointListID = [NSNumber numberWithUnsignedShort:entry_0.endpointListID]; - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() - length:entry_0.name.size() - encoding:NSUTF8StringEncoding]; - newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.endpoints.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedShort:entry_2]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.endpoints = array_2; - } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::SetupURL::Id: { - using TypeInfo = Attributes::SetupURL::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForDoorLockCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::DoorLock; + switch (aAttributeId) { + case Attributes::LockState::Id: { + using TypeInfo = Attributes::LockState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::LockType::Id: { + using TypeInfo = Attributes::LockType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ActuatorEnabled::Id: { + using TypeInfo = Attributes::ActuatorEnabled::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::DoorState::Id: { + using TypeInfo = Attributes::DoorState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::DoorOpenEvents::Id: { + using TypeInfo = Attributes::DoorOpenEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::DoorClosedEvents::Id: { + using TypeInfo = Attributes::DoorClosedEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::OpenPeriod::Id: { + using TypeInfo = Attributes::OpenPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::NumberOfTotalUsersSupported::Id: { + using TypeInfo = Attributes::NumberOfTotalUsersSupported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::NumberOfPINUsersSupported::Id: { + using TypeInfo = Attributes::NumberOfPINUsersSupported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::NumberOfRFIDUsersSupported::Id: { + using TypeInfo = Attributes::NumberOfRFIDUsersSupported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id: { + using TypeInfo = Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id: { + using TypeInfo = Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfHolidaySchedulesSupported::Id: { + using TypeInfo = Attributes::NumberOfHolidaySchedulesSupported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MaxPINCodeLength::Id: { + using TypeInfo = Attributes::MaxPINCodeLength::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MinPINCodeLength::Id: { + using TypeInfo = Attributes::MinPINCodeLength::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MaxRFIDCodeLength::Id: { + using TypeInfo = Attributes::MaxRFIDCodeLength::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MinRFIDCodeLength::Id: { + using TypeInfo = Attributes::MinRFIDCodeLength::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CredentialRulesSupport::Id: { + using TypeInfo = Attributes::CredentialRulesSupport::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::NumberOfCredentialsSupportedPerUser::Id: { + using TypeInfo = Attributes::NumberOfCredentialsSupportedPerUser::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Language::Id: { + using TypeInfo = Attributes::Language::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::LEDSettings::Id: { + using TypeInfo = Attributes::LEDSettings::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::AutoRelockTime::Id: { + using TypeInfo = Attributes::AutoRelockTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::SoundVolume::Id: { + using TypeInfo = Attributes::SoundVolume::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::OperatingMode::Id: { + using TypeInfo = Attributes::OperatingMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::SupportedOperatingModes::Id: { + using TypeInfo = Attributes::SupportedOperatingModes::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; + return value; + } + case Attributes::DefaultConfigurationRegister::Id: { + using TypeInfo = Attributes::DefaultConfigurationRegister::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; + return value; + } + case Attributes::EnableLocalProgramming::Id: { + using TypeInfo = Attributes::EnableLocalProgramming::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::EnableOneTouchLocking::Id: { + using TypeInfo = Attributes::EnableOneTouchLocking::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::EnableInsideStatusLED::Id: { + using TypeInfo = Attributes::EnableInsideStatusLED::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::EnablePrivacyModeButton::Id: { + using TypeInfo = Attributes::EnablePrivacyModeButton::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::LocalProgrammingFeatures::Id: { + using TypeInfo = Attributes::LocalProgrammingFeatures::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::WrongCodeEntryLimit::Id: { + using TypeInfo = Attributes::WrongCodeEntryLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::UserCodeTemporaryDisableTime::Id: { + using TypeInfo = Attributes::UserCodeTemporaryDisableTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::SendPINOverTheAir::Id: { + using TypeInfo = Attributes::SendPINOverTheAir::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::RequirePINforRemoteOperation::Id: { + using TypeInfo = Attributes::RequirePINforRemoteOperation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::ExpiringUserTimeout::Id: { + using TypeInfo = Attributes::ExpiringUserTimeout::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::BasicInformation::Id: { - using namespace Clusters::BasicInformation; - switch (aPath.mAttributeId) { - case Attributes::DataModelRevision::Id: { - using TypeInfo = Attributes::DataModelRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::VendorName::Id: { - using TypeInfo = Attributes::VendorName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::VendorID::Id: { - using TypeInfo = Attributes::VendorID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ProductName::Id: { - using TypeInfo = Attributes::ProductName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductID::Id: { - using TypeInfo = Attributes::ProductID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NodeLabel::Id: { - using TypeInfo = Attributes::NodeLabel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::Location::Id: { - using TypeInfo = Attributes::Location::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::HardwareVersion::Id: { - using TypeInfo = Attributes::HardwareVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::HardwareVersionString::Id: { - using TypeInfo = Attributes::HardwareVersionString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::SoftwareVersion::Id: { - using TypeInfo = Attributes::SoftwareVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::SoftwareVersionString::Id: { - using TypeInfo = Attributes::SoftwareVersionString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ManufacturingDate::Id: { - using TypeInfo = Attributes::ManufacturingDate::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::PartNumber::Id: { - using TypeInfo = Attributes::PartNumber::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductURL::Id: { - using TypeInfo = Attributes::ProductURL::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductLabel::Id: { - using TypeInfo = Attributes::ProductLabel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::SerialNumber::Id: { - using TypeInfo = Attributes::SerialNumber::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::LocalConfigDisabled::Id: { - using TypeInfo = Attributes::LocalConfigDisabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::Reachable::Id: { - using TypeInfo = Attributes::Reachable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::UniqueID::Id: { - using TypeInfo = Attributes::UniqueID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::CapabilityMinima::Id: { - using TypeInfo = Attributes::CapabilityMinima::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRBasicInformationClusterCapabilityMinimaStruct * _Nonnull value; - value = [MTRBasicInformationClusterCapabilityMinimaStruct new]; - value.caseSessionsPerFabric = [NSNumber numberWithUnsignedShort:cppValue.caseSessionsPerFabric]; - value.subscriptionsPerFabric = [NSNumber numberWithUnsignedShort:cppValue.subscriptionsPerFabric]; - return value; - } - case Attributes::ProductAppearance::Id: { - using TypeInfo = Attributes::ProductAppearance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRBasicInformationClusterProductAppearanceStruct * _Nonnull value; - value = [MTRBasicInformationClusterProductAppearanceStruct new]; - value.finish = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.finish)]; - if (cppValue.primaryColor.IsNull()) { - value.primaryColor = nil; - } else { - value.primaryColor = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.primaryColor.Value())]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; } - case Clusters::OtaSoftwareUpdateProvider::Id: { - using namespace Clusters::OtaSoftwareUpdateProvider; - switch (aPath.mAttributeId) { - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForWindowCoveringCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WindowCovering; + switch (aAttributeId) { + case Attributes::Type::Id: { + using TypeInfo = Attributes::Type::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; } - case Clusters::OtaSoftwareUpdateRequestor::Id: { - using namespace Clusters::OtaSoftwareUpdateRequestor; - switch (aPath.mAttributeId) { - case Attributes::DefaultOTAProviders::Id: { - using TypeInfo = Attributes::DefaultOTAProviders::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTROTASoftwareUpdateRequestorClusterProviderLocation * newElement_0; - newElement_0 = [MTROTASoftwareUpdateRequestorClusterProviderLocation new]; - newElement_0.providerNodeID = [NSNumber numberWithUnsignedLongLong:entry_0.providerNodeID]; - newElement_0.endpoint = [NSNumber numberWithUnsignedShort:entry_0.endpoint]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::UpdatePossible::Id: { - using TypeInfo = Attributes::UpdatePossible::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::UpdateState::Id: { - using TypeInfo = Attributes::UpdateState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::UpdateStateProgress::Id: { - using TypeInfo = Attributes::UpdateStateProgress::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + case Attributes::PhysicalClosedLimitLift::Id: { + using TypeInfo = Attributes::PhysicalClosedLimitLift::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; } - case Clusters::LocalizationConfiguration::Id: { - using namespace Clusters::LocalizationConfiguration; - switch (aPath.mAttributeId) { - case Attributes::ActiveLocale::Id: { - using TypeInfo = Attributes::ActiveLocale::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::SupportedLocales::Id: { - using TypeInfo = Attributes::SupportedLocales::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSString * newElement_0; - newElement_0 = [[NSString alloc] initWithBytes:entry_0.data() - length:entry_0.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + case Attributes::PhysicalClosedLimitTilt::Id: { + using TypeInfo = Attributes::PhysicalClosedLimitTilt::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; } - case Clusters::TimeFormatLocalization::Id: { - using namespace Clusters::TimeFormatLocalization; - switch (aPath.mAttributeId) { - case Attributes::HourFormat::Id: { - using TypeInfo = Attributes::HourFormat::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ActiveCalendarType::Id: { - using TypeInfo = Attributes::ActiveCalendarType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::SupportedCalendarTypes::Id: { - using TypeInfo = Attributes::SupportedCalendarTypes::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + case Attributes::CurrentPositionLift::Id: { + using TypeInfo = Attributes::CurrentPositionLift::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; } - case Clusters::UnitLocalization::Id: { - using namespace Clusters::UnitLocalization; - switch (aPath.mAttributeId) { - case Attributes::TemperatureUnit::Id: { - using TypeInfo = Attributes::TemperatureUnit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + case Attributes::CurrentPositionTilt::Id: { + using TypeInfo = Attributes::CurrentPositionTilt::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; } - case Clusters::PowerSourceConfiguration::Id: { - using namespace Clusters::PowerSourceConfiguration; - switch (aPath.mAttributeId) { - case Attributes::Sources::Id: { - using TypeInfo = Attributes::Sources::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + case Attributes::NumberOfActuationsLift::Id: { + using TypeInfo = Attributes::NumberOfActuationsLift::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; } - case Clusters::PowerSource::Id: { - using namespace Clusters::PowerSource; - switch (aPath.mAttributeId) { - case Attributes::Status::Id: { - using TypeInfo = Attributes::Status::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::Order::Id: { - using TypeInfo = Attributes::Order::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::Description::Id: { - using TypeInfo = Attributes::Description::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::WiredAssessedInputVoltage::Id: { - using TypeInfo = Attributes::WiredAssessedInputVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::WiredAssessedInputFrequency::Id: { - using TypeInfo = Attributes::WiredAssessedInputFrequency::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::WiredCurrentType::Id: { - using TypeInfo = Attributes::WiredCurrentType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::WiredAssessedCurrent::Id: { - using TypeInfo = Attributes::WiredAssessedCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::WiredNominalVoltage::Id: { - using TypeInfo = Attributes::WiredNominalVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::WiredMaximumCurrent::Id: { - using TypeInfo = Attributes::WiredMaximumCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::WiredPresent::Id: { - using TypeInfo = Attributes::WiredPresent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::ActiveWiredFaults::Id: { - using TypeInfo = Attributes::ActiveWiredFaults::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::BatVoltage::Id: { - using TypeInfo = Attributes::BatVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::BatPercentRemaining::Id: { - using TypeInfo = Attributes::BatPercentRemaining::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::BatTimeRemaining::Id: { - using TypeInfo = Attributes::BatTimeRemaining::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::BatChargeLevel::Id: { - using TypeInfo = Attributes::BatChargeLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::BatReplacementNeeded::Id: { - using TypeInfo = Attributes::BatReplacementNeeded::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::BatReplaceability::Id: { - using TypeInfo = Attributes::BatReplaceability::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::BatPresent::Id: { - using TypeInfo = Attributes::BatPresent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::ActiveBatFaults::Id: { - using TypeInfo = Attributes::ActiveBatFaults::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::BatReplacementDescription::Id: { - using TypeInfo = Attributes::BatReplacementDescription::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::BatCommonDesignation::Id: { - using TypeInfo = Attributes::BatCommonDesignation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::BatANSIDesignation::Id: { - using TypeInfo = Attributes::BatANSIDesignation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::BatIECDesignation::Id: { - using TypeInfo = Attributes::BatIECDesignation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::BatApprovedChemistry::Id: { - using TypeInfo = Attributes::BatApprovedChemistry::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::BatCapacity::Id: { - using TypeInfo = Attributes::BatCapacity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::BatQuantity::Id: { - using TypeInfo = Attributes::BatQuantity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::BatChargeState::Id: { - using TypeInfo = Attributes::BatChargeState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::BatTimeToFullCharge::Id: { - using TypeInfo = Attributes::BatTimeToFullCharge::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::BatFunctionalWhileCharging::Id: { - using TypeInfo = Attributes::BatFunctionalWhileCharging::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::BatChargingCurrent::Id: { - using TypeInfo = Attributes::BatChargingCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::ActiveBatChargeFaults::Id: { - using TypeInfo = Attributes::ActiveBatChargeFaults::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + case Attributes::NumberOfActuationsTilt::Id: { + using TypeInfo = Attributes::NumberOfActuationsTilt::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ConfigStatus::Id: { + using TypeInfo = Attributes::ConfigStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::CurrentPositionLiftPercentage::Id: { + using TypeInfo = Attributes::CurrentPositionLiftPercentage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::CurrentPositionTiltPercentage::Id: { + using TypeInfo = Attributes::CurrentPositionTiltPercentage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::OperationalStatus::Id: { + using TypeInfo = Attributes::OperationalStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::TargetPositionLiftPercent100ths::Id: { + using TypeInfo = Attributes::TargetPositionLiftPercent100ths::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::TargetPositionTiltPercent100ths::Id: { + using TypeInfo = Attributes::TargetPositionTiltPercent100ths::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::EndProductType::Id: { + using TypeInfo = Attributes::EndProductType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::CurrentPositionLiftPercent100ths::Id: { + using TypeInfo = Attributes::CurrentPositionLiftPercent100ths::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::CurrentPositionTiltPercent100ths::Id: { + using TypeInfo = Attributes::CurrentPositionTiltPercent100ths::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::InstalledOpenLimitLift::Id: { + using TypeInfo = Attributes::InstalledOpenLimitLift::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::InstalledClosedLimitLift::Id: { + using TypeInfo = Attributes::InstalledClosedLimitLift::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::InstalledOpenLimitTilt::Id: { + using TypeInfo = Attributes::InstalledOpenLimitTilt::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::InstalledClosedLimitTilt::Id: { + using TypeInfo = Attributes::InstalledClosedLimitTilt::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Mode::Id: { + using TypeInfo = Attributes::Mode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::SafetyStatus::Id: { + using TypeInfo = Attributes::SafetyStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::GeneralCommissioning::Id: { - using namespace Clusters::GeneralCommissioning; - switch (aPath.mAttributeId) { - case Attributes::Breadcrumb::Id: { - using TypeInfo = Attributes::Breadcrumb::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::BasicCommissioningInfo::Id: { - using TypeInfo = Attributes::BasicCommissioningInfo::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRGeneralCommissioningClusterBasicCommissioningInfo * _Nonnull value; - value = [MTRGeneralCommissioningClusterBasicCommissioningInfo new]; - value.failSafeExpiryLengthSeconds = [NSNumber numberWithUnsignedShort:cppValue.failSafeExpiryLengthSeconds]; - value.maxCumulativeFailsafeSeconds = [NSNumber numberWithUnsignedShort:cppValue.maxCumulativeFailsafeSeconds]; - return value; - } - case Attributes::RegulatoryConfig::Id: { - using TypeInfo = Attributes::RegulatoryConfig::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::LocationCapability::Id: { - using TypeInfo = Attributes::LocationCapability::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::SupportsConcurrentConnection::Id: { - using TypeInfo = Attributes::SupportsConcurrentConnection::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBarrierControlCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BarrierControl; + switch (aAttributeId) { + case Attributes::BarrierMovingState::Id: { + using TypeInfo = Attributes::BarrierMovingState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::BarrierSafetyStatus::Id: { + using TypeInfo = Attributes::BarrierSafetyStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierCapabilities::Id: { + using TypeInfo = Attributes::BarrierCapabilities::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::BarrierOpenEvents::Id: { + using TypeInfo = Attributes::BarrierOpenEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierCloseEvents::Id: { + using TypeInfo = Attributes::BarrierCloseEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierCommandOpenEvents::Id: { + using TypeInfo = Attributes::BarrierCommandOpenEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierCommandCloseEvents::Id: { + using TypeInfo = Attributes::BarrierCommandCloseEvents::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierOpenPeriod::Id: { + using TypeInfo = Attributes::BarrierOpenPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierClosePeriod::Id: { + using TypeInfo = Attributes::BarrierClosePeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::BarrierPosition::Id: { + using TypeInfo = Attributes::BarrierPosition::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::NetworkCommissioning::Id: { - using namespace Clusters::NetworkCommissioning; - switch (aPath.mAttributeId) { - case Attributes::MaxNetworks::Id: { - using TypeInfo = Attributes::MaxNetworks::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::Networks::Id: { - using TypeInfo = Attributes::Networks::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRNetworkCommissioningClusterNetworkInfo * newElement_0; - newElement_0 = [MTRNetworkCommissioningClusterNetworkInfo new]; - newElement_0.networkID = [NSData dataWithBytes:entry_0.networkID.data() length:entry_0.networkID.size()]; - newElement_0.connected = [NSNumber numberWithBool:entry_0.connected]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::ScanMaxTimeSeconds::Id: { - using TypeInfo = Attributes::ScanMaxTimeSeconds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ConnectMaxTimeSeconds::Id: { - using TypeInfo = Attributes::ConnectMaxTimeSeconds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::InterfaceEnabled::Id: { - using TypeInfo = Attributes::InterfaceEnabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::LastNetworkingStatus::Id: { - using TypeInfo = Attributes::LastNetworkingStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::LastNetworkID::Id: { - using TypeInfo = Attributes::LastNetworkID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; - } - return value; - } - case Attributes::LastConnectErrorValue::Id: { - using TypeInfo = Attributes::LastConnectErrorValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithInt:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; } - case Clusters::DiagnosticLogs::Id: { - using namespace Clusters::DiagnosticLogs; - switch (aPath.mAttributeId) { - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForPumpConfigurationAndControlCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PumpConfigurationAndControl; + switch (aAttributeId) { + case Attributes::MaxPressure::Id: { + using TypeInfo = Attributes::MaxPressure::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; } - case Clusters::GeneralDiagnostics::Id: { - using namespace Clusters::GeneralDiagnostics; - switch (aPath.mAttributeId) { - case Attributes::NetworkInterfaces::Id: { - using TypeInfo = Attributes::NetworkInterfaces::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRGeneralDiagnosticsClusterNetworkInterface * newElement_0; - newElement_0 = [MTRGeneralDiagnosticsClusterNetworkInterface new]; - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() - length:entry_0.name.size() - encoding:NSUTF8StringEncoding]; - newElement_0.isOperational = [NSNumber numberWithBool:entry_0.isOperational]; - if (entry_0.offPremiseServicesReachableIPv4.IsNull()) { - newElement_0.offPremiseServicesReachableIPv4 = nil; - } else { - newElement_0.offPremiseServicesReachableIPv4 = - [NSNumber numberWithBool:entry_0.offPremiseServicesReachableIPv4.Value()]; - } - if (entry_0.offPremiseServicesReachableIPv6.IsNull()) { - newElement_0.offPremiseServicesReachableIPv6 = nil; - } else { - newElement_0.offPremiseServicesReachableIPv6 = - [NSNumber numberWithBool:entry_0.offPremiseServicesReachableIPv6.Value()]; - } - newElement_0.hardwareAddress = [NSData dataWithBytes:entry_0.hardwareAddress.data() - length:entry_0.hardwareAddress.size()]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.IPv4Addresses.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - NSData * newElement_2; - newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.iPv4Addresses = array_2; - } - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.IPv6Addresses.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - NSData * newElement_2; - newElement_2 = [NSData dataWithBytes:entry_2.data() length:entry_2.size()]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.iPv6Addresses = array_2; - } - newElement_0.type = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.type)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::RebootCount::Id: { - using TypeInfo = Attributes::RebootCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::UpTime::Id: { - using TypeInfo = Attributes::UpTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::TotalOperationalHours::Id: { - using TypeInfo = Attributes::TotalOperationalHours::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::BootReason::Id: { - using TypeInfo = Attributes::BootReason::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ActiveHardwareFaults::Id: { - using TypeInfo = Attributes::ActiveHardwareFaults::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::ActiveRadioFaults::Id: { - using TypeInfo = Attributes::ActiveRadioFaults::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::ActiveNetworkFaults::Id: { - using TypeInfo = Attributes::ActiveNetworkFaults::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::TestEventTriggersEnabled::Id: { - using TypeInfo = Attributes::TestEventTriggersEnabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; + case Attributes::MaxSpeed::Id: { + using TypeInfo = Attributes::MaxSpeed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; } - case Clusters::SoftwareDiagnostics::Id: { - using namespace Clusters::SoftwareDiagnostics; - switch (aPath.mAttributeId) { - case Attributes::ThreadMetrics::Id: { - using TypeInfo = Attributes::ThreadMetrics::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRSoftwareDiagnosticsClusterThreadMetricsStruct * newElement_0; - newElement_0 = [MTRSoftwareDiagnosticsClusterThreadMetricsStruct new]; - newElement_0.id = [NSNumber numberWithUnsignedLongLong:entry_0.id]; - if (entry_0.name.HasValue()) { - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().data() - length:entry_0.name.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.name = nil; - } - if (entry_0.stackFreeCurrent.HasValue()) { - newElement_0.stackFreeCurrent = [NSNumber numberWithUnsignedInt:entry_0.stackFreeCurrent.Value()]; - } else { - newElement_0.stackFreeCurrent = nil; - } - if (entry_0.stackFreeMinimum.HasValue()) { - newElement_0.stackFreeMinimum = [NSNumber numberWithUnsignedInt:entry_0.stackFreeMinimum.Value()]; - } else { - newElement_0.stackFreeMinimum = nil; - } - if (entry_0.stackSize.HasValue()) { - newElement_0.stackSize = [NSNumber numberWithUnsignedInt:entry_0.stackSize.Value()]; - } else { - newElement_0.stackSize = nil; - } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentHeapFree::Id: { - using TypeInfo = Attributes::CurrentHeapFree::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::CurrentHeapUsed::Id: { - using TypeInfo = Attributes::CurrentHeapUsed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::CurrentHeapHighWatermark::Id: { - using TypeInfo = Attributes::CurrentHeapHighWatermark::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + case Attributes::MaxFlow::Id: { + using TypeInfo = Attributes::MaxFlow::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinConstPressure::Id: { + using TypeInfo = Attributes::MinConstPressure::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxConstPressure::Id: { + using TypeInfo = Attributes::MaxConstPressure::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinCompPressure::Id: { + using TypeInfo = Attributes::MinCompPressure::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxCompPressure::Id: { + using TypeInfo = Attributes::MaxCompPressure::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinConstSpeed::Id: { + using TypeInfo = Attributes::MinConstSpeed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxConstSpeed::Id: { + using TypeInfo = Attributes::MaxConstSpeed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinConstFlow::Id: { + using TypeInfo = Attributes::MinConstFlow::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxConstFlow::Id: { + using TypeInfo = Attributes::MaxConstFlow::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinConstTemp::Id: { + using TypeInfo = Attributes::MinConstTemp::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxConstTemp::Id: { + using TypeInfo = Attributes::MaxConstTemp::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::PumpStatus::Id: { + using TypeInfo = Attributes::PumpStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; + return value; + } + case Attributes::EffectiveOperationMode::Id: { + using TypeInfo = Attributes::EffectiveOperationMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::EffectiveControlMode::Id: { + using TypeInfo = Attributes::EffectiveControlMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::Capacity::Id: { + using TypeInfo = Attributes::Capacity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::Speed::Id: { + using TypeInfo = Attributes::Speed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::LifetimeRunningHours::Id: { + using TypeInfo = Attributes::LifetimeRunningHours::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::Power::Id: { + using TypeInfo = Attributes::Power::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::LifetimeEnergyConsumed::Id: { + using TypeInfo = Attributes::LifetimeEnergyConsumed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::OperationMode::Id: { + using TypeInfo = Attributes::OperationMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ControlMode::Id: { + using TypeInfo = Attributes::ControlMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::ThreadNetworkDiagnostics::Id: { - using namespace Clusters::ThreadNetworkDiagnostics; - switch (aPath.mAttributeId) { - case Attributes::Channel::Id: { - using TypeInfo = Attributes::Channel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::RoutingRole::Id: { - using TypeInfo = Attributes::RoutingRole::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::NetworkName::Id: { - using TypeInfo = Attributes::NetworkName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [[NSString alloc] initWithBytes:cppValue.Value().data() - length:cppValue.Value().size() - encoding:NSUTF8StringEncoding]; - } - return value; - } - case Attributes::PanId::Id: { - using TypeInfo = Attributes::PanId::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::ExtendedPanId::Id: { - using TypeInfo = Attributes::ExtendedPanId::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::MeshLocalPrefix::Id: { - using TypeInfo = Attributes::MeshLocalPrefix::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; - } - return value; - } - case Attributes::OverrunCount::Id: { - using TypeInfo = Attributes::OverrunCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::NeighborTable::Id: { - using TypeInfo = Attributes::NeighborTable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRThreadNetworkDiagnosticsClusterNeighborTable * newElement_0; - newElement_0 = [MTRThreadNetworkDiagnosticsClusterNeighborTable new]; - newElement_0.extAddress = [NSNumber numberWithUnsignedLongLong:entry_0.extAddress]; - newElement_0.age = [NSNumber numberWithUnsignedInt:entry_0.age]; - newElement_0.rloc16 = [NSNumber numberWithUnsignedShort:entry_0.rloc16]; - newElement_0.linkFrameCounter = [NSNumber numberWithUnsignedInt:entry_0.linkFrameCounter]; - newElement_0.mleFrameCounter = [NSNumber numberWithUnsignedInt:entry_0.mleFrameCounter]; - newElement_0.lqi = [NSNumber numberWithUnsignedChar:entry_0.lqi]; - if (entry_0.averageRssi.IsNull()) { - newElement_0.averageRssi = nil; - } else { - newElement_0.averageRssi = [NSNumber numberWithChar:entry_0.averageRssi.Value()]; - } - if (entry_0.lastRssi.IsNull()) { - newElement_0.lastRssi = nil; - } else { - newElement_0.lastRssi = [NSNumber numberWithChar:entry_0.lastRssi.Value()]; - } - newElement_0.frameErrorRate = [NSNumber numberWithUnsignedChar:entry_0.frameErrorRate]; - newElement_0.messageErrorRate = [NSNumber numberWithUnsignedChar:entry_0.messageErrorRate]; - newElement_0.rxOnWhenIdle = [NSNumber numberWithBool:entry_0.rxOnWhenIdle]; - newElement_0.fullThreadDevice = [NSNumber numberWithBool:entry_0.fullThreadDevice]; - newElement_0.fullNetworkData = [NSNumber numberWithBool:entry_0.fullNetworkData]; - newElement_0.isChild = [NSNumber numberWithBool:entry_0.isChild]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::RouteTable::Id: { - using TypeInfo = Attributes::RouteTable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRThreadNetworkDiagnosticsClusterRouteTable * newElement_0; - newElement_0 = [MTRThreadNetworkDiagnosticsClusterRouteTable new]; - newElement_0.extAddress = [NSNumber numberWithUnsignedLongLong:entry_0.extAddress]; - newElement_0.rloc16 = [NSNumber numberWithUnsignedShort:entry_0.rloc16]; - newElement_0.routerId = [NSNumber numberWithUnsignedChar:entry_0.routerId]; - newElement_0.nextHop = [NSNumber numberWithUnsignedChar:entry_0.nextHop]; - newElement_0.pathCost = [NSNumber numberWithUnsignedChar:entry_0.pathCost]; - newElement_0.lqiIn = [NSNumber numberWithUnsignedChar:entry_0.LQIIn]; - newElement_0.lqiOut = [NSNumber numberWithUnsignedChar:entry_0.LQIOut]; - newElement_0.age = [NSNumber numberWithUnsignedChar:entry_0.age]; - newElement_0.allocated = [NSNumber numberWithBool:entry_0.allocated]; - newElement_0.linkEstablished = [NSNumber numberWithBool:entry_0.linkEstablished]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::PartitionId::Id: { - using TypeInfo = Attributes::PartitionId::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::Weighting::Id: { - using TypeInfo = Attributes::Weighting::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::DataVersion::Id: { - using TypeInfo = Attributes::DataVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::StableDataVersion::Id: { - using TypeInfo = Attributes::StableDataVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::LeaderRouterId::Id: { - using TypeInfo = Attributes::LeaderRouterId::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::DetachedRoleCount::Id: { - using TypeInfo = Attributes::DetachedRoleCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ChildRoleCount::Id: { - using TypeInfo = Attributes::ChildRoleCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RouterRoleCount::Id: { - using TypeInfo = Attributes::RouterRoleCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::LeaderRoleCount::Id: { - using TypeInfo = Attributes::LeaderRoleCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AttachAttemptCount::Id: { - using TypeInfo = Attributes::AttachAttemptCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PartitionIdChangeCount::Id: { - using TypeInfo = Attributes::PartitionIdChangeCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BetterPartitionAttachAttemptCount::Id: { - using TypeInfo = Attributes::BetterPartitionAttachAttemptCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ParentChangeCount::Id: { - using TypeInfo = Attributes::ParentChangeCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::TxTotalCount::Id: { - using TypeInfo = Attributes::TxTotalCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxUnicastCount::Id: { - using TypeInfo = Attributes::TxUnicastCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxBroadcastCount::Id: { - using TypeInfo = Attributes::TxBroadcastCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxAckRequestedCount::Id: { - using TypeInfo = Attributes::TxAckRequestedCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxAckedCount::Id: { - using TypeInfo = Attributes::TxAckedCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxNoAckRequestedCount::Id: { - using TypeInfo = Attributes::TxNoAckRequestedCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxDataCount::Id: { - using TypeInfo = Attributes::TxDataCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxDataPollCount::Id: { - using TypeInfo = Attributes::TxDataPollCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxBeaconCount::Id: { - using TypeInfo = Attributes::TxBeaconCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxBeaconRequestCount::Id: { - using TypeInfo = Attributes::TxBeaconRequestCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxOtherCount::Id: { - using TypeInfo = Attributes::TxOtherCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxRetryCount::Id: { - using TypeInfo = Attributes::TxRetryCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxDirectMaxRetryExpiryCount::Id: { - using TypeInfo = Attributes::TxDirectMaxRetryExpiryCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxIndirectMaxRetryExpiryCount::Id: { - using TypeInfo = Attributes::TxIndirectMaxRetryExpiryCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxErrCcaCount::Id: { - using TypeInfo = Attributes::TxErrCcaCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxErrAbortCount::Id: { - using TypeInfo = Attributes::TxErrAbortCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::TxErrBusyChannelCount::Id: { - using TypeInfo = Attributes::TxErrBusyChannelCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxTotalCount::Id: { - using TypeInfo = Attributes::RxTotalCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxUnicastCount::Id: { - using TypeInfo = Attributes::RxUnicastCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxBroadcastCount::Id: { - using TypeInfo = Attributes::RxBroadcastCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxDataCount::Id: { - using TypeInfo = Attributes::RxDataCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxDataPollCount::Id: { - using TypeInfo = Attributes::RxDataPollCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxBeaconCount::Id: { - using TypeInfo = Attributes::RxBeaconCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxBeaconRequestCount::Id: { - using TypeInfo = Attributes::RxBeaconRequestCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxOtherCount::Id: { - using TypeInfo = Attributes::RxOtherCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxAddressFilteredCount::Id: { - using TypeInfo = Attributes::RxAddressFilteredCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxDestAddrFilteredCount::Id: { - using TypeInfo = Attributes::RxDestAddrFilteredCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxDuplicatedCount::Id: { - using TypeInfo = Attributes::RxDuplicatedCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxErrNoFrameCount::Id: { - using TypeInfo = Attributes::RxErrNoFrameCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxErrUnknownNeighborCount::Id: { - using TypeInfo = Attributes::RxErrUnknownNeighborCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxErrInvalidSrcAddrCount::Id: { - using TypeInfo = Attributes::RxErrInvalidSrcAddrCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxErrSecCount::Id: { - using TypeInfo = Attributes::RxErrSecCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxErrFcsCount::Id: { - using TypeInfo = Attributes::RxErrFcsCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::RxErrOtherCount::Id: { - using TypeInfo = Attributes::RxErrOtherCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ActiveTimestamp::Id: { - using TypeInfo = Attributes::ActiveTimestamp::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::PendingTimestamp::Id: { - using TypeInfo = Attributes::PendingTimestamp::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::Delay::Id: { - using TypeInfo = Attributes::Delay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::SecurityPolicy::Id: { - using TypeInfo = Attributes::SecurityPolicy::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRThreadNetworkDiagnosticsClusterSecurityPolicy * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRThreadNetworkDiagnosticsClusterSecurityPolicy new]; - value.rotationTime = [NSNumber numberWithUnsignedShort:cppValue.Value().rotationTime]; - value.flags = [NSNumber numberWithUnsignedShort:cppValue.Value().flags]; - } - return value; - } - case Attributes::ChannelPage0Mask::Id: { - using TypeInfo = Attributes::ChannelPage0Mask::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; - } - return value; - } - case Attributes::OperationalDatasetComponents::Id: { - using TypeInfo = Attributes::OperationalDatasetComponents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRThreadNetworkDiagnosticsClusterOperationalDatasetComponents new]; - value.activeTimestampPresent = [NSNumber numberWithBool:cppValue.Value().activeTimestampPresent]; - value.pendingTimestampPresent = [NSNumber numberWithBool:cppValue.Value().pendingTimestampPresent]; - value.masterKeyPresent = [NSNumber numberWithBool:cppValue.Value().masterKeyPresent]; - value.networkNamePresent = [NSNumber numberWithBool:cppValue.Value().networkNamePresent]; - value.extendedPanIdPresent = [NSNumber numberWithBool:cppValue.Value().extendedPanIdPresent]; - value.meshLocalPrefixPresent = [NSNumber numberWithBool:cppValue.Value().meshLocalPrefixPresent]; - value.delayPresent = [NSNumber numberWithBool:cppValue.Value().delayPresent]; - value.panIdPresent = [NSNumber numberWithBool:cppValue.Value().panIdPresent]; - value.channelPresent = [NSNumber numberWithBool:cppValue.Value().channelPresent]; - value.pskcPresent = [NSNumber numberWithBool:cppValue.Value().pskcPresent]; - value.securityPolicyPresent = [NSNumber numberWithBool:cppValue.Value().securityPolicyPresent]; - value.channelMaskPresent = [NSNumber numberWithBool:cppValue.Value().channelMaskPresent]; - } - return value; - } - case Attributes::ActiveNetworkFaultsList::Id: { - using TypeInfo = Attributes::ActiveNetworkFaultsList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::WiFiNetworkDiagnostics::Id: { - using namespace Clusters::WiFiNetworkDiagnostics; - switch (aPath.mAttributeId) { - case Attributes::Bssid::Id: { - using TypeInfo = Attributes::Bssid::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; - } - return value; - } - case Attributes::SecurityType::Id: { - using TypeInfo = Attributes::SecurityType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::WiFiVersion::Id: { - using TypeInfo = Attributes::WiFiVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::ChannelNumber::Id: { - using TypeInfo = Attributes::ChannelNumber::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::Rssi::Id: { - using TypeInfo = Attributes::Rssi::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithChar:cppValue.Value()]; - } - return value; - } - case Attributes::BeaconLostCount::Id: { - using TypeInfo = Attributes::BeaconLostCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::BeaconRxCount::Id: { - using TypeInfo = Attributes::BeaconRxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::PacketMulticastRxCount::Id: { - using TypeInfo = Attributes::PacketMulticastRxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::PacketMulticastTxCount::Id: { - using TypeInfo = Attributes::PacketMulticastTxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::PacketUnicastRxCount::Id: { - using TypeInfo = Attributes::PacketUnicastRxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::PacketUnicastTxCount::Id: { - using TypeInfo = Attributes::PacketUnicastTxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::CurrentMaxRate::Id: { - using TypeInfo = Attributes::CurrentMaxRate::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::OverrunCount::Id: { - using TypeInfo = Attributes::OverrunCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::EthernetNetworkDiagnostics::Id: { - using namespace Clusters::EthernetNetworkDiagnostics; - switch (aPath.mAttributeId) { - case Attributes::PHYRate::Id: { - using TypeInfo = Attributes::PHYRate::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::FullDuplex::Id: { - using TypeInfo = Attributes::FullDuplex::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithBool:cppValue.Value()]; - } - return value; - } - case Attributes::PacketRxCount::Id: { - using TypeInfo = Attributes::PacketRxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::PacketTxCount::Id: { - using TypeInfo = Attributes::PacketTxCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::TxErrCount::Id: { - using TypeInfo = Attributes::TxErrCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::CollisionCount::Id: { - using TypeInfo = Attributes::CollisionCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::OverrunCount::Id: { - using TypeInfo = Attributes::OverrunCount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::CarrierDetect::Id: { - using TypeInfo = Attributes::CarrierDetect::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithBool:cppValue.Value()]; - } - return value; - } - case Attributes::TimeSinceReset::Id: { - using TypeInfo = Attributes::TimeSinceReset::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::BridgedDeviceBasicInformation::Id: { - using namespace Clusters::BridgedDeviceBasicInformation; - switch (aPath.mAttributeId) { - case Attributes::VendorName::Id: { - using TypeInfo = Attributes::VendorName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::VendorID::Id: { - using TypeInfo = Attributes::VendorID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ProductName::Id: { - using TypeInfo = Attributes::ProductName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::NodeLabel::Id: { - using TypeInfo = Attributes::NodeLabel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::HardwareVersion::Id: { - using TypeInfo = Attributes::HardwareVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::HardwareVersionString::Id: { - using TypeInfo = Attributes::HardwareVersionString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::SoftwareVersion::Id: { - using TypeInfo = Attributes::SoftwareVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::SoftwareVersionString::Id: { - using TypeInfo = Attributes::SoftwareVersionString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ManufacturingDate::Id: { - using TypeInfo = Attributes::ManufacturingDate::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::PartNumber::Id: { - using TypeInfo = Attributes::PartNumber::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductURL::Id: { - using TypeInfo = Attributes::ProductURL::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductLabel::Id: { - using TypeInfo = Attributes::ProductLabel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::SerialNumber::Id: { - using TypeInfo = Attributes::SerialNumber::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::Reachable::Id: { - using TypeInfo = Attributes::Reachable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::UniqueID::Id: { - using TypeInfo = Attributes::UniqueID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductAppearance::Id: { - using TypeInfo = Attributes::ProductAppearance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct * _Nonnull value; - value = [MTRBridgedDeviceBasicInformationClusterProductAppearanceStruct new]; - value.finish = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.finish)]; - if (cppValue.primaryColor.IsNull()) { - value.primaryColor = nil; - } else { - value.primaryColor = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.primaryColor.Value())]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::Switch::Id: { - using namespace Clusters::Switch; - switch (aPath.mAttributeId) { - case Attributes::NumberOfPositions::Id: { - using TypeInfo = Attributes::NumberOfPositions::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CurrentPosition::Id: { - using TypeInfo = Attributes::CurrentPosition::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MultiPressMax::Id: { - using TypeInfo = Attributes::MultiPressMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::AdministratorCommissioning::Id: { - using namespace Clusters::AdministratorCommissioning; - switch (aPath.mAttributeId) { - case Attributes::WindowStatus::Id: { - using TypeInfo = Attributes::WindowStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::AdminFabricIndex::Id: { - using TypeInfo = Attributes::AdminFabricIndex::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::AdminVendorId::Id: { - using TypeInfo = Attributes::AdminVendorId::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::OperationalCredentials::Id: { - using namespace Clusters::OperationalCredentials; - switch (aPath.mAttributeId) { - case Attributes::NOCs::Id: { - using TypeInfo = Attributes::NOCs::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTROperationalCredentialsClusterNOCStruct * newElement_0; - newElement_0 = [MTROperationalCredentialsClusterNOCStruct new]; - newElement_0.noc = [NSData dataWithBytes:entry_0.noc.data() length:entry_0.noc.size()]; - if (entry_0.icac.IsNull()) { - newElement_0.icac = nil; - } else { - newElement_0.icac = [NSData dataWithBytes:entry_0.icac.Value().data() length:entry_0.icac.Value().size()]; - } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::Fabrics::Id: { - using TypeInfo = Attributes::Fabrics::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTROperationalCredentialsClusterFabricDescriptorStruct * newElement_0; - newElement_0 = [MTROperationalCredentialsClusterFabricDescriptorStruct new]; - newElement_0.rootPublicKey = [NSData dataWithBytes:entry_0.rootPublicKey.data() - length:entry_0.rootPublicKey.size()]; - newElement_0.vendorID = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0.vendorID)]; - newElement_0.fabricID = [NSNumber numberWithUnsignedLongLong:entry_0.fabricID]; - newElement_0.nodeID = [NSNumber numberWithUnsignedLongLong:entry_0.nodeID]; - newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() - length:entry_0.label.size() - encoding:NSUTF8StringEncoding]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::SupportedFabrics::Id: { - using TypeInfo = Attributes::SupportedFabrics::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CommissionedFabrics::Id: { - using TypeInfo = Attributes::CommissionedFabrics::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::TrustedRootCertificates::Id: { - using TypeInfo = Attributes::TrustedRootCertificates::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentFabricIndex::Id: { - using TypeInfo = Attributes::CurrentFabricIndex::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::GroupKeyManagement::Id: { - using namespace Clusters::GroupKeyManagement; - switch (aPath.mAttributeId) { - case Attributes::GroupKeyMap::Id: { - using TypeInfo = Attributes::GroupKeyMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRGroupKeyManagementClusterGroupKeyMapStruct * newElement_0; - newElement_0 = [MTRGroupKeyManagementClusterGroupKeyMapStruct new]; - newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; - newElement_0.groupKeySetID = [NSNumber numberWithUnsignedShort:entry_0.groupKeySetID]; - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GroupTable::Id: { - using TypeInfo = Attributes::GroupTable::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRGroupKeyManagementClusterGroupInfoMapStruct * newElement_0; - newElement_0 = [MTRGroupKeyManagementClusterGroupInfoMapStruct new]; - newElement_0.groupId = [NSNumber numberWithUnsignedShort:entry_0.groupId]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.endpoints.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedShort:entry_2]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.endpoints = array_2; - } - if (entry_0.groupName.HasValue()) { - newElement_0.groupName = [[NSString alloc] initWithBytes:entry_0.groupName.Value().data() - length:entry_0.groupName.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.groupName = nil; - } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::MaxGroupsPerFabric::Id: { - using TypeInfo = Attributes::MaxGroupsPerFabric::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::MaxGroupKeysPerFabric::Id: { - using TypeInfo = Attributes::MaxGroupKeysPerFabric::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::FixedLabel::Id: { - using namespace Clusters::FixedLabel; - switch (aPath.mAttributeId) { - case Attributes::LabelList::Id: { - using TypeInfo = Attributes::LabelList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRFixedLabelClusterLabelStruct * newElement_0; - newElement_0 = [MTRFixedLabelClusterLabelStruct new]; - newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() - length:entry_0.label.size() - encoding:NSUTF8StringEncoding]; - newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() - length:entry_0.value.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::UserLabel::Id: { - using namespace Clusters::UserLabel; - switch (aPath.mAttributeId) { - case Attributes::LabelList::Id: { - using TypeInfo = Attributes::LabelList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRUserLabelClusterLabelStruct * newElement_0; - newElement_0 = [MTRUserLabelClusterLabelStruct new]; - newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() - length:entry_0.label.size() - encoding:NSUTF8StringEncoding]; - newElement_0.value = [[NSString alloc] initWithBytes:entry_0.value.data() - length:entry_0.value.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::BooleanState::Id: { - using namespace Clusters::BooleanState; - switch (aPath.mAttributeId) { - case Attributes::StateValue::Id: { - using TypeInfo = Attributes::StateValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ModeSelect::Id: { - using namespace Clusters::ModeSelect; - switch (aPath.mAttributeId) { - case Attributes::Description::Id: { - using TypeInfo = Attributes::Description::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::StandardNamespace::Id: { - using TypeInfo = Attributes::StandardNamespace::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::SupportedModes::Id: { - using TypeInfo = Attributes::SupportedModes::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRModeSelectClusterModeOptionStruct * newElement_0; - newElement_0 = [MTRModeSelectClusterModeOptionStruct new]; - newElement_0.label = [[NSString alloc] initWithBytes:entry_0.label.data() - length:entry_0.label.size() - encoding:NSUTF8StringEncoding]; - newElement_0.mode = [NSNumber numberWithUnsignedChar:entry_0.mode]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.semanticTags.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTRModeSelectClusterSemanticTagStruct * newElement_2; - newElement_2 = [MTRModeSelectClusterSemanticTagStruct new]; - newElement_2.mfgCode = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_2.mfgCode)]; - newElement_2.value = [NSNumber numberWithUnsignedShort:entry_2.value]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.semanticTags = array_2; - } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentMode::Id: { - using TypeInfo = Attributes::CurrentMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::StartUpMode::Id: { - using TypeInfo = Attributes::StartUpMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::OnMode::Id: { - using TypeInfo = Attributes::OnMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::DoorLock::Id: { - using namespace Clusters::DoorLock; - switch (aPath.mAttributeId) { - case Attributes::LockState::Id: { - using TypeInfo = Attributes::LockState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::LockType::Id: { - using TypeInfo = Attributes::LockType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ActuatorEnabled::Id: { - using TypeInfo = Attributes::ActuatorEnabled::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::DoorState::Id: { - using TypeInfo = Attributes::DoorState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::DoorOpenEvents::Id: { - using TypeInfo = Attributes::DoorOpenEvents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::DoorClosedEvents::Id: { - using TypeInfo = Attributes::DoorClosedEvents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::OpenPeriod::Id: { - using TypeInfo = Attributes::OpenPeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NumberOfTotalUsersSupported::Id: { - using TypeInfo = Attributes::NumberOfTotalUsersSupported::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NumberOfPINUsersSupported::Id: { - using TypeInfo = Attributes::NumberOfPINUsersSupported::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NumberOfRFIDUsersSupported::Id: { - using TypeInfo = Attributes::NumberOfRFIDUsersSupported::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NumberOfWeekDaySchedulesSupportedPerUser::Id: { - using TypeInfo = Attributes::NumberOfWeekDaySchedulesSupportedPerUser::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::NumberOfYearDaySchedulesSupportedPerUser::Id: { - using TypeInfo = Attributes::NumberOfYearDaySchedulesSupportedPerUser::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::NumberOfHolidaySchedulesSupported::Id: { - using TypeInfo = Attributes::NumberOfHolidaySchedulesSupported::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MaxPINCodeLength::Id: { - using TypeInfo = Attributes::MaxPINCodeLength::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MinPINCodeLength::Id: { - using TypeInfo = Attributes::MinPINCodeLength::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MaxRFIDCodeLength::Id: { - using TypeInfo = Attributes::MaxRFIDCodeLength::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MinRFIDCodeLength::Id: { - using TypeInfo = Attributes::MinRFIDCodeLength::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CredentialRulesSupport::Id: { - using TypeInfo = Attributes::CredentialRulesSupport::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::NumberOfCredentialsSupportedPerUser::Id: { - using TypeInfo = Attributes::NumberOfCredentialsSupportedPerUser::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::Language::Id: { - using TypeInfo = Attributes::Language::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::LEDSettings::Id: { - using TypeInfo = Attributes::LEDSettings::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::AutoRelockTime::Id: { - using TypeInfo = Attributes::AutoRelockTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::SoundVolume::Id: { - using TypeInfo = Attributes::SoundVolume::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::OperatingMode::Id: { - using TypeInfo = Attributes::OperatingMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::SupportedOperatingModes::Id: { - using TypeInfo = Attributes::SupportedOperatingModes::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; - return value; - } - case Attributes::DefaultConfigurationRegister::Id: { - using TypeInfo = Attributes::DefaultConfigurationRegister::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; - return value; - } - case Attributes::EnableLocalProgramming::Id: { - using TypeInfo = Attributes::EnableLocalProgramming::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::EnableOneTouchLocking::Id: { - using TypeInfo = Attributes::EnableOneTouchLocking::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::EnableInsideStatusLED::Id: { - using TypeInfo = Attributes::EnableInsideStatusLED::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::EnablePrivacyModeButton::Id: { - using TypeInfo = Attributes::EnablePrivacyModeButton::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::LocalProgrammingFeatures::Id: { - using TypeInfo = Attributes::LocalProgrammingFeatures::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::WrongCodeEntryLimit::Id: { - using TypeInfo = Attributes::WrongCodeEntryLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::UserCodeTemporaryDisableTime::Id: { - using TypeInfo = Attributes::UserCodeTemporaryDisableTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::SendPINOverTheAir::Id: { - using TypeInfo = Attributes::SendPINOverTheAir::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::RequirePINforRemoteOperation::Id: { - using TypeInfo = Attributes::RequirePINforRemoteOperation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::ExpiringUserTimeout::Id: { - using TypeInfo = Attributes::ExpiringUserTimeout::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::WindowCovering::Id: { - using namespace Clusters::WindowCovering; - switch (aPath.mAttributeId) { - case Attributes::Type::Id: { - using TypeInfo = Attributes::Type::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::PhysicalClosedLimitLift::Id: { - using TypeInfo = Attributes::PhysicalClosedLimitLift::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PhysicalClosedLimitTilt::Id: { - using TypeInfo = Attributes::PhysicalClosedLimitTilt::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::CurrentPositionLift::Id: { - using TypeInfo = Attributes::CurrentPositionLift::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::CurrentPositionTilt::Id: { - using TypeInfo = Attributes::CurrentPositionTilt::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::NumberOfActuationsLift::Id: { - using TypeInfo = Attributes::NumberOfActuationsLift::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NumberOfActuationsTilt::Id: { - using TypeInfo = Attributes::NumberOfActuationsTilt::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ConfigStatus::Id: { - using TypeInfo = Attributes::ConfigStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::CurrentPositionLiftPercentage::Id: { - using TypeInfo = Attributes::CurrentPositionLiftPercentage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::CurrentPositionTiltPercentage::Id: { - using TypeInfo = Attributes::CurrentPositionTiltPercentage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::OperationalStatus::Id: { - using TypeInfo = Attributes::OperationalStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::TargetPositionLiftPercent100ths::Id: { - using TypeInfo = Attributes::TargetPositionLiftPercent100ths::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::TargetPositionTiltPercent100ths::Id: { - using TypeInfo = Attributes::TargetPositionTiltPercent100ths::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::EndProductType::Id: { - using TypeInfo = Attributes::EndProductType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::CurrentPositionLiftPercent100ths::Id: { - using TypeInfo = Attributes::CurrentPositionLiftPercent100ths::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::CurrentPositionTiltPercent100ths::Id: { - using TypeInfo = Attributes::CurrentPositionTiltPercent100ths::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::InstalledOpenLimitLift::Id: { - using TypeInfo = Attributes::InstalledOpenLimitLift::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::InstalledClosedLimitLift::Id: { - using TypeInfo = Attributes::InstalledClosedLimitLift::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::InstalledOpenLimitTilt::Id: { - using TypeInfo = Attributes::InstalledOpenLimitTilt::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::InstalledClosedLimitTilt::Id: { - using TypeInfo = Attributes::InstalledClosedLimitTilt::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Mode::Id: { - using TypeInfo = Attributes::Mode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::SafetyStatus::Id: { - using TypeInfo = Attributes::SafetyStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::BarrierControl::Id: { - using namespace Clusters::BarrierControl; - switch (aPath.mAttributeId) { - case Attributes::BarrierMovingState::Id: { - using TypeInfo = Attributes::BarrierMovingState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::BarrierSafetyStatus::Id: { - using TypeInfo = Attributes::BarrierSafetyStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierCapabilities::Id: { - using TypeInfo = Attributes::BarrierCapabilities::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::BarrierOpenEvents::Id: { - using TypeInfo = Attributes::BarrierOpenEvents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierCloseEvents::Id: { - using TypeInfo = Attributes::BarrierCloseEvents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierCommandOpenEvents::Id: { - using TypeInfo = Attributes::BarrierCommandOpenEvents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierCommandCloseEvents::Id: { - using TypeInfo = Attributes::BarrierCommandCloseEvents::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierOpenPeriod::Id: { - using TypeInfo = Attributes::BarrierOpenPeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierClosePeriod::Id: { - using TypeInfo = Attributes::BarrierClosePeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::BarrierPosition::Id: { - using TypeInfo = Attributes::BarrierPosition::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::PumpConfigurationAndControl::Id: { - using namespace Clusters::PumpConfigurationAndControl; - switch (aPath.mAttributeId) { - case Attributes::MaxPressure::Id: { - using TypeInfo = Attributes::MaxPressure::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxSpeed::Id: { - using TypeInfo = Attributes::MaxSpeed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxFlow::Id: { - using TypeInfo = Attributes::MaxFlow::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinConstPressure::Id: { - using TypeInfo = Attributes::MinConstPressure::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxConstPressure::Id: { - using TypeInfo = Attributes::MaxConstPressure::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinCompPressure::Id: { - using TypeInfo = Attributes::MinCompPressure::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxCompPressure::Id: { - using TypeInfo = Attributes::MaxCompPressure::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinConstSpeed::Id: { - using TypeInfo = Attributes::MinConstSpeed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxConstSpeed::Id: { - using TypeInfo = Attributes::MaxConstSpeed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinConstFlow::Id: { - using TypeInfo = Attributes::MinConstFlow::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxConstFlow::Id: { - using TypeInfo = Attributes::MaxConstFlow::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinConstTemp::Id: { - using TypeInfo = Attributes::MinConstTemp::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxConstTemp::Id: { - using TypeInfo = Attributes::MaxConstTemp::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::PumpStatus::Id: { - using TypeInfo = Attributes::PumpStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; - return value; - } - case Attributes::EffectiveOperationMode::Id: { - using TypeInfo = Attributes::EffectiveOperationMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::EffectiveControlMode::Id: { - using TypeInfo = Attributes::EffectiveControlMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::Capacity::Id: { - using TypeInfo = Attributes::Capacity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::Speed::Id: { - using TypeInfo = Attributes::Speed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::LifetimeRunningHours::Id: { - using TypeInfo = Attributes::LifetimeRunningHours::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::Power::Id: { - using TypeInfo = Attributes::Power::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::LifetimeEnergyConsumed::Id: { - using TypeInfo = Attributes::LifetimeEnergyConsumed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::OperationMode::Id: { - using TypeInfo = Attributes::OperationMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ControlMode::Id: { - using TypeInfo = Attributes::ControlMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::Thermostat::Id: { - using namespace Clusters::Thermostat; - switch (aPath.mAttributeId) { - case Attributes::LocalTemperature::Id: { - using TypeInfo = Attributes::LocalTemperature::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::OutdoorTemperature::Id: { - using TypeInfo = Attributes::OutdoorTemperature::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::Occupancy::Id: { - using TypeInfo = Attributes::Occupancy::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::AbsMinHeatSetpointLimit::Id: { - using TypeInfo = Attributes::AbsMinHeatSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AbsMaxHeatSetpointLimit::Id: { - using TypeInfo = Attributes::AbsMaxHeatSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AbsMinCoolSetpointLimit::Id: { - using TypeInfo = Attributes::AbsMinCoolSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AbsMaxCoolSetpointLimit::Id: { - using TypeInfo = Attributes::AbsMaxCoolSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::PICoolingDemand::Id: { - using TypeInfo = Attributes::PICoolingDemand::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::PIHeatingDemand::Id: { - using TypeInfo = Attributes::PIHeatingDemand::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::HVACSystemTypeConfiguration::Id: { - using TypeInfo = Attributes::HVACSystemTypeConfiguration::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::LocalTemperatureCalibration::Id: { - using TypeInfo = Attributes::LocalTemperatureCalibration::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::OccupiedCoolingSetpoint::Id: { - using TypeInfo = Attributes::OccupiedCoolingSetpoint::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::OccupiedHeatingSetpoint::Id: { - using TypeInfo = Attributes::OccupiedHeatingSetpoint::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::UnoccupiedCoolingSetpoint::Id: { - using TypeInfo = Attributes::UnoccupiedCoolingSetpoint::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::UnoccupiedHeatingSetpoint::Id: { - using TypeInfo = Attributes::UnoccupiedHeatingSetpoint::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MinHeatSetpointLimit::Id: { - using TypeInfo = Attributes::MinHeatSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MaxHeatSetpointLimit::Id: { - using TypeInfo = Attributes::MaxHeatSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MinCoolSetpointLimit::Id: { - using TypeInfo = Attributes::MinCoolSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MaxCoolSetpointLimit::Id: { - using TypeInfo = Attributes::MaxCoolSetpointLimit::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MinSetpointDeadBand::Id: { - using TypeInfo = Attributes::MinSetpointDeadBand::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::RemoteSensing::Id: { - using TypeInfo = Attributes::RemoteSensing::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ControlSequenceOfOperation::Id: { - using TypeInfo = Attributes::ControlSequenceOfOperation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::SystemMode::Id: { - using TypeInfo = Attributes::SystemMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ThermostatRunningMode::Id: { - using TypeInfo = Attributes::ThermostatRunningMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::StartOfWeek::Id: { - using TypeInfo = Attributes::StartOfWeek::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::NumberOfWeeklyTransitions::Id: { - using TypeInfo = Attributes::NumberOfWeeklyTransitions::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::NumberOfDailyTransitions::Id: { - using TypeInfo = Attributes::NumberOfDailyTransitions::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::TemperatureSetpointHold::Id: { - using TypeInfo = Attributes::TemperatureSetpointHold::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::TemperatureSetpointHoldDuration::Id: { - using TypeInfo = Attributes::TemperatureSetpointHoldDuration::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::ThermostatProgrammingOperationMode::Id: { - using TypeInfo = Attributes::ThermostatProgrammingOperationMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ThermostatRunningState::Id: { - using TypeInfo = Attributes::ThermostatRunningState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::SetpointChangeSource::Id: { - using TypeInfo = Attributes::SetpointChangeSource::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::SetpointChangeAmount::Id: { - using TypeInfo = Attributes::SetpointChangeAmount::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::SetpointChangeSourceTimestamp::Id: { - using TypeInfo = Attributes::SetpointChangeSourceTimestamp::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::OccupiedSetback::Id: { - using TypeInfo = Attributes::OccupiedSetback::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::OccupiedSetbackMin::Id: { - using TypeInfo = Attributes::OccupiedSetbackMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::OccupiedSetbackMax::Id: { - using TypeInfo = Attributes::OccupiedSetbackMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::UnoccupiedSetback::Id: { - using TypeInfo = Attributes::UnoccupiedSetback::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::UnoccupiedSetbackMin::Id: { - using TypeInfo = Attributes::UnoccupiedSetbackMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::UnoccupiedSetbackMax::Id: { - using TypeInfo = Attributes::UnoccupiedSetbackMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::EmergencyHeatDelta::Id: { - using TypeInfo = Attributes::EmergencyHeatDelta::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ACType::Id: { - using TypeInfo = Attributes::ACType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ACCapacity::Id: { - using TypeInfo = Attributes::ACCapacity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ACRefrigerantType::Id: { - using TypeInfo = Attributes::ACRefrigerantType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ACCompressorType::Id: { - using TypeInfo = Attributes::ACCompressorType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ACErrorCode::Id: { - using TypeInfo = Attributes::ACErrorCode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ACLouverPosition::Id: { - using TypeInfo = Attributes::ACLouverPosition::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ACCoilTemperature::Id: { - using TypeInfo = Attributes::ACCoilTemperature::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::ACCapacityformat::Id: { - using TypeInfo = Attributes::ACCapacityformat::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::FanControl::Id: { - using namespace Clusters::FanControl; - switch (aPath.mAttributeId) { - case Attributes::FanMode::Id: { - using TypeInfo = Attributes::FanMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::FanModeSequence::Id: { - using TypeInfo = Attributes::FanModeSequence::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::PercentSetting::Id: { - using TypeInfo = Attributes::PercentSetting::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::PercentCurrent::Id: { - using TypeInfo = Attributes::PercentCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::SpeedMax::Id: { - using TypeInfo = Attributes::SpeedMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::SpeedSetting::Id: { - using TypeInfo = Attributes::SpeedSetting::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::SpeedCurrent::Id: { - using TypeInfo = Attributes::SpeedCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::RockSupport::Id: { - using TypeInfo = Attributes::RockSupport::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::RockSetting::Id: { - using TypeInfo = Attributes::RockSetting::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::WindSupport::Id: { - using TypeInfo = Attributes::WindSupport::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::WindSetting::Id: { - using TypeInfo = Attributes::WindSetting::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ThermostatUserInterfaceConfiguration::Id: { - using namespace Clusters::ThermostatUserInterfaceConfiguration; - switch (aPath.mAttributeId) { - case Attributes::TemperatureDisplayMode::Id: { - using TypeInfo = Attributes::TemperatureDisplayMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::KeypadLockout::Id: { - using TypeInfo = Attributes::KeypadLockout::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ScheduleProgrammingVisibility::Id: { - using TypeInfo = Attributes::ScheduleProgrammingVisibility::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ColorControl::Id: { - using namespace Clusters::ColorControl; - switch (aPath.mAttributeId) { - case Attributes::CurrentHue::Id: { - using TypeInfo = Attributes::CurrentHue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CurrentSaturation::Id: { - using TypeInfo = Attributes::CurrentSaturation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::RemainingTime::Id: { - using TypeInfo = Attributes::RemainingTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::CurrentX::Id: { - using TypeInfo = Attributes::CurrentX::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::CurrentY::Id: { - using TypeInfo = Attributes::CurrentY::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::DriftCompensation::Id: { - using TypeInfo = Attributes::DriftCompensation::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::CompensationText::Id: { - using TypeInfo = Attributes::CompensationText::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ColorTemperatureMireds::Id: { - using TypeInfo = Attributes::ColorTemperatureMireds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorMode::Id: { - using TypeInfo = Attributes::ColorMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::Options::Id: { - using TypeInfo = Attributes::Options::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::NumberOfPrimaries::Id: { - using TypeInfo = Attributes::NumberOfPrimaries::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::Primary1X::Id: { - using TypeInfo = Attributes::Primary1X::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary1Y::Id: { - using TypeInfo = Attributes::Primary1Y::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary1Intensity::Id: { - using TypeInfo = Attributes::Primary1Intensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::Primary2X::Id: { - using TypeInfo = Attributes::Primary2X::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary2Y::Id: { - using TypeInfo = Attributes::Primary2Y::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary2Intensity::Id: { - using TypeInfo = Attributes::Primary2Intensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::Primary3X::Id: { - using TypeInfo = Attributes::Primary3X::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary3Y::Id: { - using TypeInfo = Attributes::Primary3Y::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary3Intensity::Id: { - using TypeInfo = Attributes::Primary3Intensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::Primary4X::Id: { - using TypeInfo = Attributes::Primary4X::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary4Y::Id: { - using TypeInfo = Attributes::Primary4Y::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary4Intensity::Id: { - using TypeInfo = Attributes::Primary4Intensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::Primary5X::Id: { - using TypeInfo = Attributes::Primary5X::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary5Y::Id: { - using TypeInfo = Attributes::Primary5Y::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary5Intensity::Id: { - using TypeInfo = Attributes::Primary5Intensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::Primary6X::Id: { - using TypeInfo = Attributes::Primary6X::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary6Y::Id: { - using TypeInfo = Attributes::Primary6Y::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Primary6Intensity::Id: { - using TypeInfo = Attributes::Primary6Intensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::WhitePointX::Id: { - using TypeInfo = Attributes::WhitePointX::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::WhitePointY::Id: { - using TypeInfo = Attributes::WhitePointY::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointRX::Id: { - using TypeInfo = Attributes::ColorPointRX::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointRY::Id: { - using TypeInfo = Attributes::ColorPointRY::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointRIntensity::Id: { - using TypeInfo = Attributes::ColorPointRIntensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::ColorPointGX::Id: { - using TypeInfo = Attributes::ColorPointGX::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointGY::Id: { - using TypeInfo = Attributes::ColorPointGY::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointGIntensity::Id: { - using TypeInfo = Attributes::ColorPointGIntensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::ColorPointBX::Id: { - using TypeInfo = Attributes::ColorPointBX::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointBY::Id: { - using TypeInfo = Attributes::ColorPointBY::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorPointBIntensity::Id: { - using TypeInfo = Attributes::ColorPointBIntensity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::EnhancedCurrentHue::Id: { - using TypeInfo = Attributes::EnhancedCurrentHue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::EnhancedColorMode::Id: { - using TypeInfo = Attributes::EnhancedColorMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ColorLoopActive::Id: { - using TypeInfo = Attributes::ColorLoopActive::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ColorLoopDirection::Id: { - using TypeInfo = Attributes::ColorLoopDirection::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::ColorLoopTime::Id: { - using TypeInfo = Attributes::ColorLoopTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorLoopStartEnhancedHue::Id: { - using TypeInfo = Attributes::ColorLoopStartEnhancedHue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorLoopStoredEnhancedHue::Id: { - using TypeInfo = Attributes::ColorLoopStoredEnhancedHue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorCapabilities::Id: { - using TypeInfo = Attributes::ColorCapabilities::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorTempPhysicalMinMireds::Id: { - using TypeInfo = Attributes::ColorTempPhysicalMinMireds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ColorTempPhysicalMaxMireds::Id: { - using TypeInfo = Attributes::ColorTempPhysicalMaxMireds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::CoupleColorTempToLevelMinMireds::Id: { - using TypeInfo = Attributes::CoupleColorTempToLevelMinMireds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::StartUpColorTemperatureMireds::Id: { - using TypeInfo = Attributes::StartUpColorTemperatureMireds::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::BallastConfiguration::Id: { - using namespace Clusters::BallastConfiguration; - switch (aPath.mAttributeId) { - case Attributes::PhysicalMinLevel::Id: { - using TypeInfo = Attributes::PhysicalMinLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::PhysicalMaxLevel::Id: { - using TypeInfo = Attributes::PhysicalMaxLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::BallastStatus::Id: { - using TypeInfo = Attributes::BallastStatus::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MinLevel::Id: { - using TypeInfo = Attributes::MinLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::MaxLevel::Id: { - using TypeInfo = Attributes::MaxLevel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::IntrinsicBallastFactor::Id: { - using TypeInfo = Attributes::IntrinsicBallastFactor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::BallastFactorAdjustment::Id: { - using TypeInfo = Attributes::BallastFactorAdjustment::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::LampQuantity::Id: { - using TypeInfo = Attributes::LampQuantity::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::LampType::Id: { - using TypeInfo = Attributes::LampType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::LampManufacturer::Id: { - using TypeInfo = Attributes::LampManufacturer::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::LampRatedHours::Id: { - using TypeInfo = Attributes::LampRatedHours::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::LampBurnHours::Id: { - using TypeInfo = Attributes::LampBurnHours::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::LampAlarmMode::Id: { - using TypeInfo = Attributes::LampAlarmMode::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::LampBurnHoursTripPoint::Id: { - using TypeInfo = Attributes::LampBurnHoursTripPoint::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::IlluminanceMeasurement::Id: { - using namespace Clusters::IlluminanceMeasurement; - switch (aPath.mAttributeId) { - case Attributes::MeasuredValue::Id: { - using TypeInfo = Attributes::MeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinMeasuredValue::Id: { - using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxMeasuredValue::Id: { - using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::Tolerance::Id: { - using TypeInfo = Attributes::Tolerance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::LightSensorType::Id: { - using TypeInfo = Attributes::LightSensorType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::TemperatureMeasurement::Id: { - using namespace Clusters::TemperatureMeasurement; - switch (aPath.mAttributeId) { - case Attributes::MeasuredValue::Id: { - using TypeInfo = Attributes::MeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinMeasuredValue::Id: { - using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxMeasuredValue::Id: { - using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::Tolerance::Id: { - using TypeInfo = Attributes::Tolerance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::PressureMeasurement::Id: { - using namespace Clusters::PressureMeasurement; - switch (aPath.mAttributeId) { - case Attributes::MeasuredValue::Id: { - using TypeInfo = Attributes::MeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinMeasuredValue::Id: { - using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxMeasuredValue::Id: { - using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::Tolerance::Id: { - using TypeInfo = Attributes::Tolerance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ScaledValue::Id: { - using TypeInfo = Attributes::ScaledValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinScaledValue::Id: { - using TypeInfo = Attributes::MinScaledValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxScaledValue::Id: { - using TypeInfo = Attributes::MaxScaledValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::ScaledTolerance::Id: { - using TypeInfo = Attributes::ScaledTolerance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Scale::Id: { - using TypeInfo = Attributes::Scale::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::FlowMeasurement::Id: { - using namespace Clusters::FlowMeasurement; - switch (aPath.mAttributeId) { - case Attributes::MeasuredValue::Id: { - using TypeInfo = Attributes::MeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinMeasuredValue::Id: { - using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxMeasuredValue::Id: { - using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::Tolerance::Id: { - using TypeInfo = Attributes::Tolerance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::RelativeHumidityMeasurement::Id: { - using namespace Clusters::RelativeHumidityMeasurement; - switch (aPath.mAttributeId) { - case Attributes::MeasuredValue::Id: { - using TypeInfo = Attributes::MeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MinMeasuredValue::Id: { - using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::MaxMeasuredValue::Id: { - using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::Tolerance::Id: { - using TypeInfo = Attributes::Tolerance::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::OccupancySensing::Id: { - using namespace Clusters::OccupancySensing; - switch (aPath.mAttributeId) { - case Attributes::Occupancy::Id: { - using TypeInfo = Attributes::Occupancy::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::OccupancySensorType::Id: { - using TypeInfo = Attributes::OccupancySensorType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::OccupancySensorTypeBitmap::Id: { - using TypeInfo = Attributes::OccupancySensorTypeBitmap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::PIROccupiedToUnoccupiedDelay::Id: { - using TypeInfo = Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PIRUnoccupiedToOccupiedDelay::Id: { - using TypeInfo = Attributes::PIRUnoccupiedToOccupiedDelay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PIRUnoccupiedToOccupiedThreshold::Id: { - using TypeInfo = Attributes::PIRUnoccupiedToOccupiedThreshold::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id: { - using TypeInfo = Attributes::UltrasonicOccupiedToUnoccupiedDelay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id: { - using TypeInfo = Attributes::UltrasonicUnoccupiedToOccupiedDelay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id: { - using TypeInfo = Attributes::UltrasonicUnoccupiedToOccupiedThreshold::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id: { - using TypeInfo = Attributes::PhysicalContactOccupiedToUnoccupiedDelay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id: { - using TypeInfo = Attributes::PhysicalContactUnoccupiedToOccupiedDelay::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id: { - using TypeInfo = Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::WakeOnLan::Id: { - using namespace Clusters::WakeOnLan; - switch (aPath.mAttributeId) { - case Attributes::MACAddress::Id: { - using TypeInfo = Attributes::MACAddress::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::Channel::Id: { - using namespace Clusters::Channel; - switch (aPath.mAttributeId) { - case Attributes::ChannelList::Id: { - using TypeInfo = Attributes::ChannelList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRChannelClusterChannelInfoStruct * newElement_0; - newElement_0 = [MTRChannelClusterChannelInfoStruct new]; - newElement_0.majorNumber = [NSNumber numberWithUnsignedShort:entry_0.majorNumber]; - newElement_0.minorNumber = [NSNumber numberWithUnsignedShort:entry_0.minorNumber]; - if (entry_0.name.HasValue()) { - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().data() - length:entry_0.name.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.name = nil; - } - if (entry_0.callSign.HasValue()) { - newElement_0.callSign = [[NSString alloc] initWithBytes:entry_0.callSign.Value().data() - length:entry_0.callSign.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.callSign = nil; - } - if (entry_0.affiliateCallSign.HasValue()) { - newElement_0.affiliateCallSign = [[NSString alloc] initWithBytes:entry_0.affiliateCallSign.Value().data() - length:entry_0.affiliateCallSign.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.affiliateCallSign = nil; - } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::Lineup::Id: { - using TypeInfo = Attributes::Lineup::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRChannelClusterLineupInfoStruct * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRChannelClusterLineupInfoStruct new]; - value.operatorName = [[NSString alloc] initWithBytes:cppValue.Value().operatorName.data() - length:cppValue.Value().operatorName.size() - encoding:NSUTF8StringEncoding]; - if (cppValue.Value().lineupName.HasValue()) { - value.lineupName = [[NSString alloc] initWithBytes:cppValue.Value().lineupName.Value().data() - length:cppValue.Value().lineupName.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - value.lineupName = nil; - } - if (cppValue.Value().postalCode.HasValue()) { - value.postalCode = [[NSString alloc] initWithBytes:cppValue.Value().postalCode.Value().data() - length:cppValue.Value().postalCode.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - value.postalCode = nil; - } - value.lineupInfoType = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().lineupInfoType)]; - } - return value; - } - case Attributes::CurrentChannel::Id: { - using TypeInfo = Attributes::CurrentChannel::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRChannelClusterChannelInfoStruct * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRChannelClusterChannelInfoStruct new]; - value.majorNumber = [NSNumber numberWithUnsignedShort:cppValue.Value().majorNumber]; - value.minorNumber = [NSNumber numberWithUnsignedShort:cppValue.Value().minorNumber]; - if (cppValue.Value().name.HasValue()) { - value.name = [[NSString alloc] initWithBytes:cppValue.Value().name.Value().data() - length:cppValue.Value().name.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - value.name = nil; - } - if (cppValue.Value().callSign.HasValue()) { - value.callSign = [[NSString alloc] initWithBytes:cppValue.Value().callSign.Value().data() - length:cppValue.Value().callSign.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - value.callSign = nil; - } - if (cppValue.Value().affiliateCallSign.HasValue()) { - value.affiliateCallSign = [[NSString alloc] initWithBytes:cppValue.Value().affiliateCallSign.Value().data() - length:cppValue.Value().affiliateCallSign.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - value.affiliateCallSign = nil; - } - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::TargetNavigator::Id: { - using namespace Clusters::TargetNavigator; - switch (aPath.mAttributeId) { - case Attributes::TargetList::Id: { - using TypeInfo = Attributes::TargetList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRTargetNavigatorClusterTargetInfoStruct * newElement_0; - newElement_0 = [MTRTargetNavigatorClusterTargetInfoStruct new]; - newElement_0.identifier = [NSNumber numberWithUnsignedChar:entry_0.identifier]; - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() - length:entry_0.name.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentTarget::Id: { - using TypeInfo = Attributes::CurrentTarget::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::MediaPlayback::Id: { - using namespace Clusters::MediaPlayback; - switch (aPath.mAttributeId) { - case Attributes::CurrentState::Id: { - using TypeInfo = Attributes::CurrentState::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::StartTime::Id: { - using TypeInfo = Attributes::StartTime::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::Duration::Id: { - using TypeInfo = Attributes::Duration::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::SampledPosition::Id: { - using TypeInfo = Attributes::SampledPosition::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRMediaPlaybackClusterPlaybackPositionStruct * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRMediaPlaybackClusterPlaybackPositionStruct new]; - value.updatedAt = [NSNumber numberWithUnsignedLongLong:cppValue.Value().updatedAt]; - if (cppValue.Value().position.IsNull()) { - value.position = nil; - } else { - value.position = [NSNumber numberWithUnsignedLongLong:cppValue.Value().position.Value()]; - } - } - return value; - } - case Attributes::PlaybackSpeed::Id: { - using TypeInfo = Attributes::PlaybackSpeed::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithFloat:cppValue]; - return value; - } - case Attributes::SeekRangeEnd::Id: { - using TypeInfo = Attributes::SeekRangeEnd::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::SeekRangeStart::Id: { - using TypeInfo = Attributes::SeekRangeStart::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::MediaInput::Id: { - using namespace Clusters::MediaInput; - switch (aPath.mAttributeId) { - case Attributes::InputList::Id: { - using TypeInfo = Attributes::InputList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRMediaInputClusterInputInfoStruct * newElement_0; - newElement_0 = [MTRMediaInputClusterInputInfoStruct new]; - newElement_0.index = [NSNumber numberWithUnsignedChar:entry_0.index]; - newElement_0.inputType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.inputType)]; - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() - length:entry_0.name.size() - encoding:NSUTF8StringEncoding]; - newElement_0.descriptionString = [[NSString alloc] initWithBytes:entry_0.description.data() - length:entry_0.description.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentInput::Id: { - using TypeInfo = Attributes::CurrentInput::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::LowPower::Id: { - using namespace Clusters::LowPower; - switch (aPath.mAttributeId) { - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::KeypadInput::Id: { - using namespace Clusters::KeypadInput; - switch (aPath.mAttributeId) { - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ContentLauncher::Id: { - using namespace Clusters::ContentLauncher; - switch (aPath.mAttributeId) { - case Attributes::AcceptHeader::Id: { - using TypeInfo = Attributes::AcceptHeader::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSString * newElement_0; - newElement_0 = [[NSString alloc] initWithBytes:entry_0.data() - length:entry_0.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::SupportedStreamingProtocols::Id: { - using TypeInfo = Attributes::SupportedStreamingProtocols::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::AudioOutput::Id: { - using namespace Clusters::AudioOutput; - switch (aPath.mAttributeId) { - case Attributes::OutputList::Id: { - using TypeInfo = Attributes::OutputList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRAudioOutputClusterOutputInfoStruct * newElement_0; - newElement_0 = [MTRAudioOutputClusterOutputInfoStruct new]; - newElement_0.index = [NSNumber numberWithUnsignedChar:entry_0.index]; - newElement_0.outputType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.outputType)]; - newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() - length:entry_0.name.size() - encoding:NSUTF8StringEncoding]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentOutput::Id: { - using TypeInfo = Attributes::CurrentOutput::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ApplicationLauncher::Id: { - using namespace Clusters::ApplicationLauncher; - switch (aPath.mAttributeId) { - case Attributes::CatalogList::Id: { - using TypeInfo = Attributes::CatalogList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::CurrentApp::Id: { - using TypeInfo = Attributes::CurrentApp::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRApplicationLauncherClusterApplicationEPStruct new]; - value.application = [MTRApplicationLauncherClusterApplicationStruct new]; - value.application.catalogVendorID = [NSNumber numberWithUnsignedShort:cppValue.Value().application.catalogVendorID]; - value.application.applicationID = [[NSString alloc] initWithBytes:cppValue.Value().application.applicationID.data() - length:cppValue.Value().application.applicationID.size() - encoding:NSUTF8StringEncoding]; - if (cppValue.Value().endpoint.HasValue()) { - value.endpoint = [NSNumber numberWithUnsignedShort:cppValue.Value().endpoint.Value()]; - } else { - value.endpoint = nil; - } - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ApplicationBasic::Id: { - using namespace Clusters::ApplicationBasic; - switch (aPath.mAttributeId) { - case Attributes::VendorName::Id: { - using TypeInfo = Attributes::VendorName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::VendorID::Id: { - using TypeInfo = Attributes::VendorID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ApplicationName::Id: { - using TypeInfo = Attributes::ApplicationName::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::ProductID::Id: { - using TypeInfo = Attributes::ProductID::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Application::Id: { - using TypeInfo = Attributes::Application::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRApplicationBasicClusterApplicationStruct * _Nonnull value; - value = [MTRApplicationBasicClusterApplicationStruct new]; - value.catalogVendorID = [NSNumber numberWithUnsignedShort:cppValue.catalogVendorID]; - value.applicationID = [[NSString alloc] initWithBytes:cppValue.applicationID.data() - length:cppValue.applicationID.size() - encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::Status::Id: { - using TypeInfo = Attributes::Status::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; - } - case Attributes::ApplicationVersion::Id: { - using TypeInfo = Attributes::ApplicationVersion::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::AllowedVendorList::Id: { - using TypeInfo = Attributes::AllowedVendorList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::AccountLogin::Id: { - using namespace Clusters::AccountLogin; - switch (aPath.mAttributeId) { - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } - break; - } - case Clusters::ElectricalMeasurement::Id: { - using namespace Clusters::ElectricalMeasurement; - switch (aPath.mAttributeId) { - case Attributes::MeasurementType::Id: { - using TypeInfo = Attributes::MeasurementType::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::DcVoltage::Id: { - using TypeInfo = Attributes::DcVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcVoltageMin::Id: { - using TypeInfo = Attributes::DcVoltageMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcVoltageMax::Id: { - using TypeInfo = Attributes::DcVoltageMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcCurrent::Id: { - using TypeInfo = Attributes::DcCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcCurrentMin::Id: { - using TypeInfo = Attributes::DcCurrentMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcCurrentMax::Id: { - using TypeInfo = Attributes::DcCurrentMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcPower::Id: { - using TypeInfo = Attributes::DcPower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcPowerMin::Id: { - using TypeInfo = Attributes::DcPowerMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcPowerMax::Id: { - using TypeInfo = Attributes::DcPowerMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::DcVoltageMultiplier::Id: { - using TypeInfo = Attributes::DcVoltageMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::DcVoltageDivisor::Id: { - using TypeInfo = Attributes::DcVoltageDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::DcCurrentMultiplier::Id: { - using TypeInfo = Attributes::DcCurrentMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::DcCurrentDivisor::Id: { - using TypeInfo = Attributes::DcCurrentDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::DcPowerMultiplier::Id: { - using TypeInfo = Attributes::DcPowerMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::DcPowerDivisor::Id: { - using TypeInfo = Attributes::DcPowerDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcFrequency::Id: { - using TypeInfo = Attributes::AcFrequency::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcFrequencyMin::Id: { - using TypeInfo = Attributes::AcFrequencyMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcFrequencyMax::Id: { - using TypeInfo = Attributes::AcFrequencyMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::NeutralCurrent::Id: { - using TypeInfo = Attributes::NeutralCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::TotalActivePower::Id: { - using TypeInfo = Attributes::TotalActivePower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithInt:cppValue]; - return value; - } - case Attributes::TotalReactivePower::Id: { - using TypeInfo = Attributes::TotalReactivePower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithInt:cppValue]; - return value; - } - case Attributes::TotalApparentPower::Id: { - using TypeInfo = Attributes::TotalApparentPower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::Measured1stHarmonicCurrent::Id: { - using TypeInfo = Attributes::Measured1stHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::Measured3rdHarmonicCurrent::Id: { - using TypeInfo = Attributes::Measured3rdHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::Measured5thHarmonicCurrent::Id: { - using TypeInfo = Attributes::Measured5thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::Measured7thHarmonicCurrent::Id: { - using TypeInfo = Attributes::Measured7thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::Measured9thHarmonicCurrent::Id: { - using TypeInfo = Attributes::Measured9thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::Measured11thHarmonicCurrent::Id: { - using TypeInfo = Attributes::Measured11thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MeasuredPhase1stHarmonicCurrent::Id: { - using TypeInfo = Attributes::MeasuredPhase1stHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MeasuredPhase3rdHarmonicCurrent::Id: { - using TypeInfo = Attributes::MeasuredPhase3rdHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MeasuredPhase5thHarmonicCurrent::Id: { - using TypeInfo = Attributes::MeasuredPhase5thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MeasuredPhase7thHarmonicCurrent::Id: { - using TypeInfo = Attributes::MeasuredPhase7thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MeasuredPhase9thHarmonicCurrent::Id: { - using TypeInfo = Attributes::MeasuredPhase9thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::MeasuredPhase11thHarmonicCurrent::Id: { - using TypeInfo = Attributes::MeasuredPhase11thHarmonicCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AcFrequencyMultiplier::Id: { - using TypeInfo = Attributes::AcFrequencyMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcFrequencyDivisor::Id: { - using TypeInfo = Attributes::AcFrequencyDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PowerMultiplier::Id: { - using TypeInfo = Attributes::PowerMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::PowerDivisor::Id: { - using TypeInfo = Attributes::PowerDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::HarmonicCurrentMultiplier::Id: { - using TypeInfo = Attributes::HarmonicCurrentMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::PhaseHarmonicCurrentMultiplier::Id: { - using TypeInfo = Attributes::PhaseHarmonicCurrentMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::InstantaneousVoltage::Id: { - using TypeInfo = Attributes::InstantaneousVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::InstantaneousLineCurrent::Id: { - using TypeInfo = Attributes::InstantaneousLineCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::InstantaneousActiveCurrent::Id: { - using TypeInfo = Attributes::InstantaneousActiveCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::InstantaneousReactiveCurrent::Id: { - using TypeInfo = Attributes::InstantaneousReactiveCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::InstantaneousPower::Id: { - using TypeInfo = Attributes::InstantaneousPower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsVoltage::Id: { - using TypeInfo = Attributes::RmsVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageMin::Id: { - using TypeInfo = Attributes::RmsVoltageMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageMax::Id: { - using TypeInfo = Attributes::RmsVoltageMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrent::Id: { - using TypeInfo = Attributes::RmsCurrent::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentMin::Id: { - using TypeInfo = Attributes::RmsCurrentMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentMax::Id: { - using TypeInfo = Attributes::RmsCurrentMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ActivePower::Id: { - using TypeInfo = Attributes::ActivePower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ActivePowerMin::Id: { - using TypeInfo = Attributes::ActivePowerMin::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ActivePowerMax::Id: { - using TypeInfo = Attributes::ActivePowerMax::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ReactivePower::Id: { - using TypeInfo = Attributes::ReactivePower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ApparentPower::Id: { - using TypeInfo = Attributes::ApparentPower::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PowerFactor::Id: { - using TypeInfo = Attributes::PowerFactor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::AverageRmsVoltageMeasurementPeriod::Id: { - using TypeInfo = Attributes::AverageRmsVoltageMeasurementPeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AverageRmsUnderVoltageCounter::Id: { - using TypeInfo = Attributes::AverageRmsUnderVoltageCounter::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsExtremeOverVoltagePeriod::Id: { - using TypeInfo = Attributes::RmsExtremeOverVoltagePeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsExtremeUnderVoltagePeriod::Id: { - using TypeInfo = Attributes::RmsExtremeUnderVoltagePeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSagPeriod::Id: { - using TypeInfo = Attributes::RmsVoltageSagPeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSwellPeriod::Id: { - using TypeInfo = Attributes::RmsVoltageSwellPeriod::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcVoltageMultiplier::Id: { - using TypeInfo = Attributes::AcVoltageMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcVoltageDivisor::Id: { - using TypeInfo = Attributes::AcVoltageDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcCurrentMultiplier::Id: { - using TypeInfo = Attributes::AcCurrentMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcCurrentDivisor::Id: { - using TypeInfo = Attributes::AcCurrentDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcPowerMultiplier::Id: { - using TypeInfo = Attributes::AcPowerMultiplier::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcPowerDivisor::Id: { - using TypeInfo = Attributes::AcPowerDivisor::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::OverloadAlarmsMask::Id: { - using TypeInfo = Attributes::OverloadAlarmsMask::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::VoltageOverload::Id: { - using TypeInfo = Attributes::VoltageOverload::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::CurrentOverload::Id: { - using TypeInfo = Attributes::CurrentOverload::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AcOverloadAlarmsMask::Id: { - using TypeInfo = Attributes::AcOverloadAlarmsMask::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AcVoltageOverload::Id: { - using TypeInfo = Attributes::AcVoltageOverload::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AcCurrentOverload::Id: { - using TypeInfo = Attributes::AcCurrentOverload::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AcActivePowerOverload::Id: { - using TypeInfo = Attributes::AcActivePowerOverload::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AcReactivePowerOverload::Id: { - using TypeInfo = Attributes::AcReactivePowerOverload::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AverageRmsOverVoltage::Id: { - using TypeInfo = Attributes::AverageRmsOverVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::AverageRmsUnderVoltage::Id: { - using TypeInfo = Attributes::AverageRmsUnderVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsExtremeOverVoltage::Id: { - using TypeInfo = Attributes::RmsExtremeOverVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsExtremeUnderVoltage::Id: { - using TypeInfo = Attributes::RmsExtremeUnderVoltage::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSag::Id: { - using TypeInfo = Attributes::RmsVoltageSag::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSwell::Id: { - using TypeInfo = Attributes::RmsVoltageSwell::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::LineCurrentPhaseB::Id: { - using TypeInfo = Attributes::LineCurrentPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ActiveCurrentPhaseB::Id: { - using TypeInfo = Attributes::ActiveCurrentPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ReactiveCurrentPhaseB::Id: { - using TypeInfo = Attributes::ReactiveCurrentPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsVoltagePhaseB::Id: { - using TypeInfo = Attributes::RmsVoltagePhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageMinPhaseB::Id: { - using TypeInfo = Attributes::RmsVoltageMinPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageMaxPhaseB::Id: { - using TypeInfo = Attributes::RmsVoltageMaxPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentPhaseB::Id: { - using TypeInfo = Attributes::RmsCurrentPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentMinPhaseB::Id: { - using TypeInfo = Attributes::RmsCurrentMinPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentMaxPhaseB::Id: { - using TypeInfo = Attributes::RmsCurrentMaxPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ActivePowerPhaseB::Id: { - using TypeInfo = Attributes::ActivePowerPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ActivePowerMinPhaseB::Id: { - using TypeInfo = Attributes::ActivePowerMinPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ActivePowerMaxPhaseB::Id: { - using TypeInfo = Attributes::ActivePowerMaxPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ReactivePowerPhaseB::Id: { - using TypeInfo = Attributes::ReactivePowerPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ApparentPowerPhaseB::Id: { - using TypeInfo = Attributes::ApparentPowerPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PowerFactorPhaseB::Id: { - using TypeInfo = Attributes::PowerFactorPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::AverageRmsVoltageMeasurementPeriodPhaseB::Id: { - using TypeInfo = Attributes::AverageRmsVoltageMeasurementPeriodPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AverageRmsOverVoltageCounterPhaseB::Id: { - using TypeInfo = Attributes::AverageRmsOverVoltageCounterPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AverageRmsUnderVoltageCounterPhaseB::Id: { - using TypeInfo = Attributes::AverageRmsUnderVoltageCounterPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsExtremeOverVoltagePeriodPhaseB::Id: { - using TypeInfo = Attributes::RmsExtremeOverVoltagePeriodPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsExtremeUnderVoltagePeriodPhaseB::Id: { - using TypeInfo = Attributes::RmsExtremeUnderVoltagePeriodPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSagPeriodPhaseB::Id: { - using TypeInfo = Attributes::RmsVoltageSagPeriodPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSwellPeriodPhaseB::Id: { - using TypeInfo = Attributes::RmsVoltageSwellPeriodPhaseB::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::LineCurrentPhaseC::Id: { - using TypeInfo = Attributes::LineCurrentPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ActiveCurrentPhaseC::Id: { - using TypeInfo = Attributes::ActiveCurrentPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ReactiveCurrentPhaseC::Id: { - using TypeInfo = Attributes::ReactiveCurrentPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::RmsVoltagePhaseC::Id: { - using TypeInfo = Attributes::RmsVoltagePhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageMinPhaseC::Id: { - using TypeInfo = Attributes::RmsVoltageMinPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageMaxPhaseC::Id: { - using TypeInfo = Attributes::RmsVoltageMaxPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentPhaseC::Id: { - using TypeInfo = Attributes::RmsCurrentPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentMinPhaseC::Id: { - using TypeInfo = Attributes::RmsCurrentMinPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsCurrentMaxPhaseC::Id: { - using TypeInfo = Attributes::RmsCurrentMaxPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::ActivePowerPhaseC::Id: { - using TypeInfo = Attributes::ActivePowerPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ActivePowerMinPhaseC::Id: { - using TypeInfo = Attributes::ActivePowerMinPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ActivePowerMaxPhaseC::Id: { - using TypeInfo = Attributes::ActivePowerMaxPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ReactivePowerPhaseC::Id: { - using TypeInfo = Attributes::ReactivePowerPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::ApparentPowerPhaseC::Id: { - using TypeInfo = Attributes::ApparentPowerPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::PowerFactorPhaseC::Id: { - using TypeInfo = Attributes::PowerFactorPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::AverageRmsVoltageMeasurementPeriodPhaseC::Id: { - using TypeInfo = Attributes::AverageRmsVoltageMeasurementPeriodPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AverageRmsOverVoltageCounterPhaseC::Id: { - using TypeInfo = Attributes::AverageRmsOverVoltageCounterPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::AverageRmsUnderVoltageCounterPhaseC::Id: { - using TypeInfo = Attributes::AverageRmsUnderVoltageCounterPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsExtremeOverVoltagePeriodPhaseC::Id: { - using TypeInfo = Attributes::RmsExtremeOverVoltagePeriodPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsExtremeUnderVoltagePeriodPhaseC::Id: { - using TypeInfo = Attributes::RmsExtremeUnderVoltagePeriodPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSagPeriodPhaseC::Id: { - using TypeInfo = Attributes::RmsVoltageSagPeriodPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::RmsVoltageSwellPeriodPhaseC::Id: { - using TypeInfo = Attributes::RmsVoltageSwellPeriodPhaseC::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; - } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForThermostatCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Thermostat; + switch (aAttributeId) { + case Attributes::LocalTemperature::Id: { + using TypeInfo = Attributes::LocalTemperature::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::OutdoorTemperature::Id: { + using TypeInfo = Attributes::OutdoorTemperature::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::Occupancy::Id: { + using TypeInfo = Attributes::Occupancy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::AbsMinHeatSetpointLimit::Id: { + using TypeInfo = Attributes::AbsMinHeatSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AbsMaxHeatSetpointLimit::Id: { + using TypeInfo = Attributes::AbsMaxHeatSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AbsMinCoolSetpointLimit::Id: { + using TypeInfo = Attributes::AbsMinCoolSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AbsMaxCoolSetpointLimit::Id: { + using TypeInfo = Attributes::AbsMaxCoolSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::PICoolingDemand::Id: { + using TypeInfo = Attributes::PICoolingDemand::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::PIHeatingDemand::Id: { + using TypeInfo = Attributes::PIHeatingDemand::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::HVACSystemTypeConfiguration::Id: { + using TypeInfo = Attributes::HVACSystemTypeConfiguration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::LocalTemperatureCalibration::Id: { + using TypeInfo = Attributes::LocalTemperatureCalibration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::OccupiedCoolingSetpoint::Id: { + using TypeInfo = Attributes::OccupiedCoolingSetpoint::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::OccupiedHeatingSetpoint::Id: { + using TypeInfo = Attributes::OccupiedHeatingSetpoint::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::UnoccupiedCoolingSetpoint::Id: { + using TypeInfo = Attributes::UnoccupiedCoolingSetpoint::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::UnoccupiedHeatingSetpoint::Id: { + using TypeInfo = Attributes::UnoccupiedHeatingSetpoint::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MinHeatSetpointLimit::Id: { + using TypeInfo = Attributes::MinHeatSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MaxHeatSetpointLimit::Id: { + using TypeInfo = Attributes::MaxHeatSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MinCoolSetpointLimit::Id: { + using TypeInfo = Attributes::MinCoolSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MaxCoolSetpointLimit::Id: { + using TypeInfo = Attributes::MaxCoolSetpointLimit::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MinSetpointDeadBand::Id: { + using TypeInfo = Attributes::MinSetpointDeadBand::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::RemoteSensing::Id: { + using TypeInfo = Attributes::RemoteSensing::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ControlSequenceOfOperation::Id: { + using TypeInfo = Attributes::ControlSequenceOfOperation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::SystemMode::Id: { + using TypeInfo = Attributes::SystemMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ThermostatRunningMode::Id: { + using TypeInfo = Attributes::ThermostatRunningMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::StartOfWeek::Id: { + using TypeInfo = Attributes::StartOfWeek::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfWeeklyTransitions::Id: { + using TypeInfo = Attributes::NumberOfWeeklyTransitions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfDailyTransitions::Id: { + using TypeInfo = Attributes::NumberOfDailyTransitions::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::TemperatureSetpointHold::Id: { + using TypeInfo = Attributes::TemperatureSetpointHold::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::TemperatureSetpointHoldDuration::Id: { + using TypeInfo = Attributes::TemperatureSetpointHoldDuration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::ThermostatProgrammingOperationMode::Id: { + using TypeInfo = Attributes::ThermostatProgrammingOperationMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ThermostatRunningState::Id: { + using TypeInfo = Attributes::ThermostatRunningState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::SetpointChangeSource::Id: { + using TypeInfo = Attributes::SetpointChangeSource::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::SetpointChangeAmount::Id: { + using TypeInfo = Attributes::SetpointChangeAmount::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::SetpointChangeSourceTimestamp::Id: { + using TypeInfo = Attributes::SetpointChangeSourceTimestamp::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::OccupiedSetback::Id: { + using TypeInfo = Attributes::OccupiedSetback::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::OccupiedSetbackMin::Id: { + using TypeInfo = Attributes::OccupiedSetbackMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::OccupiedSetbackMax::Id: { + using TypeInfo = Attributes::OccupiedSetbackMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::UnoccupiedSetback::Id: { + using TypeInfo = Attributes::UnoccupiedSetback::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::UnoccupiedSetbackMin::Id: { + using TypeInfo = Attributes::UnoccupiedSetbackMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::UnoccupiedSetbackMax::Id: { + using TypeInfo = Attributes::UnoccupiedSetbackMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::EmergencyHeatDelta::Id: { + using TypeInfo = Attributes::EmergencyHeatDelta::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ACType::Id: { + using TypeInfo = Attributes::ACType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ACCapacity::Id: { + using TypeInfo = Attributes::ACCapacity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ACRefrigerantType::Id: { + using TypeInfo = Attributes::ACRefrigerantType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ACCompressorType::Id: { + using TypeInfo = Attributes::ACCompressorType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ACErrorCode::Id: { + using TypeInfo = Attributes::ACErrorCode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ACLouverPosition::Id: { + using TypeInfo = Attributes::ACLouverPosition::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ACCoilTemperature::Id: { + using TypeInfo = Attributes::ACCoilTemperature::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::ACCapacityformat::Id: { + using TypeInfo = Attributes::ACCapacityformat::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForFanControlCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::FanControl; + switch (aAttributeId) { + case Attributes::FanMode::Id: { + using TypeInfo = Attributes::FanMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::FanModeSequence::Id: { + using TypeInfo = Attributes::FanModeSequence::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::PercentSetting::Id: { + using TypeInfo = Attributes::PercentSetting::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::PercentCurrent::Id: { + using TypeInfo = Attributes::PercentCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::SpeedMax::Id: { + using TypeInfo = Attributes::SpeedMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::SpeedSetting::Id: { + using TypeInfo = Attributes::SpeedSetting::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::SpeedCurrent::Id: { + using TypeInfo = Attributes::SpeedCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::RockSupport::Id: { + using TypeInfo = Attributes::RockSupport::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::RockSetting::Id: { + using TypeInfo = Attributes::RockSetting::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::WindSupport::Id: { + using TypeInfo = Attributes::WindSupport::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::WindSetting::Id: { + using TypeInfo = Attributes::WindSetting::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForThermostatUserInterfaceConfigurationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ThermostatUserInterfaceConfiguration; + switch (aAttributeId) { + case Attributes::TemperatureDisplayMode::Id: { + using TypeInfo = Attributes::TemperatureDisplayMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::KeypadLockout::Id: { + using TypeInfo = Attributes::KeypadLockout::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ScheduleProgrammingVisibility::Id: { + using TypeInfo = Attributes::ScheduleProgrammingVisibility::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForColorControlCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ColorControl; + switch (aAttributeId) { + case Attributes::CurrentHue::Id: { + using TypeInfo = Attributes::CurrentHue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CurrentSaturation::Id: { + using TypeInfo = Attributes::CurrentSaturation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::RemainingTime::Id: { + using TypeInfo = Attributes::RemainingTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::CurrentX::Id: { + using TypeInfo = Attributes::CurrentX::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::CurrentY::Id: { + using TypeInfo = Attributes::CurrentY::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::DriftCompensation::Id: { + using TypeInfo = Attributes::DriftCompensation::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::CompensationText::Id: { + using TypeInfo = Attributes::CompensationText::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ColorTemperatureMireds::Id: { + using TypeInfo = Attributes::ColorTemperatureMireds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorMode::Id: { + using TypeInfo = Attributes::ColorMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Options::Id: { + using TypeInfo = Attributes::Options::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::NumberOfPrimaries::Id: { + using TypeInfo = Attributes::NumberOfPrimaries::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::Primary1X::Id: { + using TypeInfo = Attributes::Primary1X::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary1Y::Id: { + using TypeInfo = Attributes::Primary1Y::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary1Intensity::Id: { + using TypeInfo = Attributes::Primary1Intensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::Primary2X::Id: { + using TypeInfo = Attributes::Primary2X::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary2Y::Id: { + using TypeInfo = Attributes::Primary2Y::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary2Intensity::Id: { + using TypeInfo = Attributes::Primary2Intensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::Primary3X::Id: { + using TypeInfo = Attributes::Primary3X::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary3Y::Id: { + using TypeInfo = Attributes::Primary3Y::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary3Intensity::Id: { + using TypeInfo = Attributes::Primary3Intensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::Primary4X::Id: { + using TypeInfo = Attributes::Primary4X::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary4Y::Id: { + using TypeInfo = Attributes::Primary4Y::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary4Intensity::Id: { + using TypeInfo = Attributes::Primary4Intensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::Primary5X::Id: { + using TypeInfo = Attributes::Primary5X::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary5Y::Id: { + using TypeInfo = Attributes::Primary5Y::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary5Intensity::Id: { + using TypeInfo = Attributes::Primary5Intensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::Primary6X::Id: { + using TypeInfo = Attributes::Primary6X::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary6Y::Id: { + using TypeInfo = Attributes::Primary6Y::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Primary6Intensity::Id: { + using TypeInfo = Attributes::Primary6Intensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::WhitePointX::Id: { + using TypeInfo = Attributes::WhitePointX::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::WhitePointY::Id: { + using TypeInfo = Attributes::WhitePointY::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointRX::Id: { + using TypeInfo = Attributes::ColorPointRX::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointRY::Id: { + using TypeInfo = Attributes::ColorPointRY::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointRIntensity::Id: { + using TypeInfo = Attributes::ColorPointRIntensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::ColorPointGX::Id: { + using TypeInfo = Attributes::ColorPointGX::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointGY::Id: { + using TypeInfo = Attributes::ColorPointGY::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointGIntensity::Id: { + using TypeInfo = Attributes::ColorPointGIntensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::ColorPointBX::Id: { + using TypeInfo = Attributes::ColorPointBX::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointBY::Id: { + using TypeInfo = Attributes::ColorPointBY::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorPointBIntensity::Id: { + using TypeInfo = Attributes::ColorPointBIntensity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::EnhancedCurrentHue::Id: { + using TypeInfo = Attributes::EnhancedCurrentHue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::EnhancedColorMode::Id: { + using TypeInfo = Attributes::EnhancedColorMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ColorLoopActive::Id: { + using TypeInfo = Attributes::ColorLoopActive::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ColorLoopDirection::Id: { + using TypeInfo = Attributes::ColorLoopDirection::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::ColorLoopTime::Id: { + using TypeInfo = Attributes::ColorLoopTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorLoopStartEnhancedHue::Id: { + using TypeInfo = Attributes::ColorLoopStartEnhancedHue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorLoopStoredEnhancedHue::Id: { + using TypeInfo = Attributes::ColorLoopStoredEnhancedHue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorCapabilities::Id: { + using TypeInfo = Attributes::ColorCapabilities::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorTempPhysicalMinMireds::Id: { + using TypeInfo = Attributes::ColorTempPhysicalMinMireds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ColorTempPhysicalMaxMireds::Id: { + using TypeInfo = Attributes::ColorTempPhysicalMaxMireds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::CoupleColorTempToLevelMinMireds::Id: { + using TypeInfo = Attributes::CoupleColorTempToLevelMinMireds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::StartUpColorTemperatureMireds::Id: { + using TypeInfo = Attributes::StartUpColorTemperatureMireds::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForBallastConfigurationCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BallastConfiguration; + switch (aAttributeId) { + case Attributes::PhysicalMinLevel::Id: { + using TypeInfo = Attributes::PhysicalMinLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::PhysicalMaxLevel::Id: { + using TypeInfo = Attributes::PhysicalMaxLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::BallastStatus::Id: { + using TypeInfo = Attributes::BallastStatus::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MinLevel::Id: { + using TypeInfo = Attributes::MinLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::MaxLevel::Id: { + using TypeInfo = Attributes::MaxLevel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::IntrinsicBallastFactor::Id: { + using TypeInfo = Attributes::IntrinsicBallastFactor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::BallastFactorAdjustment::Id: { + using TypeInfo = Attributes::BallastFactorAdjustment::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::LampQuantity::Id: { + using TypeInfo = Attributes::LampQuantity::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::LampType::Id: { + using TypeInfo = Attributes::LampType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::LampManufacturer::Id: { + using TypeInfo = Attributes::LampManufacturer::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::LampRatedHours::Id: { + using TypeInfo = Attributes::LampRatedHours::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::LampBurnHours::Id: { + using TypeInfo = Attributes::LampBurnHours::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::LampAlarmMode::Id: { + using TypeInfo = Attributes::LampAlarmMode::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::LampBurnHoursTripPoint::Id: { + using TypeInfo = Attributes::LampBurnHoursTripPoint::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForIlluminanceMeasurementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::IlluminanceMeasurement; + switch (aAttributeId) { + case Attributes::MeasuredValue::Id: { + using TypeInfo = Attributes::MeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinMeasuredValue::Id: { + using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxMeasuredValue::Id: { + using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::LightSensorType::Id: { + using TypeInfo = Attributes::LightSensorType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForTemperatureMeasurementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::TemperatureMeasurement; + switch (aAttributeId) { + case Attributes::MeasuredValue::Id: { + using TypeInfo = Attributes::MeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinMeasuredValue::Id: { + using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxMeasuredValue::Id: { + using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForPressureMeasurementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PressureMeasurement; + switch (aAttributeId) { + case Attributes::MeasuredValue::Id: { + using TypeInfo = Attributes::MeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinMeasuredValue::Id: { + using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxMeasuredValue::Id: { + using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ScaledValue::Id: { + using TypeInfo = Attributes::ScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinScaledValue::Id: { + using TypeInfo = Attributes::MinScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxScaledValue::Id: { + using TypeInfo = Attributes::MaxScaledValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::ScaledTolerance::Id: { + using TypeInfo = Attributes::ScaledTolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Scale::Id: { + using TypeInfo = Attributes::Scale::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForFlowMeasurementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::FlowMeasurement; + switch (aAttributeId) { + case Attributes::MeasuredValue::Id: { + using TypeInfo = Attributes::MeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinMeasuredValue::Id: { + using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxMeasuredValue::Id: { + using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForRelativeHumidityMeasurementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::RelativeHumidityMeasurement; + switch (aAttributeId) { + case Attributes::MeasuredValue::Id: { + using TypeInfo = Attributes::MeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MinMeasuredValue::Id: { + using TypeInfo = Attributes::MinMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::MaxMeasuredValue::Id: { + using TypeInfo = Attributes::MaxMeasuredValue::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::Tolerance::Id: { + using TypeInfo = Attributes::Tolerance::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForOccupancySensingCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OccupancySensing; + switch (aAttributeId) { + case Attributes::Occupancy::Id: { + using TypeInfo = Attributes::Occupancy::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::OccupancySensorType::Id: { + using TypeInfo = Attributes::OccupancySensorType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::OccupancySensorTypeBitmap::Id: { + using TypeInfo = Attributes::OccupancySensorTypeBitmap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::PIROccupiedToUnoccupiedDelay::Id: { + using TypeInfo = Attributes::PIROccupiedToUnoccupiedDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PIRUnoccupiedToOccupiedDelay::Id: { + using TypeInfo = Attributes::PIRUnoccupiedToOccupiedDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PIRUnoccupiedToOccupiedThreshold::Id: { + using TypeInfo = Attributes::PIRUnoccupiedToOccupiedThreshold::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::UltrasonicOccupiedToUnoccupiedDelay::Id: { + using TypeInfo = Attributes::UltrasonicOccupiedToUnoccupiedDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::UltrasonicUnoccupiedToOccupiedDelay::Id: { + using TypeInfo = Attributes::UltrasonicUnoccupiedToOccupiedDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::UltrasonicUnoccupiedToOccupiedThreshold::Id: { + using TypeInfo = Attributes::UltrasonicUnoccupiedToOccupiedThreshold::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::PhysicalContactOccupiedToUnoccupiedDelay::Id: { + using TypeInfo = Attributes::PhysicalContactOccupiedToUnoccupiedDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PhysicalContactUnoccupiedToOccupiedDelay::Id: { + using TypeInfo = Attributes::PhysicalContactUnoccupiedToOccupiedDelay::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::Id: { + using TypeInfo = Attributes::PhysicalContactUnoccupiedToOccupiedThreshold::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } - case Clusters::UnitTesting::Id: { - using namespace Clusters::UnitTesting; - switch (aPath.mAttributeId) { - case Attributes::Boolean::Id: { - using TypeInfo = Attributes::Boolean::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::Bitmap8::Id: { - using TypeInfo = Attributes::Bitmap8::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; - return value; - } - case Attributes::Bitmap16::Id: { - using TypeInfo = Attributes::Bitmap16::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; - return value; - } - case Attributes::Bitmap32::Id: { - using TypeInfo = Attributes::Bitmap32::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue.Raw()]; - return value; - } - case Attributes::Bitmap64::Id: { - using TypeInfo = Attributes::Bitmap64::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue.Raw()]; - return value; - } - case Attributes::Int8u::Id: { - using TypeInfo = Attributes::Int8u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::Int16u::Id: { - using TypeInfo = Attributes::Int16u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::Int24u::Id: { - using TypeInfo = Attributes::Int24u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::Int32u::Id: { - using TypeInfo = Attributes::Int32u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::Int40u::Id: { - using TypeInfo = Attributes::Int40u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::Int48u::Id: { - using TypeInfo = Attributes::Int48u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::Int56u::Id: { - using TypeInfo = Attributes::Int56u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::Int64u::Id: { - using TypeInfo = Attributes::Int64u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; - } - case Attributes::Int8s::Id: { - using TypeInfo = Attributes::Int8s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::Int16s::Id: { - using TypeInfo = Attributes::Int16s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; - } - case Attributes::Int24s::Id: { - using TypeInfo = Attributes::Int24s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithInt:cppValue]; - return value; - } - case Attributes::Int32s::Id: { - using TypeInfo = Attributes::Int32s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithInt:cppValue]; - return value; - } - case Attributes::Int40s::Id: { - using TypeInfo = Attributes::Int40s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithLongLong:cppValue]; - return value; - } - case Attributes::Int48s::Id: { - using TypeInfo = Attributes::Int48s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithLongLong:cppValue]; - return value; - } - case Attributes::Int56s::Id: { - using TypeInfo = Attributes::Int56s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithLongLong:cppValue]; - return value; - } - case Attributes::Int64s::Id: { - using TypeInfo = Attributes::Int64s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithLongLong:cppValue]; - return value; - } - case Attributes::Enum8::Id: { - using TypeInfo = Attributes::Enum8::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::Enum16::Id: { - using TypeInfo = Attributes::Enum16::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - case Attributes::FloatSingle::Id: { - using TypeInfo = Attributes::FloatSingle::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithFloat:cppValue]; - return value; - } - case Attributes::FloatDouble::Id: { - using TypeInfo = Attributes::FloatDouble::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithDouble:cppValue]; - return value; - } - case Attributes::OctetString::Id: { - using TypeInfo = Attributes::OctetString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nonnull value; - value = [NSData dataWithBytes:cppValue.data() length:cppValue.size()]; - return value; - } - case Attributes::ListInt8u::Id: { - using TypeInfo = Attributes::ListInt8u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; - } - return value; - } - case Attributes::ListOctetString::Id: { - using TypeInfo = Attributes::ListOctetString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForWakeOnLANCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WakeOnLan; + switch (aAttributeId) { + case Attributes::MACAddress::Id: { + using TypeInfo = Attributes::MACAddress::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForChannelCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Channel; + switch (aAttributeId) { + case Attributes::ChannelList::Id: { + using TypeInfo = Attributes::ChannelList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRChannelClusterChannelInfoStruct * newElement_0; + newElement_0 = [MTRChannelClusterChannelInfoStruct new]; + newElement_0.majorNumber = [NSNumber numberWithUnsignedShort:entry_0.majorNumber]; + newElement_0.minorNumber = [NSNumber numberWithUnsignedShort:entry_0.minorNumber]; + if (entry_0.name.HasValue()) { + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.Value().data() + length:entry_0.name.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.name = nil; } - value = array_0; - } - return value; - } - case Attributes::ListStructOctetString::Id: { - using TypeInfo = Attributes::ListStructOctetString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterTestListStructOctet * newElement_0; - newElement_0 = [MTRUnitTestingClusterTestListStructOctet new]; - newElement_0.member1 = [NSNumber numberWithUnsignedLongLong:entry_0.member1]; - newElement_0.member2 = [NSData dataWithBytes:entry_0.member2.data() length:entry_0.member2.size()]; - [array_0 addObject:newElement_0]; + if (entry_0.callSign.HasValue()) { + newElement_0.callSign = [[NSString alloc] initWithBytes:entry_0.callSign.Value().data() + length:entry_0.callSign.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.callSign = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.affiliateCallSign.HasValue()) { + newElement_0.affiliateCallSign = [[NSString alloc] initWithBytes:entry_0.affiliateCallSign.Value().data() + length:entry_0.affiliateCallSign.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.affiliateCallSign = nil; } - value = array_0; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::LongOctetString::Id: { - using TypeInfo = Attributes::LongOctetString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nonnull value; - value = [NSData dataWithBytes:cppValue.data() length:cppValue.size()]; - return value; - } - case Attributes::CharString::Id: { - using TypeInfo = Attributes::CharString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::LongCharString::Id: { - using TypeInfo = Attributes::LongCharString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nonnull value; - value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; - return value; - } - case Attributes::EpochUs::Id: { - using TypeInfo = Attributes::EpochUs::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedLongLong:cppValue]; - return value; + value = array_0; } - case Attributes::EpochS::Id: { - using TypeInfo = Attributes::EpochS::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + return value; + } + case Attributes::Lineup::Id: { + using TypeInfo = Attributes::Lineup::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRChannelClusterLineupInfoStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRChannelClusterLineupInfoStruct new]; + value.operatorName = [[NSString alloc] initWithBytes:cppValue.Value().operatorName.data() + length:cppValue.Value().operatorName.size() + encoding:NSUTF8StringEncoding]; + if (cppValue.Value().lineupName.HasValue()) { + value.lineupName = [[NSString alloc] initWithBytes:cppValue.Value().lineupName.Value().data() + length:cppValue.Value().lineupName.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + value.lineupName = nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; - } - case Attributes::VendorId::Id: { - using TypeInfo = Attributes::VendorId::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + if (cppValue.Value().postalCode.HasValue()) { + value.postalCode = [[NSString alloc] initWithBytes:cppValue.Value().postalCode.Value().data() + length:cppValue.Value().postalCode.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + value.postalCode = nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; - return value; + value.lineupInfoType = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().lineupInfoType)]; } - case Attributes::ListNullablesAndOptionalsStruct::Id: { - using TypeInfo = Attributes::ListNullablesAndOptionalsStruct::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + return value; + } + case Attributes::CurrentChannel::Id: { + using TypeInfo = Attributes::CurrentChannel::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRChannelClusterChannelInfoStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRChannelClusterChannelInfoStruct new]; + value.majorNumber = [NSNumber numberWithUnsignedShort:cppValue.Value().majorNumber]; + value.minorNumber = [NSNumber numberWithUnsignedShort:cppValue.Value().minorNumber]; + if (cppValue.Value().name.HasValue()) { + value.name = [[NSString alloc] initWithBytes:cppValue.Value().name.Value().data() + length:cppValue.Value().name.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + value.name = nil; } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterNullablesAndOptionalsStruct * newElement_0; - newElement_0 = [MTRUnitTestingClusterNullablesAndOptionalsStruct new]; - if (entry_0.nullableInt.IsNull()) { - newElement_0.nullableInt = nil; - } else { - newElement_0.nullableInt = [NSNumber numberWithUnsignedShort:entry_0.nullableInt.Value()]; - } - if (entry_0.optionalInt.HasValue()) { - newElement_0.optionalInt = [NSNumber numberWithUnsignedShort:entry_0.optionalInt.Value()]; - } else { - newElement_0.optionalInt = nil; - } - if (entry_0.nullableOptionalInt.HasValue()) { - if (entry_0.nullableOptionalInt.Value().IsNull()) { - newElement_0.nullableOptionalInt = nil; - } else { - newElement_0.nullableOptionalInt = - [NSNumber numberWithUnsignedShort:entry_0.nullableOptionalInt.Value().Value()]; - } - } else { - newElement_0.nullableOptionalInt = nil; - } - if (entry_0.nullableString.IsNull()) { - newElement_0.nullableString = nil; - } else { - newElement_0.nullableString = [[NSString alloc] initWithBytes:entry_0.nullableString.Value().data() - length:entry_0.nullableString.Value().size() - encoding:NSUTF8StringEncoding]; - } - if (entry_0.optionalString.HasValue()) { - newElement_0.optionalString = [[NSString alloc] initWithBytes:entry_0.optionalString.Value().data() - length:entry_0.optionalString.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - newElement_0.optionalString = nil; - } - if (entry_0.nullableOptionalString.HasValue()) { - if (entry_0.nullableOptionalString.Value().IsNull()) { - newElement_0.nullableOptionalString = nil; - } else { - newElement_0.nullableOptionalString = - [[NSString alloc] initWithBytes:entry_0.nullableOptionalString.Value().Value().data() - length:entry_0.nullableOptionalString.Value().Value().size() - encoding:NSUTF8StringEncoding]; - } - } else { - newElement_0.nullableOptionalString = nil; - } - if (entry_0.nullableStruct.IsNull()) { - newElement_0.nullableStruct = nil; - } else { - newElement_0.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.nullableStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().a]; - newElement_0.nullableStruct.b = [NSNumber numberWithBool:entry_0.nullableStruct.Value().b]; - newElement_0.nullableStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().c)]; - newElement_0.nullableStruct.d = [NSData dataWithBytes:entry_0.nullableStruct.Value().d.data() - length:entry_0.nullableStruct.Value().d.size()]; - newElement_0.nullableStruct.e = [[NSString alloc] initWithBytes:entry_0.nullableStruct.Value().e.data() - length:entry_0.nullableStruct.Value().e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.nullableStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; - newElement_0.nullableStruct.g = [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; - newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; - } - if (entry_0.optionalStruct.HasValue()) { - newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.optionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().a]; - newElement_0.optionalStruct.b = [NSNumber numberWithBool:entry_0.optionalStruct.Value().b]; - newElement_0.optionalStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().c)]; - newElement_0.optionalStruct.d = [NSData dataWithBytes:entry_0.optionalStruct.Value().d.data() - length:entry_0.optionalStruct.Value().d.size()]; - newElement_0.optionalStruct.e = [[NSString alloc] initWithBytes:entry_0.optionalStruct.Value().e.data() - length:entry_0.optionalStruct.Value().e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.optionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; - newElement_0.optionalStruct.g = [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; - newElement_0.optionalStruct.h = [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; - } else { - newElement_0.optionalStruct = nil; - } - if (entry_0.nullableOptionalStruct.HasValue()) { - if (entry_0.nullableOptionalStruct.Value().IsNull()) { - newElement_0.nullableOptionalStruct = nil; - } else { - newElement_0.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.nullableOptionalStruct.a = - [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().a]; - newElement_0.nullableOptionalStruct.b = - [NSNumber numberWithBool:entry_0.nullableOptionalStruct.Value().Value().b]; - newElement_0.nullableOptionalStruct.c = [NSNumber - numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().c)]; - newElement_0.nullableOptionalStruct.d = - [NSData dataWithBytes:entry_0.nullableOptionalStruct.Value().Value().d.data() - length:entry_0.nullableOptionalStruct.Value().Value().d.size()]; - newElement_0.nullableOptionalStruct.e = - [[NSString alloc] initWithBytes:entry_0.nullableOptionalStruct.Value().Value().e.data() - length:entry_0.nullableOptionalStruct.Value().Value().e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.nullableOptionalStruct.f = - [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().f.Raw()]; - newElement_0.nullableOptionalStruct.g = - [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value().Value().g]; - newElement_0.nullableOptionalStruct.h = - [NSNumber numberWithDouble:entry_0.nullableOptionalStruct.Value().Value().h]; - } - } else { - newElement_0.nullableOptionalStruct = nil; - } - if (entry_0.nullableList.IsNull()) { - newElement_0.nullableList = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = entry_0.nullableList.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; - [array_3 addObject:newElement_3]; - } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.nullableList = array_3; - } - } - if (entry_0.optionalList.HasValue()) { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = entry_0.optionalList.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; - [array_3 addObject:newElement_3]; - } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.optionalList = array_3; - } - } else { - newElement_0.optionalList = nil; - } - if (entry_0.nullableOptionalList.HasValue()) { - if (entry_0.nullableOptionalList.Value().IsNull()) { - newElement_0.nullableOptionalList = nil; - } else { - { // Scope for our temporary variables - auto * array_4 = [NSMutableArray new]; - auto iter_4 = entry_0.nullableOptionalList.Value().Value().begin(); - while (iter_4.Next()) { - auto & entry_4 = iter_4.GetValue(); - NSNumber * newElement_4; - newElement_4 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_4)]; - [array_4 addObject:newElement_4]; - } - CHIP_ERROR err = iter_4.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.nullableOptionalList = array_4; - } - } - } else { - newElement_0.nullableOptionalList = nil; - } - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - value = array_0; + if (cppValue.Value().callSign.HasValue()) { + value.callSign = [[NSString alloc] initWithBytes:cppValue.Value().callSign.Value().data() + length:cppValue.Value().callSign.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + value.callSign = nil; } - return value; - } - case Attributes::EnumAttr::Id: { - using TypeInfo = Attributes::EnumAttr::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + if (cppValue.Value().affiliateCallSign.HasValue()) { + value.affiliateCallSign = [[NSString alloc] initWithBytes:cppValue.Value().affiliateCallSign.Value().data() + length:cppValue.Value().affiliateCallSign.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + value.affiliateCallSign = nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; - return value; } - case Attributes::StructAttr::Id: { - using TypeInfo = Attributes::StructAttr::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRUnitTestingClusterSimpleStruct * _Nonnull value; - value = [MTRUnitTestingClusterSimpleStruct new]; - value.a = [NSNumber numberWithUnsignedChar:cppValue.a]; - value.b = [NSNumber numberWithBool:cppValue.b]; - value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.c)]; - value.d = [NSData dataWithBytes:cppValue.d.data() length:cppValue.d.size()]; - value.e = [[NSString alloc] initWithBytes:cppValue.e.data() length:cppValue.e.size() encoding:NSUTF8StringEncoding]; - value.f = [NSNumber numberWithUnsignedChar:cppValue.f.Raw()]; - value.g = [NSNumber numberWithFloat:cppValue.g]; - value.h = [NSNumber numberWithDouble:cppValue.h]; - return value; - } - case Attributes::RangeRestrictedInt8u::Id: { - using TypeInfo = Attributes::RangeRestrictedInt8u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForTargetNavigatorCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::TargetNavigator; + switch (aAttributeId) { + case Attributes::TargetList::Id: { + using TypeInfo = Attributes::TargetList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRTargetNavigatorClusterTargetInfoStruct * newElement_0; + newElement_0 = [MTRTargetNavigatorClusterTargetInfoStruct new]; + newElement_0.identifier = [NSNumber numberWithUnsignedChar:entry_0.identifier]; + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() + length:entry_0.name.size() + encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::CurrentTarget::Id: { + using TypeInfo = Attributes::CurrentTarget::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForMediaPlaybackCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::MediaPlayback; + switch (aAttributeId) { + case Attributes::CurrentState::Id: { + using TypeInfo = Attributes::CurrentState::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::StartTime::Id: { + using TypeInfo = Attributes::StartTime::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::Duration::Id: { + using TypeInfo = Attributes::Duration::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::SampledPosition::Id: { + using TypeInfo = Attributes::SampledPosition::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRMediaPlaybackClusterPlaybackPositionStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRMediaPlaybackClusterPlaybackPositionStruct new]; + value.updatedAt = [NSNumber numberWithUnsignedLongLong:cppValue.Value().updatedAt]; + if (cppValue.Value().position.IsNull()) { + value.position = nil; + } else { + value.position = [NSNumber numberWithUnsignedLongLong:cppValue.Value().position.Value()]; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; } - case Attributes::RangeRestrictedInt8s::Id: { - using TypeInfo = Attributes::RangeRestrictedInt8s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + return value; + } + case Attributes::PlaybackSpeed::Id: { + using TypeInfo = Attributes::PlaybackSpeed::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithFloat:cppValue]; + return value; + } + case Attributes::SeekRangeEnd::Id: { + using TypeInfo = Attributes::SeekRangeEnd::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::SeekRangeStart::Id: { + using TypeInfo = Attributes::SeekRangeStart::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForMediaInputCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::MediaInput; + switch (aAttributeId) { + case Attributes::InputList::Id: { + using TypeInfo = Attributes::InputList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRMediaInputClusterInputInfoStruct * newElement_0; + newElement_0 = [MTRMediaInputClusterInputInfoStruct new]; + newElement_0.index = [NSNumber numberWithUnsignedChar:entry_0.index]; + newElement_0.inputType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.inputType)]; + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() + length:entry_0.name.size() + encoding:NSUTF8StringEncoding]; + newElement_0.descriptionString = [[NSString alloc] initWithBytes:entry_0.description.data() + length:entry_0.description.size() + encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithChar:cppValue]; - return value; - } - case Attributes::RangeRestrictedInt16u::Id: { - using TypeInfo = Attributes::RangeRestrictedInt16u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; + value = array_0; } - case Attributes::RangeRestrictedInt16s::Id: { - using TypeInfo = Attributes::RangeRestrictedInt16s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + return value; + } + case Attributes::CurrentInput::Id: { + using TypeInfo = Attributes::CurrentInput::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForLowPowerCluster(AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::LowPower; + switch (aAttributeId) { + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForKeypadInputCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::KeypadInput; + switch (aAttributeId) { + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForContentLauncherCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ContentLauncher; + switch (aAttributeId) { + case Attributes::AcceptHeader::Id: { + using TypeInfo = Attributes::AcceptHeader::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSString * newElement_0; + newElement_0 = [[NSString alloc] initWithBytes:entry_0.data() length:entry_0.size() encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::SupportedStreamingProtocols::Id: { + using TypeInfo = Attributes::SupportedStreamingProtocols::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForAudioOutputCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AudioOutput; + switch (aAttributeId) { + case Attributes::OutputList::Id: { + using TypeInfo = Attributes::OutputList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRAudioOutputClusterOutputInfoStruct * newElement_0; + newElement_0 = [MTRAudioOutputClusterOutputInfoStruct new]; + newElement_0.index = [NSNumber numberWithUnsignedChar:entry_0.index]; + newElement_0.outputType = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.outputType)]; + newElement_0.name = [[NSString alloc] initWithBytes:entry_0.name.data() + length:entry_0.name.size() + encoding:NSUTF8StringEncoding]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::CurrentOutput::Id: { + using TypeInfo = Attributes::CurrentOutput::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForApplicationLauncherCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ApplicationLauncher; + switch (aAttributeId) { + case Attributes::CatalogList::Id: { + using TypeInfo = Attributes::CatalogList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::CurrentApp::Id: { + using TypeInfo = Attributes::CurrentApp::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRApplicationLauncherClusterApplicationEPStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRApplicationLauncherClusterApplicationEPStruct new]; + value.application = [MTRApplicationLauncherClusterApplicationStruct new]; + value.application.catalogVendorID = [NSNumber numberWithUnsignedShort:cppValue.Value().application.catalogVendorID]; + value.application.applicationID = [[NSString alloc] initWithBytes:cppValue.Value().application.applicationID.data() + length:cppValue.Value().application.applicationID.size() + encoding:NSUTF8StringEncoding]; + if (cppValue.Value().endpoint.HasValue()) { + value.endpoint = [NSNumber numberWithUnsignedShort:cppValue.Value().endpoint.Value()]; + } else { + value.endpoint = nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithShort:cppValue]; - return value; } - case Attributes::ListLongOctetString::Id: { - using TypeInfo = Attributes::ListLongOctetString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSData * newElement_0; - newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; - [array_0 addObject:newElement_0]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForApplicationBasicCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ApplicationBasic; + switch (aAttributeId) { + case Attributes::VendorName::Id: { + using TypeInfo = Attributes::VendorName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::VendorID::Id: { + using TypeInfo = Attributes::VendorID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ApplicationName::Id: { + using TypeInfo = Attributes::ApplicationName::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::ProductID::Id: { + using TypeInfo = Attributes::ProductID::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Application::Id: { + using TypeInfo = Attributes::Application::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRApplicationBasicClusterApplicationStruct * _Nonnull value; + value = [MTRApplicationBasicClusterApplicationStruct new]; + value.catalogVendorID = [NSNumber numberWithUnsignedShort:cppValue.catalogVendorID]; + value.applicationID = [[NSString alloc] initWithBytes:cppValue.applicationID.data() + length:cppValue.applicationID.size() + encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::Status::Id: { + using TypeInfo = Attributes::Status::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ApplicationVersion::Id: { + using TypeInfo = Attributes::ApplicationVersion::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::AllowedVendorList::Id: { + using TypeInfo = Attributes::AllowedVendorList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedShort:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForAccountLoginCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AccountLogin; + switch (aAttributeId) { + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForElectricalMeasurementCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ElectricalMeasurement; + switch (aAttributeId) { + case Attributes::MeasurementType::Id: { + using TypeInfo = Attributes::MeasurementType::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::DcVoltage::Id: { + using TypeInfo = Attributes::DcVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcVoltageMin::Id: { + using TypeInfo = Attributes::DcVoltageMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcVoltageMax::Id: { + using TypeInfo = Attributes::DcVoltageMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcCurrent::Id: { + using TypeInfo = Attributes::DcCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcCurrentMin::Id: { + using TypeInfo = Attributes::DcCurrentMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcCurrentMax::Id: { + using TypeInfo = Attributes::DcCurrentMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcPower::Id: { + using TypeInfo = Attributes::DcPower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcPowerMin::Id: { + using TypeInfo = Attributes::DcPowerMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcPowerMax::Id: { + using TypeInfo = Attributes::DcPowerMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::DcVoltageMultiplier::Id: { + using TypeInfo = Attributes::DcVoltageMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::DcVoltageDivisor::Id: { + using TypeInfo = Attributes::DcVoltageDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::DcCurrentMultiplier::Id: { + using TypeInfo = Attributes::DcCurrentMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::DcCurrentDivisor::Id: { + using TypeInfo = Attributes::DcCurrentDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::DcPowerMultiplier::Id: { + using TypeInfo = Attributes::DcPowerMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::DcPowerDivisor::Id: { + using TypeInfo = Attributes::DcPowerDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcFrequency::Id: { + using TypeInfo = Attributes::AcFrequency::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcFrequencyMin::Id: { + using TypeInfo = Attributes::AcFrequencyMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcFrequencyMax::Id: { + using TypeInfo = Attributes::AcFrequencyMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::NeutralCurrent::Id: { + using TypeInfo = Attributes::NeutralCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::TotalActivePower::Id: { + using TypeInfo = Attributes::TotalActivePower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithInt:cppValue]; + return value; + } + case Attributes::TotalReactivePower::Id: { + using TypeInfo = Attributes::TotalReactivePower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithInt:cppValue]; + return value; + } + case Attributes::TotalApparentPower::Id: { + using TypeInfo = Attributes::TotalApparentPower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::Measured1stHarmonicCurrent::Id: { + using TypeInfo = Attributes::Measured1stHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::Measured3rdHarmonicCurrent::Id: { + using TypeInfo = Attributes::Measured3rdHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::Measured5thHarmonicCurrent::Id: { + using TypeInfo = Attributes::Measured5thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::Measured7thHarmonicCurrent::Id: { + using TypeInfo = Attributes::Measured7thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::Measured9thHarmonicCurrent::Id: { + using TypeInfo = Attributes::Measured9thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::Measured11thHarmonicCurrent::Id: { + using TypeInfo = Attributes::Measured11thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MeasuredPhase1stHarmonicCurrent::Id: { + using TypeInfo = Attributes::MeasuredPhase1stHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MeasuredPhase3rdHarmonicCurrent::Id: { + using TypeInfo = Attributes::MeasuredPhase3rdHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MeasuredPhase5thHarmonicCurrent::Id: { + using TypeInfo = Attributes::MeasuredPhase5thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MeasuredPhase7thHarmonicCurrent::Id: { + using TypeInfo = Attributes::MeasuredPhase7thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MeasuredPhase9thHarmonicCurrent::Id: { + using TypeInfo = Attributes::MeasuredPhase9thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::MeasuredPhase11thHarmonicCurrent::Id: { + using TypeInfo = Attributes::MeasuredPhase11thHarmonicCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AcFrequencyMultiplier::Id: { + using TypeInfo = Attributes::AcFrequencyMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcFrequencyDivisor::Id: { + using TypeInfo = Attributes::AcFrequencyDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PowerMultiplier::Id: { + using TypeInfo = Attributes::PowerMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::PowerDivisor::Id: { + using TypeInfo = Attributes::PowerDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::HarmonicCurrentMultiplier::Id: { + using TypeInfo = Attributes::HarmonicCurrentMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::PhaseHarmonicCurrentMultiplier::Id: { + using TypeInfo = Attributes::PhaseHarmonicCurrentMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::InstantaneousVoltage::Id: { + using TypeInfo = Attributes::InstantaneousVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::InstantaneousLineCurrent::Id: { + using TypeInfo = Attributes::InstantaneousLineCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::InstantaneousActiveCurrent::Id: { + using TypeInfo = Attributes::InstantaneousActiveCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::InstantaneousReactiveCurrent::Id: { + using TypeInfo = Attributes::InstantaneousReactiveCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::InstantaneousPower::Id: { + using TypeInfo = Attributes::InstantaneousPower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsVoltage::Id: { + using TypeInfo = Attributes::RmsVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageMin::Id: { + using TypeInfo = Attributes::RmsVoltageMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageMax::Id: { + using TypeInfo = Attributes::RmsVoltageMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrent::Id: { + using TypeInfo = Attributes::RmsCurrent::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentMin::Id: { + using TypeInfo = Attributes::RmsCurrentMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentMax::Id: { + using TypeInfo = Attributes::RmsCurrentMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ActivePower::Id: { + using TypeInfo = Attributes::ActivePower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ActivePowerMin::Id: { + using TypeInfo = Attributes::ActivePowerMin::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ActivePowerMax::Id: { + using TypeInfo = Attributes::ActivePowerMax::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ReactivePower::Id: { + using TypeInfo = Attributes::ReactivePower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ApparentPower::Id: { + using TypeInfo = Attributes::ApparentPower::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PowerFactor::Id: { + using TypeInfo = Attributes::PowerFactor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::AverageRmsVoltageMeasurementPeriod::Id: { + using TypeInfo = Attributes::AverageRmsVoltageMeasurementPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AverageRmsUnderVoltageCounter::Id: { + using TypeInfo = Attributes::AverageRmsUnderVoltageCounter::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsExtremeOverVoltagePeriod::Id: { + using TypeInfo = Attributes::RmsExtremeOverVoltagePeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsExtremeUnderVoltagePeriod::Id: { + using TypeInfo = Attributes::RmsExtremeUnderVoltagePeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSagPeriod::Id: { + using TypeInfo = Attributes::RmsVoltageSagPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSwellPeriod::Id: { + using TypeInfo = Attributes::RmsVoltageSwellPeriod::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcVoltageMultiplier::Id: { + using TypeInfo = Attributes::AcVoltageMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcVoltageDivisor::Id: { + using TypeInfo = Attributes::AcVoltageDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcCurrentMultiplier::Id: { + using TypeInfo = Attributes::AcCurrentMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcCurrentDivisor::Id: { + using TypeInfo = Attributes::AcCurrentDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcPowerMultiplier::Id: { + using TypeInfo = Attributes::AcPowerMultiplier::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcPowerDivisor::Id: { + using TypeInfo = Attributes::AcPowerDivisor::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::OverloadAlarmsMask::Id: { + using TypeInfo = Attributes::OverloadAlarmsMask::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::VoltageOverload::Id: { + using TypeInfo = Attributes::VoltageOverload::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::CurrentOverload::Id: { + using TypeInfo = Attributes::CurrentOverload::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AcOverloadAlarmsMask::Id: { + using TypeInfo = Attributes::AcOverloadAlarmsMask::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AcVoltageOverload::Id: { + using TypeInfo = Attributes::AcVoltageOverload::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AcCurrentOverload::Id: { + using TypeInfo = Attributes::AcCurrentOverload::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AcActivePowerOverload::Id: { + using TypeInfo = Attributes::AcActivePowerOverload::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AcReactivePowerOverload::Id: { + using TypeInfo = Attributes::AcReactivePowerOverload::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AverageRmsOverVoltage::Id: { + using TypeInfo = Attributes::AverageRmsOverVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::AverageRmsUnderVoltage::Id: { + using TypeInfo = Attributes::AverageRmsUnderVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsExtremeOverVoltage::Id: { + using TypeInfo = Attributes::RmsExtremeOverVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsExtremeUnderVoltage::Id: { + using TypeInfo = Attributes::RmsExtremeUnderVoltage::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSag::Id: { + using TypeInfo = Attributes::RmsVoltageSag::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSwell::Id: { + using TypeInfo = Attributes::RmsVoltageSwell::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::LineCurrentPhaseB::Id: { + using TypeInfo = Attributes::LineCurrentPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ActiveCurrentPhaseB::Id: { + using TypeInfo = Attributes::ActiveCurrentPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ReactiveCurrentPhaseB::Id: { + using TypeInfo = Attributes::ReactiveCurrentPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsVoltagePhaseB::Id: { + using TypeInfo = Attributes::RmsVoltagePhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageMinPhaseB::Id: { + using TypeInfo = Attributes::RmsVoltageMinPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageMaxPhaseB::Id: { + using TypeInfo = Attributes::RmsVoltageMaxPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentPhaseB::Id: { + using TypeInfo = Attributes::RmsCurrentPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentMinPhaseB::Id: { + using TypeInfo = Attributes::RmsCurrentMinPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentMaxPhaseB::Id: { + using TypeInfo = Attributes::RmsCurrentMaxPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ActivePowerPhaseB::Id: { + using TypeInfo = Attributes::ActivePowerPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ActivePowerMinPhaseB::Id: { + using TypeInfo = Attributes::ActivePowerMinPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ActivePowerMaxPhaseB::Id: { + using TypeInfo = Attributes::ActivePowerMaxPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ReactivePowerPhaseB::Id: { + using TypeInfo = Attributes::ReactivePowerPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ApparentPowerPhaseB::Id: { + using TypeInfo = Attributes::ApparentPowerPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PowerFactorPhaseB::Id: { + using TypeInfo = Attributes::PowerFactorPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::AverageRmsVoltageMeasurementPeriodPhaseB::Id: { + using TypeInfo = Attributes::AverageRmsVoltageMeasurementPeriodPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AverageRmsOverVoltageCounterPhaseB::Id: { + using TypeInfo = Attributes::AverageRmsOverVoltageCounterPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AverageRmsUnderVoltageCounterPhaseB::Id: { + using TypeInfo = Attributes::AverageRmsUnderVoltageCounterPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsExtremeOverVoltagePeriodPhaseB::Id: { + using TypeInfo = Attributes::RmsExtremeOverVoltagePeriodPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsExtremeUnderVoltagePeriodPhaseB::Id: { + using TypeInfo = Attributes::RmsExtremeUnderVoltagePeriodPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSagPeriodPhaseB::Id: { + using TypeInfo = Attributes::RmsVoltageSagPeriodPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSwellPeriodPhaseB::Id: { + using TypeInfo = Attributes::RmsVoltageSwellPeriodPhaseB::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::LineCurrentPhaseC::Id: { + using TypeInfo = Attributes::LineCurrentPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ActiveCurrentPhaseC::Id: { + using TypeInfo = Attributes::ActiveCurrentPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ReactiveCurrentPhaseC::Id: { + using TypeInfo = Attributes::ReactiveCurrentPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::RmsVoltagePhaseC::Id: { + using TypeInfo = Attributes::RmsVoltagePhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageMinPhaseC::Id: { + using TypeInfo = Attributes::RmsVoltageMinPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageMaxPhaseC::Id: { + using TypeInfo = Attributes::RmsVoltageMaxPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentPhaseC::Id: { + using TypeInfo = Attributes::RmsCurrentPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentMinPhaseC::Id: { + using TypeInfo = Attributes::RmsCurrentMinPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsCurrentMaxPhaseC::Id: { + using TypeInfo = Attributes::RmsCurrentMaxPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::ActivePowerPhaseC::Id: { + using TypeInfo = Attributes::ActivePowerPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ActivePowerMinPhaseC::Id: { + using TypeInfo = Attributes::ActivePowerMinPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ActivePowerMaxPhaseC::Id: { + using TypeInfo = Attributes::ActivePowerMaxPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ReactivePowerPhaseC::Id: { + using TypeInfo = Attributes::ReactivePowerPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ApparentPowerPhaseC::Id: { + using TypeInfo = Attributes::ApparentPowerPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::PowerFactorPhaseC::Id: { + using TypeInfo = Attributes::PowerFactorPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::AverageRmsVoltageMeasurementPeriodPhaseC::Id: { + using TypeInfo = Attributes::AverageRmsVoltageMeasurementPeriodPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AverageRmsOverVoltageCounterPhaseC::Id: { + using TypeInfo = Attributes::AverageRmsOverVoltageCounterPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::AverageRmsUnderVoltageCounterPhaseC::Id: { + using TypeInfo = Attributes::AverageRmsUnderVoltageCounterPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsExtremeOverVoltagePeriodPhaseC::Id: { + using TypeInfo = Attributes::RmsExtremeOverVoltagePeriodPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsExtremeUnderVoltagePeriodPhaseC::Id: { + using TypeInfo = Attributes::RmsExtremeUnderVoltagePeriodPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSagPeriodPhaseC::Id: { + using TypeInfo = Attributes::RmsVoltageSagPeriodPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RmsVoltageSwellPeriodPhaseC::Id: { + using TypeInfo = Attributes::RmsVoltageSwellPeriodPhaseC::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { + break; + } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} +static id _Nullable DecodeAttributeValueForUnitTestingCluster( + AttributeId aAttributeId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::UnitTesting; + switch (aAttributeId) { + case Attributes::Boolean::Id: { + using TypeInfo = Attributes::Boolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::Bitmap8::Id: { + using TypeInfo = Attributes::Bitmap8::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue.Raw()]; + return value; + } + case Attributes::Bitmap16::Id: { + using TypeInfo = Attributes::Bitmap16::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue.Raw()]; + return value; + } + case Attributes::Bitmap32::Id: { + using TypeInfo = Attributes::Bitmap32::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue.Raw()]; + return value; + } + case Attributes::Bitmap64::Id: { + using TypeInfo = Attributes::Bitmap64::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue.Raw()]; + return value; + } + case Attributes::Int8u::Id: { + using TypeInfo = Attributes::Int8u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Int16u::Id: { + using TypeInfo = Attributes::Int16u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::Int24u::Id: { + using TypeInfo = Attributes::Int24u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::Int32u::Id: { + using TypeInfo = Attributes::Int32u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::Int40u::Id: { + using TypeInfo = Attributes::Int40u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::Int48u::Id: { + using TypeInfo = Attributes::Int48u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::Int56u::Id: { + using TypeInfo = Attributes::Int56u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::Int64u::Id: { + using TypeInfo = Attributes::Int64u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::Int8s::Id: { + using TypeInfo = Attributes::Int8s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::Int16s::Id: { + using TypeInfo = Attributes::Int16s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::Int24s::Id: { + using TypeInfo = Attributes::Int24s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithInt:cppValue]; + return value; + } + case Attributes::Int32s::Id: { + using TypeInfo = Attributes::Int32s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithInt:cppValue]; + return value; + } + case Attributes::Int40s::Id: { + using TypeInfo = Attributes::Int40s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithLongLong:cppValue]; + return value; + } + case Attributes::Int48s::Id: { + using TypeInfo = Attributes::Int48s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithLongLong:cppValue]; + return value; + } + case Attributes::Int56s::Id: { + using TypeInfo = Attributes::Int56s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithLongLong:cppValue]; + return value; + } + case Attributes::Int64s::Id: { + using TypeInfo = Attributes::Int64s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithLongLong:cppValue]; + return value; + } + case Attributes::Enum8::Id: { + using TypeInfo = Attributes::Enum8::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::Enum16::Id: { + using TypeInfo = Attributes::Enum16::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::FloatSingle::Id: { + using TypeInfo = Attributes::FloatSingle::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithFloat:cppValue]; + return value; + } + case Attributes::FloatDouble::Id: { + using TypeInfo = Attributes::FloatDouble::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithDouble:cppValue]; + return value; + } + case Attributes::OctetString::Id: { + using TypeInfo = Attributes::OctetString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nonnull value; + value = [NSData dataWithBytes:cppValue.data() length:cppValue.size()]; + return value; + } + case Attributes::ListInt8u::Id: { + using TypeInfo = Attributes::ListInt8u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ListOctetString::Id: { + using TypeInfo = Attributes::ListOctetString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSData * newElement_0; + newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ListStructOctetString::Id: { + using TypeInfo = Attributes::ListStructOctetString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRUnitTestingClusterTestListStructOctet * newElement_0; + newElement_0 = [MTRUnitTestingClusterTestListStructOctet new]; + newElement_0.member1 = [NSNumber numberWithUnsignedLongLong:entry_0.member1]; + newElement_0.member2 = [NSData dataWithBytes:entry_0.member2.data() length:entry_0.member2.size()]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::LongOctetString::Id: { + using TypeInfo = Attributes::LongOctetString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nonnull value; + value = [NSData dataWithBytes:cppValue.data() length:cppValue.size()]; + return value; + } + case Attributes::CharString::Id: { + using TypeInfo = Attributes::CharString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::LongCharString::Id: { + using TypeInfo = Attributes::LongCharString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nonnull value; + value = [[NSString alloc] initWithBytes:cppValue.data() length:cppValue.size() encoding:NSUTF8StringEncoding]; + return value; + } + case Attributes::EpochUs::Id: { + using TypeInfo = Attributes::EpochUs::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedLongLong:cppValue]; + return value; + } + case Attributes::EpochS::Id: { + using TypeInfo = Attributes::EpochS::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::VendorId::Id: { + using TypeInfo = Attributes::VendorId::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::ListNullablesAndOptionalsStruct::Id: { + using TypeInfo = Attributes::ListNullablesAndOptionalsStruct::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRUnitTestingClusterNullablesAndOptionalsStruct * newElement_0; + newElement_0 = [MTRUnitTestingClusterNullablesAndOptionalsStruct new]; + if (entry_0.nullableInt.IsNull()) { + newElement_0.nullableInt = nil; + } else { + newElement_0.nullableInt = [NSNumber numberWithUnsignedShort:entry_0.nullableInt.Value()]; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.optionalInt.HasValue()) { + newElement_0.optionalInt = [NSNumber numberWithUnsignedShort:entry_0.optionalInt.Value()]; + } else { + newElement_0.optionalInt = nil; } - value = array_0; - } - return value; - } - case Attributes::ListFabricScoped::Id: { - using TypeInfo = Attributes::ListFabricScoped::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterTestFabricScoped * newElement_0; - newElement_0 = [MTRUnitTestingClusterTestFabricScoped new]; - newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; - if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { - newElement_0.optionalFabricSensitiveInt8u = - [NSNumber numberWithUnsignedChar:entry_0.optionalFabricSensitiveInt8u.Value()]; - } else { - newElement_0.optionalFabricSensitiveInt8u = nil; - } - if (entry_0.nullableFabricSensitiveInt8u.IsNull()) { - newElement_0.nullableFabricSensitiveInt8u = nil; - } else { - newElement_0.nullableFabricSensitiveInt8u = - [NSNumber numberWithUnsignedChar:entry_0.nullableFabricSensitiveInt8u.Value()]; - } - if (entry_0.nullableOptionalFabricSensitiveInt8u.HasValue()) { - if (entry_0.nullableOptionalFabricSensitiveInt8u.Value().IsNull()) { - newElement_0.nullableOptionalFabricSensitiveInt8u = nil; - } else { - newElement_0.nullableOptionalFabricSensitiveInt8u = - [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalFabricSensitiveInt8u.Value().Value()]; - } + if (entry_0.nullableOptionalInt.HasValue()) { + if (entry_0.nullableOptionalInt.Value().IsNull()) { + newElement_0.nullableOptionalInt = nil; } else { - newElement_0.nullableOptionalFabricSensitiveInt8u = nil; - } - newElement_0.fabricSensitiveCharString = - [[NSString alloc] initWithBytes:entry_0.fabricSensitiveCharString.data() - length:entry_0.fabricSensitiveCharString.size() - encoding:NSUTF8StringEncoding]; - newElement_0.fabricSensitiveStruct = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.fabricSensitiveStruct.a = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.a]; - newElement_0.fabricSensitiveStruct.b = [NSNumber numberWithBool:entry_0.fabricSensitiveStruct.b]; - newElement_0.fabricSensitiveStruct.c = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.c)]; - newElement_0.fabricSensitiveStruct.d = [NSData dataWithBytes:entry_0.fabricSensitiveStruct.d.data() - length:entry_0.fabricSensitiveStruct.d.size()]; - newElement_0.fabricSensitiveStruct.e = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveStruct.e.data() - length:entry_0.fabricSensitiveStruct.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.fabricSensitiveStruct.f = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; - newElement_0.fabricSensitiveStruct.g = [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; - newElement_0.fabricSensitiveStruct.h = [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = entry_0.fabricSensitiveInt8uList.begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - NSNumber * newElement_2; - newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - newElement_0.fabricSensitiveInt8uList = array_2; + newElement_0.nullableOptionalInt = + [NSNumber numberWithUnsignedShort:entry_0.nullableOptionalInt.Value().Value()]; } - newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + } else { + newElement_0.nullableOptionalInt = nil; } - value = array_0; - } - return value; - } - case Attributes::TimedWriteBoolean::Id: { - using TypeInfo = Attributes::TimedWriteBoolean::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::GeneralErrorBoolean::Id: { - using TypeInfo = Attributes::GeneralErrorBoolean::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::ClusterErrorBoolean::Id: { - using TypeInfo = Attributes::ClusterErrorBoolean::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::Unsupported::Id: { - using TypeInfo = Attributes::Unsupported::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithBool:cppValue]; - return value; - } - case Attributes::NullableBoolean::Id: { - using TypeInfo = Attributes::NullableBoolean::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithBool:cppValue.Value()]; - } - return value; - } - case Attributes::NullableBitmap8::Id: { - using TypeInfo = Attributes::NullableBitmap8::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value().Raw()]; - } - return value; - } - case Attributes::NullableBitmap16::Id: { - using TypeInfo = Attributes::NullableBitmap16::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value().Raw()]; - } - return value; - } - case Attributes::NullableBitmap32::Id: { - using TypeInfo = Attributes::NullableBitmap32::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value().Raw()]; - } - return value; - } - case Attributes::NullableBitmap64::Id: { - using TypeInfo = Attributes::NullableBitmap64::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Raw()]; - } - return value; - } - case Attributes::NullableInt8u::Id: { - using TypeInfo = Attributes::NullableInt8u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt16u::Id: { - using TypeInfo = Attributes::NullableInt16u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt24u::Id: { - using TypeInfo = Attributes::NullableInt24u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt32u::Id: { - using TypeInfo = Attributes::NullableInt32u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt40u::Id: { - using TypeInfo = Attributes::NullableInt40u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt48u::Id: { - using TypeInfo = Attributes::NullableInt48u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt56u::Id: { - using TypeInfo = Attributes::NullableInt56u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt64u::Id: { - using TypeInfo = Attributes::NullableInt64u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt8s::Id: { - using TypeInfo = Attributes::NullableInt8s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithChar:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt16s::Id: { - using TypeInfo = Attributes::NullableInt16s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt24s::Id: { - using TypeInfo = Attributes::NullableInt24s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithInt:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt32s::Id: { - using TypeInfo = Attributes::NullableInt32s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithInt:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt40s::Id: { - using TypeInfo = Attributes::NullableInt40s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt48s::Id: { - using TypeInfo = Attributes::NullableInt48s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt56s::Id: { - using TypeInfo = Attributes::NullableInt56s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableInt64s::Id: { - using TypeInfo = Attributes::NullableInt64s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithLongLong:cppValue.Value()]; - } - return value; - } - case Attributes::NullableEnum8::Id: { - using TypeInfo = Attributes::NullableEnum8::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::NullableEnum16::Id: { - using TypeInfo = Attributes::NullableEnum16::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::NullableFloatSingle::Id: { - using TypeInfo = Attributes::NullableFloatSingle::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithFloat:cppValue.Value()]; - } - return value; - } - case Attributes::NullableFloatDouble::Id: { - using TypeInfo = Attributes::NullableFloatDouble::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithDouble:cppValue.Value()]; - } - return value; - } - case Attributes::NullableOctetString::Id: { - using TypeInfo = Attributes::NullableOctetString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSData * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; - } - return value; - } - case Attributes::NullableCharString::Id: { - using TypeInfo = Attributes::NullableCharString::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSString * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [[NSString alloc] initWithBytes:cppValue.Value().data() - length:cppValue.Value().size() - encoding:NSUTF8StringEncoding]; - } - return value; - } - case Attributes::NullableEnumAttr::Id: { - using TypeInfo = Attributes::NullableEnumAttr::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; - } - return value; - } - case Attributes::NullableStruct::Id: { - using TypeInfo = Attributes::NullableStruct::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - MTRUnitTestingClusterSimpleStruct * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [MTRUnitTestingClusterSimpleStruct new]; - value.a = [NSNumber numberWithUnsignedChar:cppValue.Value().a]; - value.b = [NSNumber numberWithBool:cppValue.Value().b]; - value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().c)]; - value.d = [NSData dataWithBytes:cppValue.Value().d.data() length:cppValue.Value().d.size()]; - value.e = [[NSString alloc] initWithBytes:cppValue.Value().e.data() - length:cppValue.Value().e.size() - encoding:NSUTF8StringEncoding]; - value.f = [NSNumber numberWithUnsignedChar:cppValue.Value().f.Raw()]; - value.g = [NSNumber numberWithFloat:cppValue.Value().g]; - value.h = [NSNumber numberWithDouble:cppValue.Value().h]; - } - return value; - } - case Attributes::NullableRangeRestrictedInt8u::Id: { - using TypeInfo = Attributes::NullableRangeRestrictedInt8u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; - } - return value; - } - case Attributes::NullableRangeRestrictedInt8s::Id: { - using TypeInfo = Attributes::NullableRangeRestrictedInt8s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithChar:cppValue.Value()]; - } - return value; - } - case Attributes::NullableRangeRestrictedInt16u::Id: { - using TypeInfo = Attributes::NullableRangeRestrictedInt16u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; - } - return value; - } - case Attributes::NullableRangeRestrictedInt16s::Id: { - using TypeInfo = Attributes::NullableRangeRestrictedInt16s::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nullable value; - if (cppValue.IsNull()) { - value = nil; - } else { - value = [NSNumber numberWithShort:cppValue.Value()]; - } - return value; - } - case Attributes::WriteOnlyInt8u::Id: { - using TypeInfo = Attributes::WriteOnlyInt8u::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedChar:cppValue]; - return value; - } - case Attributes::GeneratedCommandList::Id: { - using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + if (entry_0.nullableString.IsNull()) { + newElement_0.nullableString = nil; + } else { + newElement_0.nullableString = [[NSString alloc] initWithBytes:entry_0.nullableString.Value().data() + length:entry_0.nullableString.Value().size() + encoding:NSUTF8StringEncoding]; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.optionalString.HasValue()) { + newElement_0.optionalString = [[NSString alloc] initWithBytes:entry_0.optionalString.Value().data() + length:entry_0.optionalString.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + newElement_0.optionalString = nil; } - value = array_0; - } - return value; - } - case Attributes::AcceptedCommandList::Id: { - using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + if (entry_0.nullableOptionalString.HasValue()) { + if (entry_0.nullableOptionalString.Value().IsNull()) { + newElement_0.nullableOptionalString = nil; + } else { + newElement_0.nullableOptionalString = + [[NSString alloc] initWithBytes:entry_0.nullableOptionalString.Value().Value().data() + length:entry_0.nullableOptionalString.Value().Value().size() + encoding:NSUTF8StringEncoding]; + } + } else { + newElement_0.nullableOptionalString = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.nullableStruct.IsNull()) { + newElement_0.nullableStruct = nil; + } else { + newElement_0.nullableStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.nullableStruct.a = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().a]; + newElement_0.nullableStruct.b = [NSNumber numberWithBool:entry_0.nullableStruct.Value().b]; + newElement_0.nullableStruct.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableStruct.Value().c)]; + newElement_0.nullableStruct.d = [NSData dataWithBytes:entry_0.nullableStruct.Value().d.data() + length:entry_0.nullableStruct.Value().d.size()]; + newElement_0.nullableStruct.e = [[NSString alloc] initWithBytes:entry_0.nullableStruct.Value().e.data() + length:entry_0.nullableStruct.Value().e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.nullableStruct.f = [NSNumber numberWithUnsignedChar:entry_0.nullableStruct.Value().f.Raw()]; + newElement_0.nullableStruct.g = [NSNumber numberWithFloat:entry_0.nullableStruct.Value().g]; + newElement_0.nullableStruct.h = [NSNumber numberWithDouble:entry_0.nullableStruct.Value().h]; + } + if (entry_0.optionalStruct.HasValue()) { + newElement_0.optionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.optionalStruct.a = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().a]; + newElement_0.optionalStruct.b = [NSNumber numberWithBool:entry_0.optionalStruct.Value().b]; + newElement_0.optionalStruct.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.optionalStruct.Value().c)]; + newElement_0.optionalStruct.d = [NSData dataWithBytes:entry_0.optionalStruct.Value().d.data() + length:entry_0.optionalStruct.Value().d.size()]; + newElement_0.optionalStruct.e = [[NSString alloc] initWithBytes:entry_0.optionalStruct.Value().e.data() + length:entry_0.optionalStruct.Value().e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.optionalStruct.f = [NSNumber numberWithUnsignedChar:entry_0.optionalStruct.Value().f.Raw()]; + newElement_0.optionalStruct.g = [NSNumber numberWithFloat:entry_0.optionalStruct.Value().g]; + newElement_0.optionalStruct.h = [NSNumber numberWithDouble:entry_0.optionalStruct.Value().h]; + } else { + newElement_0.optionalStruct = nil; } - value = array_0; - } - return value; - } - case Attributes::AttributeList::Id: { - using TypeInfo = Attributes::AttributeList::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - NSArray * _Nonnull value; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; - [array_0 addObject:newElement_0]; + if (entry_0.nullableOptionalStruct.HasValue()) { + if (entry_0.nullableOptionalStruct.Value().IsNull()) { + newElement_0.nullableOptionalStruct = nil; + } else { + newElement_0.nullableOptionalStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.nullableOptionalStruct.a = + [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().a]; + newElement_0.nullableOptionalStruct.b = + [NSNumber numberWithBool:entry_0.nullableOptionalStruct.Value().Value().b]; + newElement_0.nullableOptionalStruct.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.nullableOptionalStruct.Value().Value().c)]; + newElement_0.nullableOptionalStruct.d = + [NSData dataWithBytes:entry_0.nullableOptionalStruct.Value().Value().d.data() + length:entry_0.nullableOptionalStruct.Value().Value().d.size()]; + newElement_0.nullableOptionalStruct.e = + [[NSString alloc] initWithBytes:entry_0.nullableOptionalStruct.Value().Value().e.data() + length:entry_0.nullableOptionalStruct.Value().Value().e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.nullableOptionalStruct.f = + [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalStruct.Value().Value().f.Raw()]; + newElement_0.nullableOptionalStruct.g = + [NSNumber numberWithFloat:entry_0.nullableOptionalStruct.Value().Value().g]; + newElement_0.nullableOptionalStruct.h = + [NSNumber numberWithDouble:entry_0.nullableOptionalStruct.Value().Value().h]; + } + } else { + newElement_0.nullableOptionalStruct = nil; + } + if (entry_0.nullableList.IsNull()) { + newElement_0.nullableList = nil; + } else { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_0.nullableList.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + NSNumber * newElement_3; + newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.nullableList = array_3; + } + } + if (entry_0.optionalList.HasValue()) { + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = entry_0.optionalList.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + NSNumber * newElement_3; + newElement_3 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_3)]; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.optionalList = array_3; + } + } else { + newElement_0.optionalList = nil; } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_0.nullableOptionalList.HasValue()) { + if (entry_0.nullableOptionalList.Value().IsNull()) { + newElement_0.nullableOptionalList = nil; + } else { + { // Scope for our temporary variables + auto * array_4 = [NSMutableArray new]; + auto iter_4 = entry_0.nullableOptionalList.Value().Value().begin(); + while (iter_4.Next()) { + auto & entry_4 = iter_4.GetValue(); + NSNumber * newElement_4; + newElement_4 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_4)]; + [array_4 addObject:newElement_4]; + } + CHIP_ERROR err = iter_4.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.nullableOptionalList = array_4; + } + } + } else { + newElement_0.nullableOptionalList = nil; } - value = array_0; + [array_0 addObject:newElement_0]; } - return value; - } - case Attributes::FeatureMap::Id: { - using TypeInfo = Attributes::FeatureMap::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedInt:cppValue]; - return value; + value = array_0; } - case Attributes::ClusterRevision::Id: { - using TypeInfo = Attributes::ClusterRevision::TypeInfo; - TypeInfo::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { + return value; + } + case Attributes::EnumAttr::Id: { + using TypeInfo = Attributes::EnumAttr::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue)]; + return value; + } + case Attributes::StructAttr::Id: { + using TypeInfo = Attributes::StructAttr::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRUnitTestingClusterSimpleStruct * _Nonnull value; + value = [MTRUnitTestingClusterSimpleStruct new]; + value.a = [NSNumber numberWithUnsignedChar:cppValue.a]; + value.b = [NSNumber numberWithBool:cppValue.b]; + value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.c)]; + value.d = [NSData dataWithBytes:cppValue.d.data() length:cppValue.d.size()]; + value.e = [[NSString alloc] initWithBytes:cppValue.e.data() length:cppValue.e.size() encoding:NSUTF8StringEncoding]; + value.f = [NSNumber numberWithUnsignedChar:cppValue.f.Raw()]; + value.g = [NSNumber numberWithFloat:cppValue.g]; + value.h = [NSNumber numberWithDouble:cppValue.h]; + return value; + } + case Attributes::RangeRestrictedInt8u::Id: { + using TypeInfo = Attributes::RangeRestrictedInt8u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::RangeRestrictedInt8s::Id: { + using TypeInfo = Attributes::RangeRestrictedInt8s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithChar:cppValue]; + return value; + } + case Attributes::RangeRestrictedInt16u::Id: { + using TypeInfo = Attributes::RangeRestrictedInt16u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + case Attributes::RangeRestrictedInt16s::Id: { + using TypeInfo = Attributes::RangeRestrictedInt16s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithShort:cppValue]; + return value; + } + case Attributes::ListLongOctetString::Id: { + using TypeInfo = Attributes::ListLongOctetString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSData * newElement_0; + newElement_0 = [NSData dataWithBytes:entry_0.data() length:entry_0.size()]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::ListFabricScoped::Id: { + using TypeInfo = Attributes::ListFabricScoped::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRUnitTestingClusterTestFabricScoped * newElement_0; + newElement_0 = [MTRUnitTestingClusterTestFabricScoped new]; + newElement_0.fabricSensitiveInt8u = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveInt8u]; + if (entry_0.optionalFabricSensitiveInt8u.HasValue()) { + newElement_0.optionalFabricSensitiveInt8u = + [NSNumber numberWithUnsignedChar:entry_0.optionalFabricSensitiveInt8u.Value()]; + } else { + newElement_0.optionalFabricSensitiveInt8u = nil; + } + if (entry_0.nullableFabricSensitiveInt8u.IsNull()) { + newElement_0.nullableFabricSensitiveInt8u = nil; + } else { + newElement_0.nullableFabricSensitiveInt8u = + [NSNumber numberWithUnsignedChar:entry_0.nullableFabricSensitiveInt8u.Value()]; + } + if (entry_0.nullableOptionalFabricSensitiveInt8u.HasValue()) { + if (entry_0.nullableOptionalFabricSensitiveInt8u.Value().IsNull()) { + newElement_0.nullableOptionalFabricSensitiveInt8u = nil; + } else { + newElement_0.nullableOptionalFabricSensitiveInt8u = + [NSNumber numberWithUnsignedChar:entry_0.nullableOptionalFabricSensitiveInt8u.Value().Value()]; + } + } else { + newElement_0.nullableOptionalFabricSensitiveInt8u = nil; + } + newElement_0.fabricSensitiveCharString = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveCharString.data() + length:entry_0.fabricSensitiveCharString.size() + encoding:NSUTF8StringEncoding]; + newElement_0.fabricSensitiveStruct = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.fabricSensitiveStruct.a = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.a]; + newElement_0.fabricSensitiveStruct.b = [NSNumber numberWithBool:entry_0.fabricSensitiveStruct.b]; + newElement_0.fabricSensitiveStruct.c = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.fabricSensitiveStruct.c)]; + newElement_0.fabricSensitiveStruct.d = [NSData dataWithBytes:entry_0.fabricSensitiveStruct.d.data() + length:entry_0.fabricSensitiveStruct.d.size()]; + newElement_0.fabricSensitiveStruct.e = [[NSString alloc] initWithBytes:entry_0.fabricSensitiveStruct.e.data() + length:entry_0.fabricSensitiveStruct.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.fabricSensitiveStruct.f = [NSNumber numberWithUnsignedChar:entry_0.fabricSensitiveStruct.f.Raw()]; + newElement_0.fabricSensitiveStruct.g = [NSNumber numberWithFloat:entry_0.fabricSensitiveStruct.g]; + newElement_0.fabricSensitiveStruct.h = [NSNumber numberWithDouble:entry_0.fabricSensitiveStruct.h]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = entry_0.fabricSensitiveInt8uList.begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + NSNumber * newElement_2; + newElement_2 = [NSNumber numberWithUnsignedChar:entry_2]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + newElement_0.fabricSensitiveInt8uList = array_2; + } + newElement_0.fabricIndex = [NSNumber numberWithUnsignedChar:entry_0.fabricIndex]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; return nil; } - NSNumber * _Nonnull value; - value = [NSNumber numberWithUnsignedShort:cppValue]; - return value; - } - default: - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; - break; + value = array_0; } + return value; + } + case Attributes::TimedWriteBoolean::Id: { + using TypeInfo = Attributes::TimedWriteBoolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::GeneralErrorBoolean::Id: { + using TypeInfo = Attributes::GeneralErrorBoolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::ClusterErrorBoolean::Id: { + using TypeInfo = Attributes::ClusterErrorBoolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::Unsupported::Id: { + using TypeInfo = Attributes::Unsupported::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithBool:cppValue]; + return value; + } + case Attributes::NullableBoolean::Id: { + using TypeInfo = Attributes::NullableBoolean::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithBool:cppValue.Value()]; + } + return value; + } + case Attributes::NullableBitmap8::Id: { + using TypeInfo = Attributes::NullableBitmap8::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value().Raw()]; + } + return value; + } + case Attributes::NullableBitmap16::Id: { + using TypeInfo = Attributes::NullableBitmap16::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value().Raw()]; + } + return value; + } + case Attributes::NullableBitmap32::Id: { + using TypeInfo = Attributes::NullableBitmap32::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value().Raw()]; + } + return value; + } + case Attributes::NullableBitmap64::Id: { + using TypeInfo = Attributes::NullableBitmap64::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value().Raw()]; + } + return value; + } + case Attributes::NullableInt8u::Id: { + using TypeInfo = Attributes::NullableInt8u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt16u::Id: { + using TypeInfo = Attributes::NullableInt16u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt24u::Id: { + using TypeInfo = Attributes::NullableInt24u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt32u::Id: { + using TypeInfo = Attributes::NullableInt32u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedInt:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt40u::Id: { + using TypeInfo = Attributes::NullableInt40u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt48u::Id: { + using TypeInfo = Attributes::NullableInt48u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt56u::Id: { + using TypeInfo = Attributes::NullableInt56u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt64u::Id: { + using TypeInfo = Attributes::NullableInt64u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt8s::Id: { + using TypeInfo = Attributes::NullableInt8s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithChar:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt16s::Id: { + using TypeInfo = Attributes::NullableInt16s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt24s::Id: { + using TypeInfo = Attributes::NullableInt24s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithInt:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt32s::Id: { + using TypeInfo = Attributes::NullableInt32s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithInt:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt40s::Id: { + using TypeInfo = Attributes::NullableInt40s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt48s::Id: { + using TypeInfo = Attributes::NullableInt48s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt56s::Id: { + using TypeInfo = Attributes::NullableInt56s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableInt64s::Id: { + using TypeInfo = Attributes::NullableInt64s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithLongLong:cppValue.Value()]; + } + return value; + } + case Attributes::NullableEnum8::Id: { + using TypeInfo = Attributes::NullableEnum8::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::NullableEnum16::Id: { + using TypeInfo = Attributes::NullableEnum16::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::NullableFloatSingle::Id: { + using TypeInfo = Attributes::NullableFloatSingle::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithFloat:cppValue.Value()]; + } + return value; + } + case Attributes::NullableFloatDouble::Id: { + using TypeInfo = Attributes::NullableFloatDouble::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithDouble:cppValue.Value()]; + } + return value; + } + case Attributes::NullableOctetString::Id: { + using TypeInfo = Attributes::NullableOctetString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSData * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSData dataWithBytes:cppValue.Value().data() length:cppValue.Value().size()]; + } + return value; + } + case Attributes::NullableCharString::Id: { + using TypeInfo = Attributes::NullableCharString::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSString * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [[NSString alloc] initWithBytes:cppValue.Value().data() + length:cppValue.Value().size() + encoding:NSUTF8StringEncoding]; + } + return value; + } + case Attributes::NullableEnumAttr::Id: { + using TypeInfo = Attributes::NullableEnumAttr::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value())]; + } + return value; + } + case Attributes::NullableStruct::Id: { + using TypeInfo = Attributes::NullableStruct::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + MTRUnitTestingClusterSimpleStruct * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [MTRUnitTestingClusterSimpleStruct new]; + value.a = [NSNumber numberWithUnsignedChar:cppValue.Value().a]; + value.b = [NSNumber numberWithBool:cppValue.Value().b]; + value.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.Value().c)]; + value.d = [NSData dataWithBytes:cppValue.Value().d.data() length:cppValue.Value().d.size()]; + value.e = [[NSString alloc] initWithBytes:cppValue.Value().e.data() + length:cppValue.Value().e.size() + encoding:NSUTF8StringEncoding]; + value.f = [NSNumber numberWithUnsignedChar:cppValue.Value().f.Raw()]; + value.g = [NSNumber numberWithFloat:cppValue.Value().g]; + value.h = [NSNumber numberWithDouble:cppValue.Value().h]; + } + return value; + } + case Attributes::NullableRangeRestrictedInt8u::Id: { + using TypeInfo = Attributes::NullableRangeRestrictedInt8u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedChar:cppValue.Value()]; + } + return value; + } + case Attributes::NullableRangeRestrictedInt8s::Id: { + using TypeInfo = Attributes::NullableRangeRestrictedInt8s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithChar:cppValue.Value()]; + } + return value; + } + case Attributes::NullableRangeRestrictedInt16u::Id: { + using TypeInfo = Attributes::NullableRangeRestrictedInt16u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithUnsignedShort:cppValue.Value()]; + } + return value; + } + case Attributes::NullableRangeRestrictedInt16s::Id: { + using TypeInfo = Attributes::NullableRangeRestrictedInt16s::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nullable value; + if (cppValue.IsNull()) { + value = nil; + } else { + value = [NSNumber numberWithShort:cppValue.Value()]; + } + return value; + } + case Attributes::WriteOnlyInt8u::Id: { + using TypeInfo = Attributes::WriteOnlyInt8u::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedChar:cppValue]; + return value; + } + case Attributes::GeneratedCommandList::Id: { + using TypeInfo = Attributes::GeneratedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AcceptedCommandList::Id: { + using TypeInfo = Attributes::AcceptedCommandList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::AttributeList::Id: { + using TypeInfo = Attributes::AttributeList::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSArray * _Nonnull value; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedInt:entry_0]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + value = array_0; + } + return value; + } + case Attributes::FeatureMap::Id: { + using TypeInfo = Attributes::FeatureMap::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedInt:cppValue]; + return value; + } + case Attributes::ClusterRevision::Id: { + using TypeInfo = Attributes::ClusterRevision::TypeInfo; + TypeInfo::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + NSNumber * _Nonnull value; + value = [NSNumber numberWithUnsignedShort:cppValue]; + return value; + } + default: { break; } + } + + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; + return nil; +} + +id _Nullable MTRDecodeAttributeValue(const ConcreteAttributePath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) { + case Clusters::Identify::Id: { + return DecodeAttributeValueForIdentifyCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Groups::Id: { + return DecodeAttributeValueForGroupsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Scenes::Id: { + return DecodeAttributeValueForScenesCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::OnOff::Id: { + return DecodeAttributeValueForOnOffCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::OnOffSwitchConfiguration::Id: { + return DecodeAttributeValueForOnOffSwitchConfigurationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::LevelControl::Id: { + return DecodeAttributeValueForLevelControlCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::BinaryInputBasic::Id: { + return DecodeAttributeValueForBinaryInputBasicCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Descriptor::Id: { + return DecodeAttributeValueForDescriptorCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Binding::Id: { + return DecodeAttributeValueForBindingCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::AccessControl::Id: { + return DecodeAttributeValueForAccessControlCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Actions::Id: { + return DecodeAttributeValueForActionsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::BasicInformation::Id: { + return DecodeAttributeValueForBasicInformationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::OtaSoftwareUpdateProvider::Id: { + return DecodeAttributeValueForOTASoftwareUpdateProviderCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::OtaSoftwareUpdateRequestor::Id: { + return DecodeAttributeValueForOTASoftwareUpdateRequestorCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::LocalizationConfiguration::Id: { + return DecodeAttributeValueForLocalizationConfigurationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::TimeFormatLocalization::Id: { + return DecodeAttributeValueForTimeFormatLocalizationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::UnitLocalization::Id: { + return DecodeAttributeValueForUnitLocalizationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::PowerSourceConfiguration::Id: { + return DecodeAttributeValueForPowerSourceConfigurationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::PowerSource::Id: { + return DecodeAttributeValueForPowerSourceCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::GeneralCommissioning::Id: { + return DecodeAttributeValueForGeneralCommissioningCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::NetworkCommissioning::Id: { + return DecodeAttributeValueForNetworkCommissioningCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::DiagnosticLogs::Id: { + return DecodeAttributeValueForDiagnosticLogsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::GeneralDiagnostics::Id: { + return DecodeAttributeValueForGeneralDiagnosticsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::SoftwareDiagnostics::Id: { + return DecodeAttributeValueForSoftwareDiagnosticsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ThreadNetworkDiagnostics::Id: { + return DecodeAttributeValueForThreadNetworkDiagnosticsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::WiFiNetworkDiagnostics::Id: { + return DecodeAttributeValueForWiFiNetworkDiagnosticsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::EthernetNetworkDiagnostics::Id: { + return DecodeAttributeValueForEthernetNetworkDiagnosticsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::BridgedDeviceBasicInformation::Id: { + return DecodeAttributeValueForBridgedDeviceBasicInformationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Switch::Id: { + return DecodeAttributeValueForSwitchCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::AdministratorCommissioning::Id: { + return DecodeAttributeValueForAdministratorCommissioningCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::OperationalCredentials::Id: { + return DecodeAttributeValueForOperationalCredentialsCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::GroupKeyManagement::Id: { + return DecodeAttributeValueForGroupKeyManagementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::FixedLabel::Id: { + return DecodeAttributeValueForFixedLabelCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::UserLabel::Id: { + return DecodeAttributeValueForUserLabelCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::BooleanState::Id: { + return DecodeAttributeValueForBooleanStateCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ModeSelect::Id: { + return DecodeAttributeValueForModeSelectCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::DoorLock::Id: { + return DecodeAttributeValueForDoorLockCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::WindowCovering::Id: { + return DecodeAttributeValueForWindowCoveringCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::BarrierControl::Id: { + return DecodeAttributeValueForBarrierControlCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::PumpConfigurationAndControl::Id: { + return DecodeAttributeValueForPumpConfigurationAndControlCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Thermostat::Id: { + return DecodeAttributeValueForThermostatCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::FanControl::Id: { + return DecodeAttributeValueForFanControlCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ThermostatUserInterfaceConfiguration::Id: { + return DecodeAttributeValueForThermostatUserInterfaceConfigurationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ColorControl::Id: { + return DecodeAttributeValueForColorControlCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::BallastConfiguration::Id: { + return DecodeAttributeValueForBallastConfigurationCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::IlluminanceMeasurement::Id: { + return DecodeAttributeValueForIlluminanceMeasurementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::TemperatureMeasurement::Id: { + return DecodeAttributeValueForTemperatureMeasurementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::PressureMeasurement::Id: { + return DecodeAttributeValueForPressureMeasurementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::FlowMeasurement::Id: { + return DecodeAttributeValueForFlowMeasurementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::RelativeHumidityMeasurement::Id: { + return DecodeAttributeValueForRelativeHumidityMeasurementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::OccupancySensing::Id: { + return DecodeAttributeValueForOccupancySensingCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::WakeOnLan::Id: { + return DecodeAttributeValueForWakeOnLANCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::Channel::Id: { + return DecodeAttributeValueForChannelCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::TargetNavigator::Id: { + return DecodeAttributeValueForTargetNavigatorCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::MediaPlayback::Id: { + return DecodeAttributeValueForMediaPlaybackCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::MediaInput::Id: { + return DecodeAttributeValueForMediaInputCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::LowPower::Id: { + return DecodeAttributeValueForLowPowerCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::KeypadInput::Id: { + return DecodeAttributeValueForKeypadInputCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ContentLauncher::Id: { + return DecodeAttributeValueForContentLauncherCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::AudioOutput::Id: { + return DecodeAttributeValueForAudioOutputCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ApplicationLauncher::Id: { + return DecodeAttributeValueForApplicationLauncherCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ApplicationBasic::Id: { + return DecodeAttributeValueForApplicationBasicCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::AccountLogin::Id: { + return DecodeAttributeValueForAccountLoginCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::ElectricalMeasurement::Id: { + return DecodeAttributeValueForElectricalMeasurementCluster(aPath.mAttributeId, aReader, aError); + } + case Clusters::UnitTesting::Id: { + return DecodeAttributeValueForUnitTestingCluster(aPath.mAttributeId, aReader, aError); + } default: { - *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; break; } } + *aError = CHIP_ERROR_IM_MALFORMED_ATTRIBUTE_PATH_IB; return nil; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h index 5d5fbcead09a84..28ee1109035ef2 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRClusterConstants.h @@ -2850,11 +2850,11 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000002, MTRClusterTimeSynchronizationAttributeTrustedTimeNodeIdID MTR_DEPRECATED( - "Please use MTRAttributeIDTypeClusterTimeSynchronizationAttributeTrustedTimeNodeIdID", ios(16.1, 16.4), macos(13.0, 13.3), + "Please use MTRAttributeIDTypeClusterTimeSynchronizationAttributeTrustedTimeSourceID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000003, MTRClusterTimeSynchronizationAttributeDefaultNtpID MTR_DEPRECATED( - "Please use MTRAttributeIDTypeClusterTimeSynchronizationAttributeDefaultNtpID", ios(16.1, 16.4), macos(13.0, 13.3), + "Please use MTRAttributeIDTypeClusterTimeSynchronizationAttributeDefaultNTPID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000004, MTRClusterTimeSynchronizationAttributeTimeZoneID MTR_DEPRECATED( @@ -2874,7 +2874,7 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000008, MTRClusterTimeSynchronizationAttributeNtpServerPortID MTR_DEPRECATED( - "Please use MTRAttributeIDTypeClusterTimeSynchronizationAttributeNtpServerPortID", ios(16.1, 16.4), macos(13.0, 13.3), + "Please use MTRAttributeIDTypeClusterTimeSynchronizationAttributeNTPServerAvailableID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000009, MTRClusterTimeSynchronizationAttributeGeneratedCommandListID MTR_DEPRECATED( @@ -2907,12 +2907,14 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterTimeSynchronizationAttributeTimeSourceID API_AVAILABLE( ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000002, + MTRAttributeIDTypeClusterTimeSynchronizationAttributeTrustedTimeSourceID MTR_NEWLY_AVAILABLE = 0x00000003, MTRAttributeIDTypeClusterTimeSynchronizationAttributeTrustedTimeNodeIdID API_AVAILABLE( ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - = 0x00000003, + = MTRAttributeIDTypeClusterTimeSynchronizationAttributeTrustedTimeSourceID, + MTRAttributeIDTypeClusterTimeSynchronizationAttributeDefaultNTPID MTR_NEWLY_AVAILABLE = 0x00000004, MTRAttributeIDTypeClusterTimeSynchronizationAttributeDefaultNtpID API_AVAILABLE( ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - = 0x00000004, + = MTRAttributeIDTypeClusterTimeSynchronizationAttributeDefaultNTPID, MTRAttributeIDTypeClusterTimeSynchronizationAttributeTimeZoneID API_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000005, MTRAttributeIDTypeClusterTimeSynchronizationAttributeDSTOffsetID API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)) @@ -2926,9 +2928,10 @@ typedef NS_ENUM(uint32_t, MTRAttributeIDType) { MTRAttributeIDTypeClusterTimeSynchronizationAttributeTimeZoneDatabaseID API_AVAILABLE( ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = 0x00000008, + MTRAttributeIDTypeClusterTimeSynchronizationAttributeNTPServerAvailableID MTR_NEWLY_AVAILABLE = 0x00000009, MTRAttributeIDTypeClusterTimeSynchronizationAttributeNtpServerPortID API_AVAILABLE( ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) - = 0x00000009, + = MTRAttributeIDTypeClusterTimeSynchronizationAttributeNTPServerAvailableID, MTRAttributeIDTypeClusterTimeSynchronizationAttributeGeneratedCommandListID API_AVAILABLE( ios(16.4), macos(13.3), watchos(9.4), tvos(16.4)) = MTRAttributeIDTypeGlobalAttributeGeneratedCommandListID, @@ -8561,7 +8564,7 @@ typedef NS_ENUM(uint32_t, MTRCommandIDType) { // Cluster TimeSynchronization deprecated command id names MTRClusterTimeSynchronizationCommandSetUtcTimeID MTR_DEPRECATED( - "Please use MTRCommandIDTypeClusterTimeSynchronizationCommandSetUtcTimeID", ios(16.1, 16.4), macos(13.0, 13.3), + "Please use MTRCommandIDTypeClusterTimeSynchronizationCommandSetUTCTimeID", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4)) = 0x00000000, diff --git a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm index d36a169791c077..a331c2bf1a6334 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTREventTLVValueDecoder.mm @@ -32,2355 +32,2641 @@ using namespace chip; using namespace chip::app; -id MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +static id _Nullable DecodeEventPayloadForIdentifyCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) { - switch (aPath.mClusterId) { - case Clusters::Identify::Id: { - using namespace Clusters::Identify; - switch (aPath.mEventId) { - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + using namespace Clusters::Identify; + switch (aEventId) { + default: { break; } - case Clusters::Groups::Id: { - using namespace Clusters::Groups; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForGroupsCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Groups; + switch (aEventId) { + default: { break; } - case Clusters::Scenes::Id: { - using namespace Clusters::Scenes; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForScenesCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Scenes; + switch (aEventId) { + default: { break; } - case Clusters::OnOff::Id: { - using namespace Clusters::OnOff; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForOnOffCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OnOff; + switch (aEventId) { + default: { break; } - case Clusters::OnOffSwitchConfiguration::Id: { - using namespace Clusters::OnOffSwitchConfiguration; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForOnOffSwitchConfigurationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OnOffSwitchConfiguration; + switch (aEventId) { + default: { break; } - case Clusters::LevelControl::Id: { - using namespace Clusters::LevelControl; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForLevelControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::LevelControl; + switch (aEventId) { + default: { break; } - case Clusters::BinaryInputBasic::Id: { - using namespace Clusters::BinaryInputBasic; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBinaryInputBasicCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BinaryInputBasic; + switch (aEventId) { + default: { break; } - case Clusters::Descriptor::Id: { - using namespace Clusters::Descriptor; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForDescriptorCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Descriptor; + switch (aEventId) { + default: { break; } - case Clusters::Binding::Id: { - using namespace Clusters::Binding; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBindingCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Binding; + switch (aEventId) { + default: { break; } - case Clusters::AccessControl::Id: { - using namespace Clusters::AccessControl; - switch (aPath.mEventId) { - - case Events::AccessControlEntryChanged::Id: { - Events::AccessControlEntryChanged::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRAccessControlClusterAccessControlEntryChangedEvent new]; + } - do { - NSNumber * _Nullable memberValue; - if (cppValue.adminNodeID.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; - } - value.adminNodeID = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.adminPasscodeID.IsNull()) { - memberValue = nil; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForAccessControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AccessControl; + switch (aEventId) { + case Events::AccessControlEntryChanged::Id: { + Events::AccessControlEntryChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRAccessControlClusterAccessControlEntryChangedEvent new]; + + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminNodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; + } + value.adminNodeID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminPasscodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + } + value.adminPasscodeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; + value.changeType = memberValue; + } while (0); + do { + MTRAccessControlClusterAccessControlEntryStruct * _Nullable memberValue; + if (cppValue.latestValue.IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRAccessControlClusterAccessControlEntryStruct new]; + memberValue.privilege = + [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().privilege)]; + memberValue.authMode = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().authMode)]; + if (cppValue.latestValue.Value().subjects.IsNull()) { + memberValue.subjects = nil; } else { - memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = cppValue.latestValue.Value().subjects.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + NSNumber * newElement_3; + newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue.subjects = array_3; + } } - value.adminPasscodeID = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; - value.changeType = memberValue; - } while (0); - do { - MTRAccessControlClusterAccessControlEntryStruct * _Nullable memberValue; - if (cppValue.latestValue.IsNull()) { - memberValue = nil; + if (cppValue.latestValue.Value().targets.IsNull()) { + memberValue.targets = nil; } else { - memberValue = [MTRAccessControlClusterAccessControlEntryStruct new]; - memberValue.privilege = - [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().privilege)]; - memberValue.authMode = - [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.latestValue.Value().authMode)]; - if (cppValue.latestValue.Value().subjects.IsNull()) { - memberValue.subjects = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = cppValue.latestValue.Value().subjects.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - NSNumber * newElement_3; - newElement_3 = [NSNumber numberWithUnsignedLongLong:entry_3]; - [array_3 addObject:newElement_3]; + { // Scope for our temporary variables + auto * array_3 = [NSMutableArray new]; + auto iter_3 = cppValue.latestValue.Value().targets.Value().begin(); + while (iter_3.Next()) { + auto & entry_3 = iter_3.GetValue(); + MTRAccessControlClusterTarget * newElement_3; + newElement_3 = [MTRAccessControlClusterTarget new]; + if (entry_3.cluster.IsNull()) { + newElement_3.cluster = nil; + } else { + newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue.subjects = array_3; - } - } - if (cppValue.latestValue.Value().targets.IsNull()) { - memberValue.targets = nil; - } else { - { // Scope for our temporary variables - auto * array_3 = [NSMutableArray new]; - auto iter_3 = cppValue.latestValue.Value().targets.Value().begin(); - while (iter_3.Next()) { - auto & entry_3 = iter_3.GetValue(); - MTRAccessControlClusterTarget * newElement_3; - newElement_3 = [MTRAccessControlClusterTarget new]; - if (entry_3.cluster.IsNull()) { - newElement_3.cluster = nil; - } else { - newElement_3.cluster = [NSNumber numberWithUnsignedInt:entry_3.cluster.Value()]; - } - if (entry_3.endpoint.IsNull()) { - newElement_3.endpoint = nil; - } else { - newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; - } - if (entry_3.deviceType.IsNull()) { - newElement_3.deviceType = nil; - } else { - newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; - } - [array_3 addObject:newElement_3]; + if (entry_3.endpoint.IsNull()) { + newElement_3.endpoint = nil; + } else { + newElement_3.endpoint = [NSNumber numberWithUnsignedShort:entry_3.endpoint.Value()]; } - CHIP_ERROR err = iter_3.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; + if (entry_3.deviceType.IsNull()) { + newElement_3.deviceType = nil; + } else { + newElement_3.deviceType = [NSNumber numberWithUnsignedInt:entry_3.deviceType.Value()]; } - memberValue.targets = array_3; + [array_3 addObject:newElement_3]; + } + CHIP_ERROR err = iter_3.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } + memberValue.targets = array_3; } - memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; } - value.latestValue = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; - value.fabricIndex = memberValue; - } while (0); - - return value; - } - - case Events::AccessControlExtensionChanged::Id: { - Events::AccessControlExtensionChanged::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; } + value.latestValue = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); + + return value; + } + case Events::AccessControlExtensionChanged::Id: { + Events::AccessControlExtensionChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRAccessControlClusterAccessControlExtensionChangedEvent new]; + + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminNodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; + } + value.adminNodeID = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.adminPasscodeID.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; + } + value.adminPasscodeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; + value.changeType = memberValue; + } while (0); + do { + MTRAccessControlClusterAccessControlExtensionStruct * _Nullable memberValue; + if (cppValue.latestValue.IsNull()) { + memberValue = nil; + } else { + memberValue = [MTRAccessControlClusterAccessControlExtensionStruct new]; + memberValue.data = [NSData dataWithBytes:cppValue.latestValue.Value().data.data() + length:cppValue.latestValue.Value().data.size()]; + memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; + } + value.latestValue = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); - __auto_type * value = [MTRAccessControlClusterAccessControlExtensionChangedEvent new]; - - do { - NSNumber * _Nullable memberValue; - if (cppValue.adminNodeID.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.adminNodeID.Value()]; - } - value.adminNodeID = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.adminPasscodeID.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedShort:cppValue.adminPasscodeID.Value()]; - } - value.adminPasscodeID = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.changeType)]; - value.changeType = memberValue; - } while (0); - do { - MTRAccessControlClusterAccessControlExtensionStruct * _Nullable memberValue; - if (cppValue.latestValue.IsNull()) { - memberValue = nil; - } else { - memberValue = [MTRAccessControlClusterAccessControlExtensionStruct new]; - memberValue.data = [NSData dataWithBytes:cppValue.latestValue.Value().data.data() - length:cppValue.latestValue.Value().data.size()]; - memberValue.fabricIndex = [NSNumber numberWithUnsignedChar:cppValue.latestValue.Value().fabricIndex]; - } - value.latestValue = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; - value.fabricIndex = memberValue; - } while (0); - - return value; - } + return value; + } + default: { + break; + } + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForActionsCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Actions; + switch (aEventId) { + case Events::StateChanged::Id: { + Events::StateChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRActionsClusterStateChangedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; + value.actionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; + value.invokeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + + return value; + } + case Events::ActionFailed::Id: { + Events::ActionFailed::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRActionsClusterActionFailedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; + value.actionID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; + value.invokeID = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.error)]; + value.error = memberValue; + } while (0); + + return value; + } + default: { break; } - case Clusters::Actions::Id: { - using namespace Clusters::Actions; - switch (aPath.mEventId) { - - case Events::StateChanged::Id: { - Events::StateChanged::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + } - __auto_type * value = [MTRActionsClusterStateChangedEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; - value.actionID = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; - value.invokeID = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; - value.newState = memberValue; - } while (0); - - return value; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBasicInformationCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BasicInformation; + switch (aEventId) { + case Events::StartUp::Id: { + Events::StartUp::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ActionFailed::Id: { - Events::ActionFailed::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + __auto_type * value = [MTRBasicInformationClusterStartUpEvent new]; - __auto_type * value = [MTRActionsClusterActionFailedEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedShort:cppValue.actionID]; - value.actionID = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.invokeID]; - value.invokeID = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; - value.newState = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.error)]; - value.error = memberValue; - } while (0); - - return value; - } + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } - break; + return value; } - case Clusters::BasicInformation::Id: { - using namespace Clusters::BasicInformation; - switch (aPath.mEventId) { - - case Events::StartUp::Id: { - Events::StartUp::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRBasicInformationClusterStartUpEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; - value.softwareVersion = memberValue; - } while (0); - - return value; + case Events::ShutDown::Id: { + Events::ShutDown::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ShutDown::Id: { - Events::ShutDown::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRBasicInformationClusterShutDownEvent new]; + __auto_type * value = [MTRBasicInformationClusterShutDownEvent new]; - return value; + return value; + } + case Events::Leave::Id: { + Events::Leave::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::Leave::Id: { - Events::Leave::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRBasicInformationClusterLeaveEvent new]; + __auto_type * value = [MTRBasicInformationClusterLeaveEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; - value.fabricIndex = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); - return value; + return value; + } + case Events::ReachableChanged::Id: { + Events::ReachableChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ReachableChanged::Id: { - Events::ReachableChanged::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRBasicInformationClusterReachableChangedEvent new]; + __auto_type * value = [MTRBasicInformationClusterReachableChangedEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; - value.reachableNewValue = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; + value.reachableNewValue = memberValue; + } while (0); - return value; - } - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + return value; + } + default: { break; } - case Clusters::OtaSoftwareUpdateProvider::Id: { - using namespace Clusters::OtaSoftwareUpdateProvider; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForOTASoftwareUpdateProviderCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OtaSoftwareUpdateProvider; + switch (aEventId) { + default: { break; } - case Clusters::OtaSoftwareUpdateRequestor::Id: { - using namespace Clusters::OtaSoftwareUpdateRequestor; - switch (aPath.mEventId) { - - case Events::StateTransition::Id: { - Events::StateTransition::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTROTASoftwareUpdateRequestorClusterStateTransitionEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.previousState)]; - value.previousState = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; - value.newState = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.reason)]; - value.reason = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.targetSoftwareVersion.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedInt:cppValue.targetSoftwareVersion.Value()]; - } - value.targetSoftwareVersion = memberValue; - } while (0); - - return value; - } + } - case Events::VersionApplied::Id: { - Events::VersionApplied::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForOTASoftwareUpdateRequestorCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OtaSoftwareUpdateRequestor; + switch (aEventId) { + case Events::StateTransition::Id: { + Events::StateTransition::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTROTASoftwareUpdateRequestorClusterStateTransitionEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.previousState)]; + value.previousState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.newState)]; + value.newState = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.reason)]; + value.reason = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.targetSoftwareVersion.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedInt:cppValue.targetSoftwareVersion.Value()]; } - - __auto_type * value = [MTROTASoftwareUpdateRequestorClusterVersionAppliedEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; - value.softwareVersion = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedShort:cppValue.productID]; - value.productID = memberValue; - } while (0); - - return value; - } - - case Events::DownloadError::Id: { - Events::DownloadError::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + value.targetSoftwareVersion = memberValue; + } while (0); + + return value; + } + case Events::VersionApplied::Id: { + Events::VersionApplied::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTROTASoftwareUpdateRequestorClusterVersionAppliedEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.productID]; + value.productID = memberValue; + } while (0); + + return value; + } + case Events::DownloadError::Id: { + Events::DownloadError::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTROTASoftwareUpdateRequestorClusterDownloadErrorEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.bytesDownloaded]; + value.bytesDownloaded = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.progressPercent.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.progressPercent.Value()]; } + value.progressPercent = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.platformCode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithLongLong:cppValue.platformCode.Value()]; + } + value.platformCode = memberValue; + } while (0); - __auto_type * value = [MTROTASoftwareUpdateRequestorClusterDownloadErrorEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; - value.softwareVersion = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.bytesDownloaded]; - value.bytesDownloaded = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.progressPercent.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedChar:cppValue.progressPercent.Value()]; - } - value.progressPercent = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.platformCode.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithLongLong:cppValue.platformCode.Value()]; - } - value.platformCode = memberValue; - } while (0); - - return value; - } - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + return value; + } + default: { break; } - case Clusters::LocalizationConfiguration::Id: { - using namespace Clusters::LocalizationConfiguration; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForLocalizationConfigurationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::LocalizationConfiguration; + switch (aEventId) { + default: { break; } - case Clusters::TimeFormatLocalization::Id: { - using namespace Clusters::TimeFormatLocalization; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForTimeFormatLocalizationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::TimeFormatLocalization; + switch (aEventId) { + default: { break; } - case Clusters::UnitLocalization::Id: { - using namespace Clusters::UnitLocalization; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForUnitLocalizationCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::UnitLocalization; + switch (aEventId) { + default: { break; } - case Clusters::PowerSourceConfiguration::Id: { - using namespace Clusters::PowerSourceConfiguration; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForPowerSourceConfigurationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PowerSourceConfiguration; + switch (aEventId) { + default: { break; } - case Clusters::PowerSource::Id: { - using namespace Clusters::PowerSource; - switch (aPath.mEventId) { - - case Events::WiredFaultChange::Id: { - Events::WiredFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + } - __auto_type * value = [MTRPowerSourceClusterWiredFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForPowerSourceCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PowerSource; + switch (aEventId) { + case Events::WiredFaultChange::Id: { + Events::WiredFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRPowerSourceClusterWiredFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.previous = memberValue; - } while (0); - - return value; - } - - case Events::BatFaultChange::Id: { - Events::BatFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + memberValue = array_0; } - - __auto_type * value = [MTRPowerSourceClusterBatFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.previous = memberValue; - } while (0); - - return value; - } - - case Events::BatChargeFaultChange::Id: { - Events::BatChargeFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + memberValue = array_0; } - - __auto_type * value = [MTRPowerSourceClusterBatChargeFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + value.previous = memberValue; + } while (0); + + return value; + } + case Events::BatFaultChange::Id: { + Events::BatFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRPowerSourceClusterBatFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.previous = memberValue; - } while (0); - - return value; - } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); + + return value; + } + case Events::BatChargeFaultChange::Id: { + Events::BatChargeFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRPowerSourceClusterBatChargeFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } - break; + return value; } - case Clusters::GeneralCommissioning::Id: { - using namespace Clusters::GeneralCommissioning; - switch (aPath.mEventId) { - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + default: { break; } - case Clusters::NetworkCommissioning::Id: { - using namespace Clusters::NetworkCommissioning; - switch (aPath.mEventId) { - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } - break; } - case Clusters::DiagnosticLogs::Id: { - using namespace Clusters::DiagnosticLogs; - switch (aPath.mEventId) { - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForGeneralCommissioningCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::GeneralCommissioning; + switch (aEventId) { + default: { break; } - case Clusters::GeneralDiagnostics::Id: { - using namespace Clusters::GeneralDiagnostics; - switch (aPath.mEventId) { - - case Events::HardwareFaultChange::Id: { - Events::HardwareFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + } - __auto_type * value = [MTRGeneralDiagnosticsClusterHardwareFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; - } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; - } - value.previous = memberValue; - } while (0); + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForNetworkCommissioningCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::NetworkCommissioning; + switch (aEventId) { + default: { + break; + } + } - return value; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForDiagnosticLogsCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::DiagnosticLogs; + switch (aEventId) { + default: { + break; + } + } - case Events::RadioFaultChange::Id: { - Events::RadioFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForGeneralDiagnosticsCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::GeneralDiagnostics; + switch (aEventId) { + case Events::HardwareFaultChange::Id: { + Events::HardwareFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRGeneralDiagnosticsClusterHardwareFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; } - - __auto_type * value = [MTRGeneralDiagnosticsClusterRadioFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.previous = memberValue; - } while (0); - - return value; - } - - case Events::NetworkFaultChange::Id: { - Events::NetworkFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + memberValue = array_0; } - - __auto_type * value = [MTRGeneralDiagnosticsClusterNetworkFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + value.previous = memberValue; + } while (0); + + return value; + } + case Events::RadioFaultChange::Id: { + Events::RadioFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRGeneralDiagnosticsClusterRadioFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.previous = memberValue; - } while (0); - - return value; - } - - case Events::BootReason::Id: { - Events::BootReason::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + memberValue = array_0; } - - __auto_type * value = [MTRGeneralDiagnosticsClusterBootReasonEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.bootReason)]; - value.bootReason = memberValue; - } while (0); - - return value; - } - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } - break; - } - case Clusters::SoftwareDiagnostics::Id: { - using namespace Clusters::SoftwareDiagnostics; - switch (aPath.mEventId) { - - case Events::SoftwareFault::Id: { - Events::SoftwareFault::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; } - - __auto_type * value = [MTRSoftwareDiagnosticsClusterSoftwareFaultEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.id]; - value.id = memberValue; - } while (0); - do { - NSString * _Nullable memberValue; - if (cppValue.name.HasValue()) { - memberValue = [[NSString alloc] initWithBytes:cppValue.name.Value().data() - length:cppValue.name.Value().size() - encoding:NSUTF8StringEncoding]; - } else { - memberValue = nil; + value.previous = memberValue; + } while (0); + + return value; + } + case Events::NetworkFaultChange::Id: { + Events::NetworkFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRGeneralDiagnosticsClusterNetworkFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.name = memberValue; - } while (0); - do { - NSData * _Nullable memberValue; - if (cppValue.faultRecording.HasValue()) { - memberValue = [NSData dataWithBytes:cppValue.faultRecording.Value().data() - length:cppValue.faultRecording.Value().size()]; - } else { - memberValue = nil; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.faultRecording = memberValue; - } while (0); + memberValue = array_0; + } + value.previous = memberValue; + } while (0); - return value; + return value; + } + case Events::BootReason::Id: { + Events::BootReason::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + __auto_type * value = [MTRGeneralDiagnosticsClusterBootReasonEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.bootReason)]; + value.bootReason = memberValue; + } while (0); + + return value; + } + default: { break; } - case Clusters::ThreadNetworkDiagnostics::Id: { - using namespace Clusters::ThreadNetworkDiagnostics; - switch (aPath.mEventId) { - - case Events::ConnectionStatus::Id: { - Events::ConnectionStatus::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRThreadNetworkDiagnosticsClusterConnectionStatusEvent new]; + } - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; - value.connectionStatus = memberValue; - } while (0); + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForSoftwareDiagnosticsCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::SoftwareDiagnostics; + switch (aEventId) { + case Events::SoftwareFault::Id: { + Events::SoftwareFault::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRSoftwareDiagnosticsClusterSoftwareFaultEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.id]; + value.id = memberValue; + } while (0); + do { + NSString * _Nullable memberValue; + if (cppValue.name.HasValue()) { + memberValue = [[NSString alloc] initWithBytes:cppValue.name.Value().data() + length:cppValue.name.Value().size() + encoding:NSUTF8StringEncoding]; + } else { + memberValue = nil; + } + value.name = memberValue; + } while (0); + do { + NSData * _Nullable memberValue; + if (cppValue.faultRecording.HasValue()) { + memberValue = [NSData dataWithBytes:cppValue.faultRecording.Value().data() + length:cppValue.faultRecording.Value().size()]; + } else { + memberValue = nil; + } + value.faultRecording = memberValue; + } while (0); - return value; - } + return value; + } + default: { + break; + } + } - case Events::NetworkFaultChange::Id: { - Events::NetworkFaultChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForThreadNetworkDiagnosticsCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ThreadNetworkDiagnostics; + switch (aEventId) { + case Events::ConnectionStatus::Id: { + Events::ConnectionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRThreadNetworkDiagnosticsClusterConnectionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; + value.connectionStatus = memberValue; + } while (0); + + return value; + } + case Events::NetworkFaultChange::Id: { + Events::NetworkFaultChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent new]; + + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.current.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; } - - __auto_type * value = [MTRThreadNetworkDiagnosticsClusterNetworkFaultChangeEvent new]; - - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.current.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + value.current = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.previous.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; } - value.current = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.previous.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.previous = memberValue; - } while (0); - - return value; - } + memberValue = array_0; + } + value.previous = memberValue; + } while (0); - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + return value; + } + default: { break; } - case Clusters::WiFiNetworkDiagnostics::Id: { - using namespace Clusters::WiFiNetworkDiagnostics; - switch (aPath.mEventId) { - - case Events::Disconnection::Id: { - Events::Disconnection::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRWiFiNetworkDiagnosticsClusterDisconnectionEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedShort:cppValue.reasonCode]; - value.reasonCode = memberValue; - } while (0); + } - return value; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForWiFiNetworkDiagnosticsCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WiFiNetworkDiagnostics; + switch (aEventId) { + case Events::Disconnection::Id: { + Events::Disconnection::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::AssociationFailure::Id: { - Events::AssociationFailure::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRWiFiNetworkDiagnosticsClusterAssociationFailureEvent new]; + __auto_type * value = [MTRWiFiNetworkDiagnosticsClusterDisconnectionEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.associationFailure)]; - value.associationFailure = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedShort:cppValue.status]; - value.status = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.reasonCode]; + value.reasonCode = memberValue; + } while (0); - return value; + return value; + } + case Events::AssociationFailure::Id: { + Events::AssociationFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ConnectionStatus::Id: { - Events::ConnectionStatus::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRWiFiNetworkDiagnosticsClusterConnectionStatusEvent new]; + __auto_type * value = [MTRWiFiNetworkDiagnosticsClusterAssociationFailureEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; - value.connectionStatus = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.associationFailure)]; + value.associationFailure = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedShort:cppValue.status]; + value.status = memberValue; + } while (0); - return value; + return value; + } + case Events::ConnectionStatus::Id: { + Events::ConnectionStatus::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + __auto_type * value = [MTRWiFiNetworkDiagnosticsClusterConnectionStatusEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.connectionStatus)]; + value.connectionStatus = memberValue; + } while (0); + + return value; + } + default: { break; } - case Clusters::EthernetNetworkDiagnostics::Id: { - using namespace Clusters::EthernetNetworkDiagnostics; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForEthernetNetworkDiagnosticsCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::EthernetNetworkDiagnostics; + switch (aEventId) { + default: { break; } - case Clusters::BridgedDeviceBasicInformation::Id: { - using namespace Clusters::BridgedDeviceBasicInformation; - switch (aPath.mEventId) { - - case Events::StartUp::Id: { - Events::StartUp::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRBridgedDeviceBasicInformationClusterStartUpEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; - value.softwareVersion = memberValue; - } while (0); + } - return value; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBridgedDeviceBasicInformationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BridgedDeviceBasicInformation; + switch (aEventId) { + case Events::StartUp::Id: { + Events::StartUp::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ShutDown::Id: { - Events::ShutDown::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + __auto_type * value = [MTRBridgedDeviceBasicInformationClusterStartUpEvent new]; - __auto_type * value = [MTRBridgedDeviceBasicInformationClusterShutDownEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedInt:cppValue.softwareVersion]; + value.softwareVersion = memberValue; + } while (0); - return value; + return value; + } + case Events::ShutDown::Id: { + Events::ShutDown::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::Leave::Id: { - Events::Leave::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRBridgedDeviceBasicInformationClusterLeaveEvent new]; + __auto_type * value = [MTRBridgedDeviceBasicInformationClusterShutDownEvent new]; - return value; + return value; + } + case Events::Leave::Id: { + Events::Leave::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ReachableChanged::Id: { - Events::ReachableChanged::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + __auto_type * value = [MTRBridgedDeviceBasicInformationClusterLeaveEvent new]; - __auto_type * value = [MTRBridgedDeviceBasicInformationClusterReachableChangedEvent new]; + return value; + } + case Events::ReachableChanged::Id: { + Events::ReachableChanged::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; - value.reachableNewValue = memberValue; - } while (0); + __auto_type * value = [MTRBridgedDeviceBasicInformationClusterReachableChangedEvent new]; - return value; - } + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.reachableNewValue]; + value.reachableNewValue = memberValue; + } while (0); - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + return value; + } + default: { break; } - case Clusters::Switch::Id: { - using namespace Clusters::Switch; - switch (aPath.mEventId) { - - case Events::SwitchLatched::Id: { - Events::SwitchLatched::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterSwitchLatchedEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; - value.newPosition = memberValue; - } while (0); + } - return value; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForSwitchCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Switch; + switch (aEventId) { + case Events::SwitchLatched::Id: { + Events::SwitchLatched::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::InitialPress::Id: { - Events::InitialPress::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterInitialPressEvent new]; + __auto_type * value = [MTRSwitchClusterSwitchLatchedEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; - value.newPosition = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); - return value; + return value; + } + case Events::InitialPress::Id: { + Events::InitialPress::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::LongPress::Id: { - Events::LongPress::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterLongPressEvent new]; + __auto_type * value = [MTRSwitchClusterInitialPressEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; - value.newPosition = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); - return value; + return value; + } + case Events::LongPress::Id: { + Events::LongPress::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ShortRelease::Id: { - Events::ShortRelease::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterShortReleaseEvent new]; + __auto_type * value = [MTRSwitchClusterLongPressEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; - value.previousPosition = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); - return value; + return value; + } + case Events::ShortRelease::Id: { + Events::ShortRelease::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::LongRelease::Id: { - Events::LongRelease::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterLongReleaseEvent new]; + __auto_type * value = [MTRSwitchClusterShortReleaseEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; - value.previousPosition = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); - return value; + return value; + } + case Events::LongRelease::Id: { + Events::LongRelease::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::MultiPressOngoing::Id: { - Events::MultiPressOngoing::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterMultiPressOngoingEvent new]; + __auto_type * value = [MTRSwitchClusterLongReleaseEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; - value.newPosition = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.currentNumberOfPressesCounted]; - value.currentNumberOfPressesCounted = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); - return value; + return value; + } + case Events::MultiPressOngoing::Id: { + Events::MultiPressOngoing::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::MultiPressComplete::Id: { - Events::MultiPressComplete::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRSwitchClusterMultiPressCompleteEvent new]; + __auto_type * value = [MTRSwitchClusterMultiPressOngoingEvent new]; - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; - value.previousPosition = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.totalNumberOfPressesCounted]; - value.totalNumberOfPressesCounted = memberValue; - } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.newPosition]; + value.newPosition = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.currentNumberOfPressesCounted]; + value.currentNumberOfPressesCounted = memberValue; + } while (0); - return value; + return value; + } + case Events::MultiPressComplete::Id: { + Events::MultiPressComplete::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + __auto_type * value = [MTRSwitchClusterMultiPressCompleteEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.previousPosition]; + value.previousPosition = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.totalNumberOfPressesCounted]; + value.totalNumberOfPressesCounted = memberValue; + } while (0); + + return value; + } + default: { break; } - case Clusters::AdministratorCommissioning::Id: { - using namespace Clusters::AdministratorCommissioning; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForAdministratorCommissioningCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AdministratorCommissioning; + switch (aEventId) { + default: { break; } - case Clusters::OperationalCredentials::Id: { - using namespace Clusters::OperationalCredentials; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForOperationalCredentialsCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OperationalCredentials; + switch (aEventId) { + default: { break; } - case Clusters::GroupKeyManagement::Id: { - using namespace Clusters::GroupKeyManagement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForGroupKeyManagementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::GroupKeyManagement; + switch (aEventId) { + default: { break; } - case Clusters::FixedLabel::Id: { - using namespace Clusters::FixedLabel; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForFixedLabelCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::FixedLabel; + switch (aEventId) { + default: { break; } - case Clusters::UserLabel::Id: { - using namespace Clusters::UserLabel; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForUserLabelCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::UserLabel; + switch (aEventId) { + default: { break; } - case Clusters::BooleanState::Id: { - using namespace Clusters::BooleanState; - switch (aPath.mEventId) { - - case Events::StateChange::Id: { - Events::StateChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + } - __auto_type * value = [MTRBooleanStateClusterStateChangeEvent new]; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBooleanStateCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BooleanState; + switch (aEventId) { + case Events::StateChange::Id: { + Events::StateChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithBool:cppValue.stateValue]; - value.stateValue = memberValue; - } while (0); + __auto_type * value = [MTRBooleanStateClusterStateChangeEvent new]; - return value; - } + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.stateValue]; + value.stateValue = memberValue; + } while (0); - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + return value; + } + default: { break; } - case Clusters::ModeSelect::Id: { - using namespace Clusters::ModeSelect; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForModeSelectCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ModeSelect; + switch (aEventId) { + default: { break; } - case Clusters::DoorLock::Id: { - using namespace Clusters::DoorLock; - switch (aPath.mEventId) { - - case Events::DoorLockAlarm::Id: { - Events::DoorLockAlarm::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRDoorLockClusterDoorLockAlarmEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmCode)]; - value.alarmCode = memberValue; - } while (0); - - return value; - } + } - case Events::DoorStateChange::Id: { - Events::DoorStateChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForDoorLockCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::DoorLock; + switch (aEventId) { + case Events::DoorLockAlarm::Id: { + Events::DoorLockAlarm::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRDoorLockClusterDoorLockAlarmEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.alarmCode)]; + value.alarmCode = memberValue; + } while (0); + + return value; + } + case Events::DoorStateChange::Id: { + Events::DoorStateChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRDoorLockClusterDoorStateChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.doorState)]; + value.doorState = memberValue; + } while (0); + + return value; + } + case Events::LockOperation::Id: { + Events::LockOperation::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRDoorLockClusterLockOperationEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; + value.lockOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; } - - __auto_type * value = [MTRDoorLockClusterDoorStateChangeEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.doorState)]; - value.doorState = memberValue; - } while (0); - - return value; - } - - case Events::LockOperation::Id: { - Events::LockOperation::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; } - - __auto_type * value = [MTRDoorLockClusterLockOperationEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; - value.lockOperationType = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; - value.operationSource = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.userIndex.IsNull()) { + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSArray * _Nullable memberValue; + if (cppValue.credentials.HasValue()) { + if (cppValue.credentials.Value().IsNull()) { memberValue = nil; } else { - memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.credentials.Value().Value().begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRDoorLockClusterCredentialStruct * newElement_2; + newElement_2 = [MTRDoorLockClusterCredentialStruct new]; + newElement_2.credentialType = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; + newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; + [array_2 addObject:newElement_2]; + } + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_2; + } } - value.userIndex = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.fabricIndex.IsNull()) { + } else { + memberValue = nil; + } + value.credentials = memberValue; + } while (0); + + return value; + } + case Events::LockOperationError::Id: { + Events::LockOperationError::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRDoorLockClusterLockOperationErrorEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; + value.lockOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationError)]; + value.operationError = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSArray * _Nullable memberValue; + if (cppValue.credentials.HasValue()) { + if (cppValue.credentials.Value().IsNull()) { memberValue = nil; } else { - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; - } - value.fabricIndex = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.sourceNode.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; - } - value.sourceNode = memberValue; - } while (0); - do { - NSArray * _Nullable memberValue; - if (cppValue.credentials.HasValue()) { - if (cppValue.credentials.Value().IsNull()) { - memberValue = nil; - } else { - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = cppValue.credentials.Value().Value().begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTRDoorLockClusterCredentialStruct * newElement_2; - newElement_2 = [MTRDoorLockClusterCredentialStruct new]; - newElement_2.credentialType = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; - newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_2; + { // Scope for our temporary variables + auto * array_2 = [NSMutableArray new]; + auto iter_2 = cppValue.credentials.Value().Value().begin(); + while (iter_2.Next()) { + auto & entry_2 = iter_2.GetValue(); + MTRDoorLockClusterCredentialStruct * newElement_2; + newElement_2 = [MTRDoorLockClusterCredentialStruct new]; + newElement_2.credentialType = + [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; + newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; + [array_2 addObject:newElement_2]; } - } - } else { - memberValue = nil; - } - value.credentials = memberValue; - } while (0); - - return value; - } - - case Events::LockOperationError::Id: { - Events::LockOperationError::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRDoorLockClusterLockOperationErrorEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockOperationType)]; - value.lockOperationType = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; - value.operationSource = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationError)]; - value.operationError = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.userIndex.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; - } - value.userIndex = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.fabricIndex.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; - } - value.fabricIndex = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.sourceNode.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; - } - value.sourceNode = memberValue; - } while (0); - do { - NSArray * _Nullable memberValue; - if (cppValue.credentials.HasValue()) { - if (cppValue.credentials.Value().IsNull()) { - memberValue = nil; - } else { - { // Scope for our temporary variables - auto * array_2 = [NSMutableArray new]; - auto iter_2 = cppValue.credentials.Value().Value().begin(); - while (iter_2.Next()) { - auto & entry_2 = iter_2.GetValue(); - MTRDoorLockClusterCredentialStruct * newElement_2; - newElement_2 = [MTRDoorLockClusterCredentialStruct new]; - newElement_2.credentialType = - [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_2.credentialType)]; - newElement_2.credentialIndex = [NSNumber numberWithUnsignedShort:entry_2.credentialIndex]; - [array_2 addObject:newElement_2]; - } - CHIP_ERROR err = iter_2.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_2; + CHIP_ERROR err = iter_2.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } + memberValue = array_2; } - } else { - memberValue = nil; } - value.credentials = memberValue; - } while (0); - - return value; - } - - case Events::LockUserChange::Id: { - Events::LockUserChange::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; + } else { + memberValue = nil; } + value.credentials = memberValue; + } while (0); + + return value; + } + case Events::LockUserChange::Id: { + Events::LockUserChange::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRDoorLockClusterLockUserChangeEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockDataType)]; + value.lockDataType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.dataOperationType)]; + value.dataOperationType = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; + value.operationSource = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.userIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; + } + value.userIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.fabricIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; + } + value.fabricIndex = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.sourceNode.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; + } + value.sourceNode = memberValue; + } while (0); + do { + NSNumber * _Nullable memberValue; + if (cppValue.dataIndex.IsNull()) { + memberValue = nil; + } else { + memberValue = [NSNumber numberWithUnsignedShort:cppValue.dataIndex.Value()]; + } + value.dataIndex = memberValue; + } while (0); - __auto_type * value = [MTRDoorLockClusterLockUserChangeEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.lockDataType)]; - value.lockDataType = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.dataOperationType)]; - value.dataOperationType = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.operationSource)]; - value.operationSource = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.userIndex.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedShort:cppValue.userIndex.Value()]; - } - value.userIndex = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.fabricIndex.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex.Value()]; - } - value.fabricIndex = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.sourceNode.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedLongLong:cppValue.sourceNode.Value()]; - } - value.sourceNode = memberValue; - } while (0); - do { - NSNumber * _Nullable memberValue; - if (cppValue.dataIndex.IsNull()) { - memberValue = nil; - } else { - memberValue = [NSNumber numberWithUnsignedShort:cppValue.dataIndex.Value()]; - } - value.dataIndex = memberValue; - } while (0); - - return value; - } - - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + return value; + } + default: { break; } - case Clusters::WindowCovering::Id: { - using namespace Clusters::WindowCovering; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForWindowCoveringCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WindowCovering; + switch (aEventId) { + default: { break; } - case Clusters::BarrierControl::Id: { - using namespace Clusters::BarrierControl; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBarrierControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BarrierControl; + switch (aEventId) { + default: { break; } - case Clusters::PumpConfigurationAndControl::Id: { - using namespace Clusters::PumpConfigurationAndControl; - switch (aPath.mEventId) { - - case Events::SupplyVoltageLow::Id: { - Events::SupplyVoltageLow::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterSupplyVoltageLowEvent new]; + } - return value; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForPumpConfigurationAndControlCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PumpConfigurationAndControl; + switch (aEventId) { + case Events::SupplyVoltageLow::Id: { + Events::SupplyVoltageLow::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::SupplyVoltageHigh::Id: { - Events::SupplyVoltageHigh::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + __auto_type * value = [MTRPumpConfigurationAndControlClusterSupplyVoltageLowEvent new]; - __auto_type * value = [MTRPumpConfigurationAndControlClusterSupplyVoltageHighEvent new]; - - return value; + return value; + } + case Events::SupplyVoltageHigh::Id: { + Events::SupplyVoltageHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::PowerMissingPhase::Id: { - Events::PowerMissingPhase::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterPowerMissingPhaseEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterSupplyVoltageHighEvent new]; - return value; + return value; + } + case Events::PowerMissingPhase::Id: { + Events::PowerMissingPhase::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::SystemPressureLow::Id: { - Events::SystemPressureLow::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterSystemPressureLowEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterPowerMissingPhaseEvent new]; - return value; + return value; + } + case Events::SystemPressureLow::Id: { + Events::SystemPressureLow::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::SystemPressureHigh::Id: { - Events::SystemPressureHigh::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterSystemPressureHighEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterSystemPressureLowEvent new]; - return value; + return value; + } + case Events::SystemPressureHigh::Id: { + Events::SystemPressureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::DryRunning::Id: { - Events::DryRunning::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterDryRunningEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterSystemPressureHighEvent new]; - return value; + return value; + } + case Events::DryRunning::Id: { + Events::DryRunning::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::MotorTemperatureHigh::Id: { - Events::MotorTemperatureHigh::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterMotorTemperatureHighEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterDryRunningEvent new]; - return value; + return value; + } + case Events::MotorTemperatureHigh::Id: { + Events::MotorTemperatureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::PumpMotorFatalFailure::Id: { - Events::PumpMotorFatalFailure::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterMotorTemperatureHighEvent new]; - return value; + return value; + } + case Events::PumpMotorFatalFailure::Id: { + Events::PumpMotorFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ElectronicTemperatureHigh::Id: { - Events::ElectronicTemperatureHigh::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + __auto_type * value = [MTRPumpConfigurationAndControlClusterPumpMotorFatalFailureEvent new]; - __auto_type * value = [MTRPumpConfigurationAndControlClusterElectronicTemperatureHighEvent new]; - - return value; + return value; + } + case Events::ElectronicTemperatureHigh::Id: { + Events::ElectronicTemperatureHigh::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::PumpBlocked::Id: { - Events::PumpBlocked::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterPumpBlockedEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterElectronicTemperatureHighEvent new]; - return value; + return value; + } + case Events::PumpBlocked::Id: { + Events::PumpBlocked::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::SensorFailure::Id: { - Events::SensorFailure::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterSensorFailureEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterPumpBlockedEvent new]; - return value; + return value; + } + case Events::SensorFailure::Id: { + Events::SensorFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ElectronicNonFatalFailure::Id: { - Events::ElectronicNonFatalFailure::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterSensorFailureEvent new]; - return value; + return value; + } + case Events::ElectronicNonFatalFailure::Id: { + Events::ElectronicNonFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::ElectronicFatalFailure::Id: { - Events::ElectronicFatalFailure::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterElectronicFatalFailureEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterElectronicNonFatalFailureEvent new]; - return value; + return value; + } + case Events::ElectronicFatalFailure::Id: { + Events::ElectronicFatalFailure::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::GeneralFault::Id: { - Events::GeneralFault::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterGeneralFaultEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterElectronicFatalFailureEvent new]; - return value; + return value; + } + case Events::GeneralFault::Id: { + Events::GeneralFault::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::Leakage::Id: { - Events::Leakage::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterLeakageEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterGeneralFaultEvent new]; - return value; + return value; + } + case Events::Leakage::Id: { + Events::Leakage::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::AirDetection::Id: { - Events::AirDetection::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterAirDetectionEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterLeakageEvent new]; - return value; + return value; + } + case Events::AirDetection::Id: { + Events::AirDetection::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::TurbineOperation::Id: { - Events::TurbineOperation::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } - - __auto_type * value = [MTRPumpConfigurationAndControlClusterTurbineOperationEvent new]; + __auto_type * value = [MTRPumpConfigurationAndControlClusterAirDetectionEvent new]; - return value; + return value; + } + case Events::TurbineOperation::Id: { + Events::TurbineOperation::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + __auto_type * value = [MTRPumpConfigurationAndControlClusterTurbineOperationEvent new]; + + return value; + } + default: { break; } - case Clusters::Thermostat::Id: { - using namespace Clusters::Thermostat; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForThermostatCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Thermostat; + switch (aEventId) { + default: { break; } - case Clusters::FanControl::Id: { - using namespace Clusters::FanControl; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForFanControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::FanControl; + switch (aEventId) { + default: { break; } - case Clusters::ThermostatUserInterfaceConfiguration::Id: { - using namespace Clusters::ThermostatUserInterfaceConfiguration; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForThermostatUserInterfaceConfigurationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ThermostatUserInterfaceConfiguration; + switch (aEventId) { + default: { break; } - case Clusters::ColorControl::Id: { - using namespace Clusters::ColorControl; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForColorControlCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ColorControl; + switch (aEventId) { + default: { break; } - case Clusters::BallastConfiguration::Id: { - using namespace Clusters::BallastConfiguration; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForBallastConfigurationCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::BallastConfiguration; + switch (aEventId) { + default: { break; } - case Clusters::IlluminanceMeasurement::Id: { - using namespace Clusters::IlluminanceMeasurement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForIlluminanceMeasurementCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::IlluminanceMeasurement; + switch (aEventId) { + default: { break; } - case Clusters::TemperatureMeasurement::Id: { - using namespace Clusters::TemperatureMeasurement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForTemperatureMeasurementCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::TemperatureMeasurement; + switch (aEventId) { + default: { break; } - case Clusters::PressureMeasurement::Id: { - using namespace Clusters::PressureMeasurement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForPressureMeasurementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::PressureMeasurement; + switch (aEventId) { + default: { break; } - case Clusters::FlowMeasurement::Id: { - using namespace Clusters::FlowMeasurement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForFlowMeasurementCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::FlowMeasurement; + switch (aEventId) { + default: { break; } - case Clusters::RelativeHumidityMeasurement::Id: { - using namespace Clusters::RelativeHumidityMeasurement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForRelativeHumidityMeasurementCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::RelativeHumidityMeasurement; + switch (aEventId) { + default: { break; } - case Clusters::OccupancySensing::Id: { - using namespace Clusters::OccupancySensing; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForOccupancySensingCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::OccupancySensing; + switch (aEventId) { + default: { break; } - case Clusters::WakeOnLan::Id: { - using namespace Clusters::WakeOnLan; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForWakeOnLANCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::WakeOnLan; + switch (aEventId) { + default: { break; } - case Clusters::Channel::Id: { - using namespace Clusters::Channel; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForChannelCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::Channel; + switch (aEventId) { + default: { break; } - case Clusters::TargetNavigator::Id: { - using namespace Clusters::TargetNavigator; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForTargetNavigatorCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::TargetNavigator; + switch (aEventId) { + default: { break; } - case Clusters::MediaPlayback::Id: { - using namespace Clusters::MediaPlayback; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForMediaPlaybackCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::MediaPlayback; + switch (aEventId) { + default: { break; } - case Clusters::MediaInput::Id: { - using namespace Clusters::MediaInput; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForMediaInputCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::MediaInput; + switch (aEventId) { + default: { break; } - case Clusters::LowPower::Id: { - using namespace Clusters::LowPower; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForLowPowerCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::LowPower; + switch (aEventId) { + default: { break; } - case Clusters::KeypadInput::Id: { - using namespace Clusters::KeypadInput; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForKeypadInputCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::KeypadInput; + switch (aEventId) { + default: { break; } - case Clusters::ContentLauncher::Id: { - using namespace Clusters::ContentLauncher; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForContentLauncherCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ContentLauncher; + switch (aEventId) { + default: { break; } - case Clusters::AudioOutput::Id: { - using namespace Clusters::AudioOutput; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForAudioOutputCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AudioOutput; + switch (aEventId) { + default: { break; } - case Clusters::ApplicationLauncher::Id: { - using namespace Clusters::ApplicationLauncher; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForApplicationLauncherCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ApplicationLauncher; + switch (aEventId) { + default: { break; } - case Clusters::ApplicationBasic::Id: { - using namespace Clusters::ApplicationBasic; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForApplicationBasicCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ApplicationBasic; + switch (aEventId) { + default: { break; } - case Clusters::AccountLogin::Id: { - using namespace Clusters::AccountLogin; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForAccountLoginCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::AccountLogin; + switch (aEventId) { + default: { break; } - case Clusters::ElectricalMeasurement::Id: { - using namespace Clusters::ElectricalMeasurement; - switch (aPath.mEventId) { + } - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForElectricalMeasurementCluster( + EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::ElectricalMeasurement; + switch (aEventId) { + default: { break; } - case Clusters::UnitTesting::Id: { - using namespace Clusters::UnitTesting; - switch (aPath.mEventId) { - - case Events::TestEvent::Id: { - Events::TestEvent::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + } - __auto_type * value = [MTRUnitTestingClusterTestEventEvent new]; - - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.arg1]; - value.arg1 = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg2)]; - value.arg2 = memberValue; - } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithBool:cppValue.arg3]; - value.arg3 = memberValue; - } while (0); - do { - MTRUnitTestingClusterSimpleStruct * _Nonnull memberValue; - memberValue = [MTRUnitTestingClusterSimpleStruct new]; - memberValue.a = [NSNumber numberWithUnsignedChar:cppValue.arg4.a]; - memberValue.b = [NSNumber numberWithBool:cppValue.arg4.b]; - memberValue.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg4.c)]; - memberValue.d = [NSData dataWithBytes:cppValue.arg4.d.data() length:cppValue.arg4.d.size()]; - memberValue.e = [[NSString alloc] initWithBytes:cppValue.arg4.e.data() - length:cppValue.arg4.e.size() - encoding:NSUTF8StringEncoding]; - memberValue.f = [NSNumber numberWithUnsignedChar:cppValue.arg4.f.Raw()]; - memberValue.g = [NSNumber numberWithFloat:cppValue.arg4.g]; - memberValue.h = [NSNumber numberWithDouble:cppValue.arg4.h]; - value.arg4 = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.arg5.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - MTRUnitTestingClusterSimpleStruct * newElement_0; - newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; - newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; - newElement_0.b = [NSNumber numberWithBool:entry_0.b]; - newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; - newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; - newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() - length:entry_0.e.size() - encoding:NSUTF8StringEncoding]; - newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; - newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; - newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} +static id _Nullable DecodeEventPayloadForUnitTestingCluster(EventId aEventId, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + using namespace Clusters::UnitTesting; + switch (aEventId) { + case Events::TestEvent::Id: { + Events::TestEvent::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; + } + + __auto_type * value = [MTRUnitTestingClusterTestEventEvent new]; + + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.arg1]; + value.arg1 = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg2)]; + value.arg2 = memberValue; + } while (0); + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithBool:cppValue.arg3]; + value.arg3 = memberValue; + } while (0); + do { + MTRUnitTestingClusterSimpleStruct * _Nonnull memberValue; + memberValue = [MTRUnitTestingClusterSimpleStruct new]; + memberValue.a = [NSNumber numberWithUnsignedChar:cppValue.arg4.a]; + memberValue.b = [NSNumber numberWithBool:cppValue.arg4.b]; + memberValue.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(cppValue.arg4.c)]; + memberValue.d = [NSData dataWithBytes:cppValue.arg4.d.data() length:cppValue.arg4.d.size()]; + memberValue.e = [[NSString alloc] initWithBytes:cppValue.arg4.e.data() + length:cppValue.arg4.e.size() + encoding:NSUTF8StringEncoding]; + memberValue.f = [NSNumber numberWithUnsignedChar:cppValue.arg4.f.Raw()]; + memberValue.g = [NSNumber numberWithFloat:cppValue.arg4.g]; + memberValue.h = [NSNumber numberWithDouble:cppValue.arg4.h]; + value.arg4 = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.arg5.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + MTRUnitTestingClusterSimpleStruct * newElement_0; + newElement_0 = [MTRUnitTestingClusterSimpleStruct new]; + newElement_0.a = [NSNumber numberWithUnsignedChar:entry_0.a]; + newElement_0.b = [NSNumber numberWithBool:entry_0.b]; + newElement_0.c = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0.c)]; + newElement_0.d = [NSData dataWithBytes:entry_0.d.data() length:entry_0.d.size()]; + newElement_0.e = [[NSString alloc] initWithBytes:entry_0.e.data() + length:entry_0.e.size() + encoding:NSUTF8StringEncoding]; + newElement_0.f = [NSNumber numberWithUnsignedChar:entry_0.f.Raw()]; + newElement_0.g = [NSNumber numberWithFloat:entry_0.g]; + newElement_0.h = [NSNumber numberWithDouble:entry_0.h]; + [array_0 addObject:newElement_0]; } - value.arg5 = memberValue; - } while (0); - do { - NSArray * _Nonnull memberValue; - { // Scope for our temporary variables - auto * array_0 = [NSMutableArray new]; - auto iter_0 = cppValue.arg6.begin(); - while (iter_0.Next()) { - auto & entry_0 = iter_0.GetValue(); - NSNumber * newElement_0; - newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; - [array_0 addObject:newElement_0]; - } - CHIP_ERROR err = iter_0.GetStatus(); - if (err != CHIP_NO_ERROR) { - *aError = err; - return nil; - } - memberValue = array_0; + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; } - value.arg6 = memberValue; - } while (0); + memberValue = array_0; + } + value.arg5 = memberValue; + } while (0); + do { + NSArray * _Nonnull memberValue; + { // Scope for our temporary variables + auto * array_0 = [NSMutableArray new]; + auto iter_0 = cppValue.arg6.begin(); + while (iter_0.Next()) { + auto & entry_0 = iter_0.GetValue(); + NSNumber * newElement_0; + newElement_0 = [NSNumber numberWithUnsignedChar:chip::to_underlying(entry_0)]; + [array_0 addObject:newElement_0]; + } + CHIP_ERROR err = iter_0.GetStatus(); + if (err != CHIP_NO_ERROR) { + *aError = err; + return nil; + } + memberValue = array_0; + } + value.arg6 = memberValue; + } while (0); - return value; + return value; + } + case Events::TestFabricScopedEvent::Id: { + Events::TestFabricScopedEvent::DecodableType cppValue; + *aError = DataModel::Decode(aReader, cppValue); + if (*aError != CHIP_NO_ERROR) { + return nil; } - case Events::TestFabricScopedEvent::Id: { - Events::TestFabricScopedEvent::DecodableType cppValue; - *aError = DataModel::Decode(aReader, cppValue); - if (*aError != CHIP_NO_ERROR) { - return nil; - } + __auto_type * value = [MTRUnitTestingClusterTestFabricScopedEventEvent new]; - __auto_type * value = [MTRUnitTestingClusterTestFabricScopedEventEvent new]; + do { + NSNumber * _Nonnull memberValue; + memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; + value.fabricIndex = memberValue; + } while (0); - do { - NSNumber * _Nonnull memberValue; - memberValue = [NSNumber numberWithUnsignedChar:cppValue.fabricIndex]; - value.fabricIndex = memberValue; - } while (0); + return value; + } + default: { + break; + } + } - return value; - } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; + return nil; +} - default: - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; - break; - } - break; +id _Nullable MTRDecodeEventPayload(const ConcreteEventPath & aPath, TLV::TLVReader & aReader, CHIP_ERROR * aError) +{ + switch (aPath.mClusterId) { + case Clusters::Identify::Id: { + return DecodeEventPayloadForIdentifyCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Groups::Id: { + return DecodeEventPayloadForGroupsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Scenes::Id: { + return DecodeEventPayloadForScenesCluster(aPath.mEventId, aReader, aError); + } + case Clusters::OnOff::Id: { + return DecodeEventPayloadForOnOffCluster(aPath.mEventId, aReader, aError); + } + case Clusters::OnOffSwitchConfiguration::Id: { + return DecodeEventPayloadForOnOffSwitchConfigurationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::LevelControl::Id: { + return DecodeEventPayloadForLevelControlCluster(aPath.mEventId, aReader, aError); + } + case Clusters::BinaryInputBasic::Id: { + return DecodeEventPayloadForBinaryInputBasicCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Descriptor::Id: { + return DecodeEventPayloadForDescriptorCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Binding::Id: { + return DecodeEventPayloadForBindingCluster(aPath.mEventId, aReader, aError); + } + case Clusters::AccessControl::Id: { + return DecodeEventPayloadForAccessControlCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Actions::Id: { + return DecodeEventPayloadForActionsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::BasicInformation::Id: { + return DecodeEventPayloadForBasicInformationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::OtaSoftwareUpdateProvider::Id: { + return DecodeEventPayloadForOTASoftwareUpdateProviderCluster(aPath.mEventId, aReader, aError); + } + case Clusters::OtaSoftwareUpdateRequestor::Id: { + return DecodeEventPayloadForOTASoftwareUpdateRequestorCluster(aPath.mEventId, aReader, aError); + } + case Clusters::LocalizationConfiguration::Id: { + return DecodeEventPayloadForLocalizationConfigurationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::TimeFormatLocalization::Id: { + return DecodeEventPayloadForTimeFormatLocalizationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::UnitLocalization::Id: { + return DecodeEventPayloadForUnitLocalizationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::PowerSourceConfiguration::Id: { + return DecodeEventPayloadForPowerSourceConfigurationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::PowerSource::Id: { + return DecodeEventPayloadForPowerSourceCluster(aPath.mEventId, aReader, aError); + } + case Clusters::GeneralCommissioning::Id: { + return DecodeEventPayloadForGeneralCommissioningCluster(aPath.mEventId, aReader, aError); + } + case Clusters::NetworkCommissioning::Id: { + return DecodeEventPayloadForNetworkCommissioningCluster(aPath.mEventId, aReader, aError); + } + case Clusters::DiagnosticLogs::Id: { + return DecodeEventPayloadForDiagnosticLogsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::GeneralDiagnostics::Id: { + return DecodeEventPayloadForGeneralDiagnosticsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::SoftwareDiagnostics::Id: { + return DecodeEventPayloadForSoftwareDiagnosticsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ThreadNetworkDiagnostics::Id: { + return DecodeEventPayloadForThreadNetworkDiagnosticsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::WiFiNetworkDiagnostics::Id: { + return DecodeEventPayloadForWiFiNetworkDiagnosticsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::EthernetNetworkDiagnostics::Id: { + return DecodeEventPayloadForEthernetNetworkDiagnosticsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::BridgedDeviceBasicInformation::Id: { + return DecodeEventPayloadForBridgedDeviceBasicInformationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Switch::Id: { + return DecodeEventPayloadForSwitchCluster(aPath.mEventId, aReader, aError); + } + case Clusters::AdministratorCommissioning::Id: { + return DecodeEventPayloadForAdministratorCommissioningCluster(aPath.mEventId, aReader, aError); + } + case Clusters::OperationalCredentials::Id: { + return DecodeEventPayloadForOperationalCredentialsCluster(aPath.mEventId, aReader, aError); + } + case Clusters::GroupKeyManagement::Id: { + return DecodeEventPayloadForGroupKeyManagementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::FixedLabel::Id: { + return DecodeEventPayloadForFixedLabelCluster(aPath.mEventId, aReader, aError); + } + case Clusters::UserLabel::Id: { + return DecodeEventPayloadForUserLabelCluster(aPath.mEventId, aReader, aError); + } + case Clusters::BooleanState::Id: { + return DecodeEventPayloadForBooleanStateCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ModeSelect::Id: { + return DecodeEventPayloadForModeSelectCluster(aPath.mEventId, aReader, aError); + } + case Clusters::DoorLock::Id: { + return DecodeEventPayloadForDoorLockCluster(aPath.mEventId, aReader, aError); + } + case Clusters::WindowCovering::Id: { + return DecodeEventPayloadForWindowCoveringCluster(aPath.mEventId, aReader, aError); + } + case Clusters::BarrierControl::Id: { + return DecodeEventPayloadForBarrierControlCluster(aPath.mEventId, aReader, aError); + } + case Clusters::PumpConfigurationAndControl::Id: { + return DecodeEventPayloadForPumpConfigurationAndControlCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Thermostat::Id: { + return DecodeEventPayloadForThermostatCluster(aPath.mEventId, aReader, aError); + } + case Clusters::FanControl::Id: { + return DecodeEventPayloadForFanControlCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ThermostatUserInterfaceConfiguration::Id: { + return DecodeEventPayloadForThermostatUserInterfaceConfigurationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ColorControl::Id: { + return DecodeEventPayloadForColorControlCluster(aPath.mEventId, aReader, aError); + } + case Clusters::BallastConfiguration::Id: { + return DecodeEventPayloadForBallastConfigurationCluster(aPath.mEventId, aReader, aError); + } + case Clusters::IlluminanceMeasurement::Id: { + return DecodeEventPayloadForIlluminanceMeasurementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::TemperatureMeasurement::Id: { + return DecodeEventPayloadForTemperatureMeasurementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::PressureMeasurement::Id: { + return DecodeEventPayloadForPressureMeasurementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::FlowMeasurement::Id: { + return DecodeEventPayloadForFlowMeasurementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::RelativeHumidityMeasurement::Id: { + return DecodeEventPayloadForRelativeHumidityMeasurementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::OccupancySensing::Id: { + return DecodeEventPayloadForOccupancySensingCluster(aPath.mEventId, aReader, aError); + } + case Clusters::WakeOnLan::Id: { + return DecodeEventPayloadForWakeOnLANCluster(aPath.mEventId, aReader, aError); + } + case Clusters::Channel::Id: { + return DecodeEventPayloadForChannelCluster(aPath.mEventId, aReader, aError); + } + case Clusters::TargetNavigator::Id: { + return DecodeEventPayloadForTargetNavigatorCluster(aPath.mEventId, aReader, aError); + } + case Clusters::MediaPlayback::Id: { + return DecodeEventPayloadForMediaPlaybackCluster(aPath.mEventId, aReader, aError); + } + case Clusters::MediaInput::Id: { + return DecodeEventPayloadForMediaInputCluster(aPath.mEventId, aReader, aError); + } + case Clusters::LowPower::Id: { + return DecodeEventPayloadForLowPowerCluster(aPath.mEventId, aReader, aError); + } + case Clusters::KeypadInput::Id: { + return DecodeEventPayloadForKeypadInputCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ContentLauncher::Id: { + return DecodeEventPayloadForContentLauncherCluster(aPath.mEventId, aReader, aError); + } + case Clusters::AudioOutput::Id: { + return DecodeEventPayloadForAudioOutputCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ApplicationLauncher::Id: { + return DecodeEventPayloadForApplicationLauncherCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ApplicationBasic::Id: { + return DecodeEventPayloadForApplicationBasicCluster(aPath.mEventId, aReader, aError); + } + case Clusters::AccountLogin::Id: { + return DecodeEventPayloadForAccountLoginCluster(aPath.mEventId, aReader, aError); + } + case Clusters::ElectricalMeasurement::Id: { + return DecodeEventPayloadForElectricalMeasurementCluster(aPath.mEventId, aReader, aError); + } + case Clusters::UnitTesting::Id: { + return DecodeEventPayloadForUnitTestingCluster(aPath.mEventId, aReader, aError); } default: { - *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; break; } } + *aError = CHIP_ERROR_IM_MALFORMED_EVENT_PATH_IB; return nil; } diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h index f0711c27592b29..77be660c039fb5 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.h @@ -482,7 +482,7 @@ API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)) @interface MTRTimeSynchronizationClusterDSTOffsetStruct : NSObject @property (nonatomic, copy) NSNumber * _Nonnull offset API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); @property (nonatomic, copy) NSNumber * _Nonnull validStarting API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); -@property (nonatomic, copy) NSNumber * _Nonnull validUntil API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); +@property (nonatomic, copy) NSNumber * _Nullable validUntil API_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5)); @end MTR_DEPRECATED("Please use MTRTimeSynchronizationClusterDSTOffsetStruct", ios(16.1, 16.5), macos(13.0, 13.4), watchos(9.1, 9.5), diff --git a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm index d079a7173770b8..bc26064a203a12 100644 --- a/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm +++ b/src/darwin/Framework/CHIP/zap-generated/MTRStructsObjc.mm @@ -1851,7 +1851,7 @@ - (instancetype)init _validStarting = @(0); - _validUntil = @(0); + _validUntil = nil; } return self; } diff --git a/src/darwin/Framework/CHIPTests/MTRCertificateTests.m b/src/darwin/Framework/CHIPTests/MTRCertificateTests.m index 449343066b9d1f..89860b8df2f997 100644 --- a/src/darwin/Framework/CHIPTests/MTRCertificateTests.m +++ b/src/darwin/Framework/CHIPTests/MTRCertificateTests.m @@ -21,11 +21,24 @@ #import "MTRTestKeys.h" -@interface MatterCertificateTests : XCTestCase +@interface MTRCertificateTests : XCTestCase @end -@implementation MatterCertificateTests +@implementation MTRCertificateTests + +/** + * Helper function for creating start dates rounded to the nearest second (and + * which can therefore be represented without data loss in certificates). + */ ++ (NSDate *)startDateWithTimeIntervalSinceNow:(NSTimeInterval)interval +{ + __auto_type * startDate = [NSDate dateWithTimeIntervalSinceNow:interval]; + // Round down to the nearest second, since the certificate bits will do that + // when they compute validity dates. + NSTimeInterval seconds = floor([startDate timeIntervalSinceReferenceDate]); + return [NSDate dateWithTimeIntervalSinceReferenceDate:seconds]; +} - (void)testGenerateRootCert { @@ -45,6 +58,64 @@ - (void)testGenerateRootCert XCTAssertEqualObjects(rootCert, derCert); } +- (void)testGenerateRootCertWithValidityPeriod +{ + __auto_type * testKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(testKeys); + + __auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow:100]; + __auto_type * validityPeriod = [[NSDateInterval alloc] initWithStartDate:startDate duration:200]; + + __auto_type * rootCert = [MTRCertificates createRootCertificate:testKeys + issuerID:nil + fabricID:nil + validityPeriod:validityPeriod + error:nil]; + XCTAssertNotNil(rootCert); + + // Test round-trip through TLV format. + __auto_type * tlvCert = [MTRCertificates convertX509Certificate:rootCert]; + XCTAssertNotNil(tlvCert); + + __auto_type * derCert = [MTRCertificates convertMatterCertificate:tlvCert]; + XCTAssertNotNil(derCert); + + XCTAssertEqualObjects(rootCert, derCert); + + __auto_type * certInfo = [[MTRCertificateInfo alloc] initWithTLVBytes:tlvCert]; + XCTAssertEqualObjects(validityPeriod.startDate, certInfo.notBefore); + XCTAssertEqualObjects(validityPeriod.endDate, certInfo.notAfter); +} + +- (void)testGenerateRootCertWithInfiniteValidity +{ + __auto_type * testKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(testKeys); + + __auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow:100]; + __auto_type * validityPeriod = [[NSDateInterval alloc] initWithStartDate:startDate endDate:[NSDate distantFuture]]; + + __auto_type * rootCert = [MTRCertificates createRootCertificate:testKeys + issuerID:nil + fabricID:nil + validityPeriod:validityPeriod + error:nil]; + XCTAssertNotNil(rootCert); + + // Test round-trip through TLV format. + __auto_type * tlvCert = [MTRCertificates convertX509Certificate:rootCert]; + XCTAssertNotNil(tlvCert); + + __auto_type * derCert = [MTRCertificates convertMatterCertificate:tlvCert]; + XCTAssertNotNil(derCert); + + XCTAssertEqualObjects(rootCert, derCert); + + __auto_type * certInfo = [[MTRCertificateInfo alloc] initWithTLVBytes:tlvCert]; + XCTAssertEqualObjects(validityPeriod.startDate, certInfo.notBefore); + XCTAssertEqualObjects(validityPeriod.endDate, certInfo.notAfter); +} + - (void)testGenerateIntermediateCert { __auto_type * rootKeys = [[MTRTestKeys alloc] init]; @@ -74,6 +145,80 @@ - (void)testGenerateIntermediateCert XCTAssertEqualObjects(intermediateCert, derCert); } +- (void)testGenerateIntermediateCertWithValidityPeriod +{ + __auto_type * rootKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(rootKeys); + + __auto_type * rootCert = [MTRCertificates createRootCertificate:rootKeys issuerID:nil fabricID:nil error:nil]; + XCTAssertNotNil(rootCert); + + __auto_type * intermediateKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(intermediateKeys); + + __auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow:300]; + __auto_type * validityPeriod = [[NSDateInterval alloc] initWithStartDate:startDate duration:400]; + + __auto_type * intermediateCert = [MTRCertificates createIntermediateCertificate:rootKeys + rootCertificate:rootCert + intermediatePublicKey:intermediateKeys.publicKey + issuerID:nil + fabricID:nil + validityPeriod:validityPeriod + error:nil]; + XCTAssertNotNil(intermediateCert); + + // Test round-trip through TLV format. + __auto_type * tlvCert = [MTRCertificates convertX509Certificate:intermediateCert]; + XCTAssertNotNil(tlvCert); + + __auto_type * derCert = [MTRCertificates convertMatterCertificate:tlvCert]; + XCTAssertNotNil(derCert); + + XCTAssertEqualObjects(intermediateCert, derCert); + + __auto_type * certInfo = [[MTRCertificateInfo alloc] initWithTLVBytes:tlvCert]; + XCTAssertEqualObjects(validityPeriod.startDate, certInfo.notBefore); + XCTAssertEqualObjects(validityPeriod.endDate, certInfo.notAfter); +} + +- (void)testGenerateIntermediateCertWithInfiniteValidity +{ + __auto_type * rootKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(rootKeys); + + __auto_type * rootCert = [MTRCertificates createRootCertificate:rootKeys issuerID:nil fabricID:nil error:nil]; + XCTAssertNotNil(rootCert); + + __auto_type * intermediateKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(intermediateKeys); + + __auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow:300]; + __auto_type * validityPeriod = [[NSDateInterval alloc] initWithStartDate:startDate endDate:[NSDate distantFuture]]; + + __auto_type * intermediateCert = [MTRCertificates createIntermediateCertificate:rootKeys + rootCertificate:rootCert + intermediatePublicKey:intermediateKeys.publicKey + issuerID:nil + fabricID:nil + validityPeriod:validityPeriod + error:nil]; + XCTAssertNotNil(intermediateCert); + + // Test round-trip through TLV format. + __auto_type * tlvCert = [MTRCertificates convertX509Certificate:intermediateCert]; + XCTAssertNotNil(tlvCert); + + __auto_type * derCert = [MTRCertificates convertMatterCertificate:tlvCert]; + XCTAssertNotNil(derCert); + + XCTAssertEqualObjects(intermediateCert, derCert); + + __auto_type * certInfo = [[MTRCertificateInfo alloc] initWithTLVBytes:tlvCert]; + XCTAssertEqualObjects(validityPeriod.startDate, certInfo.notBefore); + XCTAssertEqualObjects(validityPeriod.endDate, certInfo.notAfter); +} + - (void)testGenerateOperationalCertNoIntermediate { __auto_type * rootKeys = [[MTRTestKeys alloc] init]; @@ -110,6 +255,94 @@ - (void)testGenerateOperationalCertNoIntermediate XCTAssertEqualObjects(operationalCert, derCert); } +- (void)testGenerateOperationalCertNoIntermediateWithValidityPeriod +{ + __auto_type * rootKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(rootKeys); + + __auto_type * rootCert = [MTRCertificates createRootCertificate:rootKeys issuerID:nil fabricID:nil error:nil]; + XCTAssertNotNil(rootCert); + + __auto_type * operationalKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(operationalKeys); + + __auto_type * cats = [[NSMutableSet alloc] initWithCapacity:3]; + // High bits are identifier, low bits are version. + [cats addObject:@0x00010001]; + [cats addObject:@0x00020001]; + [cats addObject:@0x0003FFFF]; + + __auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow:1000]; + __auto_type * validityPeriod = [[NSDateInterval alloc] initWithStartDate:startDate duration:500]; + + __auto_type * operationalCert = [MTRCertificates createOperationalCertificate:rootKeys + signingCertificate:rootCert + operationalPublicKey:operationalKeys.publicKey + fabricID:@1 + nodeID:@1 + caseAuthenticatedTags:cats + validityPeriod:validityPeriod + error:nil]; + XCTAssertNotNil(operationalCert); + + // Test round-trip through TLV format. + __auto_type * tlvCert = [MTRCertificates convertX509Certificate:operationalCert]; + XCTAssertNotNil(tlvCert); + + __auto_type * derCert = [MTRCertificates convertMatterCertificate:tlvCert]; + XCTAssertNotNil(derCert); + + XCTAssertEqualObjects(operationalCert, derCert); + + __auto_type * certInfo = [[MTRCertificateInfo alloc] initWithTLVBytes:tlvCert]; + XCTAssertEqualObjects(validityPeriod.startDate, certInfo.notBefore); + XCTAssertEqualObjects(validityPeriod.endDate, certInfo.notAfter); +} + +- (void)testGenerateOperationalCertNoIntermediateWithInfiniteValidity +{ + __auto_type * rootKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(rootKeys); + + __auto_type * rootCert = [MTRCertificates createRootCertificate:rootKeys issuerID:nil fabricID:nil error:nil]; + XCTAssertNotNil(rootCert); + + __auto_type * operationalKeys = [[MTRTestKeys alloc] init]; + XCTAssertNotNil(operationalKeys); + + __auto_type * cats = [[NSMutableSet alloc] initWithCapacity:3]; + // High bits are identifier, low bits are version. + [cats addObject:@0x00010001]; + [cats addObject:@0x00020001]; + [cats addObject:@0x0003FFFF]; + + __auto_type * startDate = [MTRCertificateTests startDateWithTimeIntervalSinceNow:1000]; + __auto_type * validityPeriod = [[NSDateInterval alloc] initWithStartDate:startDate endDate:[NSDate distantFuture]]; + + __auto_type * operationalCert = [MTRCertificates createOperationalCertificate:rootKeys + signingCertificate:rootCert + operationalPublicKey:operationalKeys.publicKey + fabricID:@1 + nodeID:@1 + caseAuthenticatedTags:cats + validityPeriod:validityPeriod + error:nil]; + XCTAssertNotNil(operationalCert); + + // Test round-trip through TLV format. + __auto_type * tlvCert = [MTRCertificates convertX509Certificate:operationalCert]; + XCTAssertNotNil(tlvCert); + + __auto_type * derCert = [MTRCertificates convertMatterCertificate:tlvCert]; + XCTAssertNotNil(derCert); + + XCTAssertEqualObjects(operationalCert, derCert); + + __auto_type * certInfo = [[MTRCertificateInfo alloc] initWithTLVBytes:tlvCert]; + XCTAssertEqualObjects(validityPeriod.startDate, certInfo.notBefore); + XCTAssertEqualObjects(validityPeriod.endDate, certInfo.notAfter); +} + - (void)testGenerateOperationalCertWithIntermediate { __auto_type * rootKeys = [[MTRTestKeys alloc] init]; diff --git a/src/darwin/Framework/CHIPTests/MTRDataValueParserTests.m b/src/darwin/Framework/CHIPTests/MTRDataValueParserTests.m new file mode 100644 index 00000000000000..1eee9de6ccaded --- /dev/null +++ b/src/darwin/Framework/CHIPTests/MTRDataValueParserTests.m @@ -0,0 +1,976 @@ +/* + * + * Copyright (c) 2023 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#import + +#import + +@interface MTRDataValueParserTests : XCTestCase +@end + +@implementation MTRDataValueParserTests + +- (void)setUp +{ + // Per-test setup, runs before each test. + [super setUp]; + [self setContinueAfterFailure:NO]; +} + +- (void)test001_UnsignedIntAttribute +{ + // Pressure Measurement, Tolerance + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0403) attributeID:@(3)], + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @(5)); + XCTAssertNil(report.error); +} + +- (void)test002_SignedIntAttribute +{ + // Pressure Measurement, MeasuredValue + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0403) attributeID:@(2)], + MTRDataKey : @ { + MTRTypeKey : MTRSignedIntegerValueType, + MTRValueKey : @(7), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @(7)); + XCTAssertNil(report.error); +} + +- (void)test003_BooleanAttribute +{ + // On/Off, OnOff + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0006) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRBooleanValueType, + MTRValueKey : @(YES), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @(YES)); + XCTAssertNil(report.error); +} + +- (void)test004_StringAttribute +{ + // Basic Information, SerialNumber + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0028) attributeID:@(0xf)], + MTRDataKey : @ { + MTRTypeKey : MTRUTF8StringValueType, + MTRValueKey : @"hello", + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @"hello"); + XCTAssertNil(report.error); +} + +- (void)test005_OctetStringAttribute +{ + // Thread Network Diagnostics, ChannelPage0Mask + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(5) clusterID:@(0x0035) attributeID:@(0x3c)], + MTRDataKey : @ { + MTRTypeKey : MTROctetStringValueType, + MTRValueKey : [@"binary" dataUsingEncoding:NSUTF8StringEncoding], + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, [@"binary" dataUsingEncoding:NSUTF8StringEncoding]); + XCTAssertNil(report.error); +} + +- (void)test006_NullableOctetStringAttribute +{ + // Thread Network Diagnostics, ChannelPage0Mask + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(5) clusterID:@(0x0035) attributeID:@(0x3c)], + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNil(report.value); + XCTAssertNil(report.error); +} + +- (void)test007_FloatAttribute +{ + // Media Playback, PlaybackSpeed + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0x0506) attributeID:@(4)], + MTRDataKey : @ { + MTRTypeKey : MTRFloatValueType, + MTRValueKey : @(1.5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @(1.5)); + XCTAssertNil(report.error); +} + +- (void)test008_DoubleAttribute +{ + // Unit Testing, float_double + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0xFFF1FC05) attributeID:@(0x18)], + MTRDataKey : @ { + MTRTypeKey : MTRDoubleValueType, + MTRValueKey : @(1.5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @(1.5)); + XCTAssertNil(report.error); +} + +- (void)test009_NullableDoubleAttribute +{ + // Unit Testing, nullable_float_double + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0xFFF1FC05) attributeID:@(0x4018)], + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNil(report.value); + XCTAssertNil(report.error); +} + +- (void)test010_StructAttribute +{ + // Basic Information, CapabilityMinima + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0028) attributeID:@(0x0013)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(0), // CaseSessionsPerFabric + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(4), + }, + }, + @{ + MTRContextTagKey : @(1), // SubscriptionsPerFabric + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(3), + }, + }, + ], + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[MTRBasicInformationClusterCapabilityMinimaStruct class]]); + + MTRBasicInformationClusterCapabilityMinimaStruct * data = report.value; + XCTAssertEqualObjects(data.caseSessionsPerFabric, @(4)); + XCTAssertEqualObjects(data.subscriptionsPerFabric, @(3)); + + XCTAssertNil(report.error); +} + +- (void)test011_StructAttributeOtherOrder +{ + // Basic Information, CapabilityMinima + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0028) attributeID:@(0x0013)], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // SubscriptionsPerFabric + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(3), + }, + }, + @{ + MTRContextTagKey : @(0), // CaseSessionsPerFabric + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(4), + }, + }, + ] + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[MTRBasicInformationClusterCapabilityMinimaStruct class]]); + + MTRBasicInformationClusterCapabilityMinimaStruct * data = report.value; + XCTAssertEqualObjects(data.caseSessionsPerFabric, @(4)); + XCTAssertEqualObjects(data.subscriptionsPerFabric, @(3)); + + XCTAssertNil(report.error); +} + +- (void)test012_ListAttribute +{ + // Descriptor, DeviceTypeList + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x001d) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRArrayValueType, + MTRValueKey : @[ + @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(0), // DeviceType + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(100), + }, + }, + @{ + MTRContextTagKey : @(1), // Revision + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(17), + }, + }, + ], + }, + }, + @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // Revision + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(19), + }, + }, + @{ + MTRContextTagKey : @(0), // DeviceType + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(200), + }, + }, + ], + }, + }, + ], + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + + NSArray * array = report.value; + XCTAssertTrue([array[0] isKindOfClass:[MTRDescriptorClusterDeviceTypeStruct class]]); + MTRDescriptorClusterDeviceTypeStruct * deviceType = array[0]; + XCTAssertEqualObjects(deviceType.deviceType, @(100)); + XCTAssertEqualObjects(deviceType.revision, @(17)); + + XCTAssertTrue([array[1] isKindOfClass:[MTRDescriptorClusterDeviceTypeStruct class]]); + deviceType = array[1]; + XCTAssertEqualObjects(deviceType.deviceType, @(200)); + XCTAssertEqualObjects(deviceType.revision, @(19)); + + XCTAssertNil(report.error); +} + +- (void)test013_UnsignedIntAttributeSignMismatch +{ + // Pressure Measurement, Tolerance + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0403) attributeID:@(3)], + MTRDataKey : @ { + MTRTypeKey : MTRSignedIntegerValueType, + MTRValueKey : @(5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test014_SignedIntAttributeSignMismatch +{ + // Pressure Measurement, MeasuredValue + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0403) attributeID:@(2)], + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(7), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test015_UnknownAttribute +{ + // On/Off, nonexistent attribute + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(7) attributeID:@(0x1000)], + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(7), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeUnknownSchema); +} + +- (void)test016_UnknownCluster +{ + // Unknown cluster. + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0xFFF1FFF1) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(7), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeUnknownSchema); +} + +- (void)test017_StringVsOctetStringMismatch +{ + // Basic Information, SerialNumber + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0028) attributeID:@(0xf)], + MTRDataKey : @ { + MTRTypeKey : MTROctetStringValueType, + MTRValueKey : [@"binary" dataUsingEncoding:NSUTF8StringEncoding], + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test018_OctetStringVsStringMismatch +{ + // Thread Network Diagnostics, ChannelPage0Mask + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(5) clusterID:@(0x0035) attributeID:@(0x3c)], + MTRDataKey : @ { + MTRTypeKey : MTRUTF8StringValueType, + MTRValueKey : @"hello", + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test019_DoubleVsFloatMismatch +{ + // Unit Testing, float_double + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0xFFF1FC05) attributeID:@(0x18)], + MTRDataKey : @ { + MTRTypeKey : MTRFloatValueType, + MTRValueKey : @(1.5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + // If float was encoded, decoding as double is allowed. + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertEqualObjects(report.value, @(1.5)); + + XCTAssertNil(report.error); +} + +- (void)test020_FloatVsDoubleMismatch +{ + // Media Playback, PlaybackSpeed + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0x0506) attributeID:@(4)], + MTRDataKey : @ { + MTRTypeKey : MTRDoubleValueType, + MTRValueKey : @(1.5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test021_StringVsNullMismatch +{ + // Basic Information, SerialNumber + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0028) attributeID:@(0xf)], + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test022_OctetStringVsNullMismatch +{ + // Unit Testing, octet_string + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0xFFF1FC05) attributeID:@(0x19)], + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test023_DoubleVsNullMismatch +{ + // Unit Testing, float_double + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(17) clusterID:@(0xFFF1FC05) attributeID:@(0x18)], + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test024_StructFieldIntegerTypeMismatch +{ + // Descriptor, DeviceTypeList + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x001d) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRArrayValueType, + MTRValueKey : @[ + @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(0), // DeviceType + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(100), + }, + }, + @{ + MTRContextTagKey : @(1), // Revision + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(17), + }, + }, + ], + }, + }, + @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // Revision + MTRDataKey : @ { + MTRTypeKey : MTRSignedIntegerValueType, // Wrong type here. + MTRValueKey : @(19), + }, + }, + @{ + MTRContextTagKey : @(0), // DeviceType + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(200), + }, + }, + ], + }, + }, + ], + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test025_EventPayloadWithSystemUptime +{ + // Access Control, AccessControlExtensionChanged + NSDictionary * input = @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(0x001F) eventID:@(1)], + MTREventNumberKey : @(180), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeSystemUpTime), + MTREventSystemUpTimeKey : @(27.5), + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // AdminNodeID + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(177), + }, + }, + @{ + MTRContextTagKey : @(2), // AdminPasscodeID + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }, + @{ + MTRContextTagKey : @(3), // ChangeType + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(MTRAccessControlChangeTypeAdded), + }, + }, + @{ + MTRContextTagKey : @(4), // LatestValue + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // Data + MTRDataKey : @ { + MTRTypeKey : MTROctetStringValueType, + MTRValueKey : [@"extension" dataUsingEncoding:NSUTF8StringEncoding], + }, + }, + ], + }, + }, + ], + }, + }; + + NSError * error; + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertNotNil(report.path); + XCTAssertEqualObjects(report.path.endpoint, @(0)); + XCTAssertEqualObjects(report.path.cluster, @(0x001F)); + XCTAssertEqualObjects(report.path.event, @(1)); + + XCTAssertEqualObjects(report.eventNumber, @(180)); + XCTAssertEqualObjects(report.priority, @(MTREventPriorityInfo)); + XCTAssertEqual(report.eventTimeType, MTREventTimeTypeSystemUpTime); + XCTAssertEqual(report.systemUpTime, 27.5); + + XCTAssertNotNil(report.value); + + XCTAssertTrue([report.value isKindOfClass:[MTRAccessControlClusterAccessControlExtensionChangedEvent class]]); + + MTRAccessControlClusterAccessControlExtensionChangedEvent * payload = report.value; + XCTAssertEqualObjects(payload.adminNodeID, @(177)); + XCTAssertNil(payload.adminPasscodeID); + XCTAssertEqualObjects(payload.changeType, @(MTRAccessControlChangeTypeAdded)); + XCTAssertNotNil(payload.latestValue); + + XCTAssertTrue([payload.latestValue isKindOfClass:[MTRAccessControlClusterAccessControlExtensionStruct class]]); + XCTAssertEqualObjects(payload.latestValue.data, [@"extension" dataUsingEncoding:NSUTF8StringEncoding]); + + XCTAssertNil(report.error); +} + +- (void)test026_EventReportWithTimestampDate +{ + // Basic Information, Shutdown + NSDictionary * input = @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(0x0028) eventID:@(1)], + MTREventNumberKey : @(190), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), + MTREventTimestampDateKey : [NSDate date], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], + }, + }; + + NSError * error; + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertNotNil(report.path); + XCTAssertEqualObjects(report.path.endpoint, @(0)); + XCTAssertEqualObjects(report.path.cluster, @(0x0028)); + XCTAssertEqualObjects(report.path.event, @(1)); + + XCTAssertEqualObjects(report.eventNumber, @(190)); + XCTAssertEqualObjects(report.priority, @(MTREventPriorityInfo)); + XCTAssertEqual(report.eventTimeType, MTREventTimeTypeTimestampDate); + XCTAssertEqualObjects(report.timestampDate, input[MTREventTimestampDateKey]); + + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[MTRBasicInformationClusterShutDownEvent class]]); +} + +- (void)test027_AttributeWithDataAndError +{ + // Pressure Measurement, Tolerance + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x0403) attributeID:@(3)], + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeTimeout userInfo:nil], + // Include data too, which should be ignored. + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(5), + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNil(report.value); + XCTAssertEqualObjects(report.error, input[MTRErrorKey]); +} + +- (void)test028_EventReportWithDataAndError +{ + // Basic Information, Shutdown + NSDictionary * input = @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(0x0028) eventID:@(1)], + MTRErrorKey : [NSError errorWithDomain:MTRErrorDomain code:MTRErrorCodeTimeout userInfo:nil], + + // All the other keys should be ignored + MTREventNumberKey : @(190), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), + MTREventTimestampDateKey : [NSDate date], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], + }, + }; + + NSError * error; + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNotNil(report); + XCTAssertNil(error); + + XCTAssertNotNil(report.path); + XCTAssertEqualObjects(report.path.endpoint, @(0)); + XCTAssertEqualObjects(report.path.cluster, @(0x0028)); + XCTAssertEqualObjects(report.path.event, @(1)); + + XCTAssertEqualObjects(report.eventNumber, @(0)); + XCTAssertEqualObjects(report.priority, @(0)); + XCTAssertNil(report.value); + XCTAssertEqualObjects(report.error, input[MTRErrorKey]); +} + +- (void)test029_EventPayloadFailingSchemaCheck +{ + // Access Control, AccessControlExtensionChanged + NSDictionary * input = @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(0x001F) eventID:@(1)], + MTREventNumberKey : @(180), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeSystemUpTime), + MTREventSystemUpTimeKey : @(27.5), + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // AdminNodeID + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(177), + }, + }, + @{ + MTRContextTagKey : @(2), // AdminPasscodeID + MTRDataKey : @ { + MTRTypeKey : MTRNullValueType, + }, + }, + @{ + MTRContextTagKey : @(3), // ChangeType + MTRDataKey : @ { + MTRTypeKey : MTRSignedIntegerValueType, // Should be unsigned + MTRValueKey : @(MTRAccessControlChangeTypeAdded), + }, + }, + @{ + MTRContextTagKey : @(4), // LatestValue + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(1), // Data + MTRDataKey : @ { + MTRTypeKey : MTROctetStringValueType, + MTRValueKey : [@"extension" dataUsingEncoding:NSUTF8StringEncoding], + }, + }, + ], + }, + }, + ], + }, + }; + + NSError * error; + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeSchemaMismatch); +} + +- (void)test030_EventReportWithUnknownCluster +{ + NSDictionary * input = @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(0xFF1FF1) eventID:@(0)], + MTREventNumberKey : @(190), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), + MTREventTimestampDateKey : [NSDate date], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], + }, + }; + + NSError * error; + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeUnknownSchema); +} + +- (void)test031_EventReportWithUnknownEvent +{ + NSDictionary * input = @{ + MTREventPathKey : [MTREventPath eventPathWithEndpointID:@(0) clusterID:@(0x0028) eventID:@(1000)], + MTREventNumberKey : @(190), + MTREventPriorityKey : @(MTREventPriorityInfo), + MTREventTimeTypeKey : @(MTREventTimeTypeTimestampDate), + MTREventTimestampDateKey : [NSDate date], + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[], + }, + }; + + NSError * error; + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(report); + XCTAssertNotNil(error); + XCTAssertEqual(error.code, MTRErrorCodeUnknownSchema); +} + +- (void)test032_VeryLongListAttribute +{ + NSDictionary * singleListItem = @{ + MTRDataKey : @ { + MTRTypeKey : MTRStructureValueType, + MTRValueKey : @[ + @{ + MTRContextTagKey : @(0), // DeviceType + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(100), + }, + }, + @{ + MTRContextTagKey : @(1), // Revision + MTRDataKey : @ { + MTRTypeKey : MTRUnsignedIntegerValueType, + MTRValueKey : @(17), + }, + }, + ], + }, + }; + + NSUInteger arrayLength = 1000; + NSMutableArray * inputArray = [[NSMutableArray alloc] initWithCapacity:arrayLength]; + for (NSUInteger i = 0; i < arrayLength; ++i) { + [inputArray addObject:singleListItem]; + } + + // Descriptor, DeviceTypeList + NSDictionary * input = @{ + MTRAttributePathKey : [MTRAttributePath attributePathWithEndpointID:@(0) clusterID:@(0x001d) attributeID:@(0)], + MTRDataKey : @ { + MTRTypeKey : MTRArrayValueType, + MTRValueKey : inputArray, + }, + }; + + NSError * error; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:input error:&error]; + XCTAssertNil(error); + XCTAssertNotNil(report); + + XCTAssertEqualObjects(input[MTRAttributePathKey], report.path); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + + NSArray * array = report.value; + XCTAssertTrue(array.count == inputArray.count); + for (id item in array) { + XCTAssertTrue([item isKindOfClass:[MTRDescriptorClusterDeviceTypeStruct class]]); + MTRDescriptorClusterDeviceTypeStruct * deviceType = item; + XCTAssertEqualObjects(deviceType.deviceType, @(100)); + XCTAssertEqualObjects(deviceType.revision, @(17)); + } + + XCTAssertNil(report.error); +} + +@end diff --git a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m index 2a444a85ce0e81..2c3d949ba79ecc 100644 --- a/src/darwin/Framework/CHIPTests/MTRDeviceTests.m +++ b/src/darwin/Framework/CHIPTests/MTRDeviceTests.m @@ -293,6 +293,19 @@ - (void)test001_ReadAttribute XCTAssertNil(result[@"error"]); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Array"]); + + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:result + error:nil]; + XCTAssertNotNil(report); + XCTAssertEqualObjects(report.path.cluster, @(29)); + XCTAssertEqualObjects(report.path.attribute, @(0)); + XCTAssertNil(report.error); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + + for (id entry in report.value) { + XCTAssertTrue([entry isKindOfClass:[MTRDescriptorClusterDeviceTypeStruct class]]); + } } XCTAssertTrue([resultArray count] > 0); } @@ -465,16 +478,25 @@ - (void)test005_Subscribe XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSDictionary * result = values[0]; + + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:result error:nil]; + XCTAssertNotNil(report); + XCTAssertEqualObjects(report.path.endpoint, @(1)); + XCTAssertEqualObjects(report.path.cluster, @(6)); + XCTAssertEqualObjects(report.path.attribute, @(0)); + XCTAssertNil(report.error); + XCTAssertNotNil(report.value); + XCTAssertEqualObjects(report.value, @(YES)); + MTRAttributePath * path = result[@"attributePath"]; XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); XCTAssertEqual([path.cluster unsignedIntegerValue], 6); XCTAssertEqual([path.attribute unsignedIntegerValue], 0); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); - if ([result[@"data"][@"value"] boolValue] == YES) { - [reportExpectation fulfill]; - globalReportHandler = nil; - } + XCTAssertTrue([result[@"data"][@"value"] boolValue]); + [reportExpectation fulfill]; + globalReportHandler = nil; }; // Send commands to trigger attribute change @@ -517,16 +539,25 @@ - (void)test005_Subscribe XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertTrue([values isKindOfClass:[NSArray class]]); NSDictionary * result = values[0]; + + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:result error:nil]; + XCTAssertNotNil(report); + XCTAssertEqualObjects(report.path.endpoint, @(1)); + XCTAssertEqualObjects(report.path.cluster, @(6)); + XCTAssertEqualObjects(report.path.attribute, @(0)); + XCTAssertNil(report.error); + XCTAssertNotNil(report.value); + XCTAssertEqualObjects(report.value, @(NO)); + MTRAttributePath * path = result[@"attributePath"]; XCTAssertEqual([path.endpoint unsignedIntegerValue], 1); XCTAssertEqual([path.cluster unsignedIntegerValue], 6); XCTAssertEqual([path.attribute unsignedIntegerValue], 0); XCTAssertTrue([result[@"data"] isKindOfClass:[NSDictionary class]]); XCTAssertTrue([result[@"data"][@"type"] isEqualToString:@"Boolean"]); - if ([result[@"data"][@"value"] boolValue] == NO) { - [reportExpectation fulfill]; - globalReportHandler = nil; - } + XCTAssertFalse([result[@"data"][@"value"] boolValue]); + [reportExpectation fulfill]; + globalReportHandler = nil; }; // Send command to trigger attribute change @@ -592,6 +623,16 @@ - (void)test006_ReadAttributeFailure XCTAssertEqual([resultArray count], 1); NSDictionary * result = resultArray[0]; + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:result error:nil]; + XCTAssertNotNil(report); + XCTAssertEqualObjects(report.path.endpoint, @(0)); + XCTAssertEqualObjects(report.path.cluster, @(10000)); + XCTAssertEqualObjects(report.path.attribute, @(0)); + XCTAssertNotNil(report.error); + XCTAssertNil(report.value); + XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:report.error], + EMBER_ZCL_STATUS_UNSUPPORTED_CLUSTER); + MTRAttributePath * path = result[@"attributePath"]; XCTAssertEqual(path.endpoint.unsignedIntegerValue, 0); XCTAssertEqual(path.cluster.unsignedIntegerValue, 10000); @@ -925,6 +966,16 @@ - (void)test011_ReadCachedAttribute NSLog(@"Read attribute cache value: %@, error %@", values, error); XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertEqual([values count], 1); + + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:values[0] error:nil]; + XCTAssertNotNil(report); + XCTAssertEqualObjects(report.path.endpoint, @(1)); + XCTAssertEqualObjects(report.path.cluster, @(6)); + XCTAssertEqualObjects(report.path.attribute, @(0)); + XCTAssertNil(report.error); + XCTAssertNotNil(report.value); + XCTAssertEqualObjects(report.value, @(NO)); + MTRAttributePath * path = values[0][@"attributePath"]; XCTAssertEqual([path.endpoint unsignedShortValue], 1); XCTAssertEqual([path.cluster unsignedLongValue], 6); @@ -950,6 +1001,14 @@ - (void)test011_ReadCachedAttribute XCTAssertEqual([MTRErrorTestUtils errorToZCLErrorCode:error], 0); XCTAssertTrue([values count] > 0); for (NSDictionary * value in values) { + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:value error:nil]; + XCTAssertNotNil(report); + XCTAssertEqualObjects(report.path.cluster, @(6)); + XCTAssertEqualObjects(report.path.attribute, @(0)); + XCTAssertNil(report.error); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[NSNumber class]]); + MTRAttributePath * path = value[@"attributePath"]; XCTAssertEqual([path.cluster unsignedLongValue], 6); XCTAssertEqual([path.attribute unsignedLongValue], 0); @@ -1635,8 +1694,7 @@ - (void)test020_ReadMultipleAttributes [MTRAttributeRequestPath requestPathWithEndpointID:nil clusterID:@40 attributeID:@7] ]; - NSArray * eventPaths = - [NSArray arrayWithObjects:[MTREventRequestPath requestPathWithEndpointID:nil clusterID:@40 eventID:@0], nil]; + NSArray * eventPaths = @[ [MTREventRequestPath requestPathWithEndpointID:nil clusterID:@40 eventID:@0] ]; [device readAttributePaths:attributePaths eventPaths:eventPaths @@ -1655,6 +1713,21 @@ - (void)test020_ReadMultipleAttributes for (NSDictionary * result in resultArray) { if ([result objectForKey:@"eventPath"]) { ++eventResultCount; + + __auto_type * report = [[MTREventReport alloc] initWithResponseValue:result error:nil]; + XCTAssertNotNil(report); + XCTAssertNotNil(report.path); + XCTAssertEqualObjects(report.path.endpoint, @(0)); + XCTAssertEqualObjects(report.path.cluster, @(40)); + XCTAssertEqualObjects(report.path.event, @(0)); + XCTAssertNotNil(report.eventNumber); + XCTAssertEqualObjects(report.priority, @(MTREventPriorityCritical)); + XCTAssertEqual(report.eventTimeType, MTREventTimeTypeTimestampDate); + XCTAssertNotNil(report.timestampDate); + XCTAssertNotNil(report.value); + XCTAssertTrue([report.value isKindOfClass:[MTRBasicInformationClusterStartUpEvent class]]); + XCTAssertNil(report.error); + MTREventPath * path = result[@"eventPath"]; XCTAssertEqualObjects(path.endpoint, @0); XCTAssertEqualObjects(path.cluster, @40); @@ -1682,6 +1755,62 @@ - (void)test020_ReadMultipleAttributes } } else if ([result objectForKey:@"attributePath"]) { ++attributeResultCount; + + __auto_type * report = [[MTRAttributeReport alloc] initWithResponseValue:result error:nil]; + XCTAssertNotNil(report); + XCTAssertNil(report.error); + XCTAssertNotNil(report.value); + switch ([report.path.attribute unsignedLongValue]) { + case 0: + XCTAssertEqualObjects(report.path.cluster, @29); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + for (id entry in report.value) { + XCTAssertTrue([entry isKindOfClass:[MTRDescriptorClusterDeviceTypeStruct class]]); + } + break; + case 1: + XCTAssertEqualObjects(report.path.cluster, @29); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + for (id entry in report.value) { + XCTAssertTrue([entry isKindOfClass:[NSNumber class]]); + } + break; + case 2: + XCTAssertEqualObjects(report.path.cluster, @29); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + for (id entry in report.value) { + XCTAssertTrue([entry isKindOfClass:[NSNumber class]]); + } + break; + case 3: + XCTAssertEqualObjects(report.path.cluster, @29); + XCTAssertTrue([report.value isKindOfClass:[NSArray class]]); + for (id entry in report.value) { + XCTAssertTrue([entry isKindOfClass:[NSNumber class]]); + } + break; + case 4: + XCTAssertEqualObjects(report.path.cluster, @40); + XCTAssertEqualObjects(report.path.endpoint, @0); + XCTAssertTrue([report.value isKindOfClass:[NSNumber class]]); + break; + case 5: + XCTAssertEqualObjects(report.path.cluster, @40); + XCTAssertEqualObjects(report.path.endpoint, @0); + XCTAssertTrue([report.value isKindOfClass:[NSString class]]); + break; + case 6: + XCTAssertEqualObjects(report.path.cluster, @40); + XCTAssertEqualObjects(report.path.endpoint, @0); + XCTAssertTrue([report.value isKindOfClass:[NSString class]]); + break; + case 7: + XCTAssertEqualObjects(report.path.cluster, @40); + XCTAssertEqualObjects(report.path.endpoint, @0); + XCTAssertTrue([report.value isKindOfClass:[NSNumber class]]); + break; + } + MTRAttributePath * path = result[@"attributePath"]; if ([path.attribute unsignedIntegerValue] < 4) { XCTAssertEqualObjects(path.cluster, @29); diff --git a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj index 600aad44180541..2561d02229b67b 100644 --- a/src/darwin/Framework/Matter.xcodeproj/project.pbxproj +++ b/src/darwin/Framework/Matter.xcodeproj/project.pbxproj @@ -154,6 +154,7 @@ 517BF3F0282B62B800A8B7DB /* MTRCertificates.h in Headers */ = {isa = PBXBuildFile; fileRef = 517BF3EE282B62B800A8B7DB /* MTRCertificates.h */; settings = {ATTRIBUTES = (Public, ); }; }; 517BF3F1282B62B800A8B7DB /* MTRCertificates.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517BF3EF282B62B800A8B7DB /* MTRCertificates.mm */; }; 517BF3F3282B62CB00A8B7DB /* MTRCertificateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 517BF3F2282B62CB00A8B7DB /* MTRCertificateTests.m */; }; + 51A2F1322A00402A00F03298 /* MTRDataValueParserTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 51A2F1312A00402A00F03298 /* MTRDataValueParserTests.m */; }; 51B22C1E2740CB0A008D5055 /* MTRStructsObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B22C1D2740CB0A008D5055 /* MTRStructsObjc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 51B22C222740CB1D008D5055 /* MTRCommandPayloadsObjc.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B22C212740CB1D008D5055 /* MTRCommandPayloadsObjc.h */; settings = {ATTRIBUTES = (Public, ); }; }; 51B22C262740CB32008D5055 /* MTRStructsObjc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51B22C252740CB32008D5055 /* MTRStructsObjc.mm */; }; @@ -440,6 +441,7 @@ 517BF3EE282B62B800A8B7DB /* MTRCertificates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRCertificates.h; sourceTree = ""; }; 517BF3EF282B62B800A8B7DB /* MTRCertificates.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRCertificates.mm; sourceTree = ""; }; 517BF3F2282B62CB00A8B7DB /* MTRCertificateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRCertificateTests.m; sourceTree = ""; }; + 51A2F1312A00402A00F03298 /* MTRDataValueParserTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTRDataValueParserTests.m; sourceTree = ""; }; 51B22C1D2740CB0A008D5055 /* MTRStructsObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRStructsObjc.h; sourceTree = ""; }; 51B22C212740CB1D008D5055 /* MTRCommandPayloadsObjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTRCommandPayloadsObjc.h; sourceTree = ""; }; 51B22C252740CB32008D5055 /* MTRStructsObjc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MTRStructsObjc.mm; sourceTree = ""; }; @@ -1057,6 +1059,7 @@ 5173A47829C0E82300F67F48 /* MTRFabricInfoTests.m */, 51742B4D29CB6B88009974FE /* MTRPairingTests.m */, 5142E39729D377F000A206F0 /* MTROTAProviderTests.m */, + 51A2F1312A00402A00F03298 /* MTRDataValueParserTests.m */, B202529D2459E34F00F97062 /* Info.plist */, ); path = CHIPTests; @@ -1466,6 +1469,7 @@ 517BF3F3282B62CB00A8B7DB /* MTRCertificateTests.m in Sources */, 5142E39829D377F000A206F0 /* MTROTAProviderTests.m in Sources */, 51E24E73274E0DAC007CCF6E /* MTRErrorTestUtils.mm in Sources */, + 51A2F1322A00402A00F03298 /* MTRDataValueParserTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme b/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme index e42193b39be4bb..c41c41856793f4 100644 --- a/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme +++ b/src/darwin/Framework/Matter.xcodeproj/xcshareddata/xcschemes/Matter Framework Tests.xcscheme @@ -28,7 +28,8 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" enableAddressSanitizer = "YES" - enableASanStackUseAfterReturn = "YES"> + enableASanStackUseAfterReturn = "YES" + enableUBSanitizer = "YES"> diff --git a/src/darwin/Framework/chip_xcode_build_connector.sh b/src/darwin/Framework/chip_xcode_build_connector.sh index eee0afeed97506..96f70c3b10c7f2 100755 --- a/src/darwin/Framework/chip_xcode_build_connector.sh +++ b/src/darwin/Framework/chip_xcode_build_connector.sh @@ -133,6 +133,12 @@ declare -a args=( ) } +[[ $CHIP_IS_UBSAN == YES ]] && { + args+=( + 'is_ubsan=true' + ) +} + [[ $CHIP_IS_CLANG == YES ]] && { args+=( 'is_clang=true' diff --git a/src/inet/IPAddress.cpp b/src/inet/IPAddress.cpp index 3b4c25eb926185..19da2acaee94f7 100644 --- a/src/inet/IPAddress.cpp +++ b/src/inet/IPAddress.cpp @@ -237,7 +237,7 @@ struct in6_addr IPAddress::ToIPv6() const return ipAddr; } -CHIP_ERROR IPAddress::GetIPAddressFromSockAddr(const SockAddr & sockaddr, IPAddress & outIPAddress) +CHIP_ERROR IPAddress::GetIPAddressFromSockAddr(const SockAddrWithoutStorage & sockaddr, IPAddress & outIPAddress) { #if INET_CONFIG_ENABLE_IPV4 if (sockaddr.any.sa_family == AF_INET) diff --git a/src/inet/IPAddress.h b/src/inet/IPAddress.h index 0e89afa77ca347..661d0f84d65a91 100644 --- a/src/inet/IPAddress.h +++ b/src/inet/IPAddress.h @@ -107,6 +107,14 @@ enum class IPv6MulticastFlag : uint8_t using IPv6MulticastFlags = BitFlags; #if CHIP_SYSTEM_CONFIG_USE_SOCKETS +/** + * SockAddr should be used when calling any API that returns (by copying into + * it) a sockaddr, because that will need enough storage that it can hold data + * for any socket type. + * + * It can also be used when calling an API that accepts a sockaddr, to simplify + * the type-punning needed. + */ union SockAddr { sockaddr any; @@ -114,6 +122,19 @@ union SockAddr sockaddr_in6 in6; sockaddr_storage storage; }; + +/** + * SockAddrWithoutStorage can be used any time we want to do the sockaddr + * type-punning but will not store the data ourselves (e.g. we're working with + * an existing sockaddr pointer, and reintepret it as a + * pointer-to-SockAddrWithoutStorage). + */ +union SockAddrWithoutStorage +{ + sockaddr any; + sockaddr_in in; + sockaddr_in6 in6; +}; #endif // CHIP_SYSTEM_CONFIG_USE_SOCKETS /** @@ -550,10 +571,10 @@ class DLL_EXPORT IPAddress /** * Get the IP address from a SockAddr. */ - static CHIP_ERROR GetIPAddressFromSockAddr(const SockAddr & sockaddr, IPAddress & outIPAddress); + static CHIP_ERROR GetIPAddressFromSockAddr(const SockAddrWithoutStorage & sockaddr, IPAddress & outIPAddress); static CHIP_ERROR GetIPAddressFromSockAddr(const sockaddr & sockaddr, IPAddress & outIPAddress) { - return GetIPAddressFromSockAddr(reinterpret_cast(sockaddr), outIPAddress); + return GetIPAddressFromSockAddr(reinterpret_cast(sockaddr), outIPAddress); } static IPAddress FromSockAddr(const sockaddr_in6 & sockaddr) { return IPAddress(sockaddr.sin6_addr); } #if INET_CONFIG_ENABLE_IPV4 diff --git a/src/inet/TCPEndPointImplSockets.cpp b/src/inet/TCPEndPointImplSockets.cpp index 2efdaba6c3222d..384337e3342ab4 100644 --- a/src/inet/TCPEndPointImplSockets.cpp +++ b/src/inet/TCPEndPointImplSockets.cpp @@ -96,40 +96,42 @@ CHIP_ERROR TCPEndPointImplSockets::BindImpl(IPAddressType addrType, const IPAddr if (res == CHIP_NO_ERROR) { + SockAddr sa; + memset(&sa, 0, sizeof(sa)); + socklen_t sockaddrsize = 0; + if (addrType == IPAddressType::kIPv6) { - struct sockaddr_in6 sa; - memset(&sa, 0, sizeof(sa)); - sa.sin6_family = AF_INET6; - sa.sin6_port = htons(port); - sa.sin6_flowinfo = 0; - sa.sin6_addr = addr.ToIPv6(); - sa.sin6_scope_id = 0; - - if (bind(mSocket, reinterpret_cast(&sa), static_cast(sizeof(sa))) != 0) - { - res = CHIP_ERROR_POSIX(errno); - } + sa.in6.sin6_family = AF_INET6; + sa.in6.sin6_port = htons(port); + sa.in6.sin6_flowinfo = 0; + sa.in6.sin6_addr = addr.ToIPv6(); + sa.in6.sin6_scope_id = 0; + + sockaddrsize = sizeof(sa.in6); } #if INET_CONFIG_ENABLE_IPV4 else if (addrType == IPAddressType::kIPv4) { - struct sockaddr_in sa; - memset(&sa, 0, sizeof(sa)); - sa.sin_family = AF_INET; - sa.sin_port = htons(port); - sa.sin_addr = addr.ToIPv4(); + sa.in.sin_family = AF_INET; + sa.in.sin_port = htons(port); + sa.in.sin_addr = addr.ToIPv4(); - if (bind(mSocket, reinterpret_cast(&sa), static_cast(sizeof(sa))) != 0) - { - res = CHIP_ERROR_POSIX(errno); - } + sockaddrsize = sizeof(sa.in); } #endif // INET_CONFIG_ENABLE_IPV4 else { res = INET_ERROR_WRONG_ADDRESS_TYPE; } + + if (res == CHIP_NO_ERROR) + { + if (bind(mSocket, &sa.any, sockaddrsize) != 0) + { + res = CHIP_ERROR_POSIX(errno); + } + } } return res; @@ -218,8 +220,7 @@ CHIP_ERROR TCPEndPointImplSockets::ConnectImpl(const IPAddress & addr, uint16_t int flags = fcntl(mSocket, F_GETFL, 0); fcntl(mSocket, F_SETFL, flags | O_NONBLOCK); - socklen_t sockaddrsize = 0; - const sockaddr * sockaddrptr = nullptr; + socklen_t sockaddrsize = 0; SockAddr sa; memset(&sa, 0, sizeof(sa)); @@ -232,7 +233,6 @@ CHIP_ERROR TCPEndPointImplSockets::ConnectImpl(const IPAddress & addr, uint16_t sa.in6.sin6_addr = addr.ToIPv6(); sa.in6.sin6_scope_id = intfId.GetPlatformInterface(); sockaddrsize = sizeof(sockaddr_in6); - sockaddrptr = reinterpret_cast(&sa.in6); } #if INET_CONFIG_ENABLE_IPV4 else if (addrType == IPAddressType::kIPv4) @@ -241,7 +241,6 @@ CHIP_ERROR TCPEndPointImplSockets::ConnectImpl(const IPAddress & addr, uint16_t sa.in.sin_port = htons(port); sa.in.sin_addr = addr.ToIPv4(); sockaddrsize = sizeof(sockaddr_in); - sockaddrptr = reinterpret_cast(&sa.in); } #endif // INET_CONFIG_ENABLE_IPV4 else @@ -249,7 +248,7 @@ CHIP_ERROR TCPEndPointImplSockets::ConnectImpl(const IPAddress & addr, uint16_t return INET_ERROR_WRONG_ADDRESS_TYPE; } - int conRes = connect(mSocket, sockaddrptr, sockaddrsize); + int conRes = connect(mSocket, &sa.any, sockaddrsize); if (conRes == -1 && errno != EINPROGRESS) { diff --git a/src/inet/arpa-inet-compatibility.h b/src/inet/arpa-inet-compatibility.h index 25f9792893ecd8..56d9121e40d5ae 100644 --- a/src/inet/arpa-inet-compatibility.h +++ b/src/inet/arpa-inet-compatibility.h @@ -26,7 +26,6 @@ #else // !CHIP_SYSTEM_CONFIG_USE_SOCKETS #if CHIP_SYSTEM_CONFIG_USE_LWIP - #include #include @@ -49,7 +48,11 @@ #if CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT -#if BYTE_ORDER == BIG_ENDIAN +#ifndef __BYTE_ORDER__ +#error Endianness is not defined +#endif // BYTE_ORDER + +#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ #ifndef htons #define htons(x) (x) #endif @@ -63,7 +66,7 @@ #define ntohl(x) (x) #endif -#else // BYTE_ORDER != BIG_ENDIAN +#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #ifndef htons #define htons(x) ((u16_t)((((x) & (u16_t) 0x00ffU) << 8) | (((x) & (u16_t) 0xff00U) >> 8))) #endif @@ -78,7 +81,10 @@ #ifndef ntohl #define ntohl(x) htonl(x) #endif -#endif // BYTE_ORDER == BIG_ENDIAN + +#else +#error __BYTE_ORDER__ value not recognized +#endif // __BYTE_ORDER__ == #endif // CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT diff --git a/src/lib/shell/BUILD.gn b/src/lib/shell/BUILD.gn index 7f3d1d46cb62b1..68af8be17cb766 100644 --- a/src/lib/shell/BUILD.gn +++ b/src/lib/shell/BUILD.gn @@ -104,7 +104,7 @@ static_library("shell") { ] } else if (chip_device_platform == "ameba") { sources += [ - "MainLoopDefault.cpp", + "MainLoopAmeba.cpp", "streamer_ameba.cpp", ] } else if (chip_device_platform == "openiotsdk") { diff --git a/src/lib/shell/MainLoopAmeba.cpp b/src/lib/shell/MainLoopAmeba.cpp new file mode 100644 index 00000000000000..0526980e7f6080 --- /dev/null +++ b/src/lib/shell/MainLoopAmeba.cpp @@ -0,0 +1,153 @@ +/* + * + * Copyright (c) 2021 Project CHIP Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "streamer.h" +#include +#include +#include + +#include +#include + +using chip::FormatCHIPError; +using chip::Platform::MemoryAlloc; +using chip::Platform::MemoryFree; +using chip::Shell::Engine; +using chip::Shell::streamer_get; + +namespace { + +size_t ReadLine(char * buffer, size_t max) +{ + return streamer_read(streamer_get(), buffer, max); +} + +bool IsSeparator(char ch) +{ + return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'); +} + +bool IsEscape(char ch) +{ + return (ch == '\\'); +} + +bool IsEscapable(char ch) +{ + return IsSeparator(ch) || IsEscape(ch); +} + +int TokenizeLine(char * buffer, char ** tokens, int max_tokens) +{ + size_t len = strlen(buffer); + int cursor = 0; + size_t i = 0; + + // Strip leading spaces + while (buffer[i] && buffer[i] == ' ') + { + i++; + } + + if (len <= i) + { + return 0; + } + + // The first token starts at the beginning. + tokens[cursor++] = &buffer[i]; + + for (; i < len && cursor < max_tokens; i++) + { + if (IsEscape(buffer[i]) && IsEscapable(buffer[i + 1])) + { + // include the null terminator: strlen(cmd) = strlen(cmd + 1) + 1 + memmove(&buffer[i], &buffer[i + 1], strlen(&buffer[i])); + } + else if (IsSeparator(buffer[i])) + { + buffer[i] = 0; + if (!IsSeparator(buffer[i + 1])) + { + tokens[cursor++] = &buffer[i + 1]; + } + } + } + // If for too many arguments, overwrite last entry with guard. + if (cursor >= max_tokens) + { + cursor = max_tokens - 1; + } + + tokens[cursor] = nullptr; + + return cursor; +} + +void ProcessShellLine(intptr_t args) +{ + int argc; + char * argv[CHIP_SHELL_MAX_TOKENS]; + + char * line = reinterpret_cast(args); + argc = TokenizeLine(line, argv, CHIP_SHELL_MAX_TOKENS); + + if (argc > 0) + { + CHIP_ERROR retval = Engine::Root().ExecCommand(argc, argv); + + if (retval != CHIP_NO_ERROR) + { + char errorStr[160]; + bool errorStrFound = FormatCHIPError(errorStr, sizeof(errorStr), retval); + if (!errorStrFound) + { + errorStr[0] = 0; + } + streamer_printf(streamer_get(), "Error %s: %s\r\n", argv[0], errorStr); + } + else + { + streamer_printf(streamer_get(), "Done\r\n", argv[0]); + } + } +} + +} // namespace + +namespace chip { +namespace Shell { + +void Engine::RunMainLoop() +{ + char line[CHIP_SHELL_MAX_LINE_SIZE]; + while (true) + { + memset(line, 0, CHIP_SHELL_MAX_LINE_SIZE); + if (ReadLine(line, CHIP_SHELL_MAX_LINE_SIZE) > 0u) + { +#if CONFIG_DEVICE_LAYER + DeviceLayer::PlatformMgr().ScheduleWork(ProcessShellLine, reinterpret_cast(line)); +#else + ProcessShellLine(reinterpret_cast(line)); +#endif + } + } +} + +} // namespace Shell +} // namespace chip diff --git a/src/lib/shell/streamer_ameba.cpp b/src/lib/shell/streamer_ameba.cpp index d585aa942a74fa..d553331e2fcbd9 100644 --- a/src/lib/shell/streamer_ameba.cpp +++ b/src/lib/shell/streamer_ameba.cpp @@ -22,59 +22,45 @@ #include #include +#include #include #include -#include "serial_api.h" - -#if defined(CONFIG_PLATFORM_8721D) -#define UART_TX PA_18 // UART0 TX -#define UART_RX PA_19 // UART0 RX -#elif defined(CONFIG_PLATFORM_8710C) -#define UART_TX PA_14 // UART0 TX -#define UART_RX PA_13 // UART0 RX -#endif +extern QueueHandle_t shell_queue; namespace chip { namespace Shell { namespace { -serial_t sobj; - int streamer_ameba_init(streamer_t * streamer) { - (void) streamer; - serial_init(&sobj, UART_TX, UART_RX); - serial_baud(&sobj, 115200); - serial_format(&sobj, 8, ParityNone, 1); + // freertos queue should be initialized in ameba sdk + if (shell_queue == NULL) + { + // queue not initialized + return -1; + } + return 0; } ssize_t streamer_ameba_read(streamer_t * streamer, char * buffer, size_t length) { - (void) streamer; - uint16_t len_read = 0; - - while (len_read < length) + BaseType_t lineReceived = xQueueReceive(shell_queue, buffer, pdMS_TO_TICKS(10)); + if (lineReceived == pdTRUE) { - *(buffer + len_read) = (char) serial_getc(&sobj); - len_read++; + return length; } - return len_read; + + return 0; } ssize_t streamer_ameba_write(streamer_t * streamer, const char * buffer, size_t length) { (void) streamer; - uint16_t len_written = 0; - - while (len_written < length) - { - serial_putc(&sobj, *(buffer + len_written)); - len_written++; - } - return len_written; + printf("[shell] %s\r\n", buffer); + return length; } static streamer_t streamer_ameba = { diff --git a/src/platform/Darwin/BleConnectionDelegateImpl.mm b/src/platform/Darwin/BleConnectionDelegateImpl.mm index 5afd14fcb89199..ad1093007473bb 100644 --- a/src/platform/Darwin/BleConnectionDelegateImpl.mm +++ b/src/platform/Darwin/BleConnectionDelegateImpl.mm @@ -698,7 +698,7 @@ - (void)removePeripheralFromCache:(CBPeripheral *)peripheral - (void)removePeripheralsFromCache { - for (CBPeripheral * peripheral in _cachedPeripherals) { + for (CBPeripheral * peripheral in [_cachedPeripherals allValues]) { [self removePeripheralFromCache:peripheral]; } } diff --git a/src/platform/Linux/BLEManagerImpl.cpp b/src/platform/Linux/BLEManagerImpl.cpp index 2cc5c6a69d19c5..a25d0eea768d18 100644 --- a/src/platform/Linux/BLEManagerImpl.cpp +++ b/src/platform/Linux/BLEManagerImpl.cpp @@ -825,6 +825,7 @@ void BLEManagerImpl::OnScanComplete() void BLEManagerImpl::OnScanError(CHIP_ERROR err) { + BleConnectionDelegate::OnConnectionError(mBLEScanConfig.mAppState, err); ChipLogError(Ble, "BLE scan error: %" CHIP_ERROR_FORMAT, err.Format()); } diff --git a/src/platform/Linux/CHIPDevicePlatformConfig.h b/src/platform/Linux/CHIPDevicePlatformConfig.h index 9a316d4832348b..530e2716308842 100644 --- a/src/platform/Linux/CHIPDevicePlatformConfig.h +++ b/src/platform/Linux/CHIPDevicePlatformConfig.h @@ -41,9 +41,9 @@ #define CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE 0 #endif -// Start GLib main event loop if BLE or WiFi is enabled. This is needed to handle -// D-Bus communication with BlueZ or wpa_supplicant. -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE || CHIP_DEVICE_CONFIG_ENABLE_WIFI +// Start GLib main event loop if BLE, Thread or WiFi is enabled. This is needed +// to handle D-Bus communication with BlueZ or wpa_supplicant. +#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE || CHIP_DEVICE_CONFIG_ENABLE_THREAD || CHIP_DEVICE_CONFIG_ENABLE_WIFI #define CHIP_DEVICE_CONFIG_WITH_GLIB_MAIN_LOOP 1 #else #define CHIP_DEVICE_CONFIG_WITH_GLIB_MAIN_LOOP 0 diff --git a/src/platform/Linux/ConnectivityManagerImpl.cpp b/src/platform/Linux/ConnectivityManagerImpl.cpp index b8e285e19841ea..aba40e3b116528 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.cpp +++ b/src/platform/Linux/ConnectivityManagerImpl.cpp @@ -486,6 +486,10 @@ void ConnectivityManagerImpl::_OnWpaPropertiesChanged(WpaFiW1Wpa_supplicant1Inte void ConnectivityManagerImpl::_OnWpaInterfaceProxyReady(GObject * source_object, GAsyncResult * res, gpointer user_data) { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + GError * err = nullptr; std::lock_guard lock(mWpaSupplicantMutex); @@ -530,6 +534,10 @@ void ConnectivityManagerImpl::_OnWpaInterfaceProxyReady(GObject * source_object, void ConnectivityManagerImpl::_OnWpaBssProxyReady(GObject * source_object, GAsyncResult * res, gpointer user_data) { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + GError * err = nullptr; std::lock_guard lock(mWpaSupplicantMutex); @@ -559,6 +567,10 @@ void ConnectivityManagerImpl::_OnWpaBssProxyReady(GObject * source_object, GAsyn void ConnectivityManagerImpl::_OnWpaInterfaceReady(GObject * source_object, GAsyncResult * res, gpointer user_data) { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + GError * err = nullptr; std::lock_guard lock(mWpaSupplicantMutex); @@ -634,6 +646,10 @@ void ConnectivityManagerImpl::_OnWpaInterfaceReady(GObject * source_object, GAsy void ConnectivityManagerImpl::_OnWpaInterfaceAdded(WpaFiW1Wpa_supplicant1 * proxy, const gchar * path, GVariant * properties, gpointer user_data) { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + std::lock_guard lock(mWpaSupplicantMutex); if (mWpaSupplicant.interfacePath) @@ -696,6 +712,10 @@ void ConnectivityManagerImpl::_OnWpaInterfaceRemoved(WpaFiW1Wpa_supplicant1 * pr void ConnectivityManagerImpl::_OnWpaProxyReady(GObject * source_object, GAsyncResult * res, gpointer user_data) { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + GError * err = nullptr; std::lock_guard lock(mWpaSupplicantMutex); @@ -730,10 +750,8 @@ void ConnectivityManagerImpl::StartWiFiManagement() mConnectivityFlag.ClearAll(); mWpaSupplicant = GDBusWpaSupplicant{}; - ChipLogProgress(DeviceLayer, "wpa_supplicant: Start WiFi management"); - - wpa_fi_w1_wpa_supplicant1_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, - kWpaSupplicantObjectPath, nullptr, _OnWpaProxyReady, nullptr); + CHIP_ERROR err = PlatformMgrImpl().GLibMatterContextInvokeSync(_StartWiFiManagement, this); + VerifyOrReturn(err == CHIP_NO_ERROR, ChipLogError(DeviceLayer, "Failed to start WiFi management")); } bool ConnectivityManagerImpl::IsWiFiManagementStarted() @@ -1279,6 +1297,11 @@ int32_t ConnectivityManagerImpl::GetDisconnectReason() CHIP_ERROR ConnectivityManagerImpl::GetConfiguredNetwork(NetworkCommissioning::Network & network) { + // This function can be called without g_main_context_get_thread_default() being set. + // The network proxy object is created in a synchronous manner, so the D-Bus call will + // be completed before this function returns. Also, no external callbacks are registered + // with the proxy object. + std::lock_guard lock(mWpaSupplicantMutex); std::unique_ptr err; @@ -1463,6 +1486,11 @@ std::pair GetBandAndChannelFromFrequency(uint32_t freq) bool ConnectivityManagerImpl::_GetBssInfo(const gchar * bssPath, NetworkCommissioning::WiFiScanResponse & result) { + // This function can be called without g_main_context_get_thread_default() being set. + // The BSS proxy object is created in a synchronous manner, so the D-Bus call will be + // completed before this function returns. Also, no external callbacks are registered + // with the proxy object. + std::unique_ptr err; std::unique_ptr bss( wpa_fi_w1_wpa_supplicant1_bss_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, @@ -1676,6 +1704,19 @@ void ConnectivityManagerImpl::_OnWpaInterfaceScanDone(GObject * source_object, G g_strfreev(oldBsss); } +CHIP_ERROR ConnectivityManagerImpl::_StartWiFiManagement(ConnectivityManagerImpl * self) +{ + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + + ChipLogProgress(DeviceLayer, "wpa_supplicant: Start WiFi management"); + wpa_fi_w1_wpa_supplicant1_proxy_new_for_bus(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kWpaSupplicantServiceName, + kWpaSupplicantObjectPath, nullptr, self->_OnWpaProxyReady, nullptr); + + return CHIP_NO_ERROR; +} + #endif // CHIP_DEVICE_CONFIG_ENABLE_WPA } // namespace DeviceLayer diff --git a/src/platform/Linux/ConnectivityManagerImpl.h b/src/platform/Linux/ConnectivityManagerImpl.h index f3bcc2cedcb8f4..df9e893f8ec5a6 100644 --- a/src/platform/Linux/ConnectivityManagerImpl.h +++ b/src/platform/Linux/ConnectivityManagerImpl.h @@ -206,6 +206,8 @@ class ConnectivityManagerImpl final : public ConnectivityManager, static bool _GetBssInfo(const gchar * bssPath, NetworkCommissioning::WiFiScanResponse & result); + static CHIP_ERROR _StartWiFiManagement(ConnectivityManagerImpl * self); + static bool mAssociationStarted; static BitFlags mConnectivityFlag; static GDBusWpaSupplicant mWpaSupplicant CHIP_GUARDED_BY(mWpaSupplicantMutex); diff --git a/src/platform/Linux/PlatformManagerImpl.cpp b/src/platform/Linux/PlatformManagerImpl.cpp index 8001ae6677d7de..a1c83faf299389 100644 --- a/src/platform/Linux/PlatformManagerImpl.cpp +++ b/src/platform/Linux/PlatformManagerImpl.cpp @@ -56,9 +56,14 @@ PlatformManagerImpl PlatformManagerImpl::sInstance; namespace { #if CHIP_DEVICE_CONFIG_WITH_GLIB_MAIN_LOOP -void * GLibMainLoopThread(void * loop) +void * GLibMainLoopThread(void * userData) { - g_main_loop_run(static_cast(loop)); + GMainLoop * loop = static_cast(userData); + GMainContext * context = g_main_loop_get_context(loop); + + g_main_context_push_thread_default(context); + g_main_loop_run(loop); + return nullptr; } #endif @@ -172,11 +177,15 @@ CHIP_ERROR RunWiFiIPChangeListener() return CHIP_ERROR_INTERNAL; } - GIOChannel * ch = g_io_channel_unix_new(sock); - g_io_add_watch_full(ch, G_PRIORITY_DEFAULT, G_IO_IN, WiFiIPChangeListener, nullptr, nullptr); - + GIOChannel * ch = g_io_channel_unix_new(sock); + GSource * watchSource = g_io_create_watch(ch, G_IO_IN); + g_source_set_callback(watchSource, G_SOURCE_FUNC(WiFiIPChangeListener), nullptr, nullptr); g_io_channel_set_close_on_unref(ch, TRUE); g_io_channel_set_encoding(ch, nullptr, nullptr); + + PlatformMgrImpl().GLibMatterContextAttachSource(watchSource); + + g_source_unref(watchSource); g_io_channel_unref(ch); return CHIP_NO_ERROR; @@ -190,8 +199,10 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() { #if CHIP_DEVICE_CONFIG_WITH_GLIB_MAIN_LOOP - mGLibMainLoop = g_main_loop_new(nullptr, FALSE); + auto * context = g_main_context_new(); + mGLibMainLoop = g_main_loop_new(context, FALSE); mGLibMainLoopThread = g_thread_new("gmain-matter", GLibMainLoopThread, mGLibMainLoop); + g_main_context_unref(context); { // Wait for the GLib main loop to start. It is required that the context used @@ -212,7 +223,7 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack() return G_SOURCE_REMOVE; }, &invokeData, nullptr); - g_source_attach(idleSource, g_main_loop_get_context(mGLibMainLoop)); + GLibMatterContextAttachSource(idleSource); g_source_unref(idleSource); invokeData.mDoneCond.wait(lock, [&invokeData]() { return invokeData.mDone; }); diff --git a/src/platform/Linux/PlatformManagerImpl.h b/src/platform/Linux/PlatformManagerImpl.h index aa50cce59e2998..5669ce5dd28d62 100644 --- a/src/platform/Linux/PlatformManagerImpl.h +++ b/src/platform/Linux/PlatformManagerImpl.h @@ -72,6 +72,12 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener return _GLibMatterContextInvokeSync((CHIP_ERROR(*)(void *)) func, (void *) userData); } + unsigned int GLibMatterContextAttachSource(GSource * source) + { + VerifyOrDie(mGLibMainLoop != nullptr); + return g_source_attach(source, g_main_loop_get_context(mGLibMainLoop)); + } + #endif System::Clock::Timestamp GetStartTime() { return mStartTime; } @@ -121,8 +127,8 @@ class PlatformManagerImpl final : public PlatformManager, public Internal::Gener // event loop thread before the call to g_source_attach(). std::mutex mGLibMainLoopCallbackIndirectionMutex; - GMainLoop * mGLibMainLoop; - GThread * mGLibMainLoopThread; + GMainLoop * mGLibMainLoop = nullptr; + GThread * mGLibMainLoopThread = nullptr; #endif // CHIP_DEVICE_CONFIG_WITH_GLIB_MAIN_LOOP }; diff --git a/src/platform/Linux/ThreadStackManagerImpl.cpp b/src/platform/Linux/ThreadStackManagerImpl.cpp index 9b27f7d6c68e0f..fd89be709e1a20 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.cpp +++ b/src/platform/Linux/ThreadStackManagerImpl.cpp @@ -49,28 +49,66 @@ constexpr char ThreadStackManagerImpl::kOpenthreadDeviceRoleLeader[]; constexpr char ThreadStackManagerImpl::kPropertyDeviceRole[]; +namespace { + +struct SetActiveDatasetContext +{ + OpenthreadIoOpenthreadBorderRouter * proxy; + ByteSpan netInfo; +}; + +CHIP_ERROR GLibMatterContextSetActiveDataset(SetActiveDatasetContext * context) +{ + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + + std::unique_ptr bytes(g_bytes_new(context->netInfo.data(), context->netInfo.size())); + if (!bytes) + return CHIP_ERROR_NO_MEMORY; + std::unique_ptr value(g_variant_new_from_bytes(G_VARIANT_TYPE_BYTESTRING, bytes.release(), true)); + if (!value) + return CHIP_ERROR_NO_MEMORY; + openthread_io_openthread_border_router_set_active_dataset_tlvs(context->proxy, value.release()); + return CHIP_NO_ERROR; +} + +} // namespace + ThreadStackManagerImpl::ThreadStackManagerImpl() : mAttached(false) {} -CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack() +CHIP_ERROR ThreadStackManagerImpl::GLibMatterContextInitThreadStack(ThreadStackManagerImpl * self) { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + std::unique_ptr err; - mProxy.reset(openthread_io_openthread_border_router_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, - kDBusOpenThreadService, kDBusOpenThreadObjectPath, - nullptr, &MakeUniquePointerReceiver(err).Get())); - if (!mProxy) - { - ChipLogError(DeviceLayer, "openthread: failed to create openthread dbus proxy %s", err ? err->message : "unknown error"); - return CHIP_ERROR_INTERNAL; - } + self->mProxy.reset(openthread_io_openthread_border_router_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, kDBusOpenThreadService, kDBusOpenThreadObjectPath, nullptr, + &MakeUniquePointerReceiver(err).Get())); + VerifyOrReturnError( + self->mProxy != nullptr, CHIP_ERROR_INTERNAL, + ChipLogError(DeviceLayer, "openthread: failed to create openthread dbus proxy %s", err ? err->message : "unknown error")); + + g_signal_connect(self->mProxy.get(), "g-properties-changed", G_CALLBACK(OnDbusPropertiesChanged), self); - g_signal_connect(mProxy.get(), "g-properties-changed", G_CALLBACK(OnDbusPropertiesChanged), this); + return CHIP_NO_ERROR; +} + +CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack() +{ + CHIP_ERROR err; + + err = PlatformMgrImpl().GLibMatterContextInvokeSync(GLibMatterContextInitThreadStack, this); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(DeviceLayer, "openthread: failed to init dbus proxy")); // If get property is called inside dbus thread (we are going to make it so), XXX_get_XXX can be used instead of XXX_dup_XXX // which is a little bit faster and the returned object doesn't need to be freed. Same for all following get properties. std::unique_ptr role(openthread_io_openthread_border_router_dup_device_role(mProxy.get())); if (role) { - ThreadDevcieRoleChangedHandler(role.get()); + ThreadDeviceRoleChangedHandler(role.get()); } return CHIP_NO_ERROR; @@ -102,13 +140,13 @@ void ThreadStackManagerImpl::OnDbusPropertiesChanged(OpenthreadIoOpenthreadBorde if (value_str == nullptr) continue; ChipLogProgress(DeviceLayer, "Thread role changed to: %s", StringOrNullMarker(value_str)); - me->ThreadDevcieRoleChangedHandler(value_str); + me->ThreadDeviceRoleChangedHandler(value_str); } } } } -void ThreadStackManagerImpl::ThreadDevcieRoleChangedHandler(const gchar * role) +void ThreadStackManagerImpl::ThreadDeviceRoleChangedHandler(const gchar * role) { bool attached = strcmp(role, kOpenthreadDeviceRoleDetached) != 0 && strcmp(role, kOpenthreadDeviceRoleDisabled) != 0; @@ -217,16 +255,9 @@ CHIP_ERROR ThreadStackManagerImpl::_SetThreadProvision(ByteSpan netInfo) VerifyOrReturnError(mProxy, CHIP_ERROR_INCORRECT_STATE); VerifyOrReturnError(Thread::OperationalDataset::IsValid(netInfo), CHIP_ERROR_INVALID_ARGUMENT); - { - std::unique_ptr bytes(g_bytes_new(netInfo.data(), netInfo.size())); - if (!bytes) - return CHIP_ERROR_NO_MEMORY; - std::unique_ptr value( - g_variant_new_from_bytes(G_VARIANT_TYPE_BYTESTRING, bytes.release(), true)); - if (!value) - return CHIP_ERROR_NO_MEMORY; - openthread_io_openthread_border_router_set_active_dataset_tlvs(mProxy.get(), value.release()); - } + SetActiveDatasetContext context = { mProxy.get(), netInfo }; + CHIP_ERROR err = PlatformMgrImpl().GLibMatterContextInvokeSync(GLibMatterContextSetActiveDataset, &context); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(DeviceLayer, "openthread: failed to set active dataset")); // post an event alerting other subsystems about change in provisioning state ChipDeviceEvent event; @@ -345,12 +376,20 @@ bool ThreadStackManagerImpl::_IsThreadAttached() const return mAttached; } +CHIP_ERROR ThreadStackManagerImpl::GLibMatterContextCallAttach(ThreadStackManagerImpl * self) +{ + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + openthread_io_openthread_border_router_call_attach(self->mProxy.get(), nullptr, _OnThreadBrAttachFinished, self); + return CHIP_NO_ERROR; +} + CHIP_ERROR ThreadStackManagerImpl::_SetThreadEnabled(bool val) { VerifyOrReturnError(mProxy, CHIP_ERROR_INCORRECT_STATE); if (val) { - openthread_io_openthread_border_router_call_attach(mProxy.get(), nullptr, _OnThreadBrAttachFinished, this); + CHIP_ERROR err = PlatformMgrImpl().GLibMatterContextInvokeSync(GLibMatterContextCallAttach, this); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(DeviceLayer, "openthread: failed to attach")); } else { @@ -572,12 +611,20 @@ void ThreadStackManagerImpl::_SetRouterPromotion(bool val) // Set Router Promotion is not supported on linux } +CHIP_ERROR ThreadStackManagerImpl::GLibMatterContextCallScan(ThreadStackManagerImpl * self) +{ + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + openthread_io_openthread_border_router_call_scan(self->mProxy.get(), nullptr, _OnNetworkScanFinished, self); + return CHIP_NO_ERROR; +} + CHIP_ERROR ThreadStackManagerImpl::_StartThreadScan(ThreadDriver::ScanCallback * callback) { // There is another ongoing scan request, reject the new one. VerifyOrReturnError(mpScanCallback == nullptr, CHIP_ERROR_INCORRECT_STATE); mpScanCallback = callback; - openthread_io_openthread_border_router_call_scan(mProxy.get(), nullptr, _OnNetworkScanFinished, this); + CHIP_ERROR err = PlatformMgrImpl().GLibMatterContextInvokeSync(GLibMatterContextCallScan, this); + VerifyOrReturnError(err == CHIP_NO_ERROR, err, ChipLogError(DeviceLayer, "openthread: failed to start scan")); return CHIP_NO_ERROR; } diff --git a/src/platform/Linux/ThreadStackManagerImpl.h b/src/platform/Linux/ThreadStackManagerImpl.h index 37e743fbe2e64b..2c4a47a43a0c62 100755 --- a/src/platform/Linux/ThreadStackManagerImpl.h +++ b/src/platform/Linux/ThreadStackManagerImpl.h @@ -147,9 +147,12 @@ class ThreadStackManagerImpl : public ThreadStackManager std::unique_ptr mProxy; + static CHIP_ERROR GLibMatterContextInitThreadStack(ThreadStackManagerImpl * self); + static CHIP_ERROR GLibMatterContextCallAttach(ThreadStackManagerImpl * self); + static CHIP_ERROR GLibMatterContextCallScan(ThreadStackManagerImpl * self); static void OnDbusPropertiesChanged(OpenthreadIoOpenthreadBorderRouter * proxy, GVariant * changed_properties, const gchar * const * invalidated_properties, gpointer user_data); - void ThreadDevcieRoleChangedHandler(const gchar * role); + void ThreadDeviceRoleChangedHandler(const gchar * role); Thread::OperationalDataset mDataset = {}; diff --git a/src/platform/Linux/bluez/AdapterIterator.cpp b/src/platform/Linux/bluez/AdapterIterator.cpp index ec2b58b6bfe6de..30825b6c372040 100644 --- a/src/platform/Linux/bluez/AdapterIterator.cpp +++ b/src/platform/Linux/bluez/AdapterIterator.cpp @@ -47,6 +47,10 @@ AdapterIterator::~AdapterIterator() void AdapterIterator::Initialize() { + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + GError * error = nullptr; mManager = g_dbus_object_manager_client_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, diff --git a/src/platform/Linux/bluez/ChipDeviceScanner.cpp b/src/platform/Linux/bluez/ChipDeviceScanner.cpp index 7c47e735d5dfc1..344eedcce1a191 100644 --- a/src/platform/Linux/bluez/ChipDeviceScanner.cpp +++ b/src/platform/Linux/bluez/ChipDeviceScanner.cpp @@ -31,19 +31,45 @@ namespace chip { namespace DeviceLayer { namespace Internal { + namespace { -struct GObjectUnref +// Helper context for creating GDBusObjectManager with +// chip::DeviceLayer::GLibMatterContextInvokeSync() +struct GDBusCreateObjectManagerContext { - template - void operator()(T * value) + GDBusObjectManager * object = nullptr; + // Cancellable passed to g_dbus_object_manager_client_new_for_bus_sync() + // which later can be used to cancel the scan operation. + GCancellable * cancellable = nullptr; + + GDBusCreateObjectManagerContext() : cancellable(g_cancellable_new()) {} + ~GDBusCreateObjectManagerContext() { - g_object_unref(value); + g_object_unref(cancellable); + if (object != nullptr) + { + g_object_unref(object); + } } }; -using GCancellableUniquePtr = std::unique_ptr; -using GDBusObjectManagerUniquePtr = std::unique_ptr; +CHIP_ERROR MainLoopCreateObjectManager(GDBusCreateObjectManagerContext * context) +{ + // When creating D-Bus proxy object, the thread default context must be initialized. Otherwise, + // all D-Bus signals will be delivered to the GLib global default main context. + VerifyOrDie(g_main_context_get_thread_default() != nullptr); + + std::unique_ptr err; + context->object = g_dbus_object_manager_client_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, "/", + bluez_object_manager_client_get_proxy_type, nullptr /* unused user data in the Proxy Type Func */, + nullptr /* destroy notify */, context->cancellable, &MakeUniquePointerReceiver(err).Get()); + VerifyOrReturnError(context->object != nullptr, CHIP_ERROR_INTERNAL, + ChipLogError(Ble, "Failed to get DBUS object manager for device scanning: %s", err->message)); + + return CHIP_NO_ERROR; +} /// Retrieve CHIP device identification info from the device advertising data bool BluezGetChipDeviceInfo(BluezDevice1 & aDevice, chip::Ble::ChipBLEDeviceIdentificationInfo & aDeviceInfo) @@ -101,33 +127,21 @@ ChipDeviceScanner::~ChipDeviceScanner() std::unique_ptr ChipDeviceScanner::Create(BluezAdapter1 * adapter, ChipDeviceScannerDelegate * delegate) { - GError * error = nullptr; + GDBusCreateObjectManagerContext context; + CHIP_ERROR err; - GCancellableUniquePtr cancellable(g_cancellable_new(), GObjectUnref()); + err = PlatformMgrImpl().GLibMatterContextInvokeSync(MainLoopCreateObjectManager, &context); + VerifyOrExit(err == CHIP_NO_ERROR, ChipLogError(Ble, "Failed to create BLE object manager")); - if (!cancellable) - { - return std::unique_ptr(); - } - - GDBusObjectManagerUniquePtr manager( - g_dbus_object_manager_client_new_for_bus_sync(G_BUS_TYPE_SYSTEM, G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE, BLUEZ_INTERFACE, - "/", bluez_object_manager_client_get_proxy_type, - nullptr /* unused user data in the Proxy Type Func */, - nullptr /*destroy notify */, cancellable.get(), &error), - GObjectUnref()); - if (!manager) - { - ChipLogError(Ble, "Failed to get DBUS object manager for device scanning: %s", error->message); - g_error_free(error); - return std::unique_ptr(); - } + return std::make_unique(context.object, adapter, context.cancellable, delegate); - return std::make_unique(manager.get(), adapter, cancellable.get(), delegate); +exit: + return std::unique_ptr(); } CHIP_ERROR ChipDeviceScanner::StartScan(System::Clock::Timeout timeout) { + assertChipStackLockedByCurrentThread(); ReturnErrorCodeIf(mIsScanning, CHIP_ERROR_INCORRECT_STATE); mIsScanning = true; // optimistic, to allow all callbacks to check this @@ -144,9 +158,7 @@ CHIP_ERROR ChipDeviceScanner::StartScan(System::Clock::Timeout timeout) return CHIP_ERROR_INTERNAL; } - DeviceLayer::PlatformMgr().LockChipStack(); CHIP_ERROR err = chip::DeviceLayer::SystemLayer().StartTimer(timeout, TimerExpiredCallback, static_cast(this)); - DeviceLayer::PlatformMgr().UnlockChipStack(); if (err != CHIP_NO_ERROR) { diff --git a/src/platform/Linux/bluez/ChipDeviceScanner.h b/src/platform/Linux/bluez/ChipDeviceScanner.h index 4dbb244c8772da..2c8c9763b2d6b4 100644 --- a/src/platform/Linux/bluez/ChipDeviceScanner.h +++ b/src/platform/Linux/bluez/ChipDeviceScanner.h @@ -66,6 +66,9 @@ class ChipDeviceScanner ~ChipDeviceScanner(); /// Initiate a scan for devices, with the given timeout + /// + /// This method must be called while in the Matter context (from the Matter event + /// loop, or while holding the Matter stack lock). CHIP_ERROR StartScan(System::Clock::Timeout timeout); /// Stop any currently running scan diff --git a/src/platform/Linux/bluez/Helper.cpp b/src/platform/Linux/bluez/Helper.cpp index f73d4ccb392ba9..56513651cbe8c3 100644 --- a/src/platform/Linux/bluez/Helper.cpp +++ b/src/platform/Linux/bluez/Helper.cpp @@ -401,16 +401,6 @@ static gboolean BluezCharacteristicWriteFD(GIOChannel * aChannel, GIOCondition a isSuccess = true; exit: - if (!isSuccess && (conn != nullptr)) - { - // Returning G_SOURCE_REMOVE from the source callback removes the source object - // from the context. Unset self source ID tag, so we will not call g_source_remove() - // in BluezOTConnectionDestroy() on already removed source. - // - // TODO: Investigate whether there is a batter way to handle this. - conn->mC1Channel.mWatch = 0; - } - return isSuccess ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE; } @@ -425,15 +415,8 @@ static void Bluez_gatt_characteristic1_complete_acquire_write_with_fd(GDBusMetho fd_list); } -static gboolean bluezCharacteristicDestroyFD(GIOChannel * aChannel, GIOCondition aCond, gpointer apClosure) +static gboolean bluezCharacteristicDestroyFD(GIOChannel * aChannel, GIOCondition aCond, gpointer apEndpoint) { - BluezConnection * conn = static_cast(apClosure); - // Returning G_SOURCE_REMOVE from the source callback removes the source object - // from the context. Unset self source ID tag, so we will not call g_source_remove() - // in BluezOTConnectionDestroy() on already removed source. - // - // TODO: Investigate whether there is a batter way to handle this. - conn->mC2Channel.mWatch = 0; return G_SOURCE_REMOVE; } @@ -442,6 +425,7 @@ static gboolean BluezCharacteristicAcquireWrite(BluezGattCharacteristic1 * aChar { int fds[2] = { -1, -1 }; GIOChannel * channel; + GSource * watchSource; #if CHIP_ERROR_LOGGING char * errStr; #endif // CHIP_ERROR_LOGGING @@ -485,10 +469,12 @@ static gboolean BluezCharacteristicAcquireWrite(BluezGattCharacteristic1 * aChar g_io_channel_set_encoding(channel, nullptr, nullptr); g_io_channel_set_close_on_unref(channel, TRUE); g_io_channel_set_buffered(channel, FALSE); - conn->mC1Channel.mpChannel = channel; - conn->mC1Channel.mWatch = g_io_add_watch(channel, static_cast(G_IO_HUP | G_IO_IN | G_IO_ERR | G_IO_NVAL), - BluezCharacteristicWriteFD, conn); + + watchSource = g_io_create_watch(channel, static_cast(G_IO_HUP | G_IO_IN | G_IO_ERR | G_IO_NVAL)); + g_source_set_callback(watchSource, G_SOURCE_FUNC(BluezCharacteristicWriteFD), conn, nullptr); + PlatformMgrImpl().GLibMatterContextAttachSource(watchSource); + conn->mC1Channel.mWatchSource = watchSource; bluez_gatt_characteristic1_set_write_acquired(aChar, TRUE); @@ -514,6 +500,7 @@ static gboolean BluezCharacteristicAcquireNotify(BluezGattCharacteristic1 * aCha { int fds[2] = { -1, -1 }; GIOChannel * channel; + GSource * watchSource; #if CHIP_ERROR_LOGGING char * errStr; #endif // CHIP_ERROR_LOGGING @@ -548,14 +535,17 @@ static gboolean BluezCharacteristicAcquireNotify(BluezGattCharacteristic1 * aCha g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed"); goto exit; } + channel = g_io_channel_unix_new(fds[0]); g_io_channel_set_encoding(channel, nullptr, nullptr); g_io_channel_set_close_on_unref(channel, TRUE); g_io_channel_set_buffered(channel, FALSE); conn->mC2Channel.mpChannel = channel; - conn->mC2Channel.mWatch = - g_io_add_watch_full(channel, G_PRIORITY_DEFAULT_IDLE, static_cast(G_IO_HUP | G_IO_ERR | G_IO_NVAL), - bluezCharacteristicDestroyFD, conn, nullptr); + + watchSource = g_io_create_watch(channel, static_cast(G_IO_HUP | G_IO_ERR | G_IO_NVAL)); + g_source_set_callback(watchSource, G_SOURCE_FUNC(bluezCharacteristicDestroyFD), conn, nullptr); + PlatformMgrImpl().GLibMatterContextAttachSource(watchSource); + conn->mC1Channel.mWatchSource = watchSource; bluez_gatt_characteristic1_set_notify_acquired(aChar, TRUE); @@ -788,12 +778,18 @@ static void BluezOTConnectionDestroy(BluezConnection * aConn) g_object_unref(aConn->mpC2); if (aConn->mpPeerAddress) g_free(aConn->mpPeerAddress); - if (aConn->mC1Channel.mWatch > 0) - g_source_remove(aConn->mC1Channel.mWatch); + if (aConn->mC1Channel.mWatchSource) + { + g_source_destroy(aConn->mC1Channel.mWatchSource); + g_source_unref(aConn->mC1Channel.mWatchSource); + } if (aConn->mC1Channel.mpChannel) g_io_channel_unref(aConn->mC1Channel.mpChannel); - if (aConn->mC2Channel.mWatch > 0) - g_source_remove(aConn->mC2Channel.mWatch); + if (aConn->mC2Channel.mWatchSource) + { + g_source_destroy(aConn->mC2Channel.mWatchSource); + g_source_unref(aConn->mC2Channel.mWatchSource); + } if (aConn->mC2Channel.mpChannel) g_io_channel_unref(aConn->mC2Channel.mpChannel); diff --git a/src/platform/Linux/bluez/Types.h b/src/platform/Linux/bluez/Types.h index b96070e9e94430..3f61c430a5f7a2 100644 --- a/src/platform/Linux/bluez/Types.h +++ b/src/platform/Linux/bluez/Types.h @@ -125,7 +125,7 @@ struct BluezAddress struct IOChannel { GIOChannel * mpChannel; - guint mWatch; + GSource * mWatchSource; }; struct BluezEndpoint diff --git a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp index 0c113604f625df..215cfddb6d37cb 100644 --- a/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp +++ b/src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp @@ -382,10 +382,6 @@ void ConnectivityManagerImpl::OnStationConnected() (void) PlatformMgr().PostEvent(&event); // Setting the rs911x in the power save mode #if (CHIP_DEVICE_CONFIG_ENABLE_SED && RS911X_WIFI) - // TODO: Remove stop advertising after BLEManagerImpl is fixed -#if RSI_BLE_ENABLE - chip::DeviceLayer::Internal::BLEManagerImpl().StopAdvertising(); -#endif /* RSI_BLE_ENABLE */ sl_status_t err = wfx_power_save(); if (err != SL_STATUS_OK) { diff --git a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp index 5778263466ceeb..515c2695191e6a 100644 --- a/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp +++ b/src/platform/silabs/NetworkCommissioningWiFiDriver.cpp @@ -179,12 +179,10 @@ void SlWiFiDriver::UpdateNetworkingStatus() ByteSpan networkId = ByteSpan((const unsigned char *) mStagingNetwork.ssid, mStagingNetwork.ssidLen); if (!wfx_is_sta_connected()) { - mpStatusChangeCallback->OnNetworkingStatusChange(Status::kUnknownError, MakeOptional(networkId), - MakeOptional((int32_t) SL_STATUS_FAIL)); + mpStatusChangeCallback->OnNetworkingStatusChange(Status::kUnknownError, MakeOptional(networkId), NullOptional); return; } - mpStatusChangeCallback->OnNetworkingStatusChange(Status::kSuccess, MakeOptional(networkId), - MakeOptional((int32_t) SL_STATUS_OK)); + mpStatusChangeCallback->OnNetworkingStatusChange(Status::kSuccess, MakeOptional(networkId), NullOptional); } void SlWiFiDriver::OnConnectWiFiNetwork() diff --git a/src/platform/silabs/SiWx917/BLEManagerImpl.cpp b/src/platform/silabs/SiWx917/BLEManagerImpl.cpp deleted file mode 100644 index 04bf47f85400d0..00000000000000 --- a/src/platform/silabs/SiWx917/BLEManagerImpl.cpp +++ /dev/null @@ -1,1023 +0,0 @@ -/* - * - * Copyright (c) 2020-2021 Project CHIP Authors - * Copyright (c) 2019 Nest Labs, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * Provides an implementation of the BLEManager singleton object - * for the Silicon Labs EFR32 platforms. - */ - -/* this file behaves like a config.h, comes first */ -#include -#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE - -#include -#define RSI_BLE_ENABLE 1 - -//#include "rail.h" -extern "C" { -#include "FreeRTOS.h" -#include "event_groups.h" -#include "task.h" -#include "timers.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" -#include "wfx_sl_ble_init.h" -#include -#include -#include -} -#include -#include -#include -#include -#include -#include - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -#include -#endif - -// static int32_t handleTxConfirmationFlag = 0; -extern uint16_t rsi_ble_measurement_hndl; -extern rsi_ble_event_conn_status_t conn_event_to_app; -extern sl_wfx_msg_t event_msg; - -StaticTask_t rsiBLETaskStruct; -rsi_semaphore_handle_t sl_rs_ble_init_sem; -rsi_semaphore_handle_t sl_ble_event_sem; - -/* wfxRsi Task will use as its stack */ -StackType_t wfxBLETaskStack[WFX_RSI_TASK_SZ] = { 0 }; - -using namespace ::chip; -using namespace ::chip::Ble; - -void sl_ble_init() -{ - ChipLogProgress(DeviceLayer, "%s starting", __func__); - - // registering the GAP callback functions - rsi_ble_gap_register_callbacks(NULL, NULL, rsi_ble_on_disconnect_event, NULL, NULL, NULL, rsi_ble_on_enhance_conn_status_event, - NULL, NULL, NULL); - - // registering the GATT call back functions - rsi_ble_gatt_register_callbacks(NULL, NULL, NULL, NULL, NULL, NULL, NULL, rsi_ble_on_gatt_write_event, NULL, NULL, NULL, - rsi_ble_on_mtu_event, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - rsi_ble_on_event_indication_confirmation, NULL); - rsi_semaphore_create(&sl_ble_event_sem, 0); - ChipLogProgress(DeviceLayer, "registering rsi_ble_add_service"); - - // Exchange of GATT info with BLE stack - rsi_ble_add_matter_service(); - - // initializing the application events map - rsi_ble_app_init_events(); - - ChipLogProgress(DeviceLayer, "StartAdvertising"); - chip::DeviceLayer::Internal::BLEManagerImpl().StartAdvertising(); // TODO:: Called on after init of module - ChipLogProgress(DeviceLayer, "%s Ended", __func__); -} - -void sl_ble_event_handling_task(void) -{ - int32_t event_id; - - ChipLogProgress(DeviceLayer, "%s starting", __func__); - rsi_semaphore_create(&sl_rs_ble_init_sem, 0); - //! This semaphore is waiting for wifi module initialization. - rsi_semaphore_wait(&sl_rs_ble_init_sem, 0); - - // Initialize BLE and starts BLE Advertisement - sl_ble_init(); - - // Application event map - while (1) - { - // checking for events list - event_id = rsi_ble_app_get_event(); - if (event_id == -1) - { - rsi_semaphore_wait(&sl_ble_event_sem, 0); - continue; - } - switch (event_id) - { - case RSI_BLE_CONN_EVENT: { - rsi_ble_app_clear_event(RSI_BLE_CONN_EVENT); - chip::DeviceLayer::Internal::BLEMgrImpl().HandleConnectEvent(); - ChipLogProgress(DeviceLayer, "%s Module got connected", __func__); - // Requests the connection parameters change with the remote device - rsi_ble_conn_params_update(event_msg.resp_enh_conn.dev_addr, BLE_MIN_CONNECTION_INTERVAL_MS, - BLE_MAX_CONNECTION_INTERVAL_MS, BLE_SLAVE_LATENCY_MS, BLE_TIMEOUT_MS); - } - break; - case RSI_BLE_DISCONN_EVENT: { - // event invokes when disconnection was completed - ChipLogProgress(DeviceLayer, "%s Module got Disconnected", __func__); - chip::DeviceLayer::Internal::BLEMgrImpl().HandleConnectionCloseEvent(event_msg.reason); - // clear the served event - rsi_ble_app_clear_event(RSI_BLE_DISCONN_EVENT); - } - break; - case RSI_BLE_MTU_EVENT: { - // event invokes when write/notification events received - ChipLogProgress(DeviceLayer, "%s RSI_BLE_MTU_EVENT", __func__); - chip::DeviceLayer::Internal::BLEMgrImpl().UpdateMtu(event_msg.rsi_ble_mtu); - // clear the served event - rsi_ble_app_clear_event(RSI_BLE_MTU_EVENT); - } - break; - case RSI_BLE_GATT_WRITE_EVENT: { - // event invokes when write/notification events received - ChipLogProgress(DeviceLayer, "%s RSI_BLE_GATT_WRITE_EVENT", __func__); - chip::DeviceLayer::Internal::BLEMgrImpl().HandleWriteEvent(event_msg.rsi_ble_write); - // clear the served event - rsi_ble_app_clear_event(RSI_BLE_GATT_WRITE_EVENT); - } - break; - case RSI_BLE_GATT_INDICATION_CONFIRMATION: { - ChipLogProgress(DeviceLayer, "%s indication confirmation", __func__); - chip::DeviceLayer::Internal::BLEMgrImpl().HandleTxConfirmationEvent(1); - rsi_ble_app_clear_event(RSI_BLE_GATT_INDICATION_CONFIRMATION); - } - break; - - case RSI_BLE_RESP_ATT_VALUE: { - ChipLogProgress(DeviceLayer, "RSI_BLE : RESP_ATT confirmation"); - } - default: - break; - } - } - - ChipLogProgress(DeviceLayer, "%s Ended", __func__); -} - -namespace chip { -namespace DeviceLayer { -namespace Internal { - -namespace { - -#define CHIP_ADV_DATA_TYPE_FLAGS (0x01) -#define CHIP_ADV_DATA_TYPE_UUID (0x03) -#define CHIP_ADV_DATA_TYPE_NAME (0x09) -#define CHIP_ADV_DATA_TYPE_SERVICE_DATA (0x16) - -#define CHIP_ADV_DATA_FLAGS (0x06) - -#define CHIP_ADV_DATA (0) -#define CHIP_ADV_SCAN_RESPONSE_DATA (1) -#define CHIP_ADV_SHORT_UUID_LEN (2) - -#define MAX_RESPONSE_DATA_LEN (31) -#define MAX_ADV_DATA_LEN (31) - -// Timer Frequency used. -#define TIMER_CLK_FREQ ((uint32_t) 32768) - -// Convert msec to timer ticks. -#define TIMER_MS_2_TIMERTICK(ms) ((TIMER_CLK_FREQ * ms) / 1000) -#define TIMER_S_2_TIMERTICK(s) (TIMER_CLK_FREQ * s) - -#define BLE_MAX_BUFFER_SIZE (3076) -#define BLE_MAX_ADVERTISERS (1) -#define BLE_CONFIG_MAX_PERIODIC_ADVERTISING_SYNC (0) -#define BLE_CONFIG_MAX_SOFTWARE_TIMERS (4) -#define BLE_CONFIG_MIN_TX_POWER (-30) -#define BLE_CONFIG_MAX_TX_POWER (80) -#define BLE_CONFIG_RF_PATH_GAIN_TX (0) -#define BLE_CONFIG_RF_PATH_GAIN_RX (0) - -// Default Connection parameters -#define BLE_CONFIG_MIN_INTERVAL (16) // Time = Value x 1.25 ms = 30ms -#define BLE_CONFIG_MAX_INTERVAL (80) // Time = Value x 1.25 ms = 100ms -#define BLE_CONFIG_LATENCY (0) -#define BLE_CONFIG_TIMEOUT (100) // Time = Value x 10 ms = 1s -#define BLE_CONFIG_MIN_CE_LENGTH (0) // Leave to min value -#define BLE_CONFIG_MAX_CE_LENGTH (0xFFFF) // Leave to max value - -#define BLE_DEFAULT_TIMER_PERIOD_MS (1) - -TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer. - -const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 }; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_RX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x11 } }; -const ChipBleUUID ChipUUID_CHIPoBLEChar_TX = { { 0x18, 0xEE, 0x2E, 0xF5, 0x26, 0x3D, 0x45, 0x59, 0x95, 0x9F, 0x4F, 0x9C, 0x42, 0x9F, - 0x9D, 0x12 } }; - -} // namespace - -BLEManagerImpl BLEManagerImpl::sInstance; - -CHIP_ERROR BLEManagerImpl::_Init() -{ - CHIP_ERROR err; - ChipLogProgress(DeviceLayer, "%s Start ", __func__); - - wfx_rsi.ble_task = xTaskCreateStatic((TaskFunction_t) sl_ble_event_handling_task, "rsi_ble", WFX_RSI_TASK_SZ, NULL, 1, - wfxBLETaskStack, &rsiBLETaskStruct); - - if (wfx_rsi.ble_task == NULL) - { - ChipLogProgress(DeviceLayer, "%s: error: failed to create ble task.", __func__); - } - - // Initialize the CHIP BleLayer. - err = BleLayer::Init(this, this, &DeviceLayer::SystemLayer()); - SuccessOrExit(err); - - memset(mBleConnections, 0, sizeof(mBleConnections)); - memset(mIndConfId, kUnusedIndex, sizeof(mIndConfId)); - mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled; - - // Create FreeRTOS sw timer for BLE timeouts and interval change. - sbleAdvTimeoutTimer = xTimerCreate("BleAdvTimer", // Just a text name, not used by the RTOS kernel - pdMS_TO_TICKS(BLE_DEFAULT_TIMER_PERIOD_MS), // == default timer period - false, // no timer reload (==one-shot) - (void *) this, // init timer id = ble obj context - BleAdvTimeoutHandler // timer callback handler - ); - - mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART); - mFlags.Set(Flags::kFastAdvertisingEnabled, true); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - -exit: - ChipLogProgress(DeviceLayer, "%s END ", __func__); - return err; -} - -uint16_t BLEManagerImpl::_NumConnections(void) -{ - uint16_t numCons = 0; - for (uint16_t i = 0; i < kMaxConnections; i++) - { - if (mBleConnections[i].allocated) - { - numCons++; - } - } - - return numCons; -} - -CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - VerifyOrExit(mServiceMode != ConnectivityManager::kCHIPoBLEServiceMode_NotSupported, err = CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE); - - if (mFlags.Has(Flags::kAdvertisingEnabled) != val) - { - mFlags.Set(Flags::kAdvertisingEnabled, val); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - } - -exit: - return err; -} - -CHIP_ERROR BLEManagerImpl::_SetAdvertisingMode(BLEAdvertisingMode mode) -{ - switch (mode) - { - case BLEAdvertisingMode::kFastAdvertising: - mFlags.Set(Flags::kFastAdvertisingEnabled, true); - break; - case BLEAdvertisingMode::kSlowAdvertising: - mFlags.Set(Flags::kFastAdvertisingEnabled, false); - break; - default: - return CHIP_ERROR_INVALID_ARGUMENT; - } - mFlags.Set(Flags::kRestartAdvertising); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - return CHIP_NO_ERROR; -} - -CHIP_ERROR BLEManagerImpl::_GetDeviceName(char * buf, size_t bufSize) -{ - if (strlen(mDeviceName) >= bufSize) - { - return CHIP_ERROR_BUFFER_TOO_SMALL; - } - strcpy(buf, mDeviceName); - return CHIP_NO_ERROR; -} - -CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName) -{ - ChipLogProgress(DeviceLayer, "_SetDeviceName Started"); - if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_NotSupported) - { - ChipLogProgress(DeviceLayer, "_SetDeviceName CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE"); - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - } - if (deviceName != NULL && deviceName[0] != 0) - { - if (strlen(deviceName) >= kMaxDeviceNameLength) - { - ChipLogProgress(DeviceLayer, "_SetDeviceName CHIP_ERROR_INVALID_ARGUMENT"); - return CHIP_ERROR_INVALID_ARGUMENT; - } - strcpy(mDeviceName, deviceName); - mFlags.Set(Flags::kDeviceNameSet); - mFlags.Set(Flags::kRestartAdvertising); - ChipLogProgress(DeviceLayer, "Setting device name to : \"%s\"", mDeviceName); - } - else - { - mDeviceName[0] = 0; - } - PlatformMgr().ScheduleWork(DriveBLEState, 0); - ChipLogProgress(DeviceLayer, "_SetDeviceName Ended"); - return CHIP_NO_ERROR; -} - -void BLEManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event) -{ - switch (event->Type) - { - case DeviceEventType::kCHIPoBLESubscribe: { - ChipDeviceEvent connEstEvent; - - ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLESubscribe"); - HandleSubscribeReceived(event->CHIPoBLESubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); - connEstEvent.Type = DeviceEventType::kCHIPoBLEConnectionEstablished; - PlatformMgr().PostEventOrDie(&connEstEvent); - } - break; - - case DeviceEventType::kCHIPoBLEUnsubscribe: { - ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEUnsubscribe"); - HandleUnsubscribeReceived(event->CHIPoBLEUnsubscribe.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); - } - break; - - case DeviceEventType::kCHIPoBLEWriteReceived: { - ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEWriteReceived"); - HandleWriteReceived(event->CHIPoBLEWriteReceived.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_RX, - PacketBufferHandle::Adopt(event->CHIPoBLEWriteReceived.Data)); - } - break; - - case DeviceEventType::kCHIPoBLEConnectionError: { - ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEConnectionError"); - HandleConnectionError(event->CHIPoBLEConnectionError.ConId, event->CHIPoBLEConnectionError.Reason); - } - break; - - case DeviceEventType::kCHIPoBLEIndicateConfirm: { - ChipLogProgress(DeviceLayer, "_OnPlatformEvent kCHIPoBLEIndicateConfirm"); - HandleIndicationConfirmation(event->CHIPoBLEIndicateConfirm.ConId, &CHIP_BLE_SVC_ID, &ChipUUID_CHIPoBLEChar_TX); - } - break; - - default: - ChipLogProgress(DeviceLayer, "_OnPlatformEvent default: event->Type = %d", event->Type); - break; - } -} - -bool BLEManagerImpl::SubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) -{ - ChipLogProgress(DeviceLayer, "BLEManagerImpl::SubscribeCharacteristic() not supported"); - return false; -} - -bool BLEManagerImpl::UnsubscribeCharacteristic(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId) -{ - ChipLogProgress(DeviceLayer, "BLEManagerImpl::UnsubscribeCharacteristic() not supported"); - return false; -} - -bool BLEManagerImpl::CloseConnection(BLE_CONNECTION_OBJECT conId) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - - ChipLogProgress(DeviceLayer, "Closing BLE GATT connection (con %u)", conId); - - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "sl_bt_connection_close() failed: %s", ErrorStr(err)); - } - - return true; //(err == CHIP_NO_ERROR); -} - -uint16_t BLEManagerImpl::GetMTU(BLE_CONNECTION_OBJECT conId) const -{ - CHIPoBLEConState * conState = const_cast(this)->GetConnectionState(conId); - return (conState != NULL) ? conState->mtu : 0; -} - -bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle data) -{ - int32_t status = 0; - ChipLogProgress(DeviceLayer, "In send indication"); - status = rsi_ble_indicate_value(event_msg.resp_enh_conn.dev_addr, event_msg.rsi_ble_measurement_hndl, (data->DataLength()), - data->Start()); - if (status != RSI_SUCCESS) - { - ChipLogProgress(DeviceLayer, "indication failed with error code %lx ", status); - return false; - } - - return true; -} - -bool BLEManagerImpl::SendWriteRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) -{ - ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendWriteRequest() not supported"); - return false; -} - -bool BLEManagerImpl::SendReadRequest(BLE_CONNECTION_OBJECT conId, const ChipBleUUID * svcId, const ChipBleUUID * charId, - PacketBufferHandle pBuf) -{ - ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendReadRequest() not supported"); - return false; -} - -bool BLEManagerImpl::SendReadResponse(BLE_CONNECTION_OBJECT conId, BLE_READ_REQUEST_CONTEXT requestContext, - const ChipBleUUID * svcId, const ChipBleUUID * charId) -{ - ChipLogProgress(DeviceLayer, "BLEManagerImpl::SendReadResponse() not supported"); - return false; -} - -void BLEManagerImpl::NotifyChipConnectionClosed(BLE_CONNECTION_OBJECT conId) -{ - // Nothing to do : Placeholder -} - -CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) -{ - switch (bleErr) - { - case SL_STATUS_OK: - return CHIP_NO_ERROR; - case SL_STATUS_BT_ATT_INVALID_ATT_LENGTH: - return CHIP_ERROR_INVALID_STRING_LENGTH; - case SL_STATUS_INVALID_PARAMETER: - return CHIP_ERROR_INVALID_ARGUMENT; - case SL_STATUS_INVALID_STATE: - return CHIP_ERROR_INCORRECT_STATE; - case SL_STATUS_NOT_SUPPORTED: - return CHIP_ERROR_UNSUPPORTED_CHIP_FEATURE; - default: - return CHIP_ERROR(ChipError::Range::kPlatform, bleErr + CHIP_DEVICE_CONFIG_SILABS_BLE_ERROR_MIN); - } -} - -void BLEManagerImpl::DriveBLEState(void) -{ - ChipLogProgress(DeviceLayer, "DriveBLEState starting"); - CHIP_ERROR err = CHIP_NO_ERROR; - - // Check if BLE stack is initialized ( TODO ) - // VerifyOrExit(mFlags.Has(Flags::kEFRBLEStackInitialized),); - - ChipLogProgress(DeviceLayer, "Start advertising if needed..."); - // Start advertising if needed... - if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled) && - NumConnections() < kMaxConnections) - { - - ChipLogProgress(DeviceLayer, "Start/re-start advertising if not already started, or if there is a pending change"); - // Start/re-start advertising if not already started, or if there is a pending change - // to the advertising configuration. - if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kRestartAdvertising)) - { - err = StartAdvertising(); - SuccessOrExit(err); - } - } - - // Otherwise, stop advertising if it is enabled. - else if (mFlags.Has(Flags::kAdvertising)) - { - err = StopAdvertising(); - SuccessOrExit(err); - } - -exit: - ChipLogProgress(DeviceLayer, "DriveBLEState End"); - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err)); - mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Disabled; - } -} - -CHIP_ERROR BLEManagerImpl::ConfigureAdvertisingData(void) -{ - - ChipBLEDeviceIdentificationInfo mDeviceIdInfo; - CHIP_ERROR err; - int32_t result; - uint8_t responseData[MAX_RESPONSE_DATA_LEN]; - uint8_t advData[MAX_ADV_DATA_LEN]; - uint32_t index = 0; - uint32_t mDeviceNameLength = 0; - uint8_t mDeviceIdInfoLength = 0; - - ChipLogProgress(DeviceLayer, "ConfigureAdvertisingData start"); - - VerifyOrExit((kMaxDeviceNameLength + 1) < UINT8_MAX, err = CHIP_ERROR_INVALID_ARGUMENT); - - memset(responseData, 0, MAX_RESPONSE_DATA_LEN); - memset(advData, 0, MAX_ADV_DATA_LEN); - - err = ConfigurationMgr().GetBLEDeviceIdentificationInfo(mDeviceIdInfo); - SuccessOrExit(err); - - if (!mFlags.Has(Flags::kDeviceNameSet)) - { - uint16_t discriminator; - SuccessOrExit(err = GetCommissionableDataProvider()->GetSetupDiscriminator(discriminator)); - - snprintf(mDeviceName, sizeof(mDeviceName), "%s%04u", CHIP_DEVICE_CONFIG_BLE_DEVICE_NAME_PREFIX, discriminator); - - mDeviceName[kMaxDeviceNameLength] = 0; - mDeviceNameLength = strlen(mDeviceName); - - VerifyOrExit(mDeviceNameLength < kMaxDeviceNameLength, err = CHIP_ERROR_INVALID_ARGUMENT); - } - - mDeviceNameLength = strlen(mDeviceName); // Device Name length + length field - VerifyOrExit(mDeviceNameLength < kMaxDeviceNameLength, err = CHIP_ERROR_INVALID_ARGUMENT); - - mDeviceIdInfoLength = sizeof(mDeviceIdInfo); // Servicedatalen + length+ UUID (Short) - static_assert(sizeof(mDeviceIdInfo) + CHIP_ADV_SHORT_UUID_LEN + 1 <= UINT8_MAX, "Our length won't fit in a uint8_t"); - static_assert(2 + CHIP_ADV_SHORT_UUID_LEN + sizeof(mDeviceIdInfo) + 1 <= MAX_ADV_DATA_LEN, "Our buffer is not big enough"); - - index = 0; - advData[index++] = 0x02; // length - advData[index++] = CHIP_ADV_DATA_TYPE_FLAGS; // AD type : flags - advData[index++] = CHIP_ADV_DATA_FLAGS; // AD value - advData[index++] = static_cast(mDeviceIdInfoLength + CHIP_ADV_SHORT_UUID_LEN + 1); // AD length - advData[index++] = CHIP_ADV_DATA_TYPE_SERVICE_DATA; // AD type : Service Data - advData[index++] = ShortUUID_CHIPoBLEService[0]; // AD value - advData[index++] = ShortUUID_CHIPoBLEService[1]; - - memcpy(&advData[index], (void *) &mDeviceIdInfo, mDeviceIdInfoLength); // AD value - index += mDeviceIdInfoLength; - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - ReturnErrorOnFailure(EncodeAdditionalDataTlv()); -#endif - - result = rsi_ble_set_advertise_data(advData, index); - if (result != SL_STATUS_OK) - { - err = MapBLEError(result); - ChipLogError(DeviceLayer, "rsi_ble_set_advertise_data() failed: %ld", result); - ExitNow(); - } - else - { - ChipLogError(DeviceLayer, "rsi_ble_set_advertise_data() success: %ld", result); - } - - err = MapBLEError(result); - - ChipLogProgress(DeviceLayer, "ConfigureAdvertisingData End"); -exit: - return CHIP_NO_ERROR; -} - -CHIP_ERROR BLEManagerImpl::StartAdvertising(void) -{ - CHIP_ERROR err; - int32_t status = 0; - - ChipLogProgress(DeviceLayer, "StartAdvertising start"); - - // If already advertising, stop it, before changing values - if (mFlags.Has(Flags::kAdvertising)) - { - // sl_bt_advertiser_stop(advertising_set_handle); - } - else - { - ChipLogDetail(DeviceLayer, "Start BLE advertissement"); - } - - err = ConfigureAdvertisingData(); - SuccessOrExit(err); - - mFlags.Clear(Flags::kRestartAdvertising); - - sl_wfx_mac_address_t macaddr; - wfx_get_wifi_mac_addr(SL_WFX_STA_INTERFACE, &macaddr); - - //! Set local name - status = rsi_ble_start_advertising(); - if (status == RSI_SUCCESS) - { - ChipLogProgress(DeviceLayer, "rsi_ble_start_advertising Success"); - - if (mFlags.Has(Flags::kFastAdvertisingEnabled)) - { - StartBleAdvTimeoutTimer(CHIP_DEVICE_CONFIG_BLE_ADVERTISING_INTERVAL_CHANGE_TIME); - } - mFlags.Set(Flags::kAdvertising); - } - else - { - ChipLogProgress(DeviceLayer, "rsi_ble_start_advertising Failed with status: %lx", status); - } - -exit: - ChipLogError(DeviceLayer, "StartAdvertising() End error: %s", ErrorStr(err)); - return CHIP_NO_ERROR; // err; -} - -// TODO:: Implementation need to be done. -CHIP_ERROR BLEManagerImpl::StopAdvertising(void) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - // sl_status_t ret; - - if (mFlags.Has(Flags::kAdvertising)) - { - mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising); - mFlags.Set(Flags::kFastAdvertisingEnabled, true); - advertising_set_handle = 0xff; - CancelBleAdvTimeoutTimer(); - } - - // exit: - return err; -} - -void BLEManagerImpl::UpdateMtu(rsi_ble_event_mtu_t evt) -{ - CHIPoBLEConState * bleConnState = GetConnectionState(event_msg.connectionHandle); - if (bleConnState != NULL) - { - // bleConnState->MTU is a 10-bit field inside a uint16_t. We're - // assigning to it from a uint16_t, and compilers warn about - // possibly not fitting. There's no way to suppress that warning - // via explicit cast; we have to disable the warning around the - // assignment. - // - // TODO: https://github.com/project-chip/connectedhomeip/issues/2569 - // tracks making this safe with a check or explaining why no check - // is needed. - ChipLogProgress(DeviceLayer, "DriveBLEState UpdateMtu %d", evt.mtu_size); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" - bleConnState->mtu = evt.mtu_size; -#pragma GCC diagnostic pop - ; - } -} - -void BLEManagerImpl::HandleBootEvent(void) -{ - mFlags.Set(Flags::kEFRBLEStackInitialized); - PlatformMgr().ScheduleWork(DriveBLEState, 0); -} - -void BLEManagerImpl::HandleConnectEvent(void) -{ - ChipLogProgress(DeviceLayer, "Connect Event for handle : %d", event_msg.connectionHandle); - AddConnection(event_msg.connectionHandle, event_msg.bondingHandle); - - PlatformMgr().ScheduleWork(DriveBLEState, 0); -} - -// TODO:: Implementation need to be done. -void BLEManagerImpl::HandleConnectionCloseEvent(uint16_t reason) -{ - uint8_t connHandle = 1; - - ChipLogProgress(DeviceLayer, "Disconnect Event for handle : %d", connHandle); - - if (RemoveConnection(connHandle)) - { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEConnectionError; - event.CHIPoBLEConnectionError.ConId = connHandle; - - switch (reason) - { - - case RSI_BT_CTRL_REMOTE_USER_TERMINATED: - case RSI_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES: - case RSI_BT_CTRL_REMOTE_POWERING_OFF: - event.CHIPoBLEConnectionError.Reason = BLE_ERROR_REMOTE_DEVICE_DISCONNECTED; - break; - default: - event.CHIPoBLEConnectionError.Reason = BLE_ERROR_CHIPOBLE_PROTOCOL_ABORT; - } - - ChipLogProgress(DeviceLayer, "BLE GATT connection closed (con %u, reason %x)", connHandle, reason); - - PlatformMgr().PostEventOrDie(&event); - - // Arrange to re-enable connectable advertising in case it was disabled due to the - // maximum connection limit being reached. - mFlags.Set(Flags::kRestartAdvertising); - mFlags.Set(Flags::kFastAdvertisingEnabled); - PlatformMgr().ScheduleWork(DriveBLEState, 0); - } -} - -void BLEManagerImpl::HandleWriteEvent(rsi_ble_event_write_t evt) -{ - // RSI_BLE_WRITE_REQUEST_EVENT - ChipLogProgress(DeviceLayer, "Char Write Req, packet type %d", evt.pkt_type); - // uint8_t attribute = (uint8_t) event_msg.rsi_ble_measurement_hndl; - - ChipLogProgress(DeviceLayer, "event_msg.rsi_ble_gatt_server_client_config_hndl = %d", - event_msg.rsi_ble_gatt_server_client_config_hndl); - - if (evt.handle[0] == (uint8_t) event_msg.rsi_ble_gatt_server_client_config_hndl) // TODO:: compare the handle exactly - { - ChipLogProgress(DeviceLayer, "Inside HandleTXCharCCCDWrite "); - HandleTXCharCCCDWrite(&evt); - } - else - { - HandleRXCharWrite(&evt); - } -} - -// TODO:: Need to implement this -void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) -{ - CHIP_ERROR err = CHIP_NO_ERROR; - bool isIndicationEnabled = false; - ChipDeviceEvent event; - - // Determine if the client is enabling or disabling notification/indication. - if (evt->att_value[0] != 0) - { - isIndicationEnabled = true; - } - ChipLogProgress(DeviceLayer, "HandleTXcharCCCDWrite - Config Flags value : %d", evt->att_value[0]); - ChipLogProgress(DeviceLayer, "CHIPoBLE %s received", isIndicationEnabled ? "subscribe" : "unsubscribe"); - - if (isIndicationEnabled) - { - // Post an event to the CHIP queue to process either a CHIPoBLE Subscribe or Unsubscribe based on - // whether the client is enabling or disabling indications. - { - event.Type = DeviceEventType::kCHIPoBLESubscribe; - event.CHIPoBLESubscribe.ConId = 1; - err = PlatformMgr().PostEvent(&event); - } - } - else - { - event.Type = DeviceEventType::kCHIPoBLEUnsubscribe; - event.CHIPoBLESubscribe.ConId = 1; - err = PlatformMgr().PostEvent(&event); - } -} - -void BLEManagerImpl::HandleRXCharWrite(rsi_ble_event_write_t * evt) -{ - uint8_t conId = 1; - CHIP_ERROR err = CHIP_NO_ERROR; - System::PacketBufferHandle buf; - uint16_t writeLen = evt->length; - uint8_t * data = (uint8_t *) evt->att_value; - - // Copy the data to a packet buffer. - buf = System::PacketBufferHandle::NewWithData(data, writeLen, 0, 0); - VerifyOrExit(!buf.IsNull(), err = CHIP_ERROR_NO_MEMORY); - - ChipLogDetail(DeviceLayer, "Write request/command received for CHIPoBLE RX characteristic ( len %d)", writeLen); - - // Post an event to the CHIP queue to deliver the data into the CHIP stack. - { - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEWriteReceived; - event.CHIPoBLEWriteReceived.ConId = conId; - event.CHIPoBLEWriteReceived.Data = std::move(buf).UnsafeRelease(); - err = PlatformMgr().PostEvent(&event); - } - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "HandleRXCharWrite() failed: %s", ErrorStr(err)); - } -} - -void BLEManagerImpl::HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId) -{ - ChipDeviceEvent event; - event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm; - event.CHIPoBLEIndicateConfirm.ConId = conId; - PlatformMgr().PostEventOrDie(&event); -} - -// TODO:: Need to Implement -void BLEManagerImpl::HandleSoftTimerEvent(void) -{ - // TODO:: Need to Implement -} - -bool BLEManagerImpl::RemoveConnection(uint8_t connectionHandle) -{ - CHIPoBLEConState * bleConnState = GetConnectionState(connectionHandle, true); - bool status = false; - - if (bleConnState != NULL) - { - memset(bleConnState, 0, sizeof(CHIPoBLEConState)); - status = true; - } - - return status; -} - -void BLEManagerImpl::AddConnection(uint8_t connectionHandle, uint8_t bondingHandle) -{ - CHIPoBLEConState * bleConnState = GetConnectionState(connectionHandle, true); - - if (bleConnState != NULL) - { - memset(bleConnState, 0, sizeof(CHIPoBLEConState)); - bleConnState->allocated = 1; - bleConnState->connectionHandle = connectionHandle; - bleConnState->bondingHandle = bondingHandle; - } -} - -BLEManagerImpl::CHIPoBLEConState * BLEManagerImpl::GetConnectionState(uint8_t connectionHandle, bool allocate) -{ - uint8_t freeIndex = kMaxConnections; - - for (uint8_t i = 0; i < kMaxConnections; i++) - { - if (mBleConnections[i].allocated == 1) - { - if (mBleConnections[i].connectionHandle == connectionHandle) - { - return &mBleConnections[i]; - } - } - - else if (i < freeIndex) - { - freeIndex = i; - } - } - - if (allocate) - { - if (freeIndex < kMaxConnections) - { - return &mBleConnections[freeIndex]; - } - - ChipLogError(DeviceLayer, "Failed to allocate CHIPoBLEConState"); - } - - return NULL; -} - -#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING -CHIP_ERROR BLEManagerImpl::EncodeAdditionalDataTlv() -{ - CHIP_ERROR err = CHIP_NO_ERROR; - BitFlags additionalDataFields; - AdditionalDataPayloadGeneratorParams additionalDataPayloadParams; - -#if CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) - uint8_t rotatingDeviceIdUniqueId[ConfigurationManager::kRotatingDeviceIDUniqueIDLength] = {}; - MutableByteSpan rotatingDeviceIdUniqueIdSpan(rotatingDeviceIdUniqueId); - - err = DeviceLayer::GetDeviceInstanceInfoProvider()->GetRotatingDeviceIdUniqueId(rotatingDeviceIdUniqueIdSpan); - SuccessOrExit(err); - err = ConfigurationMgr().GetLifetimeCounter(additionalDataPayloadParams.rotatingDeviceIdLifetimeCounter); - SuccessOrExit(err); - additionalDataPayloadParams.rotatingDeviceIdUniqueId = rotatingDeviceIdUniqueIdSpan; - additionalDataFields.Set(AdditionalDataFields::RotatingDeviceId); -#endif /* CHIP_ENABLE_ROTATING_DEVICE_ID && defined(CHIP_DEVICE_CONFIG_ROTATING_DEVICE_ID_UNIQUE_ID) */ - - err = AdditionalDataPayloadGenerator().generateAdditionalDataPayload(additionalDataPayloadParams, c3AdditionalDataBufferHandle, - additionalDataFields); - -exit: - if (err != CHIP_NO_ERROR) - { - ChipLogError(DeviceLayer, "Failed to generate TLV encoded Additional Data (%s)", __func__); - } - - return err; -} - -// TODO:: Need to do the correct implementation -void BLEManagerImpl::HandleC3ReadRequest(void) -{ - // TODO - // if (ret != SL_STATUS_OK) - // { - // ChipLogDetail(DeviceLayer, "Failed to send read response, err:%ld", ret); - // } -} -#endif // CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING - -uint8_t BLEManagerImpl::GetTimerHandle(uint8_t connectionHandle, bool allocate) -{ - uint8_t freeIndex = kMaxConnections; - - for (uint8_t i = 0; i < kMaxConnections; i++) - { - if (mIndConfId[i] == connectionHandle) - { - return i; - } - else if (allocate) - { - if (i < freeIndex) - { - freeIndex = i; - } - } - } - - if (freeIndex < kMaxConnections) - { - mIndConfId[freeIndex] = connectionHandle; - } - else - { - ChipLogError(DeviceLayer, "Failed to Save Conn Handle for indication"); - } - - return freeIndex; -} - -void BLEManagerImpl::BleAdvTimeoutHandler(TimerHandle_t xTimer) -{ - if (BLEMgrImpl().mFlags.Has(Flags::kFastAdvertisingEnabled)) - { - ChipLogDetail(DeviceLayer, "bleAdv Timeout : Start slow advertissment"); - BLEMgr().SetAdvertisingMode(BLEAdvertisingMode::kSlowAdvertising); - } -} - -void BLEManagerImpl::CancelBleAdvTimeoutTimer(void) -{ - if (xTimerStop(sbleAdvTimeoutTimer, pdMS_TO_TICKS(0)) == pdFAIL) - { - ChipLogError(DeviceLayer, "Failed to stop BledAdv timeout timer"); - } -} - -void BLEManagerImpl::StartBleAdvTimeoutTimer(uint32_t aTimeoutInMs) -{ - if (xTimerIsTimerActive(sbleAdvTimeoutTimer)) - { - CancelBleAdvTimeoutTimer(); - } - - // timer is not active, change its period to required value (== restart). - // FreeRTOS- Block for a maximum of 100 ticks if the change period command - // cannot immediately be sent to the timer command queue. - if (xTimerChangePeriod(sbleAdvTimeoutTimer, pdMS_TO_TICKS(aTimeoutInMs), pdMS_TO_TICKS(100)) != pdPASS) - { - ChipLogError(DeviceLayer, "Failed to start BledAdv timeout timer"); - } -} - -void BLEManagerImpl::DriveBLEState(intptr_t arg) -{ - sInstance.DriveBLEState(); -} - -} // namespace Internal -} // namespace DeviceLayer -} // namespace chip - -#endif // CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE diff --git a/src/platform/silabs/SiWx917/BUILD.gn b/src/platform/silabs/SiWx917/BUILD.gn index db98b116c98507..8aea32914594db 100644 --- a/src/platform/silabs/SiWx917/BUILD.gn +++ b/src/platform/silabs/SiWx917/BUILD.gn @@ -58,12 +58,12 @@ static_library("SiWx917") { "${silabs_platform_dir}/platformAbstraction/WiseMcuSpam.cpp", "../../FreeRTOS/SystemTimeSupport.cpp", "../../SingletonConfigurationManager.cpp", - "BLEManagerImpl.cpp", + "../rs911x/BLEManagerImpl.cpp", + "../rs911x/rsi_ble_config.h", + "../rs911x/wfx_sl_ble_init.c", + "../rs911x/wfx_sl_ble_init.h", "ConfigurationManagerImpl.cpp", "PlatformManagerImpl.cpp", - "bluetooth/rsi_ble_config.h", - "bluetooth/wfx_sl_ble_init.c", - "bluetooth/wfx_sl_ble_init.h", ] # TODO: OTA on CCP platform diff --git a/src/platform/silabs/efr32/BUILD.gn b/src/platform/silabs/efr32/BUILD.gn index 1a848e54820bed..d6efa34ad7388f 100644 --- a/src/platform/silabs/efr32/BUILD.gn +++ b/src/platform/silabs/efr32/BUILD.gn @@ -68,10 +68,10 @@ static_library("efr32") { if (chip_enable_ble_rs911x) { sources += [ - "rs911x/BLEManagerImpl.cpp", - "rs911x/rsi_ble_config.h", - "rs911x/wfx_sl_ble_init.c", - "rs911x/wfx_sl_ble_init.h", + "../rs911x/BLEManagerImpl.cpp", + "../rs911x/rsi_ble_config.h", + "../rs911x/wfx_sl_ble_init.c", + "../rs911x/wfx_sl_ble_init.h", ] } else { sources += [ "BLEManagerImpl.cpp" ] diff --git a/src/platform/silabs/efr32/rs911x/rsi_ble_config.h b/src/platform/silabs/efr32/rs911x/rsi_ble_config.h deleted file mode 100644 index 8fa5097d37ea53..00000000000000 --- a/src/platform/silabs/efr32/rs911x/rsi_ble_config.h +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * @file rsi_ble_config.h - * @brief - ******************************************************************************* - * # License - * Copyright 2020 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ - -#ifndef RSI_BLE_CONFIG_H -#define RSI_BLE_CONFIG_H - -#include "rsi_ble_apis.h" -#include - -/****************************************************** - * * Macros - * ******************************************************/ -//! application event list -#define RSI_BLE_CONN_EVENT 0x01 -#define RSI_BLE_DISCONN_EVENT 0x02 -#define RSI_BLE_GATT_WRITE_EVENT 0x03 -#define RSI_BLE_MTU_EVENT 0x04 -#define RSI_BLE_GATT_INDICATION_CONFIRMATION 0x05 -#define RSI_BLE_RESP_ATT_VALUE 0x06 -#define RSI_SSID 0x0D -#define RSI_SECTYPE 0x0E -#define RSI_BLE_WLAN_DISCONN_NOTIFY 0x0F -#define RSI_WLAN_ALREADY 0x10 -#define RSI_WLAN_NOT_ALREADY 0x11 -#define RSI_BLE_WLAN_TIMEOUT_NOTIFY 0x12 -#define RSI_BLE_WLAN_JOIN_STATUS 0x15 -#define RSI_APP_FW_VERSION 0x13 -#define RSI_BLE_WLAN_DISCONNECT_STATUS 0x14 - -#define RSI_REM_DEV_ADDR_LEN 18 -#define RSI_REM_DEV_NAME_LEN 31 - -#define RSI_BLE_DEV_NAME "CCP_DEVICE" -#define RSI_BLE_SET_RAND_ADDR "00:23:A7:12:34:56" - -#define CLEAR_WHITELIST 0x00 -#define ADD_DEVICE_TO_WHITELIST 0x01 -#define DELETE_DEVICE_FROM_WHITELIST 0x02 - -#define ALL_PHYS 0x00 - -#define RSI_BLE_DEV_ADDR_RESOLUTION_ENABLE 0 - -#define RSI_OPERMODE_WLAN_BLE 13 - -/***********************************************************************************************************************************************/ -//! Characteristic Presenatation Format Fields -/***********************************************************************************************************************************************/ -#define RSI_BLE_UINT8_FORMAT 0x04 -#define RSI_BLE_EXPONENT 0x00 -#define RSI_BLE_PERCENTAGE_UNITS_UUID 0x27AD -#define RSI_BLE_NAME_SPACE 0x01 -#define RSI_BLE_DESCRIPTION 0x010B - -//! BLE characteristic custom service uuid -#define RSI_BLE_CUSTOM_SERVICE_UUID 0xFFF6 -#define RSI_BLE_CUSTOM_LEVEL_UUID 0x1FF1 - -#ifdef RSI_M4_INTERFACE -#define RSI_BLE_MAX_NBR_ATT_REC 20 -#define RSI_BLE_MAX_NBR_SLAVES 1 -#define RSI_BLE_NUM_CONN_EVENTS 2 -#else -#define RSI_BLE_MAX_NBR_ATT_REC 80 -#define RSI_BLE_MAX_NBR_SLAVES 3 -#define RSI_BLE_NUM_CONN_EVENTS 20 -#endif - -#define RSI_BLE_MAX_NBR_ATT_SERV 10 - -#define RSI_BLE_MAX_NBR_MASTERS 1 -#define RSI_BLE_GATT_ASYNC_ENABLE 1 -#define RSI_BLE_GATT_INIT 0 - -#define RSI_BLE_START_SCAN 0x01 -#define RSI_BLE_STOP_SCAN 0x00 - -#define RSI_BLE_SCAN_TYPE SCAN_TYPE_ACTIVE -#define RSI_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL -/* Number of BLE GATT RECORD SIZE IN (n*16 BYTES), eg:(0x40*16)=1024 bytes */ -#define RSI_BLE_NUM_REC_BYTES 0x40 - -#define RSI_BLE_INDICATE_CONFIRMATION_FROM_HOST 0 - -/*=======================================================================*/ -//! Advertising command parameters -/*=======================================================================*/ - -#define RSI_BLE_ADV_TYPE UNDIR_CONN -#define RSI_BLE_ADV_FILTER_TYPE ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY -#define RSI_BLE_ADV_DIR_ADDR_TYPE LE_PUBLIC_ADDRESS -#define RSI_BLE_ADV_DIR_ADDR "00:15:83:6A:64:17" - -#define RSI_BLE_ADV_INT_MIN 0x20 -#define RSI_BLE_ADV_INT_MAX 0x20 -#define RSI_BLE_ADV_CHANNEL_MAP 0x07 - -//! Advertise status -//! Start the advertising process -#define RSI_BLE_START_ADV 0x01 -//! Stop the advertising process -#define RSI_BLE_STOP_ADV 0x00 - -//! BLE Tx Power Index On Air -#define RSI_BLE_PWR_INX 30 - -//! BLE Active H/w Pwr Features -#define BLE_DISABLE_DUTY_CYCLING 0 -#define BLE_DUTY_CYCLING 1 -#define BLR_DUTY_CYCLING 2 -#define BLE_4X_PWR_SAVE_MODE 4 -#define RSI_BLE_PWR_SAVE_OPTIONS BLE_DISABLE_DUTY_CYCLING - -//! Advertise types - -/* Advertising will be visible(discoverable) to all the devices. - * Scanning/Connection is also accepted from all devices - * */ -#define UNDIR_CONN 0x80 - -/* Advertising will be visible(discoverable) to the particular device - * mentioned in RSI_BLE_ADV_DIR_ADDR only. - * Scanning and Connection will be accepted from that device only. - * */ -#define DIR_CONN 0x81 - -/* Advertising will be visible(discoverable) to all the devices. - * Scanning will be accepted from all the devices. - * Connection will be not be accepted from any device. - * */ -#define UNDIR_SCAN 0x82 - -/* Advertising will be visible(discoverable) to all the devices. - * Scanning and Connection will not be accepted from any device - * */ -#define UNDIR_NON_CONN 0x83 - -/* Advertising will be visible(discoverable) to the particular device - * mentioned in RSI_BLE_ADV_DIR_ADDR only. - * Scanning and Connection will be accepted from that device only. - * */ -#define DIR_CONN_LOW_DUTY_CYCLE 0x84 - -//! Advertising flags -#define LE_LIMITED_DISCOVERABLE 0x01 -#define LE_GENERAL_DISCOVERABLE 0x02 -#define LE_BR_EDR_NOT_SUPPORTED 0x04 - -//! Advertise filters -#define ALLOW_SCAN_REQ_ANY_CONN_REQ_ANY 0x00 -#define ALLOW_SCAN_REQ_WHITE_LIST_CONN_REQ_ANY 0x01 -#define ALLOW_SCAN_REQ_ANY_CONN_REQ_WHITE_LIST 0x02 -#define ALLOW_SCAN_REQ_WHITE_LIST_CONN_REQ_WHITE_LIST 0x03 - -//! Address types -#define LE_PUBLIC_ADDRESS 0x00 -#define LE_RANDOM_ADDRESS 0x01 -#define LE_RESOLVABLE_PUBLIC_ADDRESS 0x02 -#define LE_RESOLVABLE_RANDOM_ADDRESS 0x03 - -/*=======================================================================*/ - -/*=======================================================================*/ -//! Connection parameters -/*=======================================================================*/ -#define LE_SCAN_INTERVAL 0x0100 -#define LE_SCAN_WINDOW 0x0050 - -#define CONNECTION_INTERVAL_MIN 0x00A0 -#define CONNECTION_INTERVAL_MAX 0x00A0 - -#define CONNECTION_LATENCY 0x0000 -#define SUPERVISION_TIMEOUT 0x07D0 // 2000 - -/*=======================================================================*/ - -/*=======================================================================*/ -//! Scan command parameters -/*=======================================================================*/ - -#define SL_WFX_BLE_SCAN_TYPE SCAN_TYPE_ACTIVE -#define SL_WFX_BLE_SCAN_FILTER_TYPE SCAN_FILTER_TYPE_ALL - -//! Scan status -#define SL_WFX_BLE_START_SCAN 0x01 -#define SL_WFX_BLE_STOP_SCAN 0x00 - -//! Scan types -#define SCAN_TYPE_ACTIVE 0x01 -#define SCAN_TYPE_PASSIVE 0x00 - -//! Scan filters -#define SCAN_FILTER_TYPE_ALL 0x00 -#define SCAN_FILTER_TYPE_ONLY_WHITE_LIST 0x01 - -#define SL_WFX_SEL_INTERNAL_ANTENNA 0x00 -#define SL_WFX_SEL_EXTERNAL_ANTENNA 0x01 - -#define SL_WFX_BT_CTRL_REMOTE_USER_TERMINATED 0x4E13 -#define SL_WFX_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x4E14 -#define SL_WFX_BT_CTRL_REMOTE_POWERING_OFF 0x4E15 -#define SL_WFX_BT_CTRL_TERMINATED_MIC_FAILURE 0x4E3D -#define SL_WFX_BT_FAILED_TO_ESTABLISH_CONN 0x4E3E -#define SL_WFX_BT_INVALID_RANGE 0x4E60 - -/***********************************************************************************************************************************************/ -//! RS9116 Firmware Configurations -/***********************************************************************************************************************************************/ - -/*=======================================================================*/ -//! Opermode command parameters -/*=======================================================================*/ -/* -#define RSI_FEATURE_BIT_MAP \ - (FEAT_ULP_GPIO_BASED_HANDSHAKE | FEAT_DEV_TO_HOST_ULP_GPIO_1) //! To set wlan feature select bit map -#define RSI_TCP_IP_BYPASS RSI_DISABLE //! TCP IP BYPASS feature check -#define RSI_TCP_IP_FEATURE_BIT_MAP \ - (TCP_IP_FEAT_DHCPV4_CLIENT) //! TCP/IP feature select bitmap for selecting TCP/IP features -#define RSI_EXT_TCPIP_FEATURE_BITMAP 0 - -#define RSI_CUSTOM_FEATURE_BIT_MAP FEAT_CUSTOM_FEAT_EXTENTION_VALID //! To set custom feature select bit map - -#define RSI_EXT_CUSTOM_FEATURE_BIT_MAP (EXT_FEAT_LOW_POWER_MODE | EXT_FEAT_XTAL_CLK_ENABLE | EXT_FEAT_384K_MODE) - -#define RSI_BT_FEATURE_BITMAP (BT_RF_TYPE | ENABLE_BLE_PROTOCOL) -*/ -/*=======================================================================*/ -//! Power save command parameters -/*=======================================================================*/ -//! set handshake type of power mode -#define RSI_HAND_SHAKE_TYPE GPIO_BASED - -#define BLE_ATT_REC_SIZE 500 -#define NO_OF_VAL_ATT 5 //! Attribute value count - -/***********************************************************************************************************************************************/ -//! user defined structure -/***********************************************************************************************************************************************/ -typedef struct rsi_ble_att_list_s -{ - uuid_t char_uuid; - uint16_t handle; - uint16_t value_len; - uint16_t max_value_len; - uint8_t char_val_prop; - void * value; -} rsi_ble_att_list_t; -typedef struct rsi_ble_s -{ - uint8_t DATA[BLE_ATT_REC_SIZE]; - uint16_t DATA_ix; - uint16_t att_rec_list_count; - rsi_ble_att_list_t att_rec_list[NO_OF_VAL_ATT]; -} rsi_ble_t; - -#endif diff --git a/src/platform/silabs/efr32/rs911x/wfx_sl_ble_init.c b/src/platform/silabs/efr32/rs911x/wfx_sl_ble_init.c deleted file mode 100644 index d93e173cef9d36..00000000000000 --- a/src/platform/silabs/efr32/rs911x/wfx_sl_ble_init.c +++ /dev/null @@ -1,422 +0,0 @@ -/******************************************************************************* - * @file wfx_sl_ble_init.c - * @brief - ******************************************************************************* - * # License - * Copyright 2021 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ -/************************************************************************* - * - */ - -/*================================================================================ -* @brief : This file contains example application for Wlan Station BLE -* Provisioning -* @section Description : -* This application explains how to get the WLAN connection functionality using -* BLE provisioning. -* Silicon Labs Module starts advertising and with BLE Provisioning the Access Point -* details are fetched. -* Silicon Labs device is configured as a WiFi station and connects to an Access Point. -=================================================================================*/ - -#include "wfx_sl_ble_init.h" -#include "rsi_ble_config.h" - -// application defines -rsi_ble_event_conn_status_t conn_event_to_app; -rsi_ble_t att_list; -sl_wfx_msg_t event_msg; -extern rsi_semaphore_handle_t sl_ble_event_sem; - -// Memory to initialize driver -uint8_t bt_global_buf[BT_GLOBAL_BUFF_LEN]; -const uint8_t ShortUUID_CHIPoBLEService[] = { 0xF6, 0xFF }; - -/*==============================================*/ -/** - * @fn rsi_ble_app_init_events - * @brief initializes the event parameter. - * @param[in] none. - * @return none. - * @section description - * This function is used during BLE initialization. - */ -void rsi_ble_app_init_events() -{ - SILABS_LOG("%s: starting", __func__); - event_msg.ble_app_event_map = 0; - event_msg.ble_app_event_mask = 0xFFFFFFFF; - event_msg.ble_app_event_mask = event_msg.ble_app_event_mask; // To suppress warning while compiling - return; -} - -/*==============================================*/ -/** - * @fn rsi_ble_app_clear_event - * @brief clears the specific event. - * @param[in] event_num, specific event number. - * @return none. - * @section description - * This function is used to clear the specific event. - */ -void rsi_ble_app_clear_event(uint32_t event_num) -{ - SILABS_LOG("%s: starting", __func__); - event_msg.event_num = event_num; - event_msg.ble_app_event_map &= ~BIT(event_num); - return; -} - -/*==============================================*/ -/** - * @fn rsi_ble_on_mtu_event - * @brief its invoked when mtu exhange event is received. - * @param[in] rsi_ble_mtu, mtu event paramaters. - * @return none. - * @section description - * This callback function is invoked when mtu exhange event is received - */ -void rsi_ble_on_mtu_event(rsi_ble_event_mtu_t * rsi_ble_mtu) -{ - SILABS_LOG("%s: starting", __func__); - memcpy(&event_msg.rsi_ble_mtu, rsi_ble_mtu, sizeof(rsi_ble_event_mtu_t)); - rsi_ble_app_set_event(RSI_BLE_MTU_EVENT); -} - -/*==============================================*/ -/** - * @fn rsi_ble_on_gatt_write_event - * @brief its invoked when write/notify/indication events are received. - * @param[in] event_id, it indicates write/notification event id. - * @param[in] rsi_ble_write, write event parameters. - * @return none. - * @section description - * This callback function is invoked when write/notify/indication events are received - */ -void rsi_ble_on_gatt_write_event(uint16_t event_id, rsi_ble_event_write_t * rsi_ble_write) -{ - SILABS_LOG("%s: starting", __func__); - event_msg.event_id = event_id; - memcpy(&event_msg.rsi_ble_write, rsi_ble_write, sizeof(rsi_ble_event_write_t)); - rsi_ble_app_set_event(RSI_BLE_GATT_WRITE_EVENT); -} - -/*==============================================*/ -/** - * @fn rsi_ble_on_enhance_conn_status_event - * @brief invoked when enhanced connection complete event is received - * @param[out] resp_conn, connected remote device information - * @return none. - * @section description - * This callback function indicates the status of the connection - */ -void rsi_ble_on_enhance_conn_status_event(rsi_ble_event_enhance_conn_status_t * resp_enh_conn) -{ - SILABS_LOG("%s: starting", __func__); - event_msg.connectionHandle = 1; - event_msg.bondingHandle = 255; - memcpy(event_msg.resp_enh_conn.dev_addr, resp_enh_conn->dev_addr, RSI_DEV_ADDR_LEN); - rsi_ble_app_set_event(RSI_BLE_CONN_EVENT); -} - -/*==============================================*/ -/** - * @fn rsi_ble_on_disconnect_event - * @brief invoked when disconnection event is received - * @param[in] resp_disconnect, disconnected remote device information - * @param[in] reason, reason for disconnection. - * @return none. - * @section description - * This callback function indicates disconnected device information and status - */ -void rsi_ble_on_disconnect_event(rsi_ble_event_disconnect_t * resp_disconnect, uint16_t reason) -{ - SILABS_LOG("%s: starting", __func__); - event_msg.reason = reason; - rsi_ble_app_set_event(RSI_BLE_DISCONN_EVENT); -} - -/*==============================================*/ -/** - * @fn rsi_ble_on_event_indication_confirmation - * @brief this function will invoke when received indication confirmation event - * @param[out] resp_id, response id - * @param[out] status, status of the response - * @return none - * @section description - */ -void rsi_ble_on_event_indication_confirmation(uint16_t resp_status, rsi_ble_set_att_resp_t * rsi_ble_event_set_att_rsp) -{ - SILABS_LOG("%s: starting", __func__); - event_msg.resp_status = resp_status; - memcpy(&event_msg.rsi_ble_event_set_att_rsp, rsi_ble_event_set_att_rsp, sizeof(rsi_ble_set_att_resp_t)); - rsi_ble_app_set_event(RSI_BLE_GATT_INDICATION_CONFIRMATION); -} - -/*==============================================*/ -/** - * @fn rsi_ble_app_get_event - * @brief returns the first set event based on priority - * @param[in] none. - * @return int32_t - * > 0 = event number - * -1 = not received any event - * @section description - * This function returns the highest priority event among all the set events - */ -int32_t rsi_ble_app_get_event(void) -{ - uint32_t ix; - - for (ix = 0; ix < 32; ix++) - { - if (event_msg.ble_app_event_map & (1 << ix)) - { - return ix; - } - } - - return (-1); -} - -/*==============================================*/ -/** - * @fn rsi_ble_app_set_event - * @brief set the specific event. - * @param[in] event_num, specific event number. - * @return none. - * @section description - * This function is used to set/raise the specific event. - */ -void rsi_ble_app_set_event(uint32_t event_num) -{ - SILABS_LOG("%s: starting", __func__); - event_msg.ble_app_event_map |= BIT(event_num); - rsi_semaphore_post(&sl_ble_event_sem); - return; -} - -/*==============================================*/ -/** - * @fn rsi_gatt_add_attribute_to_list - * @brief This function is used to store characteristic service attribute. - * @param[in] p_val, pointer to homekit structure - * @param[in] handle, characteristic service attribute handle. - * @param[in] data_len, characteristic value length - * @param[in] data, characteristic value pointer - * @param[in] uuid, characteristic value uuid - * @return none. - * @section description - * This function is used to store all attribute records - */ -void rsi_gatt_add_attribute_to_list(rsi_ble_t * p_val, uint16_t handle, uint16_t data_len, uint8_t * data, uuid_t uuid, - uint8_t char_prop) -{ - if ((p_val->DATA_ix + data_len) >= BLE_ATT_REC_SIZE) - { //! Check for max data length for the characteristic value - LOG_PRINT("\r\n no data memory for att rec values \r\n"); - return; - } - - p_val->att_rec_list[p_val->att_rec_list_count].char_uuid = uuid; - p_val->att_rec_list[p_val->att_rec_list_count].handle = handle; - p_val->att_rec_list[p_val->att_rec_list_count].value_len = data_len; - p_val->att_rec_list[p_val->att_rec_list_count].max_value_len = data_len; - p_val->att_rec_list[p_val->att_rec_list_count].char_val_prop = char_prop; - memcpy(p_val->DATA + p_val->DATA_ix, data, data_len); - p_val->att_rec_list[p_val->att_rec_list_count].value = p_val->DATA + p_val->DATA_ix; - p_val->att_rec_list_count++; - p_val->DATA_ix += p_val->att_rec_list[p_val->att_rec_list_count].max_value_len; - - return; -} - -/*==============================================*/ -/** - * @fn rsi_ble_add_char_serv_att - * @brief this function is used to add characteristic service attribute.. - * @param[in] serv_handler, service handler. - * @param[in] handle, characteristic service attribute handle. - * @param[in] val_prop, characteristic value property. - * @param[in] att_val_handle, characteristic value handle - * @param[in] att_val_uuid, characteristic value uuid - * @return none. - * @section description - * This function is used at application to add characteristic attribute - */ -void rsi_ble_add_char_serv_att(void * serv_handler, uint16_t handle, uint8_t val_prop, uint16_t att_val_handle, uuid_t att_val_uuid) -{ - rsi_ble_req_add_att_t new_att = { 0 }; - - //! preparing the attribute service structure - new_att.serv_handler = serv_handler; - new_att.handle = handle; - new_att.att_uuid.size = 2; - new_att.att_uuid.val.val16 = RSI_BLE_CHAR_SERV_UUID; - new_att.property = RSI_BLE_ATT_PROPERTY_READ; - - //! preparing the characteristic attribute value - new_att.data_len = att_val_uuid.size + 4; - new_att.data[0] = val_prop; - rsi_uint16_to_2bytes(&new_att.data[2], att_val_handle); - if (new_att.data_len == 6) - { - rsi_uint16_to_2bytes(&new_att.data[4], att_val_uuid.val.val16); - } - else if (new_att.data_len == 8) - { - rsi_uint32_to_4bytes(&new_att.data[4], att_val_uuid.val.val32); - } - else if (new_att.data_len == 20) - { - memcpy(&new_att.data[4], &att_val_uuid.val.val128, att_val_uuid.size); - } - //! Add attribute to the service - rsi_ble_add_attribute(&new_att); - - return; -} - -/*==============================================*/ -/** - * @fn rsi_ble_add_char_val_att - * @brief this function is used to add characteristic value attribute. - * @param[in] serv_handler, new service handler. - * @param[in] handle, characteristic value attribute handle. - * @param[in] att_type_uuid, attribute uuid value. - * @param[in] val_prop, characteristic value property. - * @param[in] data, characteristic value data pointer. - * @param[in] data_len, characteristic value length. - * @return none. - * @section description - * This function is used at application to create new service. - */ - -void rsi_ble_add_char_val_att(void * serv_handler, uint16_t handle, uuid_t att_type_uuid, uint8_t val_prop, uint8_t * data, - uint8_t data_len, uint8_t auth_read) -{ - rsi_ble_req_add_att_t new_att = { 0 }; - - //! preparing the attributes - new_att.serv_handler = serv_handler; - new_att.handle = handle; - new_att.config_bitmap = auth_read; - memcpy(&new_att.att_uuid, &att_type_uuid, sizeof(uuid_t)); - new_att.property = val_prop; - - if (data != NULL) - memcpy(new_att.data, data, RSI_MIN(sizeof(new_att.data), data_len)); - - //! preparing the attribute value - new_att.data_len = data_len; - - //! add attribute to the service - rsi_ble_add_attribute(&new_att); - - if ((auth_read == ATT_REC_MAINTAIN_IN_HOST) || (data_len > 20)) - { - if (data != NULL) - { - rsi_gatt_add_attribute_to_list(&att_list, handle, data_len, data, att_type_uuid, val_prop); - } - } - - //! check the attribute property with notification/Indication - if ((val_prop & RSI_BLE_ATT_PROPERTY_NOTIFY) || (val_prop & RSI_BLE_ATT_PROPERTY_INDICATE)) - { - //! if notification/indication property supports then we need to add client characteristic service. - - //! preparing the client characteristic attribute & values - memset(&new_att, 0, sizeof(rsi_ble_req_add_att_t)); - new_att.serv_handler = serv_handler; - new_att.handle = handle + 1; - new_att.att_uuid.size = 2; - new_att.att_uuid.val.val16 = RSI_BLE_CLIENT_CHAR_UUID; - new_att.property = RSI_BLE_ATT_PROPERTY_READ | RSI_BLE_ATT_PROPERTY_WRITE; - new_att.data_len = 2; - - //! add attribute to the service - rsi_ble_add_attribute(&new_att); - } - - return; -} - -/*==============================================*/ -/** - * @fn rsi_ble_add_matter_service - * @brief this function is used to add service for matter - * @return status (uint32_t) 0 for success. - * @section description - * This function is used at application to create new service. - */ - -uint32_t rsi_ble_add_matter_service(void) -{ - uuid_t custom_service = { RSI_BLE_MATTER_CUSTOM_SERVICE_UUID }; - custom_service.size = RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE; - custom_service.val.val16 = RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16; - uint8_t data[230] = { RSI_BLE_MATTER_CUSTOM_SERVICE_DATA }; - - static const uuid_t custom_characteristic_RX = { .size = RSI_BLE_CUSTOM_CHARACTERISTIC_RX_SIZE, - .reserved = { RSI_BLE_CUSTOM_CHARACTERISTIC_RX_RESERVED }, - .val.val128.data1 = RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_1, - .val.val128.data2 = RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_2, - .val.val128.data3 = RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_3, - .val.val128.data4 = { RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_4 } }; - - rsi_ble_resp_add_serv_t new_serv_resp = { 0 }; - rsi_ble_add_service(custom_service, &new_serv_resp); - - // Adding custom characteristic declaration to the custom service - rsi_ble_add_char_serv_att( - new_serv_resp.serv_handler, new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_RX_ATTRIBUTE_HANDLE_LOCATION, - RSI_BLE_ATT_PROPERTY_WRITE | RSI_BLE_ATT_PROPERTY_READ, // Set read, write, write without response - new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_RX_VALUE_HANDLE_LOCATION, custom_characteristic_RX); - - // Adding characteristic value attribute to the service - rsi_ble_add_char_val_att(new_serv_resp.serv_handler, - new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_RX_VALUE_HANDLE_LOCATION, custom_characteristic_RX, - RSI_BLE_ATT_PROPERTY_WRITE | RSI_BLE_ATT_PROPERTY_READ, // Set read, write, write without response - data, sizeof(data), ATT_REC_IN_HOST); - - static const uuid_t custom_characteristic_TX = { .size = RSI_BLE_CUSTOM_CHARACTERISTIC_TX_SIZE, - .reserved = { RSI_BLE_CUSTOM_CHARACTERISTIC_TX_RESERVED }, - .val.val128.data1 = RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_1, - .val.val128.data2 = RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_2, - .val.val128.data3 = RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_3, - .val.val128.data4 = { RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_4 } }; - - // Adding custom characteristic declaration to the custom service - rsi_ble_add_char_serv_att( - new_serv_resp.serv_handler, new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_TX_ATTRIBUTE_HANDLE_LOCATION, - RSI_BLE_ATT_PROPERTY_WRITE_NO_RESPONSE | RSI_BLE_ATT_PROPERTY_WRITE | RSI_BLE_ATT_PROPERTY_READ | - RSI_BLE_ATT_PROPERTY_NOTIFY | RSI_BLE_ATT_PROPERTY_INDICATE, // Set read, write, write without response - new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_TX_MEASUREMENT_HANDLE_LOCATION, custom_characteristic_TX); - - // Adding characteristic value attribute to the service - event_msg.rsi_ble_measurement_hndl = new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_TX_MEASUREMENT_HANDLE_LOCATION; - - // Adding characteristic value attribute to the service - event_msg.rsi_ble_gatt_server_client_config_hndl = - new_serv_resp.start_handle + RSI_BLE_CHARACTERISTIC_TX_GATT_SERVER_CLIENT_HANDLE_LOCATION; - - rsi_ble_add_char_val_att(new_serv_resp.serv_handler, event_msg.rsi_ble_measurement_hndl, custom_characteristic_TX, - RSI_BLE_ATT_PROPERTY_WRITE_NO_RESPONSE | RSI_BLE_ATT_PROPERTY_WRITE | RSI_BLE_ATT_PROPERTY_READ | - RSI_BLE_ATT_PROPERTY_NOTIFY | - RSI_BLE_ATT_PROPERTY_INDICATE, // Set read, write, write without response - data, sizeof(data), ATT_REC_MAINTAIN_IN_HOST); - - memset(&data, 0, sizeof(data)); - return 0; -} diff --git a/src/platform/silabs/efr32/rs911x/wfx_sl_ble_init.h b/src/platform/silabs/efr32/rs911x/wfx_sl_ble_init.h deleted file mode 100644 index e52e1553de540d..00000000000000 --- a/src/platform/silabs/efr32/rs911x/wfx_sl_ble_init.h +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * @file wfx_sl_ble_init.h - * @brief - ******************************************************************************* - * # License - * Copyright 2021 Silicon Laboratories Inc. www.silabs.com - ******************************************************************************* - * - * The licensor of this software is Silicon Laboratories Inc. Your use of this - * software is governed by the terms of Silicon Labs Master Software License - * Agreement (MSLA) available at - * www.silabs.com/about-us/legal/master-software-license-agreement. This - * software is distributed to you in Source Code format and is governed by the - * sections of the MSLA applicable to Source Code. - * - ******************************************************************************/ -/************************************************************************* - * - */ - -/** - * Include files - * */ - -#ifndef WFX_SL_BLE_INIT -#define WFX_SL_BLE_INIT -#define RSI_BLE_ENABLE 1 - -// BLE include file to refer BLE APIs -#include "FreeRTOS.h" -#include "event_groups.h" -#include "rsi_ble_config.h" -#include "task.h" -#include "timers.h" -#include "wfx_host_events.h" -#include "wfx_rsi.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef RSI_M4_INTERFACE -#include "rsi_board.h" -#endif - -typedef struct sl_wfx_msg_s -{ - uint8_t connectionHandle; - uint8_t bondingHandle; - uint32_t event_num; - uint16_t reason; - uint16_t event_id; - uint16_t resp_status; - rsi_ble_event_mtu_t rsi_ble_mtu; - rsi_ble_event_write_t rsi_ble_write; - rsi_ble_event_enhance_conn_status_t resp_enh_conn; - rsi_ble_event_disconnect_t * resp_disconnect; - rsi_ble_set_att_resp_t rsi_ble_event_set_att_rsp; - uint32_t ble_app_event_map; - uint32_t ble_app_event_mask; - uint16_t rsi_ble_measurement_hndl; - uint16_t rsi_ble_gatt_server_client_config_hndl; - uint16_t subscribed; - -} sl_wfx_msg_t; - -#define ATT_REC_IN_HOST 0 - -#define RSI_BT_CTRL_REMOTE_USER_TERMINATED 0x4E13 -#define RSI_BT_CTRL_REMOTE_DEVICE_TERMINATED_CONNECTION_DUE_TO_LOW_RESOURCES 0x4E14 -#define RSI_BT_CTRL_REMOTE_POWERING_OFF 0x4E15 -#define RSI_BT_CTRL_TERMINATED_MIC_FAILURE 0x4E3D -#define RSI_BT_FAILED_TO_ESTABLISH_CONN 0x4E3E -#define RSI_BT_INVALID_RANGE 0x4E60 - -#define RSI_BLE_MATTER_CUSTOM_SERVICE_UUID 0 -#define RSI_BLE_MATTER_CUSTOM_SERVICE_SIZE 2 -#define RSI_BLE_MATTER_CUSTOM_SERVICE_VALUE_16 0xFFF6 -#define RSI_BLE_MATTER_CUSTOM_SERVICE_DATA 0x00 - -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_SIZE 16 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_RESERVED 0x00, 0x00, 0x00 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_1 0x18EE2EF5 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_2 0x263D -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_3 0x4559 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_RX_VALUE_128_DATA_4 0x9F, 0x95, 0x9C, 0x4F, 0x11, 0x9D, 0x9F, 0x42 -#define RSI_BLE_CHARACTERISTIC_RX_ATTRIBUTE_HANDLE_LOCATION 1 -#define RSI_BLE_CHARACTERISTIC_RX_VALUE_HANDLE_LOCATION 2 - -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_SIZE 16 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_RESERVED 0x00, 0x00, 0x00 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_1 0x18EE2EF5 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_2 0x263D -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_3 0x4559 -#define RSI_BLE_CUSTOM_CHARACTERISTIC_TX_VALUE_128_DATA_4 0x9F, 0x95, 0x9C, 0x4F, 0x12, 0x9D, 0x9F, 0x42 -#define RSI_BLE_CHARACTERISTIC_TX_ATTRIBUTE_HANDLE_LOCATION 3 -#define RSI_BLE_CHARACTERISTIC_TX_MEASUREMENT_HANDLE_LOCATION 4 -#define RSI_BLE_CHARACTERISTIC_TX_GATT_SERVER_CLIENT_HANDLE_LOCATION 5 - -// ALL Ble functions -void rsi_ble_on_connect_event(rsi_ble_event_conn_status_t * resp_conn); -void rsi_ble_on_disconnect_event(rsi_ble_event_disconnect_t * resp_disconnect, uint16_t reason); -void rsi_ble_on_enhance_conn_status_event(rsi_ble_event_enhance_conn_status_t * resp_enh_conn); -void rsi_ble_on_gatt_write_event(uint16_t event_id, rsi_ble_event_write_t * rsi_ble_write); -void rsi_ble_on_mtu_event(rsi_ble_event_mtu_t * rsi_ble_mtu); -void rsi_ble_on_event_indication_confirmation(uint16_t resp_status, rsi_ble_set_att_resp_t * rsi_ble_event_set_att_rsp); -void rsi_gatt_add_attribute_to_list(rsi_ble_t * p_val, uint16_t handle, uint16_t data_len, uint8_t * data, uuid_t uuid, - uint8_t char_prop); -void rsi_ble_add_char_serv_att(void * serv_handler, uint16_t handle, uint8_t val_prop, uint16_t att_val_handle, - uuid_t att_val_uuid); -void rsi_ble_add_char_val_att(void * serv_handler, uint16_t handle, uuid_t att_type_uuid, uint8_t val_prop, uint8_t * data, - uint8_t data_len, uint8_t auth_read); -uint32_t rsi_ble_add_matter_service(void); -void rsi_ble_app_set_event(uint32_t event_num); -int32_t rsi_ble_app_get_event(void); -void rsi_ble_app_clear_event(uint32_t event_num); -void rsi_ble_app_init_events(); -void rsi_ble_event_handling_task(void); - -#endif \ No newline at end of file diff --git a/src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp b/src/platform/silabs/rs911x/BLEManagerImpl.cpp similarity index 94% rename from src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp rename to src/platform/silabs/rs911x/BLEManagerImpl.cpp index 4a910e0a29aae5..b1dc9f77e2cb2c 100644 --- a/src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp +++ b/src/platform/silabs/rs911x/BLEManagerImpl.cpp @@ -28,7 +28,9 @@ #include +#ifndef SIWX_917 #include "rail.h" +#endif #ifdef __cplusplus extern "C" { @@ -75,7 +77,6 @@ using namespace ::chip::DeviceLayer::Internal; void sl_ble_init() { - SILABS_LOG("%s starting", __func__); // registering the GAP callback functions rsi_ble_gap_register_callbacks(NULL, NULL, rsi_ble_on_disconnect_event, NULL, NULL, NULL, rsi_ble_on_enhance_conn_status_event, @@ -86,25 +87,18 @@ void sl_ble_init() rsi_ble_on_mtu_event, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, rsi_ble_on_event_indication_confirmation, NULL); - SILABS_LOG("registering rsi_ble_add_service"); - // Exchange of GATT info with BLE stack rsi_ble_add_matter_service(); // initializing the application events map rsi_ble_app_init_events(); - - SILABS_LOG("StartAdvertising"); - chip::DeviceLayer::Internal::BLEManagerImpl().StartAdvertising(); // TODO:: Called on after init of module - SILABS_LOG("%s Ended", __func__); + chip::DeviceLayer::Internal::BLEMgrImpl().HandleBootEvent(); } void sl_ble_event_handling_task(void) { int32_t event_id; - SILABS_LOG("%s starting", __func__); - //! This semaphore is waiting for wifi module initialization. rsi_semaphore_wait(&sl_rs_ble_init_sem, 0); @@ -160,16 +154,10 @@ void sl_ble_event_handling_task(void) rsi_ble_app_clear_event(RSI_BLE_GATT_INDICATION_CONFIRMATION); } break; - - case RSI_BLE_RESP_ATT_VALUE: { - SILABS_LOG("%s RESP_ATT confirmation", __func__); - } default: break; } } - - SILABS_LOG("%s Ended", __func__); } namespace chip { @@ -237,14 +225,13 @@ CHIP_ERROR BLEManagerImpl::_Init() CHIP_ERROR err; rsi_semaphore_create(&sl_rs_ble_init_sem, 0); rsi_semaphore_create(&sl_ble_event_sem, 0); - ChipLogProgress(DeviceLayer, "%s Start ", __func__); wfx_rsi.ble_task = xTaskCreateStatic((TaskFunction_t) sl_ble_event_handling_task, "rsi_ble", WFX_RSI_TASK_SZ, NULL, 1, wfxBLETaskStack, &rsiBLETaskStruct); if (wfx_rsi.ble_task == NULL) { - SILABS_LOG("%s: error: failed to create ble task.", __func__); + ChipLogError(DeviceLayer, "%s: error: failed to create ble task.", __func__); } // Initialize the CHIP BleLayer. @@ -265,9 +252,9 @@ CHIP_ERROR BLEManagerImpl::_Init() mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART); mFlags.Set(Flags::kFastAdvertisingEnabled, true); + PlatformMgr().ScheduleWork(DriveBLEState, 0); exit: - ChipLogProgress(DeviceLayer, "%s END ", __func__); return err; } @@ -294,6 +281,7 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingEnabled(bool val) if (mFlags.Has(Flags::kAdvertisingEnabled) != val) { mFlags.Set(Flags::kAdvertisingEnabled, val); + PlatformMgr().ScheduleWork(DriveBLEState, 0); } exit: @@ -314,7 +302,7 @@ CHIP_ERROR BLEManagerImpl::_SetAdvertisingMode(BLEAdvertisingMode mode) return CHIP_ERROR_INVALID_ARGUMENT; } mFlags.Set(Flags::kRestartAdvertising); - + PlatformMgr().ScheduleWork(DriveBLEState, 0); return CHIP_NO_ERROR; } @@ -352,6 +340,7 @@ CHIP_ERROR BLEManagerImpl::_SetDeviceName(const char * deviceName) { mDeviceName[0] = 0; } + PlatformMgr().ScheduleWork(DriveBLEState, 0); ChipLogProgress(DeviceLayer, "_SetDeviceName Ended"); return CHIP_NO_ERROR; } @@ -437,12 +426,11 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU PacketBufferHandle data) { int32_t status = 0; - SILABS_LOG("In send indication"); status = rsi_ble_indicate_value(event_msg.resp_enh_conn.dev_addr, event_msg.rsi_ble_measurement_hndl, (data->DataLength()), data->Start()); if (status != RSI_SUCCESS) { - SILABS_LOG("indication %d failed with error code %lx ", status); + ChipLogProgress(DeviceLayer, "indication failed with error code %lx ", status); return false; } @@ -497,21 +485,20 @@ CHIP_ERROR BLEManagerImpl::MapBLEError(int bleErr) void BLEManagerImpl::DriveBLEState(void) { - - ChipLogProgress(DeviceLayer, "DriveBLEState starting"); CHIP_ERROR err = CHIP_NO_ERROR; - ChipLogProgress(DeviceLayer, "Start advertising if needed..."); + // Check if BLE stack is initialized ( TODO ) + VerifyOrExit(mFlags.Has(Flags::kEFRBLEStackInitialized), /* */); + // Start advertising if needed... if (mServiceMode == ConnectivityManager::kCHIPoBLEServiceMode_Enabled && mFlags.Has(Flags::kAdvertisingEnabled) && NumConnections() < kMaxConnections) { - - ChipLogProgress(DeviceLayer, "Start/re-start advertising if not already started, or if there is a pending change"); // Start/re-start advertising if not already started, or if there is a pending change // to the advertising configuration. if (!mFlags.Has(Flags::kAdvertising) || mFlags.Has(Flags::kRestartAdvertising)) { + ChipLogProgress(DeviceLayer, "Start Advertising"); err = StartAdvertising(); SuccessOrExit(err); } @@ -520,12 +507,12 @@ void BLEManagerImpl::DriveBLEState(void) // Otherwise, stop advertising if it is enabled. else if (mFlags.Has(Flags::kAdvertising)) { + ChipLogProgress(DeviceLayer, "Stop Advertising"); err = StopAdvertising(); SuccessOrExit(err); } exit: - ChipLogProgress(DeviceLayer, "DriveBLEState End"); if (err != CHIP_NO_ERROR) { ChipLogError(DeviceLayer, "Disabling CHIPoBLE service due to error: %s", ErrorStr(err)); @@ -661,23 +648,28 @@ CHIP_ERROR BLEManagerImpl::StartAdvertising(void) return CHIP_NO_ERROR; // err; } +// TODO:: Implementation need to be done. CHIP_ERROR BLEManagerImpl::StopAdvertising(void) { CHIP_ERROR err = CHIP_NO_ERROR; int32_t status = 0; - // TODO: add the below code in a condition if (mFlags.Has(Flags::kAdvertising)) - // Since DriveBLEState is not called the device is still advertising - mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising); - mFlags.Set(Flags::kFastAdvertisingEnabled, true); - status = rsi_ble_stop_advertising(); - if (status != RSI_SUCCESS) + + if (mFlags.Has(Flags::kAdvertising)) { - ChipLogProgress(DeviceLayer, "advertising failed to stop, with status = 0x%lx", status); + // Since DriveBLEState is not called the device is still advertising + status = rsi_ble_stop_advertising(); + if (status != RSI_SUCCESS) + { + mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising); + mFlags.Set(Flags::kFastAdvertisingEnabled, true); + advertising_set_handle = 0xff; + CancelBleAdvTimeoutTimer(); + } + else + { + ChipLogProgress(DeviceLayer, "advertising failed to stop, with status = 0x%lx", status); + } } - advertising_set_handle = 0xff; - CancelBleAdvTimeoutTimer(); - - // exit: return err; } @@ -707,20 +699,20 @@ void BLEManagerImpl::UpdateMtu(rsi_ble_event_mtu_t evt) void BLEManagerImpl::HandleBootEvent(void) { mFlags.Set(Flags::kEFRBLEStackInitialized); + PlatformMgr().ScheduleWork(DriveBLEState, 0); } void BLEManagerImpl::HandleConnectEvent(void) { - ChipLogProgress(DeviceLayer, "Connect Event for handle : %d", event_msg.connectionHandle); AddConnection(event_msg.connectionHandle, event_msg.bondingHandle); + PlatformMgr().ScheduleWork(DriveBLEState, 0); } +// TODO:: Implementation need to be done. void BLEManagerImpl::HandleConnectionCloseEvent(uint16_t reason) { uint8_t connHandle = 1; - ChipLogProgress(DeviceLayer, "Disconnect Event for handle : %d", connHandle); - if (RemoveConnection(connHandle)) { ChipDeviceEvent event; @@ -753,15 +745,10 @@ void BLEManagerImpl::HandleConnectionCloseEvent(uint16_t reason) void BLEManagerImpl::HandleWriteEvent(rsi_ble_event_write_t evt) { - // RSI_BLE_WRITE_REQUEST_EVENT ChipLogProgress(DeviceLayer, "Char Write Req, packet type %d", evt.pkt_type); - // uint8_t attribute = (uint8_t) event_msg.rsi_ble_measurement_hndl; - - SILABS_LOG("event_msg.rsi_ble_gatt_server_client_config_hndl = %d", event_msg.rsi_ble_gatt_server_client_config_hndl); if (evt.handle[0] == (uint8_t) event_msg.rsi_ble_gatt_server_client_config_hndl) // TODO:: compare the handle exactly { - SILABS_LOG("Inside HandleTXCharCCCDWrite "); HandleTXCharCCCDWrite(&evt); } else @@ -770,6 +757,7 @@ void BLEManagerImpl::HandleWriteEvent(rsi_ble_event_write_t evt) } } +// TODO:: Need to implement this void BLEManagerImpl::HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt) { CHIP_ERROR err = CHIP_NO_ERROR; @@ -840,6 +828,7 @@ void BLEManagerImpl::HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId) PlatformMgr().PostEventOrDie(&event); } +// TODO:: Need to Implement void BLEManagerImpl::HandleSoftTimerEvent(void) { // TODO:: Need to Implement @@ -936,8 +925,9 @@ CHIP_ERROR BLEManagerImpl::EncodeAdditionalDataTlv() return err; } -// TODO:: Need the +// TODO:: Need to do the correct implementation void BLEManagerImpl::HandleC3ReadRequest(void) {} + #endif // CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING uint8_t BLEManagerImpl::GetTimerHandle(uint8_t connectionHandle, bool allocate) diff --git a/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h b/src/platform/silabs/rs911x/rsi_ble_config.h similarity index 96% rename from src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h rename to src/platform/silabs/rs911x/rsi_ble_config.h index 7b257895fd1d84..550e29fda03ed2 100644 --- a/src/platform/silabs/SiWx917/bluetooth/rsi_ble_config.h +++ b/src/platform/silabs/rs911x/rsi_ble_config.h @@ -224,6 +224,8 @@ /*=======================================================================*/ //! Power save command parameters /*=======================================================================*/ +//! set handshake type of power mode +#define RSI_HAND_SHAKE_TYPE GPIO_BASED #define BLE_ATT_REC_SIZE (500) #define NO_OF_VAL_ATT (5) //! Attribute value count diff --git a/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.c b/src/platform/silabs/rs911x/wfx_sl_ble_init.c similarity index 95% rename from src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.c rename to src/platform/silabs/rs911x/wfx_sl_ble_init.c index 579ed35a48e6f2..4429dc9277c3c7 100644 --- a/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.c +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.c @@ -1,4 +1,10 @@ -/* +/******************************************************************************* + * @file wfx_sl_ble_init.c + * @brief + ******************************************************************************* + * # License + * Copyright 2021 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* * * Copyright (c) 2022 Project CHIP Authors * diff --git a/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h b/src/platform/silabs/rs911x/wfx_sl_ble_init.h similarity index 90% rename from src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h rename to src/platform/silabs/rs911x/wfx_sl_ble_init.h index bdc93f3a3ccbf9..435cfe00225699 100644 --- a/src/platform/silabs/SiWx917/bluetooth/wfx_sl_ble_init.h +++ b/src/platform/silabs/rs911x/wfx_sl_ble_init.h @@ -1,4 +1,10 @@ -/* +/******************************************************************************* + * @file wfx_sl_ble_init.h + * @brief + ******************************************************************************* + * # License + * Copyright 2021 Silicon Laboratories Inc. www.silabs.com + ******************************************************************************* * * Copyright (c) 2022 Project CHIP Authors * @@ -15,6 +21,10 @@ * limitations under the License. */ +/** + * Include files + * */ + #ifndef WFX_SL_BLE_INIT #define WFX_SL_BLE_INIT #ifndef RSI_BLE_ENABLE @@ -122,4 +132,4 @@ void rsi_ble_app_clear_event(uint32_t event_num); void rsi_ble_app_init_events(); void rsi_ble_event_handling_task(void); -#endif +#endif \ No newline at end of file diff --git a/src/platform/webos/ThreadStackManagerImpl.cpp b/src/platform/webos/ThreadStackManagerImpl.cpp index eba2d0d9033924..3b0bea0eeec628 100644 --- a/src/platform/webos/ThreadStackManagerImpl.cpp +++ b/src/platform/webos/ThreadStackManagerImpl.cpp @@ -70,7 +70,7 @@ CHIP_ERROR ThreadStackManagerImpl::_InitThreadStack() std::unique_ptr role(openthread_io_openthread_border_router_dup_device_role(mProxy.get())); if (role) { - ThreadDevcieRoleChangedHandler(role.get()); + ThreadDeviceRoleChangedHandler(role.get()); } return CHIP_NO_ERROR; @@ -102,13 +102,13 @@ void ThreadStackManagerImpl::OnDbusPropertiesChanged(OpenthreadIoOpenthreadBorde if (value_str == nullptr) continue; ChipLogProgress(DeviceLayer, "Thread role changed to: %s", StringOrNullMarker(value_str)); - me->ThreadDevcieRoleChangedHandler(value_str); + me->ThreadDeviceRoleChangedHandler(value_str); } } } } -void ThreadStackManagerImpl::ThreadDevcieRoleChangedHandler(const gchar * role) +void ThreadStackManagerImpl::ThreadDeviceRoleChangedHandler(const gchar * role) { bool attached = strcmp(role, kOpenthreadDeviceRoleDetached) != 0 && strcmp(role, kOpenthreadDeviceRoleDisabled) != 0; diff --git a/src/platform/webos/ThreadStackManagerImpl.h b/src/platform/webos/ThreadStackManagerImpl.h index ce7bf3b0e56b52..e2391dffd78aba 100644 --- a/src/platform/webos/ThreadStackManagerImpl.h +++ b/src/platform/webos/ThreadStackManagerImpl.h @@ -147,7 +147,7 @@ class ThreadStackManagerImpl : public ThreadStackManager static void OnDbusPropertiesChanged(OpenthreadIoOpenthreadBorderRouter * proxy, GVariant * changed_properties, const gchar * const * invalidated_properties, gpointer user_data); - void ThreadDevcieRoleChangedHandler(const gchar * role); + void ThreadDeviceRoleChangedHandler(const gchar * role); Thread::OperationalDataset mDataset = {}; diff --git a/src/python_testing/TestMatterTestingSupport.py b/src/python_testing/TestMatterTestingSupport.py new file mode 100644 index 00000000000000..59476e033d4a52 --- /dev/null +++ b/src/python_testing/TestMatterTestingSupport.py @@ -0,0 +1,162 @@ +# +# Copyright (c) 2023 Project CHIP Authors +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import typing +from datetime import datetime, timedelta, timezone + +import chip.clusters as Clusters +from chip.clusters.Types import Nullable, NullValue +from chip.tlv import uint +from matter_testing_support import (MatterBaseTest, async_test_body, default_matter_test_main, parse_pics, type_matches, + utc_time_in_matter_epoch) +from mobly import asserts + + +def get_raw_type_list(): + test = Clusters.UnitTesting + struct = test.Structs.SimpleStruct() + struct_type = test.Structs.SimpleStruct + null_opt_struct = test.Structs.NullablesAndOptionalsStruct() + null_opt_struct_type = test.Structs.NullablesAndOptionalsStruct + double_nested_struct_list = test.Structs.DoubleNestedStructList() + double_nested_struct_list_type = test.Structs.DoubleNestedStructList + list_of_uints = [0, 1] + list_of_uints_type = typing.List[uint] + list_of_structs = [struct, struct] + list_of_structs_type = typing.List[struct_type] + list_of_double_nested_struct_list = [double_nested_struct_list, double_nested_struct_list] + list_of_double_nested_struct_list_type = typing.List[double_nested_struct_list_type] + + # Create a list with all the types and a list of the values that should match for that type + vals = {uint: [1], + str: ["str"], + struct_type: [struct], + null_opt_struct_type: [null_opt_struct], + double_nested_struct_list_type: [double_nested_struct_list], + list_of_uints_type: [list_of_uints], + list_of_structs_type: [list_of_structs], + list_of_double_nested_struct_list_type: [list_of_double_nested_struct_list]} + return vals + + +def test_type_matching_for_type(test_type, test_nullable: bool = False, test_optional: bool = False): + vals = get_raw_type_list() + + if test_nullable and test_optional: + match_type = typing.Union[Nullable, None, test_type] + elif test_nullable: + match_type = typing.Union[Nullable, test_type] + elif test_optional: + match_type = typing.Optional[test_type] + else: + match_type = test_type + + true_list = vals[test_type] + if test_nullable: + true_list.append(NullValue) + if test_optional: + true_list.append(None) + + del vals[test_type] + + # true_list is all the values that should match with the test type + for i in true_list: + asserts.assert_true(type_matches(i, match_type), "{} type checking failure".format(test_type)) + + # try every value in every type in the remaining dict - they should all fail + for v in vals.values(): + for i in v: + asserts.assert_false(type_matches(i, match_type), "{} falsely matched to type {}".format(i, match_type)) + + # Test the nullables or optionals that aren't supposed to work + if not test_nullable: + asserts.assert_false(type_matches(NullValue, match_type), "NullValue falsely matched to {}".format(match_type)) + + if not test_optional: + asserts.assert_false(type_matches(None, match_type), "None falsely matched to {}".format(match_type)) + + +def run_all_match_tests_for_type(test_type): + test_type_matching_for_type(test_type=test_type) + test_type_matching_for_type(test_type=test_type, test_nullable=True) + test_type_matching_for_type(test_type=test_type, test_optional=True) + test_type_matching_for_type(test_type=test_type, test_nullable=True, test_optional=True) + + +class TestMatterTestingSupport(MatterBaseTest): + @async_test_body + async def test_matter_epoch_time(self): + # Matter epoch should return zero + ret = utc_time_in_matter_epoch(datetime(2000, 1, 1, 0, 0, 0, 0, timezone.utc)) + asserts.assert_equal(ret, 0, "UTC epoch returned non-zero value") + + # Jan 2 is exactly 1 day after Jan 1 + ret = utc_time_in_matter_epoch(datetime(2000, 1, 2, 0, 0, 0, 0, timezone.utc)) + expected_delay = timedelta(days=1) + actual_delay = timedelta(microseconds=ret) + asserts.assert_equal(expected_delay, actual_delay, "Calculation for Jan 2 date is incorrect") + + # There's a catch 22 for knowing the current time, but we can check that it's + # going up, and that it's larger than when I wrote the test + # Check that the returned value is larger than the test writing date + writing_date = utc_time_in_matter_epoch(datetime(2023, 5, 5, 0, 0, 0, 0, timezone.utc)) + current_date = utc_time_in_matter_epoch() + asserts.assert_greater(current_date, writing_date, "Calculation for current date is smaller than writing date") + + # Check that the time is going up + last_date = current_date + current_date = utc_time_in_matter_epoch() + asserts.assert_greater(current_date, last_date, "Time does not appear to be incrementing") + + @async_test_body + async def test_type_checking(self): + vals = get_raw_type_list() + for k in vals.keys(): + run_all_match_tests_for_type(k) + + @async_test_body + async def test_pics_support(self): + pics_list = ['TEST.S.A0000=1', + 'TEST.S.A0001=0', + 'lower.s.a0000=1', + '', + ' ', + '# comment', + ' # comment', + ' SPACE.S.A0000 = 1'] + pics = parse_pics(pics_list) + # force the parsed pics here to be in the config so we can check the check_pics function + self.matter_test_config.pics = pics + + asserts.assert_true(self.check_pics("TEST.S.A0000"), "PICS parsed incorrectly for TEST.S.A0000") + asserts.assert_false(self.check_pics("TEST.S.A0001"), "PICS parsed incorrectly for TEST.S.A0001") + asserts.assert_true(self.check_pics("LOWER.S.A0000"), "PICS pased incorrectly for LOWER.S.A0000") + asserts.assert_true(self.check_pics("SPACE.S.A0000"), "PICS parsed incorrectly for SPACE.S.A0000") + asserts.assert_false(self.check_pics("NOT.S.A0000"), "PICS parsed incorrectly for NOT.S.A0000") + asserts.assert_true(self.check_pics(" test.s.a0000"), "PICS checker lowercase handled incorrectly") + + # invalid pics file should throw a value error + pics_list.append("BAD.S.A000=5") + try: + pics = parse_pics(pics_list) + asserts.assert_false(True, "PICS parser did not throw an error as expected") + except ValueError: + pass + + +if __name__ == "__main__": + default_matter_test_main() diff --git a/src/python_testing/matter_testing_support.py b/src/python_testing/matter_testing_support.py index c4a73c0179d33b..1e2e40a6b4ab3d 100644 --- a/src/python_testing/matter_testing_support.py +++ b/src/python_testing/matter_testing_support.py @@ -24,12 +24,16 @@ import pathlib import re import sys +import typing import uuid from binascii import hexlify, unhexlify from dataclasses import asdict as dataclass_asdict from dataclasses import dataclass, field +from datetime import datetime, timezone from typing import List, Optional, Tuple +from chip.tlv import float32, uint + # isort: off from chip import ChipDeviceCtrl # Needed before chip.FabricAdmin @@ -117,6 +121,68 @@ def get_default_paa_trust_store(root_path: pathlib.Path) -> pathlib.Path: return pathlib.Path.cwd() +def parse_pics(lines=typing.List[str]) -> dict[str, bool]: + pics = {} + for raw in lines: + line, _, _ = raw.partition("#") + line = line.strip() + + if not line: + continue + + key, _, val = line.partition("=") + val = val.strip() + if val not in ["1", "0"]: + raise ValueError('PICS {} must have a value of 0 or 1'.format(key)) + + pics[key.strip().upper()] = (val == "1") + return pics + + +def read_pics_from_file(filename: str) -> dict[str, bool]: + """ Reads a dictionary of PICS from a file. """ + with open(filename, 'r') as f: + lines = f.readlines() + return parse_pics(lines) + + +def type_matches(received_value, desired_type): + """ Checks if the value received matches the expected type. + + Handles unpacking Nullable and Optional types and + compares list value types for non-empty lists. + """ + if typing.get_origin(desired_type) == typing.Union: + return any(type_matches(received_value, t) for t in typing.get_args(desired_type)) + elif typing.get_origin(desired_type) == list: + if isinstance(received_value, list): + # Assume an empty list is of the correct type + return True if received_value == [] else any(type_matches(received_value[0], t) for t in typing.get_args(desired_type)) + else: + return False + elif desired_type == uint: + return isinstance(received_value, int) and received_value >= 0 + elif desired_type == float32: + return isinstance(received_value, float) + else: + return isinstance(received_value, desired_type) + + +def utc_time_in_matter_epoch(desired_datetime: datetime = None): + """ Returns the time in matter epoch in us. + + If desired_datetime is None, it will return the current time. + """ + if desired_datetime is None: + utc_native = datetime.now(tz=timezone.utc) + else: + utc_native = desired_datetime + # Matter epoch is 0 hours, 0 minutes, 0 seconds on Jan 1, 2000 UTC + utc_th_delta = utc_native - datetime(2000, 1, 1, 0, 0, 0, 0, timezone.utc) + utc_th_us = int(utc_th_delta.total_seconds() * 1000000) + return utc_th_us + + @dataclass class MatterTestConfig: storage_path: pathlib.Path = None @@ -266,6 +332,11 @@ def certificate_authority_manager(self) -> chip.CertificateAuthority.Certificate def dut_node_id(self) -> int: return self.matter_test_config.dut_node_id[0] + def check_pics(self, pics_key: str) -> bool: + picsd = self.matter_test_config.pics + pics_key = pics_key.strip().upper() + return pics_key in picsd and picsd[pics_key] + async def read_single_attribute( self, dev_ctrl: ChipDeviceCtrl, node_id: int, endpoint: int, attribute: object, fabricFiltered: bool = True) -> object: result = await dev_ctrl.ReadAttribute(node_id, [(endpoint, attribute)], fabricFiltered=fabricFiltered) @@ -273,7 +344,7 @@ async def read_single_attribute( return list(data.values())[0][attribute] async def read_single_attribute_check_success( - self, cluster: object, attribute: object, + self, cluster: Clusters.ClusterObjects.ClusterCommand, attribute: Clusters.ClusterObjects.ClusterAttributeDescriptor, dev_ctrl: ChipDeviceCtrl = None, node_id: int = None, endpoint: int = 0) -> object: if dev_ctrl is None: dev_ctrl = self.default_controller @@ -285,6 +356,9 @@ async def read_single_attribute_check_success( err_msg = "Error reading {}:{}".format(str(cluster), str(attribute)) asserts.assert_true(attr_ret is not None, err_msg) asserts.assert_false(isinstance(attr_ret, Clusters.Attribute.ValueDecodeFailure), err_msg) + desired_type = attribute.attribute_type.Type + asserts.assert_true(type_matches(attr_ret, desired_type), + 'Returned attribute {} is wrong type expected {}, got {}'.format(attribute, desired_type, type(attr_ret))) return attr_ret async def read_single_attribute_expect_error( @@ -304,6 +378,18 @@ async def read_single_attribute_expect_error( asserts.assert_equal(attr_ret.Reason.status, error, err_msg) return attr_ret + async def send_single_cmd( + self, cmd: Clusters.ClusterObjects.ClusterCommand, + dev_ctrl: ChipDeviceCtrl = None, node_id: int = None, endpoint: int = 0, + timedRequestTimeoutMs: typing.Union[None, int] = None) -> object: + if dev_ctrl is None: + dev_ctrl = self.default_controller + if node_id is None: + node_id = self.dut_node_id + + result = await dev_ctrl.SendCommand(nodeid=node_id, endpoint=endpoint, payload=cmd, timedRequestTimeoutMs=timedRequestTimeoutMs) + return result + def print_step(self, stepnum: int, title: str) -> None: logging.info('***** Test Step %d : %s', stepnum, title) @@ -567,6 +653,7 @@ def convert_args_to_matter_config(args: argparse.Namespace) -> MatterTestConfig: config.logs_path = pathlib.Path(_DEFAULT_LOG_PATH) if args.logs_path is None else args.logs_path config.paa_trust_store_path = args.paa_trust_store_path config.ble_interface_id = args.ble_interface_id + config.pics = {} if args.PICS is None else read_pics_from_file(args.PICS) config.controller_node_id = args.controller_node_id @@ -616,6 +703,7 @@ def parse_matter_test_args(argv: List[str]) -> MatterTestConfig: metavar='NODE_ID', default=[_DEFAULT_DUT_NODE_ID], help='Node ID for primary DUT communication, ' 'and NodeID to assign if commissioning (default: %d)' % _DEFAULT_DUT_NODE_ID, nargs="+") + basic_group.add_argument("--PICS", help="PICS file path", type=str) commission_group = parser.add_argument_group(title="Commissioning", description="Arguments to commission a node") diff --git a/src/system/BUILD.gn b/src/system/BUILD.gn index 581ed2e23f0bb0..acc7f790e3471d 100644 --- a/src/system/BUILD.gn +++ b/src/system/BUILD.gn @@ -17,6 +17,7 @@ import("//build_overrides/chip.gni") import("//build_overrides/nlassert.gni") import("//build_overrides/nlfaultinjection.gni") +import("${build_root}/config/compiler/compiler.gni") import("${chip_root}/build/chip/buildconfig_header.gni") import("${chip_root}/build/chip/tests.gni") import("${chip_root}/src/platform/device.gni") @@ -32,6 +33,12 @@ declare_args() { # Extra include dirs for project configs. chip_project_config_include_dirs = [] + + # enable clang thread safety analysis in SystemMutex.h, + # specifically attributes such as capability, guarded_by, acquire, ... + # + # see https://clang.llvm.org/docs/ThreadSafetyAnalysis.html + chip_enable_thread_safety_checks = is_clang } if (chip_project_config_include_dirs == [] && @@ -117,6 +124,9 @@ buildconfig_header("system_buildconfig") { "SYSTEM_PLATFORM_CONFIG_INCLUDE=${chip_system_platform_config_include}", ] } + if (chip_enable_thread_safety_checks) { + defines += [ "SYSTEM_ENABLE_CLANG_THREAD_SAFETY_ANALYSIS=1" ] + } if (chip_system_layer_impl_config_file != "") { defines += [ "CHIP_SYSTEM_LAYER_IMPL_CONFIG_FILE=${chip_system_layer_impl_config_file}" ] diff --git a/src/system/SystemMutex.h b/src/system/SystemMutex.h index bb0d67fd7d91c4..4a1f135f5e9efd 100644 --- a/src/system/SystemMutex.h +++ b/src/system/SystemMutex.h @@ -64,7 +64,7 @@ namespace chip { namespace System { // Enable thread safety attributes only with clang. -#if defined(__clang__) && (!defined(SWIG)) +#if defined(SYSTEM_ENABLE_CLANG_THREAD_SAFETY_ANALYSIS) && (!defined(SWIG)) #define CHIP_TSA_ATTRIBUTE__(x) __attribute__((x)) #else #define CHIP_TSA_ATTRIBUTE__(x) diff --git a/src/system/tests/TestSystemScheduleLambda.cpp b/src/system/tests/TestSystemScheduleLambda.cpp index 9dd78829bb4ff5..1826bec5e0619c 100644 --- a/src/system/tests/TestSystemScheduleLambda.cpp +++ b/src/system/tests/TestSystemScheduleLambda.cpp @@ -67,9 +67,10 @@ static nlTestSuite kTheSuite = */ static int TestSetup(void * aContext) { + if (chip::Platform::MemoryInit() != CHIP_NO_ERROR) + return FAILURE; if (chip::DeviceLayer::PlatformMgr().InitChipStack() != CHIP_NO_ERROR) return FAILURE; - return (SUCCESS); } @@ -80,6 +81,7 @@ static int TestSetup(void * aContext) static int TestTeardown(void * aContext) { chip::DeviceLayer::PlatformMgr().Shutdown(); + chip::Platform::MemoryShutdown(); return (SUCCESS); } diff --git a/src/test_driver/tizen/integration_tests/lighting-app/BUILD.gn b/src/test_driver/tizen/integration_tests/lighting-app/BUILD.gn index 36fb2c340a23ec..612d1cfb0c7728 100644 --- a/src/test_driver/tizen/integration_tests/lighting-app/BUILD.gn +++ b/src/test_driver/tizen/integration_tests/lighting-app/BUILD.gn @@ -28,9 +28,9 @@ tizen_qemu_mkisofs("test-runner") { # Use artifacts created by the dependencies. assets = [ - rebase_path("${root_build_dir}/chip-tool"), + rebase_path("${root_out_dir}/chip-tool"), rebase_path( - "${root_build_dir}/org.tizen.matter.example.lighting/out/org.tizen.matter.example.lighting-1.0.0.tpk"), + "${root_out_dir}/org.tizen.matter.example.lighting/out/org.tizen.matter.example.lighting-1.0.0.tpk"), ] } diff --git a/src/transport/SecureSession.cpp b/src/transport/SecureSession.cpp index 6e914e764f962e..9748fdcbb1c839 100644 --- a/src/transport/SecureSession.cpp +++ b/src/transport/SecureSession.cpp @@ -87,8 +87,8 @@ void SecureSession::MoveToState(State targetState) { if (mState != targetState) { - ChipLogProgress(SecureChannel, "SecureSession[%p]: Moving from state '%s' --> '%s'", this, StateToString(mState), - StateToString(targetState)); + ChipLogProgress(SecureChannel, "SecureSession[%p, LSID:%d]: State change '%s' --> '%s'", this, mLocalSessionId, + StateToString(mState), StateToString(targetState)); mState = targetState; } } diff --git a/third_party/qpg_sdk/BUILD.gn b/third_party/qpg_sdk/BUILD.gn index 26cf78cf4e52be..c6565e4041e9ed 100755 --- a/third_party/qpg_sdk/BUILD.gn +++ b/third_party/qpg_sdk/BUILD.gn @@ -193,3 +193,44 @@ 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_ftd/libOpenThreadQorvoGlue_${qpg_target_ic}_ftd.a" ] } + +qpg_make_build("qpg_light_factorydata") { + make_sources = [ "${qpg_sdk_root}/Tools/FactoryData" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_light_static_pake/libFactoryData_light_static_pake.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + + "/Libraries/Qorvo/FactoryData/Makefile.FactoryData_light_static_pake", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/FactoryData_light_static_pake", + ] +} +static_library("qpg_light_factorydata_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_light_factorydata" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_light_static_pake/libFactoryData_light_static_pake.a" ] + public_configs = [ ":qpg_retain_factorydata" ] +} + +qpg_make_build("qpg_lock_factorydata") { + make_sources = [ "${qpg_sdk_root}/Tools/FactoryData" ] + make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_lock_static_pake/libFactoryData_lock_static_pake.a" ] + make_args = [ + "-f", + rebase_path(qpg_sdk_root, root_build_dir) + + "/Libraries/Qorvo/FactoryData/Makefile.FactoryData_lock_static_pake", + "WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) + + "/${qpg_sdk_lib_dir}/FactoryData_lock_static_pake", + ] +} +static_library("qpg_lock_factorydata_lib") { + deps = [ "${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata" ] + libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FactoryData_lock_static_pake/libFactoryData_lock_static_pake.a" ] + public_configs = [ ":qpg_retain_factorydata" ] +} + +config("qpg_retain_factorydata") { + ldflags = [ + "-Wl,-u_binary_factory_data_bin_start", + "-Wl,-u_binary_factory_data_start", + ] +} diff --git a/third_party/qpg_sdk/qpg_sdk.gni b/third_party/qpg_sdk/qpg_sdk.gni index f9f6ed610b49fc..65c06f3ce67982 100644 --- a/third_party/qpg_sdk/qpg_sdk.gni +++ b/third_party/qpg_sdk/qpg_sdk.gni @@ -14,7 +14,6 @@ import("//build_overrides/chip.gni") import("//build_overrides/jlink.gni") -import("//build_overrides/mbedtls.gni") import("//build_overrides/openthread.gni") import("//build_overrides/qpg_sdk.gni") @@ -72,14 +71,14 @@ template("qpg_sdk") { include_dirs += [ "${qpg_sdk_root}/Components/Qorvo/Matter/qvCHIP/inc", "${qpg_sdk_root}/Components/Qorvo/BSP/qvIO/inc", - "${mbedtls_root}/repo/include", "${openthread_root}/include", ] if (mbedtls_alt_enabled) { include_dirs += [ - "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt_3.3.0", "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/include", ] } else { include_dirs += [ "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc" ] @@ -139,39 +138,40 @@ template("qpg_sdk") { if (mbedtls_alt_enabled) { 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}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt_3.3.0/aes_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt_3.3.0/ecjpake_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt_3.3.0/ecp_alt.h", + "${qpg_sdk_root}/Components/ThirdParty/Silex/cryptosoc/mbedtls_alt_3.3.0/sha256_alt.h", ] } 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/bignum.c", - "${chip_root}/third_party/mbedtls/repo/library/ccm.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/ctr_drbg.c", - "${chip_root}/third_party/mbedtls/repo/library/ecdsa.c", - "${chip_root}/third_party/mbedtls/repo/library/entropy.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/oid.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/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/sha1.c", - "${chip_root}/third_party/mbedtls/repo/library/sha256.c", - "${chip_root}/third_party/mbedtls/repo/library/x509_create.c", - "${chip_root}/third_party/mbedtls/repo/library/x509write_csr.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/asn1parse.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/asn1write.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/bignum.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/bignum_core.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/ccm.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/cipher.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/cipher_wrap.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/ctr_drbg.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/ecdsa.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/entropy.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/hash_info.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/hkdf.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/hmac_drbg.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/md.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/oid.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/pk.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/pk_wrap.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/pkcs5.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/pkparse.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/pkwrite.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/platform.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/platform_util.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/sha1.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/sha256.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/x509_create.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/x509write_csr.c", "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/inc/${qpg_target_ic}-mbedtls-config.h", "${qpg_sdk_root}/Libraries/Qorvo/mbedtls_alt/src/trng.c", ] @@ -182,11 +182,11 @@ template("qpg_sdk") { sources += mbedtls_alt_sources } else { sources += [ - "${chip_root}/third_party/mbedtls/repo/library/aes.c", - "${chip_root}/third_party/mbedtls/repo/library/constant_time.c", - "${chip_root}/third_party/mbedtls/repo/library/ecdh.c", - "${chip_root}/third_party/mbedtls/repo/library/ecp.c", - "${chip_root}/third_party/mbedtls/repo/library/ecp_curves.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/aes.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/constant_time.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/ecdh.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/ecp.c", + "${qpg_sdk_root}/Components/ThirdParty/ARM/mbedtls/v3.3.0/library/ecp_curves.c", ] } diff --git a/third_party/qpg_sdk/repo b/third_party/qpg_sdk/repo index e5c17b34e011a0..cacb7eb95985f9 160000 --- a/third_party/qpg_sdk/repo +++ b/third_party/qpg_sdk/repo @@ -1 +1 @@ -Subproject commit e5c17b34e011a0997a4b1614008aacff4f97e5b6 +Subproject commit cacb7eb95985f9b81359d839cd25468fb3b1aec1 diff --git a/third_party/silabs/SiWx917_sdk.gni b/third_party/silabs/SiWx917_sdk.gni index 75d776b720b8fe..13fe8c987870b1 100644 --- a/third_party/silabs/SiWx917_sdk.gni +++ b/third_party/silabs/SiWx917_sdk.gni @@ -69,6 +69,7 @@ template("siwx917_sdk") { "${wisemcu_sdk_root}/third_party/freertos/include", "${wisemcu_sdk_root}/third_party/freertos/portable/GCC/ARM_CM4F", "${examples_plat_dir}/device/inc", + "${chip_root}/src/platform/silabs/rs911x", ] # Note that we're setting the mbedTLS and PSA configuration files through a diff --git a/third_party/silabs/efr32_sdk.gni b/third_party/silabs/efr32_sdk.gni index 9c3f6bf8ed9026..507fde96fee71a 100644 --- a/third_party/silabs/efr32_sdk.gni +++ b/third_party/silabs/efr32_sdk.gni @@ -193,6 +193,7 @@ template("efr32_sdk") { if (chip_enable_ble_rs911x) { _include_dirs += [ "${wifi_sapi_root}/sapi/include" ] + _include_dirs += [ "${chip_root}/src/platform/silabs/rs911x" ] } # Note that we're setting the mbedTLS and PSA configuration files through a diff --git a/third_party/tizen/tizen_sdk.gni b/third_party/tizen/tizen_sdk.gni index 32bb5539a483f6..70242ee1c3dbf6 100644 --- a/third_party/tizen/tizen_sdk.gni +++ b/third_party/tizen/tizen_sdk.gni @@ -82,7 +82,7 @@ template("tizen_sdk_certificate") { assert(defined(invoker.sign_security_profile), "It is required to specify a `sign_security_profile` which " + "should be added to Tizen security profiles.") - stamp_file = "${root_build_dir}/.tizen_sdk_dev_certificate_stamp" + stamp_file = "${root_out_dir}/.tizen_sdk_dev_certificate_stamp" action(target_name) { forward_variables_from(invoker, [ "deps" ]) script = tizen_dev_certificate @@ -91,7 +91,7 @@ template("tizen_sdk_certificate") { "--author-certificate-email=" + invoker.author_certificate_email, "--author-certificate-password=" + invoker.author_certificate_password, "--sign-security-profile=" + invoker.sign_security_profile, - "--stamp-file=" + stamp_file, + "--stamp-file=" + rebase_path(stamp_file), ] outputs = [ stamp_file ] } @@ -112,7 +112,7 @@ template("tizen_sdk_package") { # Extract data from Tizen XML manifest. manifest = exec_script(tizen_manifest_parser, - [ rebase_path(invoker.manifest, root_build_dir) ], + [ rebase_path(invoker.manifest) ], "json") manifest_package = manifest["package"] manifest_package_name = manifest_package["name"] @@ -123,7 +123,7 @@ template("tizen_sdk_package") { # for this, because Tizen Studio CLI scans "res" (resources), "shared" and # "lib" directories for items to pack. In our case it could include in the # TPK package libraries available in ${root_out_dir}/lib directory. - tizen_package_dir = "${root_build_dir}/${manifest_package_name}" + tizen_package_dir = "${root_out_dir}/${manifest_package_name}" tizen_package_out_dir = "${tizen_package_dir}/out" # Copy Tizen manifest from the source directory. @@ -160,7 +160,7 @@ template("tizen_sdk_package") { "--sign", invoker.sign_security_profile, "--", - tizen_package_out_dir, + rebase_path(tizen_package_out_dir), ] } } @@ -192,7 +192,7 @@ template("tizen_qemu_mkisofs") { "-JRU", # Joliet + Rock Ridge with untranslated filenames "-o", rebase_path(image_file), - rebase_path(invoker.runner, root_build_dir), + rebase_path(invoker.runner), ] if (defined(invoker.assets)) { args += invoker.assets @@ -216,7 +216,7 @@ template("tizen_qemu_run") { "It is required to specify ISO runner image.") # Store QEMU output in a dedicated log file. - output_log_file = "${root_build_dir}/tizen-qemu-" + target_name + ".log" + output_log_file = "${root_out_dir}/tizen-qemu-" + target_name + ".log" action(target_name) { forward_variables_from(invoker, [ "deps" ]) diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp index 603fa9be0d4fab..c620b5f2108b1e 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.cpp @@ -5069,59 +5069,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) namespace TimeSynchronization { namespace Attributes { -namespace UTCTime { - -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType temp; - uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); - VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else - { - value.SetNonNull() = Traits::StorageToWorking(temp); - } - return status; -} -EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) -{ - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) - { - return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; - } - Traits::StorageType storageValue; - Traits::WorkingToStorage(value, storageValue); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); -} - -} // namespace UTCTime - namespace Granularity { EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum * value) @@ -5184,165 +5131,104 @@ EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchroniz } // namespace TimeSource -namespace TrustedTimeNodeId { +namespace TimeZoneDatabase { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { - value.SetNonNull() = Traits::StorageToWorking(temp); + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } + *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, chip::NodeId value) +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum value) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_NODE_ID_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_NODE_ID_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); + return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_ENUM8_ATTRIBUTE_TYPE); } -} // namespace TrustedTimeNodeId +} // namespace TimeZoneDatabase -namespace DefaultNtp { +namespace NTPServerAvailable { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - uint8_t zclString[128 + 1]; - EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, zclString, sizeof(zclString)); + using Traits = NumericAttributeTraits; + Traits::StorageType temp; + uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); + EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - size_t length = emberAfStringLength(zclString); - if (length == NumericAttributeTraits::kNullValue) + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { - value.SetNull(); - return EMBER_ZCL_STATUS_SUCCESS; + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } - auto & span = value.SetNonNull(); - - VerifyOrReturnError(span.size() == 128, EMBER_ZCL_STATUS_INVALID_DATA_TYPE); - memcpy(span.data(), &zclString[1], 128); - span.reduce_size(length); + *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value) -{ - static_assert(128 < NumericAttributeTraits::kNullValue, "value.size() might be too big"); - VerifyOrReturnError(value.size() <= 128, EMBER_ZCL_STATUS_CONSTRAINT_ERROR); - uint8_t zclString[128 + 1]; - emberAfCopyInt8u(zclString, 0, static_cast(value.size())); - memcpy(&zclString[1], value.data(), value.size()); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - uint8_t zclString[1] = { 0xFF }; - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, zclString, ZCL_CHAR_STRING_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) +EmberAfStatus Set(chip::EndpointId endpoint, bool value) { - if (value.IsNull()) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { - return SetNull(endpoint); + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } - - return Set(endpoint, value.Value()); + Traits::StorageType storageValue; + Traits::WorkingToStorage(value, storageValue); + uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); + return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } -} // namespace DefaultNtp +} // namespace NTPServerAvailable -namespace LocalTime { +namespace TimeZoneListMaxSize { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { - value.SetNonNull() = Traits::StorageToWorking(temp); + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } + *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_EPOCH_US_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); + return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } -} // namespace LocalTime +} // namespace TimeZoneListMaxSize -namespace TimeZoneDatabase { +namespace DSTOffsetListMaxSize { -EmberAfStatus Get(chip::EndpointId endpoint, bool * value) +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); @@ -5354,9 +5240,9 @@ EmberAfStatus Get(chip::EndpointId endpoint, bool * value) *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, bool value) +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; @@ -5364,63 +5250,41 @@ EmberAfStatus Set(chip::EndpointId endpoint, bool value) Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); + return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_INT8U_ATTRIBUTE_TYPE); } -} // namespace TimeZoneDatabase +} // namespace DSTOffsetListMaxSize -namespace NtpServerPort { +namespace SupportsDNSResolve { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value) +EmberAfStatus Get(chip::EndpointId endpoint, bool * value) { - using Traits = NumericAttributeTraits; + using Traits = NumericAttributeTraits; Traits::StorageType temp; uint8_t * readable = Traits::ToAttributeStoreRepresentation(temp); EmberAfStatus status = emberAfReadAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, readable, sizeof(temp)); VerifyOrReturnError(EMBER_ZCL_STATUS_SUCCESS == status, status); - if (Traits::IsNullValue(temp)) - { - value.SetNull(); - } - else + if (!Traits::CanRepresentValue(/* isNullable = */ false, temp)) { - value.SetNonNull() = Traits::StorageToWorking(temp); + return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } + *value = Traits::StorageToWorking(temp); return status; } -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value) +EmberAfStatus Set(chip::EndpointId endpoint, bool value) { - using Traits = NumericAttributeTraits; - if (!Traits::CanRepresentValue(/* isNullable = */ true, value)) + using Traits = NumericAttributeTraits; + if (!Traits::CanRepresentValue(/* isNullable = */ false, value)) { return EMBER_ZCL_STATUS_CONSTRAINT_ERROR; } Traits::StorageType storageValue; Traits::WorkingToStorage(value, storageValue); uint8_t * writable = Traits::ToAttributeStoreRepresentation(storageValue); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -EmberAfStatus SetNull(chip::EndpointId endpoint) -{ - using Traits = NumericAttributeTraits; - Traits::StorageType value; - Traits::SetNull(value); - uint8_t * writable = Traits::ToAttributeStoreRepresentation(value); - return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_INT16U_ATTRIBUTE_TYPE); -} - -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value) -{ - if (value.IsNull()) - { - return SetNull(endpoint); - } - - return Set(endpoint, value.Value()); + return emberAfWriteAttribute(endpoint, Clusters::TimeSynchronization::Id, Id, writable, ZCL_BOOLEAN_ATTRIBUTE_TYPE); } -} // namespace NtpServerPort +} // namespace SupportsDNSResolve namespace FeatureMap { diff --git a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h index d897fd29993f61..c2b6ca482ae634 100644 --- a/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h +++ b/zzz_generated/app-common/app-common/zap-generated/attributes/Accessors.h @@ -973,13 +973,6 @@ EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); namespace TimeSynchronization { namespace Attributes { -namespace UTCTime { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_us -EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace UTCTime - namespace Granularity { EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum * value); // GranularityEnum EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::GranularityEnum value); @@ -990,38 +983,31 @@ EmberAfStatus Get(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchroniz EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeSourceEnum value); } // namespace TimeSource -namespace TrustedTimeNodeId { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // node_id -EmberAfStatus Set(chip::EndpointId endpoint, chip::NodeId value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace TrustedTimeNodeId +namespace TimeZoneDatabase { +EmberAfStatus Get(chip::EndpointId endpoint, + chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum * value); // TimeZoneDatabaseEnum +EmberAfStatus Set(chip::EndpointId endpoint, chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum value); +} // namespace TimeZoneDatabase -namespace DefaultNtp { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // char_string -EmberAfStatus Set(chip::EndpointId endpoint, chip::CharSpan value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace DefaultNtp +namespace NTPServerAvailable { +EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean +EmberAfStatus Set(chip::EndpointId endpoint, bool value); +} // namespace NTPServerAvailable -namespace LocalTime { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // epoch_us -EmberAfStatus Set(chip::EndpointId endpoint, uint64_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace LocalTime +namespace TimeZoneListMaxSize { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace TimeZoneListMaxSize -namespace TimeZoneDatabase { +namespace DSTOffsetListMaxSize { +EmberAfStatus Get(chip::EndpointId endpoint, uint8_t * value); // int8u +EmberAfStatus Set(chip::EndpointId endpoint, uint8_t value); +} // namespace DSTOffsetListMaxSize + +namespace SupportsDNSResolve { EmberAfStatus Get(chip::EndpointId endpoint, bool * value); // boolean EmberAfStatus Set(chip::EndpointId endpoint, bool value); -} // namespace TimeZoneDatabase - -namespace NtpServerPort { -EmberAfStatus Get(chip::EndpointId endpoint, DataModel::Nullable & value); // int16u -EmberAfStatus Set(chip::EndpointId endpoint, uint16_t value); -EmberAfStatus SetNull(chip::EndpointId endpoint); -EmberAfStatus Set(chip::EndpointId endpoint, const chip::app::DataModel::Nullable & value); -} // namespace NtpServerPort +} // namespace SupportsDNSResolve namespace FeatureMap { EmberAfStatus Get(chip::EndpointId endpoint, uint32_t * value); // bitmap32 diff --git a/zzz_generated/app-common/app-common/zap-generated/callback.h b/zzz_generated/app-common/app-common/zap-generated/callback.h index f28ebdafecf988..ac7379e8c8f052 100644 --- a/zzz_generated/app-common/app-common/zap-generated/callback.h +++ b/zzz_generated/app-common/app-common/zap-generated/callback.h @@ -6525,11 +6525,35 @@ bool emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, const chip::app::Clusters::EthernetNetworkDiagnostics::Commands::ResetCounts::DecodableType & commandData); /** - * @brief Time Synchronization Cluster SetUtcTime Command callback (from client) + * @brief Time Synchronization Cluster SetUTCTime Command callback (from client) */ -bool emberAfTimeSynchronizationClusterSetUtcTimeCallback( +bool emberAfTimeSynchronizationClusterSetUTCTimeCallback( chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, - const chip::app::Clusters::TimeSynchronization::Commands::SetUtcTime::DecodableType & commandData); + const chip::app::Clusters::TimeSynchronization::Commands::SetUTCTime::DecodableType & commandData); +/** + * @brief Time Synchronization Cluster SetTrustedTimeSource Command callback (from client) + */ +bool emberAfTimeSynchronizationClusterSetTrustedTimeSourceCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::DecodableType & commandData); +/** + * @brief Time Synchronization Cluster SetTimeZone Command callback (from client) + */ +bool emberAfTimeSynchronizationClusterSetTimeZoneCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::DecodableType & commandData); +/** + * @brief Time Synchronization Cluster SetDSTOffset Command callback (from client) + */ +bool emberAfTimeSynchronizationClusterSetDSTOffsetCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::DecodableType & commandData); +/** + * @brief Time Synchronization Cluster SetDefaultNTP Command callback (from client) + */ +bool emberAfTimeSynchronizationClusterSetDefaultNTPCallback( + chip::app::CommandHandler * commandObj, const chip::app::ConcreteCommandPath & commandPath, + const chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::DecodableType & commandData); /** * @brief Administrator Commissioning Cluster OpenCommissioningWindow Command callback (from client) */ diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h index dd8a0282fdab6d..d5cd9844b83932 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums-check.h @@ -1111,6 +1111,17 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::Gr return static_cast(5); } } +static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::StatusCode val) +{ + using EnumType = TimeSynchronization::StatusCode; + switch (val) + { + case EnumType::kTimeNotAccepted: + return val; + default: + return static_cast(0); + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::TimeSourceEnum val) { using EnumType = TimeSynchronization::TimeSourceEnum; @@ -1120,16 +1131,16 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::Ti case EnumType::kUnknown: case EnumType::kAdmin: case EnumType::kNodeTimeCluster: - case EnumType::kNonFabricSntp: - case EnumType::kNonFabricNtp: - case EnumType::kFabricSntp: - case EnumType::kFabricNtp: - case EnumType::kMixedNtp: - case EnumType::kNonFabricSntpNts: - case EnumType::kNonFabricNtpNts: - case EnumType::kFabricSntpNts: - case EnumType::kFabricNtpNts: - case EnumType::kMixedNtpNts: + case EnumType::kNonMatterSNTP: + case EnumType::kNonMatterNTP: + case EnumType::kMatterSNTP: + case EnumType::kMatterNTP: + case EnumType::kMixedNTP: + case EnumType::kNonMatterSNTPNTS: + case EnumType::kNonMatterNTPNTS: + case EnumType::kMatterSNTPNTS: + case EnumType::kMatterNTPNTS: + case EnumType::kMixedNTPNTS: case EnumType::kCloudSource: case EnumType::kPtp: case EnumType::kGnss: @@ -1138,6 +1149,19 @@ static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::Ti return static_cast(17); } } +static auto __attribute__((unused)) EnsureKnownEnumValue(TimeSynchronization::TimeZoneDatabaseEnum val) +{ + using EnumType = TimeSynchronization::TimeZoneDatabaseEnum; + switch (val) + { + case EnumType::kFull: + case EnumType::kPartial: + case EnumType::kNone: + return val; + default: + return static_cast(3); + } +} static auto __attribute__((unused)) EnsureKnownEnumValue(BridgedDeviceBasicInformation::ColorEnum val) { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h index 9b423e822a7e64..481e9b1b438fb2 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-enums.h @@ -1271,6 +1271,17 @@ enum class GranularityEnum : uint8_t kUnknownEnumValue = 5, }; +// Enum for StatusCode +enum class StatusCode : uint8_t +{ + kTimeNotAccepted = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 0, +}; + // Enum for TimeSourceEnum enum class TimeSourceEnum : uint8_t { @@ -1278,16 +1289,16 @@ enum class TimeSourceEnum : uint8_t kUnknown = 0x01, kAdmin = 0x02, kNodeTimeCluster = 0x03, - kNonFabricSntp = 0x04, - kNonFabricNtp = 0x05, - kFabricSntp = 0x06, - kFabricNtp = 0x07, - kMixedNtp = 0x08, - kNonFabricSntpNts = 0x09, - kNonFabricNtpNts = 0x0A, - kFabricSntpNts = 0x0B, - kFabricNtpNts = 0x0C, - kMixedNtpNts = 0x0D, + kNonMatterSNTP = 0x04, + kNonMatterNTP = 0x05, + kMatterSNTP = 0x06, + kMatterNTP = 0x07, + kMixedNTP = 0x08, + kNonMatterSNTPNTS = 0x09, + kNonMatterNTPNTS = 0x0A, + kMatterSNTPNTS = 0x0B, + kMatterNTPNTS = 0x0C, + kMixedNTPNTS = 0x0D, kCloudSource = 0x0E, kPtp = 0x0F, kGnss = 0x10, @@ -1297,6 +1308,28 @@ enum class TimeSourceEnum : uint8_t // enum value. This specific should never be transmitted. kUnknownEnumValue = 17, }; + +// Enum for TimeZoneDatabaseEnum +enum class TimeZoneDatabaseEnum : uint8_t +{ + kFull = 0x00, + kPartial = 0x01, + kNone = 0x02, + // All received enum values that are not listed above will be mapped + // to kUnknownEnumValue. This is a helper enum value that should only + // be used by code to process how it handles receiving and unknown + // enum value. This specific should never be transmitted. + kUnknownEnumValue = 3, +}; + +// Bitmap for TimeSynchronizationFeature +enum class TimeSynchronizationFeature : uint32_t +{ + kTimeZone = 0x1, + kNTPClient = 0x2, + kNTPServer = 0x4, + kTimeSyncClient = 0x8, +}; } // namespace TimeSynchronization namespace BridgedDeviceBasicInformation { diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp index 1e9a9aa8a52728..d412b0a9b64cc0 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp @@ -8125,6 +8125,50 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace DSTOffsetStruct +namespace FabricScopedTrustedTimeSourceStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kNodeID), nodeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kEndpoint), endpoint)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + err = reader.EnterContainer(outer); + ReturnErrorOnFailure(err); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kNodeID): + ReturnErrorOnFailure(DataModel::Decode(reader, nodeID)); + break; + case to_underlying(Fields::kEndpoint): + ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + + return CHIP_NO_ERROR; +} + +} // namespace FabricScopedTrustedTimeSourceStruct namespace TimeZoneStruct { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { @@ -8173,15 +8217,63 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } } // namespace TimeZoneStruct +namespace TrustedTimeSourceStruct { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kFabricIndex), fabricIndex)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kNodeID), nodeID)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kEndpoint), endpoint)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + err = reader.EnterContainer(outer); + ReturnErrorOnFailure(err); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kFabricIndex): + ReturnErrorOnFailure(DataModel::Decode(reader, fabricIndex)); + break; + case to_underlying(Fields::kNodeID): + ReturnErrorOnFailure(DataModel::Decode(reader, nodeID)); + break; + case to_underlying(Fields::kEndpoint): + ReturnErrorOnFailure(DataModel::Decode(reader, endpoint)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + + return CHIP_NO_ERROR; +} + +} // namespace TrustedTimeSourceStruct } // namespace Structs namespace Commands { -namespace SetUtcTime { +namespace SetUTCTime { CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const { TLV::TLVType outer; ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); - ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kUtcTime), utcTime)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kUTCTime), UTCTime)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kGranularity), granularity)); ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kTimeSource), timeSource)); ReturnErrorOnFailure(writer.EndContainer(outer)); @@ -8202,8 +8294,8 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) } switch (TLV::TagNumFromTag(reader.GetTag())) { - case to_underlying(Fields::kUtcTime): - ReturnErrorOnFailure(DataModel::Decode(reader, utcTime)); + case to_underlying(Fields::kUTCTime): + ReturnErrorOnFailure(DataModel::Decode(reader, UTCTime)); break; case to_underlying(Fields::kGranularity): ReturnErrorOnFailure(DataModel::Decode(reader, granularity)); @@ -8220,7 +8312,192 @@ CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) ReturnErrorOnFailure(reader.ExitContainer(outer)); return CHIP_NO_ERROR; } -} // namespace SetUtcTime. +} // namespace SetUTCTime. +namespace SetTrustedTimeSource { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kTrustedTimeSource), trustedTimeSource)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kTrustedTimeSource): + ReturnErrorOnFailure(DataModel::Decode(reader, trustedTimeSource)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace SetTrustedTimeSource. +namespace SetTimeZone { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kTimeZone), timeZone)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kTimeZone): + ReturnErrorOnFailure(DataModel::Decode(reader, timeZone)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace SetTimeZone. +namespace SetTimeZoneResponse { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kDSTOffsetRequired), DSTOffsetRequired)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kDSTOffsetRequired): + ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffsetRequired)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace SetTimeZoneResponse. +namespace SetDSTOffset { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kDSTOffset), DSTOffset)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kDSTOffset): + ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffset)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace SetDSTOffset. +namespace SetDefaultNTP { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kDefaultNTP), defaultNTP)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kDefaultNTP): + ReturnErrorOnFailure(DataModel::Decode(reader, defaultNTP)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace SetDefaultNTP. } // namespace Commands namespace Attributes { @@ -8237,11 +8514,11 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::TimeSource::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, timeSource)); break; - case Attributes::TrustedTimeNodeId::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, trustedTimeNodeId)); + case Attributes::TrustedTimeSource::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, trustedTimeSource)); break; - case Attributes::DefaultNtp::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, defaultNtp)); + case Attributes::DefaultNTP::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, defaultNTP)); break; case Attributes::TimeZone::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, timeZone)); @@ -8255,8 +8532,17 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre case Attributes::TimeZoneDatabase::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, timeZoneDatabase)); break; - case Attributes::NtpServerPort::TypeInfo::GetAttributeId(): - ReturnErrorOnFailure(DataModel::Decode(reader, ntpServerPort)); + case Attributes::NTPServerAvailable::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, NTPServerAvailable)); + break; + case Attributes::TimeZoneListMaxSize::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, timeZoneListMaxSize)); + break; + case Attributes::DSTOffsetListMaxSize::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffsetListMaxSize)); + break; + case Attributes::SupportsDNSResolve::TypeInfo::GetAttributeId(): + ReturnErrorOnFailure(DataModel::Decode(reader, supportsDNSResolve)); break; case Attributes::GeneratedCommandList::TypeInfo::GetAttributeId(): ReturnErrorOnFailure(DataModel::Decode(reader, generatedCommandList)); @@ -8284,7 +8570,185 @@ CHIP_ERROR TypeInfo::DecodableType::Decode(TLV::TLVReader & reader, const Concre } } // namespace Attributes -namespace Events {} // namespace Events +namespace Events { +namespace DSTTableEmpty { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace DSTTableEmpty. +namespace DSTStatus { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kDSTOffsetActive), DSTOffsetActive)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kDSTOffsetActive): + ReturnErrorOnFailure(DataModel::Decode(reader, DSTOffsetActive)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace DSTStatus. +namespace TimeZoneStatus { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kOffset), offset)); + ReturnErrorOnFailure(DataModel::Encode(writer, TLV::ContextTag(Fields::kName), name)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + case to_underlying(Fields::kOffset): + ReturnErrorOnFailure(DataModel::Decode(reader, offset)); + break; + case to_underlying(Fields::kName): + ReturnErrorOnFailure(DataModel::Decode(reader, name)); + break; + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace TimeZoneStatus. +namespace TimeFailure { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace TimeFailure. +namespace MissingTrustedTimeSource { +CHIP_ERROR Type::Encode(TLV::TLVWriter & writer, TLV::Tag tag) const +{ + TLV::TLVType outer; + ReturnErrorOnFailure(writer.StartContainer(tag, TLV::kTLVType_Structure, outer)); + ReturnErrorOnFailure(writer.EndContainer(outer)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR DecodableType::Decode(TLV::TLVReader & reader) +{ + CHIP_ERROR err = CHIP_NO_ERROR; + TLV::TLVType outer; + VerifyOrReturnError(TLV::kTLVType_Structure == reader.GetType(), CHIP_ERROR_WRONG_TLV_TYPE); + ReturnErrorOnFailure(reader.EnterContainer(outer)); + while ((err = reader.Next()) == CHIP_NO_ERROR) + { + if (!TLV::IsContextTag(reader.GetTag())) + { + continue; + } + switch (TLV::TagNumFromTag(reader.GetTag())) + { + default: + break; + } + } + + VerifyOrReturnError(err == CHIP_END_OF_TLV, err); + ReturnErrorOnFailure(reader.ExitContainer(outer)); + return CHIP_NO_ERROR; +} +} // namespace MissingTrustedTimeSource. +} // namespace Events } // namespace TimeSynchronization namespace BridgedDeviceBasicInformation { @@ -21743,6 +22207,8 @@ bool CommandIsFabricScoped(ClusterId aCluster, CommandId aCommand) case Clusters::TimeSynchronization::Id: { switch (aCommand) { + case Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Id: + return true; default: return false; } diff --git a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h index c8b474f334ba13..71cce002a8b974 100644 --- a/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h +++ b/zzz_generated/app-common/app-common/zap-generated/cluster-objects.h @@ -10307,7 +10307,7 @@ struct Type public: int32_t offset = static_cast(0); uint64_t validStarting = static_cast(0); - uint64_t validUntil = static_cast(0); + DataModel::Nullable validUntil; CHIP_ERROR Decode(TLV::TLVReader & reader); @@ -10319,6 +10319,29 @@ struct Type using DecodableType = Type; } // namespace DSTOffsetStruct +namespace FabricScopedTrustedTimeSourceStruct { +enum class Fields : uint8_t +{ + kNodeID = 0, + kEndpoint = 1, +}; + +struct Type +{ +public: + chip::NodeId nodeID = static_cast(0); + chip::EndpointId endpoint = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +using DecodableType = Type; + +} // namespace FabricScopedTrustedTimeSourceStruct namespace TimeZoneStruct { enum class Fields : uint8_t { @@ -10344,23 +10367,73 @@ struct Type using DecodableType = Type; } // namespace TimeZoneStruct +namespace TrustedTimeSourceStruct { +enum class Fields : uint8_t +{ + kFabricIndex = 0, + kNodeID = 1, + kEndpoint = 2, +}; + +struct Type +{ +public: + chip::FabricIndex fabricIndex = static_cast(0); + chip::NodeId nodeID = static_cast(0); + chip::EndpointId endpoint = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); + + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +using DecodableType = Type; + +} // namespace TrustedTimeSourceStruct } // namespace Structs namespace Commands { // Forward-declarations so we can reference these later. -namespace SetUtcTime { +namespace SetUTCTime { +struct Type; +struct DecodableType; +} // namespace SetUTCTime + +namespace SetTrustedTimeSource { +struct Type; +struct DecodableType; +} // namespace SetTrustedTimeSource + +namespace SetTimeZone { +struct Type; +struct DecodableType; +} // namespace SetTimeZone + +namespace SetTimeZoneResponse { struct Type; struct DecodableType; -} // namespace SetUtcTime +} // namespace SetTimeZoneResponse + +namespace SetDSTOffset { +struct Type; +struct DecodableType; +} // namespace SetDSTOffset + +namespace SetDefaultNTP { +struct Type; +struct DecodableType; +} // namespace SetDefaultNTP } // namespace Commands namespace Commands { -namespace SetUtcTime { +namespace SetUTCTime { enum class Fields : uint8_t { - kUtcTime = 0, + kUTCTime = 0, kGranularity = 1, kTimeSource = 2, }; @@ -10369,10 +10442,10 @@ struct Type { public: // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand - static constexpr CommandId GetCommandId() { return Commands::SetUtcTime::Id; } + static constexpr CommandId GetCommandId() { return Commands::SetUTCTime::Id; } static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } - uint64_t utcTime = static_cast(0); + uint64_t UTCTime = static_cast(0); GranularityEnum granularity = static_cast(0); Optional timeSource; @@ -10386,15 +10459,175 @@ struct Type struct DecodableType { public: - static constexpr CommandId GetCommandId() { return Commands::SetUtcTime::Id; } + static constexpr CommandId GetCommandId() { return Commands::SetUTCTime::Id; } static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } - uint64_t utcTime = static_cast(0); + uint64_t UTCTime = static_cast(0); GranularityEnum granularity = static_cast(0); Optional timeSource; CHIP_ERROR Decode(TLV::TLVReader & reader); }; -}; // namespace SetUtcTime +}; // namespace SetUTCTime +namespace SetTrustedTimeSource { +enum class Fields : uint8_t +{ + kTrustedTimeSource = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::SetTrustedTimeSource::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::Nullable trustedTimeSource; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::SetTrustedTimeSource::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::Nullable trustedTimeSource; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace SetTrustedTimeSource +namespace SetTimeZone { +enum class Fields : uint8_t +{ + kTimeZone = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::SetTimeZone::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::List timeZone; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = Clusters::TimeSynchronization::Commands::SetTimeZoneResponse::DecodableType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::SetTimeZone::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::DecodableList timeZone; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace SetTimeZone +namespace SetTimeZoneResponse { +enum class Fields : uint8_t +{ + kDSTOffsetRequired = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::SetTimeZoneResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + bool DSTOffsetRequired = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::SetTimeZoneResponse::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + bool DSTOffsetRequired = static_cast(0); + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace SetTimeZoneResponse +namespace SetDSTOffset { +enum class Fields : uint8_t +{ + kDSTOffset = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::SetDSTOffset::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::List DSTOffset; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::SetDSTOffset::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::DecodableList DSTOffset; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace SetDSTOffset +namespace SetDefaultNTP { +enum class Fields : uint8_t +{ + kDefaultNTP = 0, +}; + +struct Type +{ +public: + // Use GetCommandId instead of commandId directly to avoid naming conflict with CommandIdentification in ExecutionOfACommand + static constexpr CommandId GetCommandId() { return Commands::SetDefaultNTP::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::Nullable defaultNTP; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; + + using ResponseType = DataModel::NullObjectType; + + static constexpr bool MustUseTimedInvoke() { return false; } +}; + +struct DecodableType +{ +public: + static constexpr CommandId GetCommandId() { return Commands::SetDefaultNTP::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + DataModel::Nullable defaultNTP; + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +}; // namespace SetDefaultNTP } // namespace Commands namespace Attributes { @@ -10435,19 +10668,21 @@ struct TypeInfo static constexpr bool MustUseTimedWrite() { return false; } }; } // namespace TimeSource -namespace TrustedTimeNodeId { +namespace TrustedTimeSource { struct TypeInfo { - using Type = chip::app::DataModel::Nullable; - using DecodableType = chip::app::DataModel::Nullable; - using DecodableArgType = const chip::app::DataModel::Nullable &; + using Type = chip::app::DataModel::Nullable; + using DecodableType = + chip::app::DataModel::Nullable; + using DecodableArgType = const chip::app::DataModel::Nullable< + chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType> &; static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::TrustedTimeNodeId::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TrustedTimeSource::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace TrustedTimeNodeId -namespace DefaultNtp { +} // namespace TrustedTimeSource +namespace DefaultNTP { struct TypeInfo { using Type = chip::app::DataModel::Nullable; @@ -10455,11 +10690,11 @@ struct TypeInfo using DecodableArgType = const chip::app::DataModel::Nullable &; static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::DefaultNtp::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DefaultNTP::Id; } static constexpr bool MustUseTimedWrite() { return false; } static constexpr size_t MaxLength() { return 128; } }; -} // namespace DefaultNtp +} // namespace DefaultNTP namespace TimeZone { struct TypeInfo { @@ -10502,28 +10737,64 @@ struct TypeInfo } // namespace LocalTime namespace TimeZoneDatabase { struct TypeInfo +{ + using Type = chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum; + using DecodableType = chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum; + using DecodableArgType = chip::app::Clusters::TimeSynchronization::TimeZoneDatabaseEnum; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TimeZoneDatabase::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TimeZoneDatabase +namespace NTPServerAvailable { +struct TypeInfo { using Type = bool; using DecodableType = bool; using DecodableArgType = bool; static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::TimeZoneDatabase::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::NTPServerAvailable::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace TimeZoneDatabase -namespace NtpServerPort { +} // namespace NTPServerAvailable +namespace TimeZoneListMaxSize { struct TypeInfo { - using Type = chip::app::DataModel::Nullable; - using DecodableType = chip::app::DataModel::Nullable; - using DecodableArgType = const chip::app::DataModel::Nullable &; + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::TimeZoneListMaxSize::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace TimeZoneListMaxSize +namespace DSTOffsetListMaxSize { +struct TypeInfo +{ + using Type = uint8_t; + using DecodableType = uint8_t; + using DecodableArgType = uint8_t; + + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::DSTOffsetListMaxSize::Id; } + static constexpr bool MustUseTimedWrite() { return false; } +}; +} // namespace DSTOffsetListMaxSize +namespace SupportsDNSResolve { +struct TypeInfo +{ + using Type = bool; + using DecodableType = bool; + using DecodableArgType = bool; static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } - static constexpr AttributeId GetAttributeId() { return Attributes::NtpServerPort::Id; } + static constexpr AttributeId GetAttributeId() { return Attributes::SupportsDNSResolve::Id; } static constexpr bool MustUseTimedWrite() { return false; } }; -} // namespace NtpServerPort +} // namespace SupportsDNSResolve namespace GeneratedCommandList { struct TypeInfo : public Clusters::Globals::Attributes::GeneratedCommandList::TypeInfo { @@ -10574,13 +10845,17 @@ struct TypeInfo static_cast(0); Attributes::TimeSource::TypeInfo::DecodableType timeSource = static_cast(0); - Attributes::TrustedTimeNodeId::TypeInfo::DecodableType trustedTimeNodeId; - Attributes::DefaultNtp::TypeInfo::DecodableType defaultNtp; + Attributes::TrustedTimeSource::TypeInfo::DecodableType trustedTimeSource; + Attributes::DefaultNTP::TypeInfo::DecodableType defaultNTP; Attributes::TimeZone::TypeInfo::DecodableType timeZone; Attributes::DSTOffset::TypeInfo::DecodableType DSTOffset; Attributes::LocalTime::TypeInfo::DecodableType localTime; - Attributes::TimeZoneDatabase::TypeInfo::DecodableType timeZoneDatabase = static_cast(0); - Attributes::NtpServerPort::TypeInfo::DecodableType ntpServerPort; + Attributes::TimeZoneDatabase::TypeInfo::DecodableType timeZoneDatabase = + static_cast(0); + Attributes::NTPServerAvailable::TypeInfo::DecodableType NTPServerAvailable = static_cast(0); + Attributes::TimeZoneListMaxSize::TypeInfo::DecodableType timeZoneListMaxSize = static_cast(0); + Attributes::DSTOffsetListMaxSize::TypeInfo::DecodableType DSTOffsetListMaxSize = static_cast(0); + Attributes::SupportsDNSResolve::TypeInfo::DecodableType supportsDNSResolve = static_cast(0); Attributes::GeneratedCommandList::TypeInfo::DecodableType generatedCommandList; Attributes::AcceptedCommandList::TypeInfo::DecodableType acceptedCommandList; Attributes::EventList::TypeInfo::DecodableType eventList; @@ -10590,6 +10865,161 @@ struct TypeInfo }; }; } // namespace Attributes +namespace Events { +namespace DSTTableEmpty { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::DSTTableEmpty::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::DSTTableEmpty::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace DSTTableEmpty +namespace DSTStatus { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kDSTOffsetActive = 0, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::DSTStatus::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr bool kIsFabricScoped = false; + + bool DSTOffsetActive = static_cast(0); + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::DSTStatus::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + bool DSTOffsetActive = static_cast(0); + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace DSTStatus +namespace TimeZoneStatus { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ + kOffset = 0, + kName = 1, +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::TimeZoneStatus::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr bool kIsFabricScoped = false; + + int32_t offset = static_cast(0); + Optional name; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::TimeZoneStatus::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + int32_t offset = static_cast(0); + Optional name; + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace TimeZoneStatus +namespace TimeFailure { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::TimeFailure::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::TimeFailure::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace TimeFailure +namespace MissingTrustedTimeSource { +static constexpr PriorityLevel kPriorityLevel = PriorityLevel::Info; + +enum class Fields : uint8_t +{ +}; + +struct Type +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::MissingTrustedTimeSource::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + static constexpr bool kIsFabricScoped = false; + + CHIP_ERROR Encode(TLV::TLVWriter & writer, TLV::Tag tag) const; +}; + +struct DecodableType +{ +public: + static constexpr PriorityLevel GetPriorityLevel() { return kPriorityLevel; } + static constexpr EventId GetEventId() { return Events::MissingTrustedTimeSource::Id; } + static constexpr ClusterId GetClusterId() { return Clusters::TimeSynchronization::Id; } + + CHIP_ERROR Decode(TLV::TLVReader & reader); +}; +} // namespace MissingTrustedTimeSource +} // namespace Events } // namespace TimeSynchronization namespace BridgedDeviceBasicInformation { namespace Structs { diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h index e658adbe832a81..f3027919531c3b 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Attributes.h @@ -1814,13 +1814,13 @@ namespace TimeSource { static constexpr AttributeId Id = 0x00000002; } // namespace TimeSource -namespace TrustedTimeNodeId { +namespace TrustedTimeSource { static constexpr AttributeId Id = 0x00000003; -} // namespace TrustedTimeNodeId +} // namespace TrustedTimeSource -namespace DefaultNtp { +namespace DefaultNTP { static constexpr AttributeId Id = 0x00000004; -} // namespace DefaultNtp +} // namespace DefaultNTP namespace TimeZone { static constexpr AttributeId Id = 0x00000005; @@ -1838,9 +1838,21 @@ namespace TimeZoneDatabase { static constexpr AttributeId Id = 0x00000008; } // namespace TimeZoneDatabase -namespace NtpServerPort { +namespace NTPServerAvailable { static constexpr AttributeId Id = 0x00000009; -} // namespace NtpServerPort +} // namespace NTPServerAvailable + +namespace TimeZoneListMaxSize { +static constexpr AttributeId Id = 0x0000000A; +} // namespace TimeZoneListMaxSize + +namespace DSTOffsetListMaxSize { +static constexpr AttributeId Id = 0x0000000B; +} // namespace DSTOffsetListMaxSize + +namespace SupportsDNSResolve { +static constexpr AttributeId Id = 0x0000000C; +} // namespace SupportsDNSResolve namespace GeneratedCommandList { static constexpr AttributeId Id = Globals::Attributes::GeneratedCommandList::Id; diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h index 6699a225a48b1f..b8763a4db4024d 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Commands.h @@ -480,9 +480,29 @@ static constexpr CommandId Id = 0x00000000; namespace TimeSynchronization { namespace Commands { -namespace SetUtcTime { +namespace SetUTCTime { static constexpr CommandId Id = 0x00000000; -} // namespace SetUtcTime +} // namespace SetUTCTime + +namespace SetTrustedTimeSource { +static constexpr CommandId Id = 0x00000001; +} // namespace SetTrustedTimeSource + +namespace SetTimeZone { +static constexpr CommandId Id = 0x00000002; +} // namespace SetTimeZone + +namespace SetTimeZoneResponse { +static constexpr CommandId Id = 0x00000003; +} // namespace SetTimeZoneResponse + +namespace SetDSTOffset { +static constexpr CommandId Id = 0x00000004; +} // namespace SetDSTOffset + +namespace SetDefaultNTP { +static constexpr CommandId Id = 0x00000005; +} // namespace SetDefaultNTP } // namespace Commands } // namespace TimeSynchronization diff --git a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h index 743778bab8bd1f..598669e8ec2603 100644 --- a/zzz_generated/app-common/app-common/zap-generated/ids/Events.h +++ b/zzz_generated/app-common/app-common/zap-generated/ids/Events.h @@ -175,6 +175,32 @@ static constexpr EventId Id = 0x00000002; } // namespace Events } // namespace WiFiNetworkDiagnostics +namespace TimeSynchronization { +namespace Events { + +namespace DSTTableEmpty { +static constexpr EventId Id = 0x00000000; +} // namespace DSTTableEmpty + +namespace DSTStatus { +static constexpr EventId Id = 0x00000001; +} // namespace DSTStatus + +namespace TimeZoneStatus { +static constexpr EventId Id = 0x00000002; +} // namespace TimeZoneStatus + +namespace TimeFailure { +static constexpr EventId Id = 0x00000003; +} // namespace TimeFailure + +namespace MissingTrustedTimeSource { +static constexpr EventId Id = 0x00000004; +} // namespace MissingTrustedTimeSource + +} // namespace Events +} // namespace TimeSynchronization + namespace BridgedDeviceBasicInformation { namespace Events { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h index f0cbc03189adf7..23ef97785a890b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/Commands.h @@ -2942,19 +2942,26 @@ class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand | Cluster TimeSynchronization | 0x0038 | |------------------------------------------------------------------------------| | Commands: | | -| * SetUtcTime | 0x00 | +| * SetUTCTime | 0x00 | +| * SetTrustedTimeSource | 0x01 | +| * SetTimeZone | 0x02 | +| * SetDSTOffset | 0x04 | +| * SetDefaultNTP | 0x05 | |------------------------------------------------------------------------------| | Attributes: | | | * UTCTime | 0x0000 | | * Granularity | 0x0001 | | * TimeSource | 0x0002 | -| * TrustedTimeNodeId | 0x0003 | -| * DefaultNtp | 0x0004 | +| * TrustedTimeSource | 0x0003 | +| * DefaultNTP | 0x0004 | | * TimeZone | 0x0005 | | * DSTOffset | 0x0006 | | * LocalTime | 0x0007 | | * TimeZoneDatabase | 0x0008 | -| * NtpServerPort | 0x0009 | +| * NTPServerAvailable | 0x0009 | +| * TimeZoneListMaxSize | 0x000A | +| * DSTOffsetListMaxSize | 0x000B | +| * SupportsDNSResolve | 0x000C | | * GeneratedCommandList | 0xFFF8 | | * AcceptedCommandList | 0xFFF9 | | * EventList | 0xFFFA | @@ -2963,17 +2970,22 @@ class EthernetNetworkDiagnosticsResetCounts : public ClusterCommand | * ClusterRevision | 0xFFFD | |------------------------------------------------------------------------------| | Events: | | +| * DSTTableEmpty | 0x0000 | +| * DSTStatus | 0x0001 | +| * TimeZoneStatus | 0x0002 | +| * TimeFailure | 0x0003 | +| * MissingTrustedTimeSource | 0x0004 | \*----------------------------------------------------------------------------*/ /* - * Command SetUtcTime + * Command SetUTCTime */ -class TimeSynchronizationSetUtcTime : public ClusterCommand +class TimeSynchronizationSetUTCTime : public ClusterCommand { public: - TimeSynchronizationSetUtcTime(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("set-utc-time", credsIssuerConfig) + TimeSynchronizationSetUTCTime(CredentialIssuerCommands * credsIssuerConfig) : ClusterCommand("set-utctime", credsIssuerConfig) { - AddArgument("UtcTime", 0, UINT64_MAX, &mRequest.utcTime); + AddArgument("UTCTime", 0, UINT64_MAX, &mRequest.UTCTime); AddArgument("Granularity", 0, UINT8_MAX, &mRequest.granularity); AddArgument("TimeSource", 0, UINT8_MAX, &mRequest.timeSource); ClusterCommand::AddArguments(); @@ -2994,7 +3006,138 @@ class TimeSynchronizationSetUtcTime : public ClusterCommand } private: - chip::app::Clusters::TimeSynchronization::Commands::SetUtcTime::Type mRequest; + chip::app::Clusters::TimeSynchronization::Commands::SetUTCTime::Type mRequest; +}; + +/* + * Command SetTrustedTimeSource + */ +class TimeSynchronizationSetTrustedTimeSource : public ClusterCommand +{ +public: + TimeSynchronizationSetTrustedTimeSource(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("set-trusted-time-source", credsIssuerConfig), mComplex_TrustedTimeSource(&mRequest.trustedTimeSource) + { + AddArgument("TrustedTimeSource", &mComplex_TrustedTimeSource); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000001) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0x00000038, 0x00000001, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000001) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00000038, 0x00000001, mRequest); + } + +private: + chip::app::Clusters::TimeSynchronization::Commands::SetTrustedTimeSource::Type mRequest; + TypedComplexArgument> + mComplex_TrustedTimeSource; +}; + +/* + * Command SetTimeZone + */ +class TimeSynchronizationSetTimeZone : public ClusterCommand +{ +public: + TimeSynchronizationSetTimeZone(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("set-time-zone", credsIssuerConfig), mComplex_TimeZone(&mRequest.timeZone) + { + AddArgument("TimeZone", &mComplex_TimeZone); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000002) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0x00000038, 0x00000002, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000002) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00000038, 0x00000002, mRequest); + } + +private: + chip::app::Clusters::TimeSynchronization::Commands::SetTimeZone::Type mRequest; + TypedComplexArgument> + mComplex_TimeZone; +}; + +/* + * Command SetDSTOffset + */ +class TimeSynchronizationSetDSTOffset : public ClusterCommand +{ +public: + TimeSynchronizationSetDSTOffset(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("set-dstoffset", credsIssuerConfig), mComplex_DSTOffset(&mRequest.DSTOffset) + { + AddArgument("DSTOffset", &mComplex_DSTOffset); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000004) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0x00000038, 0x00000004, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000004) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00000038, 0x00000004, mRequest); + } + +private: + chip::app::Clusters::TimeSynchronization::Commands::SetDSTOffset::Type mRequest; + TypedComplexArgument> + mComplex_DSTOffset; +}; + +/* + * Command SetDefaultNTP + */ +class TimeSynchronizationSetDefaultNTP : public ClusterCommand +{ +public: + TimeSynchronizationSetDefaultNTP(CredentialIssuerCommands * credsIssuerConfig) : + ClusterCommand("set-default-ntp", credsIssuerConfig) + { + AddArgument("DefaultNTP", &mRequest.defaultNTP); + ClusterCommand::AddArguments(); + } + + CHIP_ERROR SendCommand(chip::DeviceProxy * device, std::vector endpointIds) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000005) on endpoint %u", endpointIds.at(0)); + + return ClusterCommand::SendCommand(device, endpointIds.at(0), 0x00000038, 0x00000005, mRequest); + } + + CHIP_ERROR SendGroupCommand(chip::GroupId groupId, chip::FabricIndex fabricIndex) override + { + ChipLogProgress(chipTool, "Sending cluster (0x00000038) command (0x00000005) on Group %u", groupId); + + return ClusterCommand::SendGroupCommand(groupId, fabricIndex, 0x00000038, 0x00000005, mRequest); + } + +private: + chip::app::Clusters::TimeSynchronization::Commands::SetDefaultNTP::Type mRequest; }; /*----------------------------------------------------------------------------*\ @@ -11008,53 +11151,66 @@ void registerClusterTimeSynchronization(Commands & commands, CredentialIssuerCom // // Commands // - make_unique(Id, credsIssuerConfig), // - make_unique(credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // + make_unique(credsIssuerConfig), // // // Attributes // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, "utctime", Attributes::UTCTime::Id, credsIssuerConfig), // - make_unique(Id, "granularity", Attributes::Granularity::Id, credsIssuerConfig), // - make_unique(Id, "time-source", Attributes::TimeSource::Id, credsIssuerConfig), // - make_unique(Id, "trusted-time-node-id", Attributes::TrustedTimeNodeId::Id, credsIssuerConfig), // - make_unique(Id, "default-ntp", Attributes::DefaultNtp::Id, credsIssuerConfig), // - make_unique(Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // - make_unique(Id, "dstoffset", Attributes::DSTOffset::Id, credsIssuerConfig), // - make_unique(Id, "local-time", Attributes::LocalTime::Id, credsIssuerConfig), // - make_unique(Id, "time-zone-database", Attributes::TimeZoneDatabase::Id, credsIssuerConfig), // - make_unique(Id, "ntp-server-port", Attributes::NtpServerPort::Id, credsIssuerConfig), // - make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // - make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // - make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // - make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // - make_unique>(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "utctime", Attributes::UTCTime::Id, credsIssuerConfig), // + make_unique(Id, "granularity", Attributes::Granularity::Id, credsIssuerConfig), // + make_unique(Id, "time-source", Attributes::TimeSource::Id, credsIssuerConfig), // + make_unique(Id, "trusted-time-source", Attributes::TrustedTimeSource::Id, credsIssuerConfig), // + make_unique(Id, "default-ntp", Attributes::DefaultNTP::Id, credsIssuerConfig), // + make_unique(Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // + make_unique(Id, "dstoffset", Attributes::DSTOffset::Id, credsIssuerConfig), // + make_unique(Id, "local-time", Attributes::LocalTime::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-database", Attributes::TimeZoneDatabase::Id, credsIssuerConfig), // + make_unique(Id, "ntpserver-available", Attributes::NTPServerAvailable::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-list-max-size", Attributes::TimeZoneListMaxSize::Id, credsIssuerConfig), // + make_unique(Id, "dstoffset-list-max-size", Attributes::DSTOffsetListMaxSize::Id, credsIssuerConfig), // + make_unique(Id, "supports-dnsresolve", Attributes::SupportsDNSResolve::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + make_unique>(Id, credsIssuerConfig), // make_unique>>(Id, "utctime", 0, UINT64_MAX, Attributes::UTCTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>( Id, "granularity", 0, UINT8_MAX, Attributes::Granularity::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>( Id, "time-source", 0, UINT8_MAX, Attributes::TimeSource::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "trusted-time-node-id", 0, UINT64_MAX, - Attributes::TrustedTimeNodeId::Id, - WriteCommandType::kWrite, credsIssuerConfig), // - make_unique>>(Id, "default-ntp", Attributes::DefaultNtp::Id, - WriteCommandType::kWrite, credsIssuerConfig), // + make_unique>>( + Id, "trusted-time-source", Attributes::TrustedTimeSource::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>>( + Id, "default-ntp", Attributes::DefaultNTP::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( - Id, "time-zone", Attributes::TimeZone::Id, WriteCommandType::kWrite, credsIssuerConfig), // + Id, "time-zone", Attributes::TimeZone::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( - Id, "dstoffset", Attributes::DSTOffset::Id, WriteCommandType::kWrite, credsIssuerConfig), // + Id, "dstoffset", Attributes::DSTOffset::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "local-time", 0, UINT64_MAX, Attributes::LocalTime::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>(Id, "time-zone-database", 0, 1, Attributes::TimeZoneDatabase::Id, + make_unique>( + Id, "time-zone-database", 0, UINT8_MAX, Attributes::TimeZoneDatabase::Id, WriteCommandType::kForceWrite, + credsIssuerConfig), // + make_unique>(Id, "ntpserver-available", 0, 1, Attributes::NTPServerAvailable::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "time-zone-list-max-size", 0, UINT8_MAX, Attributes::TimeZoneListMaxSize::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "dstoffset-list-max-size", 0, UINT8_MAX, Attributes::DSTOffsetListMaxSize::Id, + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique>(Id, "supports-dnsresolve", 0, 1, Attributes::SupportsDNSResolve::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique>>(Id, "ntp-server-port", 0, UINT16_MAX, - Attributes::NtpServerPort::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>>( Id, "generated-command-list", Attributes::GeneratedCommandList::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // @@ -11067,29 +11223,42 @@ void registerClusterTimeSynchronization(Commands & commands, CredentialIssuerCom make_unique>(Id, "feature-map", 0, UINT32_MAX, Attributes::FeatureMap::Id, WriteCommandType::kForceWrite, credsIssuerConfig), // make_unique>(Id, "cluster-revision", 0, UINT16_MAX, Attributes::ClusterRevision::Id, - WriteCommandType::kForceWrite, credsIssuerConfig), // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, "utctime", Attributes::UTCTime::Id, credsIssuerConfig), // - make_unique(Id, "granularity", Attributes::Granularity::Id, credsIssuerConfig), // - make_unique(Id, "time-source", Attributes::TimeSource::Id, credsIssuerConfig), // - make_unique(Id, "trusted-time-node-id", Attributes::TrustedTimeNodeId::Id, credsIssuerConfig), // - make_unique(Id, "default-ntp", Attributes::DefaultNtp::Id, credsIssuerConfig), // - make_unique(Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // - make_unique(Id, "dstoffset", Attributes::DSTOffset::Id, credsIssuerConfig), // - make_unique(Id, "local-time", Attributes::LocalTime::Id, credsIssuerConfig), // - make_unique(Id, "time-zone-database", Attributes::TimeZoneDatabase::Id, credsIssuerConfig), // - make_unique(Id, "ntp-server-port", Attributes::NtpServerPort::Id, credsIssuerConfig), // - make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // - make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // - make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // - make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // - make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // + WriteCommandType::kForceWrite, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "utctime", Attributes::UTCTime::Id, credsIssuerConfig), // + make_unique(Id, "granularity", Attributes::Granularity::Id, credsIssuerConfig), // + make_unique(Id, "time-source", Attributes::TimeSource::Id, credsIssuerConfig), // + make_unique(Id, "trusted-time-source", Attributes::TrustedTimeSource::Id, credsIssuerConfig), // + make_unique(Id, "default-ntp", Attributes::DefaultNTP::Id, credsIssuerConfig), // + make_unique(Id, "time-zone", Attributes::TimeZone::Id, credsIssuerConfig), // + make_unique(Id, "dstoffset", Attributes::DSTOffset::Id, credsIssuerConfig), // + make_unique(Id, "local-time", Attributes::LocalTime::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-database", Attributes::TimeZoneDatabase::Id, credsIssuerConfig), // + make_unique(Id, "ntpserver-available", Attributes::NTPServerAvailable::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-list-max-size", Attributes::TimeZoneListMaxSize::Id, credsIssuerConfig), // + make_unique(Id, "dstoffset-list-max-size", Attributes::DSTOffsetListMaxSize::Id, credsIssuerConfig), // + make_unique(Id, "supports-dnsresolve", Attributes::SupportsDNSResolve::Id, credsIssuerConfig), // + make_unique(Id, "generated-command-list", Attributes::GeneratedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "accepted-command-list", Attributes::AcceptedCommandList::Id, credsIssuerConfig), // + make_unique(Id, "event-list", Attributes::EventList::Id, credsIssuerConfig), // + make_unique(Id, "attribute-list", Attributes::AttributeList::Id, credsIssuerConfig), // + make_unique(Id, "feature-map", Attributes::FeatureMap::Id, credsIssuerConfig), // + make_unique(Id, "cluster-revision", Attributes::ClusterRevision::Id, credsIssuerConfig), // // // Events // - make_unique(Id, credsIssuerConfig), // - make_unique(Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "dsttable-empty", Events::DSTTableEmpty::Id, credsIssuerConfig), // + make_unique(Id, "dststatus", Events::DSTStatus::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-status", Events::TimeZoneStatus::Id, credsIssuerConfig), // + make_unique(Id, "time-failure", Events::TimeFailure::Id, credsIssuerConfig), // + make_unique(Id, "missing-trusted-time-source", Events::MissingTrustedTimeSource::Id, credsIssuerConfig), // + make_unique(Id, credsIssuerConfig), // + make_unique(Id, "dsttable-empty", Events::DSTTableEmpty::Id, credsIssuerConfig), // + make_unique(Id, "dststatus", Events::DSTStatus::Id, credsIssuerConfig), // + make_unique(Id, "time-zone-status", Events::TimeZoneStatus::Id, credsIssuerConfig), // + make_unique(Id, "time-failure", Events::TimeFailure::Id, credsIssuerConfig), // + make_unique(Id, "missing-trusted-time-source", Events::MissingTrustedTimeSource::Id, credsIssuerConfig), // }; commands.Register(clusterName, clusterCommands); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp index e4aa5a34e4b89d..5ce59a33759a42 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.cpp @@ -1358,6 +1358,40 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::TimeSynchronization::S ComplexArgumentParser::Finalize(request.validUntil); } +CHIP_ERROR +ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TimeSynchronization::Structs::FabricScopedTrustedTimeSourceStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("FabricScopedTrustedTimeSourceStruct.nodeID", "nodeID", value.isMember("nodeID"))); + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("FabricScopedTrustedTimeSourceStruct.endpoint", "endpoint", + value.isMember("endpoint"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nodeID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nodeID, value["nodeID"])); + valueCopy.removeMember("nodeID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + valueCopy.removeMember("endpoint"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize( + chip::app::Clusters::TimeSynchronization::Structs::FabricScopedTrustedTimeSourceStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.nodeID); + ComplexArgumentParser::Finalize(request.endpoint); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type & request, Json::Value & value) @@ -1396,6 +1430,45 @@ void ComplexArgumentParser::Finalize(chip::app::Clusters::TimeSynchronization::S ComplexArgumentParser::Finalize(request.name); } +CHIP_ERROR ComplexArgumentParser::Setup(const char * label, + chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::Type & request, + Json::Value & value) +{ + VerifyOrReturnError(value.isObject(), CHIP_ERROR_INVALID_ARGUMENT); + + // Copy to track which members we already processed. + Json::Value valueCopy(value); + + ReturnErrorOnFailure(ComplexArgumentParser::EnsureMemberExist("TrustedTimeSourceStruct.fabricIndex", "fabricIndex", + value.isMember("fabricIndex"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TrustedTimeSourceStruct.nodeID", "nodeID", value.isMember("nodeID"))); + ReturnErrorOnFailure( + ComplexArgumentParser::EnsureMemberExist("TrustedTimeSourceStruct.endpoint", "endpoint", value.isMember("endpoint"))); + + char labelWithMember[kMaxLabelLength]; + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "fabricIndex"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.fabricIndex, value["fabricIndex"])); + valueCopy.removeMember("fabricIndex"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "nodeID"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.nodeID, value["nodeID"])); + valueCopy.removeMember("nodeID"); + + snprintf(labelWithMember, sizeof(labelWithMember), "%s.%s", label, "endpoint"); + ReturnErrorOnFailure(ComplexArgumentParser::Setup(labelWithMember, request.endpoint, value["endpoint"])); + valueCopy.removeMember("endpoint"); + + return ComplexArgumentParser::EnsureNoMembersRemaining(label, valueCopy); +} + +void ComplexArgumentParser::Finalize(chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::Type & request) +{ + ComplexArgumentParser::Finalize(request.fabricIndex); + ComplexArgumentParser::Finalize(request.nodeID); + ComplexArgumentParser::Finalize(request.endpoint); +} + CHIP_ERROR ComplexArgumentParser::Setup(const char * label, chip::app::Clusters::BridgedDeviceBasicInformation::Structs::ProductAppearanceStruct::Type & request, diff --git a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h index fb84db01015080..38c67265a1bbc5 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/ComplexArgumentParser.h @@ -167,11 +167,23 @@ static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TimeSynchroniza static void Finalize(chip::app::Clusters::TimeSynchronization::Structs::DSTOffsetStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::TimeSynchronization::Structs::FabricScopedTrustedTimeSourceStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TimeSynchronization::Structs::FabricScopedTrustedTimeSourceStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type & request, Json::Value & value); static void Finalize(chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::Type & request); +static CHIP_ERROR Setup(const char * label, + chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::Type & request, + Json::Value & value); + +static void Finalize(chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::Type & request); + static CHIP_ERROR Setup(const char * label, chip::app::Clusters::BridgedDeviceBasicInformation::Structs::ProductAppearanceStruct::Type & request, Json::Value & value); diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp index 46ccdd27881a2b..c46841fe3ea27f 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.cpp @@ -1249,6 +1249,32 @@ DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue( + const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::FabricScopedTrustedTimeSourceStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("NodeID", indent + 1, value.nodeID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'NodeID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Endpoint", indent + 1, value.endpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Endpoint'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::DecodableType & value) { @@ -1282,6 +1308,40 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR +DataModelLogger::LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = LogValue("FabricIndex", indent + 1, value.fabricIndex); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'FabricIndex'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("NodeID", indent + 1, value.nodeID); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'NodeID'"); + return err; + } + } + { + CHIP_ERROR err = LogValue("Endpoint", indent + 1, value.endpoint); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Struct truncated due to invalid value for 'Endpoint'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} + CHIP_ERROR DataModelLogger::LogValue( const char * label, size_t indent, const chip::app::Clusters::BridgedDeviceBasicInformation::Structs::ProductAppearanceStruct::DecodableType & value) @@ -3150,6 +3210,70 @@ CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, return CHIP_NO_ERROR; } +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const TimeSynchronization::Events::DSTTableEmpty::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const TimeSynchronization::Events::DSTStatus::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("DSTOffsetActive", indent + 1, value.DSTOffsetActive); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'DSTOffsetActive'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const TimeSynchronization::Events::TimeZoneStatus::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + { + CHIP_ERROR err = DataModelLogger::LogValue("Offset", indent + 1, value.offset); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Offset'"); + return err; + } + } + { + CHIP_ERROR err = DataModelLogger::LogValue("Name", indent + 1, value.name); + if (err != CHIP_NO_ERROR) + { + DataModelLogger::LogString(indent + 1, "Event truncated due to invalid value for 'Name'"); + return err; + } + } + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const TimeSynchronization::Events::TimeFailure::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} +CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, + const TimeSynchronization::Events::MissingTrustedTimeSource::DecodableType & value) +{ + DataModelLogger::LogString(label, indent, "{"); + DataModelLogger::LogString(indent, "}"); + + return CHIP_NO_ERROR; +} CHIP_ERROR DataModelLogger::LogValue(const char * label, size_t indent, const BridgedDeviceBasicInformation::Events::StartUp::DecodableType & value) { diff --git a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h index 81d723c231777c..a1a038ba506b0b 100644 --- a/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h +++ b/zzz_generated/chip-tool/zap-generated/cluster/logging/DataModelLogger.h @@ -107,9 +107,16 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TimeSynchronization::Structs::DSTOffsetStruct::DecodableType & value); +static CHIP_ERROR +LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::FabricScopedTrustedTimeSourceStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::TimeSynchronization::Structs::TimeZoneStruct::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Structs::TrustedTimeSourceStruct::DecodableType & value); + static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::BridgedDeviceBasicInformation::Structs::ProductAppearanceStruct::DecodableType & value); @@ -254,6 +261,16 @@ static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::WiFiNetworkDiagnostics::Events::AssociationFailure::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::WiFiNetworkDiagnostics::Events::ConnectionStatus::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Events::DSTTableEmpty::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Events::DSTStatus::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Events::TimeZoneStatus::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Events::TimeFailure::DecodableType & value); +static CHIP_ERROR LogValue(const char * label, size_t indent, + const chip::app::Clusters::TimeSynchronization::Events::MissingTrustedTimeSource::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, const chip::app::Clusters::BridgedDeviceBasicInformation::Events::StartUp::DecodableType & value); static CHIP_ERROR LogValue(const char * label, size_t indent, diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index f56b3110884aae..26be2fb5b4c935 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -113267,7 +113267,7 @@ class Test_TC_BIND_2_3Suite : public TestCommand class Test_TC_S_1_1Suite : public TestCommand { public: - Test_TC_S_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_S_1_1", 0, credsIssuerConfig) + Test_TC_S_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : TestCommand("Test_TC_S_1_1", 11, credsIssuerConfig) { AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); AddArgument("cluster", &mCluster); @@ -113300,6 +113300,152 @@ class Test_TC_S_1_1Suite : public TestCommand switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 5U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 1UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 40UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 41UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 42UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 40UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 41UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 42UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 6UL)); + } + break; default: LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); } @@ -113314,7 +113460,73 @@ class Test_TC_S_1_1Suite : public TestCommand { using namespace chip::app::Clusters; switch (testIndex) - {} + { + case 0: { + LogStep(0, "Commission DUT to TH (can be skipped if done in a preceding test)"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read ClusterRevision (global attribute 65533)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::ClusterRevision::Id, true, + chip::NullOptional); + } + case 2: { + LogStep(2, "Read FeatureMap (global attribute 65532)"); + VerifyOrDo(!ShouldSkip("(!S.S.F00)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 3: { + LogStep(3, "Read FeatureMap (global attribute 65532)"); + VerifyOrDo(!ShouldSkip("S.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::FeatureMap::Id, true, + chip::NullOptional); + } + case 4: { + LogStep(4, "Read AttributeList (global attribute 65531)"); + VerifyOrDo(!ShouldSkip("S.S.A0005"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 5: { + LogStep(5, "Read AttributeList (global attribute 65531)"); + VerifyOrDo(!ShouldSkip("(!S.S.A0005)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AttributeList::Id, true, + chip::NullOptional); + } + case 6: { + LogStep(6, "Read EventList (global attribute 65530)"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::EventList::Id, true, + chip::NullOptional); + } + case 7: { + LogStep(7, "Read AcceptedCommandList (global attribute 65529)"); + VerifyOrDo(!ShouldSkip("S.S.C40.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 8: { + LogStep(8, "Read AcceptedCommandList (global attribute 65529)"); + VerifyOrDo(!ShouldSkip("(!S.S.C40.Rsp)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 9: { + LogStep(9, "Read GeneratedCommandList (global attribute 65528)"); + VerifyOrDo(!ShouldSkip("S.C.C40.Tx"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + case 10: { + LogStep(10, "Read GeneratedCommandList (global attribute 65528)"); + VerifyOrDo(!ShouldSkip("(!S.C.C40.Tx)"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), Scenes::Id, Scenes::Attributes::AcceptedCommandList::Id, true, + chip::NullOptional); + } + } return CHIP_NO_ERROR; } };